:root {
    --ink: #1c1f24;
    --muted: #8b939c;
    --line: #eceff2;
    --lime: #c6f04a;
    --soft: #f4f6f5;
    --card: #f7f8f7;
    --red: #ff5d5d;
    color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
    min-height: 100vh;
    color: var(--ink);
    background: #e6ebe7;
    font-family: "Segoe UI", sans-serif;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }

.frame {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr);
    width: min(1240px, calc(100% - 28px));
    min-height: calc(100vh - 28px);
    margin: 14px auto;
    background: #fff;
    border-radius: 28px;
    box-shadow: 0 24px 60px rgba(28, 31, 36, 0.06);
    overflow: hidden;
}

.rail {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 18px 0;
    border-right: 1px solid var(--line);
}
.mark, .rail-btn {
    width: 44px;
    height: 44px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    color: var(--muted);
    text-decoration: none;
}
.mark { background: var(--lime); color: var(--ink); }
.rail-btn.on { background: #e9f9b0; color: var(--ink); }
.rail-btn:hover { background: var(--soft); }
.rail svg, .mark svg, .icon svg { width: 20px; height: 20px; }

.canvas { min-width: 0; }
.top-stack {
    position: sticky;
    top: 0;
    z-index: 5;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
}
.top {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 16px 22px 8px;
}
.global-search {
    display: flex;
    gap: 8px;
    padding: 0 22px 14px;
}
.global-search input {
    flex: 1;
    border: 0;
    background: var(--soft);
    border-radius: 999px;
    padding: 11px 16px;
    outline: none;
}
.global-search .lime { flex: none; }
.range { display: flex; align-items: center; gap: 8px; }
.range input[type="date"] {
    border: 0;
    background: var(--soft);
    border-radius: 12px;
    padding: 10px 12px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 750; text-decoration: none; }
.logo {
    width: 28px; height: 28px; border-radius: 10px;
    display: grid; place-items: center;
    background: var(--lime); font-size: 14px;
}
.links { display: flex; gap: 4px; flex: 1; }
.links a {
    text-decoration: none;
    color: var(--muted);
    font-size: 14px;
    font-weight: 650;
    padding: 8px 12px;
    border-radius: 999px;
}
.links a.on { color: var(--ink); background: var(--soft); }
.book-switch {
    margin-left: auto;
    display: flex;
    flex: none;
    padding: 4px;
    background: var(--soft);
    border-radius: 999px;
}
.book-switch a {
    text-decoration: none;
    color: var(--muted);
    font-size: 14px;
    font-weight: 750;
    padding: 8px 14px;
    border-radius: 999px;
}
.book-switch a.on, .book-switch button.on { background: var(--lime); color: var(--ink); }
.book-switch button {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 14px;
    font-weight: 750;
    padding: 8px 14px;
    border-radius: 999px;
}
.kind-switch { margin: 0 0 14px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.top-actions form { display: flex; }
.ghost, a.ghost {
    border: 0;
    background: var(--soft);
    border-radius: 999px;
    padding: 8px 12px;
    font-weight: 750;
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}
.page-actions { display: flex; gap: 8px; align-items: center; margin: 0 0 12px; }
.side-block .lime { margin-top: 12px; }
.filter-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: 1; }
.filter-form .search { min-width: 180px; flex: 1; }
.date-field { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 750; }
.date-field input { width: 138px; background: var(--soft); }
body.gate {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 24px;
}
.gate-card { width: min(420px, 100%); }
.gate-card h1 { margin: 0 0 6px; font-size: 28px; }
.figure.in { color: #2f9e44; }
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.cat-card { display: block; text-decoration: none; background: var(--card); border-radius: 22px; padding: 16px; }
.cat-card b { display: block; font-size: 16px; }
.cat-card .figure { font-size: 22px; }
.cat-card:hover { box-shadow: inset 0 0 0 2px var(--lime); }
.streak { display: inline-block; margin-top: 6px; background: var(--lime); border-radius: 999px; padding: 4px 8px; font-size: 12px; font-weight: 750; }
.line small a, .latest small a { color: #3d4650; font-weight: 750; }

.workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 16px;
    padding: 4px 22px 28px;
    align-items: start;
}
.hello { margin: 8px 0 0; font-size: 30px; font-weight: 750; letter-spacing: -0.6px; }
.lead { margin: 4px 0 16px; color: var(--muted); }

.stat-row, .split-row, .fields { display: grid; gap: 12px; }
.stat-row { grid-template-columns: 1.35fr 1fr 1fr; }
.split-row { grid-template-columns: 1fr 1fr; margin-top: 12px; }
.card {
    background: var(--card);
    border-radius: 22px;
    padding: 16px 16px 14px;
}
a.card { display: block; text-decoration: none; color: inherit; }
.card-top { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; font-weight: 650; }
.spread { justify-content: space-between; }
.figure { margin: 10px 0 0; font-size: 34px; font-weight: 750; letter-spacing: -1px; font-variant-numeric: tabular-nums; }
.figure.sm { font-size: 26px; }
.figure.mid { font-size: 28px; }
.figure small, .muted { color: var(--muted); font-weight: 650; }
.figure small { font-size: 14px; letter-spacing: 0; }
.muted { margin: 6px 0 0; font-size: 13px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.pill, .chip {
    background: #fff;
    border-radius: 999px;
    padding: 7px 10px;
    font-size: 12px;
    font-weight: 700;
}
.dot { width: 8px; height: 8px; border-radius: 99px; }
.lime-dot { background: #7ed957; }
.red-dot { background: var(--red); }
.flow { margin-top: 12px; }
.flow h2, .side-block h2, .block-title { margin: 0; font-size: 16px; }
.block-title { margin: 18px 4px 8px; }
.legend { display: flex; gap: 14px; color: var(--muted); font-size: 12px; font-weight: 650; margin-top: 8px; }
.swatch { width: 8px; height: 8px; border-radius: 99px; display: inline-block; margin-right: 6px; }
.gray { background: #d5dbe2; }
.lime-swatch { background: #b6ef3c; }
.chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 220px;
    margin-top: 12px;
}
.bar {
    position: relative;
    flex: 1;
    height: 100%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    text-decoration: none;
}
.col {
    width: min(34px, 78%);
    border-radius: 12px;
    background: #e4e8ed;
    display: block;
}
.is-hot .col { background: linear-gradient(180deg, #efffb4, #c6f04a 42%, #73d64a); }
.lbl { margin-top: 8px; font-size: 11px; font-weight: 700; color: var(--muted); }
.tip, .bar:not(.is-hot):hover::after {
    background: #1c1f24;
    color: #fff;
    border-radius: 10px;
    padding: 5px 8px;
    font-size: 11px;
    font-weight: 750;
    margin-bottom: 8px;
    white-space: nowrap;
}
.bar:not(.is-hot):hover::after { content: attr(data-tip); }
.foot { margin-bottom: 0; }
.callout {
    margin: 8px 0 0;
    background: #fff;
    border-radius: 12px;
    padding: 8px 10px;
    font-size: 13px;
    color: #3c4148;
}

.panel { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 124px; }
.dark {
    background: linear-gradient(165deg, #2a332c, #141816 70%);
    color: #fff;
}
.dark .eyebrow { margin: 0; color: #c9d2cb; font-size: 12px; font-weight: 700; }
.figure.light { color: #fff; }
.figure.light small { color: #c9d2cb; }
.dark p { margin: 8px 0 0; color: #d5ddd6; font-size: 13px; }
.side-block h2 { margin-bottom: 4px; }
.quick, .form { display: grid; gap: 10px; }
.quick label, .form label { display: grid; gap: 6px; font-size: 13px; font-weight: 700; color: #667078; }
.quick input, .quick select, .form input, .form select, .search {
    width: 100%;
    border: 0;
    background: #fff;
    border-radius: 12px;
    padding: 11px 12px;
    outline: none;
}
.form input, .form select { background: #fff; }
.form { background: var(--card); padding: 16px; }
.fields { grid-template-columns: 1fr 1fr; }
.wide { grid-column: 1 / -1; }
label span { font-weight: 650; color: var(--muted); }
.lime, .text-link { text-decoration: none; }
.lime {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border: 0;
    background: var(--lime);
    color: var(--ink);
    border-radius: 999px;
    padding: 12px 16px;
    font-weight: 750;
}
.lime.sm { padding: 8px 14px; font-size: 14px; }
.lime:hover { background: #b6e234; }
.text-link { color: #5f6b61; font-size: 13px; font-weight: 700; }
.latest, .tips { list-style: none; margin: 12px 0 0; padding: 0; }
.latest li {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 0;
    border-top: 1px solid #e6eae7;
}
.latest b, .line b { display: block; font-size: 14px; }
.latest small, .line small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.latest strong.in, .line .in { color: #2f9e44; }
.tips li { padding: 6px 0; color: #3c4148; font-size: 14px; }

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    position: sticky;
    top: 118px;
    background: #fff;
    z-index: 4;
    padding-bottom: 10px;
}
.chips { display: flex; gap: 6px; }
.chip { text-decoration: none; color: var(--muted); }
.chip.on { background: var(--ink); color: #fff; }
.search { max-width: 280px; background: var(--soft); }
.list { padding: 4px 14px; }
.line {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-top: 1px solid #e7ebe8;
}
.line:first-child { border-top: 0; }
.line-end { display: flex; align-items: center; gap: 8px; }
.line-end.stack { flex-direction: column; align-items: flex-end; gap: 2px; }
.line.total { border-top: 2px solid #d5dbe2; margin-top: 4px; }
.figure.in, .line .in { color: #2f9e44; }
.line strong { font-variant-numeric: tabular-nums; }
.tag { color: #9a6b00 !important; }
.account { font-variant-numeric: tabular-nums; }
.icon {
    width: 34px; height: 34px; border: 0; border-radius: 12px;
    background: #fff; color: var(--muted); display: grid; place-items: center;
}
.icon.danger { color: #b42318; }
.acts { display: flex; align-items: center; gap: 2px; }
.acts form { display: flex; }
.line.is-suspended { opacity: .62; }
dialog.edit-box {
    width: min(560px, calc(100vw - 32px));
    max-height: none;
    margin: auto;
    padding: 0;
    border: 0;
    border-radius: 22px;
    background: #fff;
    color: inherit;
    overflow: visible;
    box-shadow: 0 24px 70px rgba(28, 31, 36, .22);
}
dialog.edit-box::backdrop { background: rgba(28, 31, 36, .38); }
.edit-box form {
    max-height: min(80vh, 720px);
    overflow: auto;
    border-radius: 22px;
}
.edit-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.edit-head h2 { margin: 0; font-size: 18px; }
.edit-actions { display: flex; justify-content: flex-end; }
.edit-box .picker-btn, .edit-box input, .edit-box select { background: var(--soft); }
.pager { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.pager a { text-decoration: none; background: var(--soft); border-radius: 10px; padding: 6px 10px; font-weight: 700; font-size: 13px; }
.pager a.on { background: var(--ink); color: #fff; }
.notes p { margin: 8px 0; font-size: 14px; }
.banner { background: #e9f9b0; border-radius: 12px; padding: 10px 12px; font-weight: 700; }
.banner.bad { background: #ffe4e4; }
.empty { color: var(--muted); }

.native-select {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
    pointer-events: none;
}
.picker-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border: 0;
    background: #fff;
    border-radius: 12px;
    padding: 11px 12px;
    text-align: left;
    font-weight: 650;
}
.picker-btn.is-empty { color: #9aa2aa; }
.picker.is-bad .picker-btn { box-shadow: inset 0 0 0 2px #ffb4b4; }
.picker-btn[aria-expanded="true"] { box-shadow: inset 0 0 0 2px var(--lime); }
.caret { display: grid; color: #8b939c; }
.caret svg { width: 16px; height: 16px; }
.picker-menu::-webkit-scrollbar { width: 12px; }
.picker-menu::-webkit-scrollbar-thumb { background: #b7c0c9; border: 3px solid #fff; border-radius: 99px; }
.picker-menu {
    position: fixed;
    z-index: 30;
    margin: 0;
    padding: 6px;
    list-style: none;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 16px 40px rgba(28, 31, 36, 0.16);
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #b7c0c9 transparent;
}
.picker-menu li {
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 650;
    cursor: pointer;
}
.picker-menu li.is-active { background: var(--soft); }
.picker-menu li[aria-selected="true"] { background: var(--lime); }
.picker-add {
    position: sticky;
    bottom: 0;
    background: #fff;
    border-top: 1px solid var(--line);
    margin: 4px -6px -6px;
    padding: 6px;
    border-radius: 0 0 16px 16px;
}
.picker-add-btn, .picker-add-row input {
    width: 100%;
    border: 0;
    background: var(--soft);
    border-radius: 10px;
    padding: 9px 12px;
    text-align: left;
    font-weight: 650;
}
.picker-add-row { display: flex; gap: 6px; }
.picker-add-row input { min-width: 0; }
.picker-add-row button {
    border: 0;
    background: var(--lime);
    border-radius: 999px;
    padding: 9px 12px;
    font-weight: 750;
}
.picker-add-error { margin: 6px 2px 0; color: #b42318; font-size: 12px; font-weight: 650; }

@media (max-width: 980px) {
    .frame { grid-template-columns: 1fr; width: min(100% - 16px, 1240px); }
    .rail { flex-direction: row; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
    .workspace, .stat-row, .fields { grid-template-columns: 1fr; }
    .top { flex-wrap: wrap; }
    .links { order: 3; width: 100%; overflow-x: auto; }
    .panel { position: static; }
    .filters, .filter-form, .page-actions { flex-wrap: wrap; }
}
