:root {
    --brand: #E85D04;
    --brand-dark: #9A3412;
    --header: #C2410C;
    --header-ink: #fff;
    --canvas: #FFF7ED;
    --surface: #fff;
    --ink: #111827;
    --muted: #6B7280;
    --line: #FED7AA;
    --danger: #DC2626;
    --success: #15803D;
    --warning: #D97706;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "IBM Plex Sans", system-ui, sans-serif; font-size: 16px; color: var(--ink); background: var(--canvas); }
a { color: var(--header); text-decoration: none; }
button, .btn { min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); padding: 0 16px; font: inherit; cursor: pointer; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { background: var(--brand-dark); }
.btn.red { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.blue { background: var(--header); color: #fff; border-color: var(--header); }
.btn.green { background: var(--success); color: #fff; border-color: var(--success); }
.btn.ink { background: #111827; color: #fff; }
.shell { display: block; min-height: 100vh; }
.backdrop { display: none; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: min(280px, 86vw); background: var(--surface); border-right: 1px solid var(--line); padding: 0 12px 16px; transform: translateX(-100%); z-index: 3; overflow: auto; }
.shell.nav-open .sidebar { transform: none; }
.shell.nav-open .backdrop { display: block; position: fixed; inset: 0; border: 0; background: rgba(17, 24, 39, .45); z-index: 2; }
.brand { margin: 0 -12px 8px; padding: 20px 16px; background: var(--brand); color: #fff; font-weight: 700; }
.group { color: var(--muted); font-size: 12px; letter-spacing: .06em; margin: 16px 8px 8px; }
.nav a, .nav button, .subnav summary { display: flex; justify-content: space-between; align-items: center; width: 100%; text-align: left; border: 0; background: transparent; border-radius: 8px; padding: 8px; min-height: 44px; color: var(--ink); font: inherit; cursor: pointer; }
.nav a.active { background: var(--brand); color: var(--header-ink); }
.subnav { margin: 2px 0; }
.subnav summary { list-style: none; font-weight: 600; }
.subnav summary::-webkit-details-marker { display: none; }
.subnav summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin-right: 6px; }
.subnav[open] summary::after { transform: rotate(-135deg); margin-top: 4px; }
.subnav.on > summary { background: #FFEDD5; color: var(--brand-dark); }
.subnav-links { display: flex; flex-direction: column; margin: 2px 0 8px 10px; padding-left: 8px; border-left: 2px solid var(--line); }
.badge { background: var(--danger); color: #fff; border-radius: 999px; padding: 0 6px; font-size: 12px; }
.main { padding: 12px; }
.topbar { display: flex; gap: 12px; align-items: center; margin: -12px -12px 12px; padding: 12px; background: var(--brand); color: #fff; }
.topbar strong { display: block; }
.who { font-size: 13px; opacity: .95; }
.menu { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; min-height: 44px; padding: 0; border: 0; border-radius: 10px; background: transparent; color: #fff; }
.menu svg { width: 26px; height: 26px; display: block; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-top: 16px; box-shadow: 0 8px 24px rgba(154, 52, 18, .06); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
th { color: var(--brand-dark); font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.tabs { display: flex; gap: 8px; overflow-x: auto; }
.tabs a { white-space: nowrap; border-bottom: 2px solid transparent; padding: 8px; }
.tabs a.on { border-color: var(--brand); color: var(--brand); font-weight: 700; }
label { display: block; font-size: 12px; color: var(--muted); margin-top: 12px; }
input, select, textarea { width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; font: inherit; background: #fff; }
.grid, .pairs, .split { display: grid; grid-template-columns: 1fr; gap: 12px; align-items: center; }
.metrics { display: flex; gap: 12px; flex-wrap: wrap; }
.metric { font-size: 28px; font-variant-numeric: tabular-nums; color: var(--brand-dark); }
.help { color: var(--header); font-size: 12px; }
.error { color: var(--danger); }
.banner { background: #FFEDD5; padding: 8px 12px; border-radius: 12px; }
.empty { color: var(--muted); }
.pin-digits { font-size: 32px; letter-spacing: .28em; font-variant-numeric: tabular-nums; font-weight: 700; margin: 8px 0; color: var(--brand-dark); }
.row { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }
.btn.small { min-height: 36px; padding: 0 10px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.chip { border-radius: 999px; background: #FFEDD5; color: var(--brand-dark); padding: 6px 12px; font-size: 13px; }
.chip.blue { background: var(--brand); color: #fff; }
.chip.blue a { color: #fff; margin-left: 8px; }
.req { color: var(--danger); }
.search { display: flex; gap: 8px; align-items: center; width: 100%; }
.search input { width: 100%; min-height: 40px; }
.table-wrap { overflow-x: auto; }
.directory-head { display: flex; flex-direction: column; gap: 12px; }
.directory .tabs { width: 100%; }
.directory .tabs a { flex: 1; text-align: center; border: 1px solid var(--line); border-radius: 12px; }
.directory .tabs a.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.directory .search { width: 100%; }
.directory .search input { min-width: 0; }
.directory .search button { flex: 0 0 auto; }
.people { display: flex; flex-direction: column; gap: 12px; }
.person { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: #fffaf5; }
.person-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.person-company { font-size: 18px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.person-name { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
.status { border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.status.on { background: #DCFCE7; color: var(--success); }
.status.off { background: #FEE2E2; color: var(--danger); }
.person-phone { display: inline-block; margin: 8px 0; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.person-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
.person-meta div { background: var(--canvas); border-radius: 10px; padding: 8px; min-width: 0; }
.person-meta dt { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.person-meta dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.row-actions form { margin: 0; }
.row-actions .btn, .row-actions summary { min-height: 40px; padding: 0 12px; font-weight: 600; }
.row-actions .tool { flex: 1 1 auto; }
.row-actions .tool summary { width: 100%; list-style: none; display: inline-flex; align-items: center; justify-content: center; }
.row-actions .tool summary::-webkit-details-marker { display: none; }
.row-actions .pop { position: static; width: 100%; min-width: 0; margin-top: 8px; box-shadow: none; }
.row-actions .view { background: #fff; color: var(--brand-dark); border-color: #FDBA74; }
.row-actions .edit { background: var(--brand); color: #fff; border-color: var(--brand); }
.row-actions .suspend { background: #fff; color: #B91C1C; border-color: #FECACA; }
.row-actions .reactivate { background: #F0FDF4; color: var(--success); border-color: #BBF7D0; }
.row-actions .login-as { background: var(--brand-dark); color: #fff; border-color: var(--brand-dark); }
.row-actions .btn.green { background: #F0FDF4; color: var(--success); border-color: #BBF7D0; }
.wallet-head { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 8px; font-size: 13px; }
.directory nav { margin-top: 12px; overflow-x: auto; }
.muted { color: var(--muted); font-size: 12px; }
.tool { position: relative; }
.tool summary { list-style: none; }
.tool summary::-webkit-details-marker { display: none; }
.pop { position: absolute; right: 0; z-index: 3; min-width: 200px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px; box-shadow: 0 8px 24px rgba(154, 52, 18, .12); }
.gate { min-height: 100vh; }
.gate-banner { background: linear-gradient(160deg, #F97316 0%, #C2410C 70%); color: #fff; padding: 32px 20px 40px; }
.gate-banner h1 { margin: 8px 0; font-size: 36px; line-height: 1.1; }
.eyebrow { margin: 0; letter-spacing: .08em; text-transform: uppercase; font-size: 12px; }
.lead { font-size: 18px; max-width: 36rem; }
.gate-banner ul { margin: 16px 0 0; padding-left: 18px; }
.gate-banner li { margin: 8px 0; }
.lock { width: 72px; height: 72px; }
.login { margin: -24px 16px 24px; }
.login h2 { margin: 0; color: var(--brand-dark); }
.login .btn { width: 100%; margin-top: 16px; }
.combo { position: relative; width: 100%; }
.combo-list { position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); max-height: 240px; overflow: auto; margin: 0; padding: 4px; list-style: none; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 24px rgba(154, 52, 18, .12); }
.combo-list button { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; width: 100%; min-height: 48px; padding: 8px 12px; border: 0; background: transparent; text-align: left; }
.combo-list button[aria-selected="true"], .combo-list button:hover { background: #FFEDD5; }
.combo-empty { padding: 12px; color: var(--muted); }
.secret { position: relative; }
.secret input { padding-right: 48px; }
.eye { position: absolute; right: 4px; bottom: 4px; width: 40px; height: 40px; min-height: 40px; padding: 8px; border: 0; background: transparent; color: var(--brand-dark); }
.eye svg { width: 22px; height: 22px; display: block; }
.eye .shut { display: none; }
.eye.is-open .open { display: none; }
.eye.is-open .shut { display: block; }
.ledger { position: relative; }
.ledger-head h1 { display: inline-block; margin: 0 0 12px; padding: 8px 14px; border-radius: 8px; background: var(--brand); color: #fff; font-size: 14px; }
.ledger-cards { display: flex; flex-direction: column; gap: 12px; }
.ledger-card { border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: #fffaf5; }
.ledger-kind { margin: 8px 0; font-weight: 700; color: var(--brand-dark); }
.party-pair { display: grid; grid-template-columns: 1fr; gap: 8px; }
.party-pair h2 { margin: 0 0 4px; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.party { display: flex; flex-direction: column; gap: 2px; font-size: 13px; line-height: 1.4; white-space: nowrap; }
.party span { color: var(--muted); }
.ledger-table { display: none; padding-bottom: 8px; }
.ledger-table table { min-width: 1280px; }
.ledger-table th { text-transform: none; letter-spacing: 0; font-size: 13px; white-space: nowrap; }
.ledger-table tbody tr:nth-child(even) { background: #F9FAFB; }
.ledger-table .nowrap { white-space: nowrap; }
.ledger-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.toast { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: fit-content; margin: 0 0 12px auto; padding: 8px 12px; border-radius: 8px; background: var(--brand); color: #fff; }
.toast button { width: 32px; height: 32px; min-height: 32px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: #fff; font-size: 20px; }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 12px; color: var(--muted); font-size: 14px; }
.pager form { margin: 0; }
.pager label { display: flex; align-items: center; gap: 8px; margin: 0; }
.pager select { width: auto; min-height: 36px; }
.pager-nav { display: flex; gap: 4px; }
.pager-nav a, .pager-nav span { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 8px; color: var(--ink); }
.pager-nav span { color: var(--line); }
.form-actions { position: fixed; z-index: 4; left: 0; right: 0; bottom: 0; display: flex; justify-content: stretch; gap: 12px; padding: 12px 16px; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgba(154, 52, 18, .08); }
.form-actions .btn { flex: 1; }
form.card { margin-bottom: 88px; }
@media (min-width: 720px) {
    .pairs, .split { grid-template-columns: 1fr 1fr; }
    .search { width: auto; }
    .search input { width: 220px; }
    .directory-head { flex-direction: row; align-items: center; justify-content: space-between; }
    .directory .tabs { width: auto; }
    .directory .search { width: min(100%, 360px); }
    .directory .search input { width: 100%; }
    .main { padding: 20px; }
    .topbar { margin: -20px -20px 16px; padding: 16px 20px; }
}
@media (min-width: 960px) {
    .shell { display: flex; }
    .sidebar { position: sticky; top: 0; height: 100vh; transform: none; flex: 0 0 240px; }
    .backdrop, .menu { display: none; }
    .main { flex: 1; min-width: 0; }
    .party-pair { grid-template-columns: 1fr 1fr; }
    .ledger-cards { display: none; }
    .ledger-table { display: block; }
    .person { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(170px, .8fr) minmax(240px, 1fr); align-items: center; column-gap: 16px; }
    .row-actions { margin-top: 0; }
    .form-actions { left: 240px; justify-content: flex-end; }
    .form-actions .btn { flex: 0 0 auto; min-width: 180px; }
    body.gate { display: grid; grid-template-columns: 1.15fr .85fr; min-height: 100vh; align-items: stretch; }
    .gate-banner { display: flex; flex-direction: column; justify-content: center; padding: 64px; }
    body.gate .login { margin: 48px; align-self: center; }
}
