:root {
    color-scheme: light;
    --ink: #17202a;
    --muted: #687684;
    --line: #d9e2ec;
    --panel: #ffffff;
    --paper: #f4f7fb;
    --accent: #176b87;
    --accent-strong: #0d4d63;
    --warn: #8a5a00;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
}
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 24px 32px 16px;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
}
h1, h2, p { margin: 0; }
h1 { font-size: 28px; letter-spacing: 0; }
h2 { font-size: 18px; letter-spacing: 0; }
.eyebrow { color: var(--accent); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.status { min-width: 180px; text-align: right; color: var(--muted); }
.setup-error {
    border-color: #bd8b2f;
    background: #fffaf0;
}
.setup-error p { margin-top: 8px; color: var(--muted); }
.setup-error code { color: var(--ink); }
.shell {
    padding: 16px 32px 32px;
}
.t3-tabs {
    display: flex;
    gap: 10px;
    margin: 0 0 0;
    overflow-x: auto;
    padding: 0;
}
.tab-panel {
    display: none;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    padding-top: 16px;
}
.tab-panel.active { display: grid; }
[hidden] { display: none !important; }
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    min-width: 0;
}
.wide, .full-span { grid-column: 1 / -1; }
.panel-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.grid-form {
    display: grid;
    grid-template-columns: repeat(6, minmax(120px, 1fr));
    gap: 12px;
}
.stack { display: grid; gap: 10px; margin-top: 14px; }
.full { grid-column: 1 / -1; }
label, legend { color: var(--muted); font-size: 12px; font-weight: 700; }
input, select, button {
    width: 100%;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px 10px;
    font: inherit;
    background: #fff;
}
button {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}
button:hover { background: var(--accent-strong); }
.t3-tabs .t3-tab {
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 14px;
    font-weight: 700;
    justify-content: center;
    min-height: 42px;
    min-width: 0;
    padding: 0 16px;
    text-decoration: none;
}
.t3-tabs .t3-tab:hover { border-color: var(--accent); background: #f7fafc; }
.t3-tabs .t3-tab.active,
.t3-tabs .t3-tab[aria-selected="true"] {
    background: #fff;
    border-color: #fff;
    color: #000;
    box-shadow: 0 1px 0 rgba(23, 32, 42, 0.08);
}
.matrix {
    display: grid;
    grid-template-columns: repeat(8, minmax(100px, 1fr));
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}
.split, .gate-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 400; }
.check input { width: auto; min-height: auto; }
.list { display: grid; gap: 8px; margin-top: 12px; }
.item {
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 8px;
    font-size: 13px;
    background: #fbfdff;
}
.item small { display: block; color: var(--muted); margin-top: 2px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; min-width: 980px; }
th, td { border-bottom: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: middle; }
th { background: #f7fafc; color: var(--muted); font-size: 12px; }
td input, td select { min-height: 34px; padding: 6px 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px; background: #fbfdff; font-size: 12px; }
.special { color: var(--warn); font-weight: 700; }
@media (max-width: 1100px) {
    .shell { padding: 14px; }
    .tab-panel { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-form, .matrix { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
    .topbar { align-items: flex-start; flex-direction: column; padding: 18px 14px; }
    .status { text-align: left; }
    .tab-panel { grid-template-columns: 1fr; }
    .panel { padding: 14px; }
    .panel-title { align-items: stretch; flex-direction: column; }
    .grid-form, .matrix { grid-template-columns: 1fr; }
}
