:root {
    --ink: #102a2e;
    --muted: #607579;
    --line: #dce7e7;
    --surface: #ffffff;
    --canvas: #f3f7f6;
    --primary: #155e75;
    --primary-dark: #164e63;
    --accent: #d97706;
    --success: #047857;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: linear-gradient(135deg, #f8fbfa 0%, #eef5f4 100%); }
a { color: var(--primary); }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: .45rem; font-size: clamp(1.8rem, 4vw, 2.55rem); letter-spacing: -.035em; }
h2 { font-size: 1.15rem; }

.topbar { min-height: 68px; padding: 0 clamp(1rem, 4vw, 3rem); display: flex; align-items: center; gap: 2rem; background: #0f2f36; color: white; box-shadow: 0 2px 12px #0f2f3620; }
.brand { color: white; text-decoration: none; font-size: 1.35rem; font-weight: 800; letter-spacing: -.04em; }
.brand span { color: #f59e0b; }
.topbar nav { display: flex; gap: 1rem; }
.topbar nav a { color: #d6e8e8; text-decoration: none; font-weight: 600; }
.topbar nav a:hover { color: white; }
.account { margin-left: auto; display: flex; align-items: center; gap: 1rem; font-size: .9rem; }
.account form { margin: 0; }
.link-button { border: 0; padding: 0; color: #fbbf24; background: transparent; font: inherit; cursor: pointer; }

.container { width: min(1500px, calc(100% - 2rem)); margin: 0 auto; padding: 2.25rem 0 4rem; }
.page-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 1.5rem; }
.eyebrow { margin-bottom: .35rem; color: var(--accent); font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.muted { color: var(--muted); }
.block { display: block; }
.mono { font-family: "SFMono-Regular", Consolas, monospace; font-size: .9em; }

input, select { width: 100%; min-height: 42px; padding: .65rem .75rem; border: 1px solid #bfd0d0; border-radius: 8px; background: white; color: var(--ink); font: inherit; }
input:focus, select:focus { outline: 3px solid #0891b230; border-color: #0891b2; }
select[multiple] { min-height: 104px; }
label { font-size: .84rem; font-weight: 700; }
.hint { font-weight: 400; color: var(--muted); }

.filter-card, .panel, .table-card, .narrow-card, .auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 30px #173b3f0a; }
.filter-card { padding: 1rem; display: flex; align-items: end; flex-wrap: wrap; gap: .8rem; }
.field { min-width: 150px; flex: 1 1 170px; display: grid; gap: .35rem; }
.field.grow { flex-grow: 2; min-width: 240px; }
.field.compact { max-width: 170px; }
.stores-field { min-width: 220px; }
.filter-actions { width: 100%; padding-top: .25rem; display: flex; flex-wrap: wrap; gap: .6rem; }

.button { min-height: 40px; padding: .65rem 1rem; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 8px; font: inherit; font-weight: 750; text-decoration: none; cursor: pointer; }
.button.primary { color: white; background: var(--primary); }
.button.primary:hover { background: var(--primary-dark); }
.button.secondary { color: var(--ink); border-color: #bfd0d0; background: white; }
.button.success { color: white; background: var(--success); }
.button.small { min-height: 34px; padding: .45rem .7rem; font-size: .82rem; }

.summary-grid { margin: 1rem 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.summary-card { padding: 1.15rem 1.3rem; display: grid; gap: .25rem; border-radius: 12px; background: #e8f3f3; }
.summary-card.accent { background: #fff4da; }
.summary-card span, .summary-card small { color: var(--muted); font-size: .86rem; font-weight: 650; }
.summary-card strong { font-size: 1.8rem; letter-spacing: -.03em; }

.table-card { overflow: hidden; }
.table-wrap { overflow-x: auto; }
.data-table-card { padding: 1rem; }
.data-table-card .table-wrap { overflow: visible; }
.data-table-card .dt-container { width: 100%; }
.data-table-card .dt-layout-row { align-items: center; gap: .75rem; margin: 0 0 .85rem; }
.data-table-card .dt-layout-row:last-child { margin: .9rem 0 0; }
.data-table-card .dt-length select { width: auto; min-width: 72px; min-height: 38px; margin: 0 .35rem; }
.data-table-card .dt-info { color: var(--muted); font-size: .88rem; }
.data-table-card .dt-paging-button { border-radius: 7px !important; }
.data-table-card table.dataTable { margin: 0 !important; }
.data-table-card table.dataTable thead th { border-bottom: 1px solid var(--line); }
.data-table-card table.dataTable tbody td { border-top: 1px solid var(--line); }
.data-table-card table.dataTable tbody tr:hover { background: #f6fafa; }
.data-table-card th.dt-control { width: 44px; }
.row-details { width: 30px; height: 30px; padding: 0; border: 1px solid #9bbdbf; border-radius: 999px; color: var(--primary); background: white; font: 700 1rem/1 inherit; cursor: pointer; }
.row-details:hover { color: white; border-color: var(--primary); background: var(--primary); }
.data-table-details { padding: .85rem .35rem .45rem; }
.warning-text { color: #b45309; font-weight: 650; }
table { width: 100%; border-collapse: collapse; }
th { padding: .8rem 1rem; background: #eaf1f1; color: #486164; font-size: .76rem; text-align: left; text-transform: uppercase; letter-spacing: .04em; }
td { padding: .85rem 1rem; border-top: 1px solid var(--line); vertical-align: middle; }
td.numeric, th.numeric { text-align: right; }
td.total { font-size: 1.05rem; color: var(--primary-dark); }
.detail-row td { padding-top: 0; background: #fbfdfd; }
details summary { width: fit-content; padding: .45rem 0 .65rem; color: var(--primary); font-size: .84rem; font-weight: 750; cursor: pointer; }
.store-grid { padding: .2rem 0 1rem; display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: .65rem; }
.store-balance { padding: .75rem; display: grid; gap: .25rem; border: 1px solid var(--line); border-radius: 9px; background: white; }
.store-balance span { color: var(--muted); font-size: .8rem; }
.store-balance strong { font-size: 1.1rem; }
.store-balance small { color: var(--muted); font-size: .72rem; }
.empty { padding: 3rem; color: var(--muted); text-align: center; }
.pagination { padding: 1rem; display: flex; align-items: center; justify-content: center; gap: 1.2rem; border-top: 1px solid var(--line); }
.pagination a { font-weight: 700; text-decoration: none; }

.auth-shell { min-height: calc(100vh - 150px); display: grid; place-items: center; }
.auth-card, .narrow-card { width: min(100%, 450px); margin: 2rem auto; padding: clamp(1.4rem, 4vw, 2.25rem); }
.stack { display: grid; gap: .6rem; }
.stack .button { margin-top: .5rem; }
.validation { color: #b42318; font-size: .82rem; }
.validation:empty { display: none; }
.notice { margin-bottom: 1rem; padding: .85rem 1rem; border: 1px solid #9bd2bc; border-radius: 9px; color: #065f46; background: #ecfdf5; }

.split-grid { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 1rem; align-items: start; }
.panel { padding: 1.25rem; }
.user-list { display: grid; gap: .8rem; }
.user-item { padding: .9rem; display: flex; justify-content: space-between; gap: 1rem; border: 1px solid var(--line); border-radius: 10px; }
.user-actions { display: flex; flex-direction: column; align-items: end; gap: .5rem; }
.reset-form { display: flex; gap: .4rem; }
.reset-form input { min-width: 180px; min-height: 34px; padding: .4rem .55rem; font-size: .82rem; }
.badge { margin-top: .45rem; padding: .18rem .45rem; display: inline-block; border-radius: 999px; font-size: .7rem; font-weight: 800; }
.badge.active { color: #065f46; background: #d1fae5; }
.badge.inactive { color: #991b1b; background: #fee2e2; }
.badge.warning { color: #92400e; background: #fef3c7; }

@media (max-width: 760px) {
    .topbar { padding: .8rem 1rem; flex-wrap: wrap; gap: .8rem 1.2rem; }
    .topbar nav { order: 3; width: 100%; }
    .account span { display: none; }
    .container { width: min(100% - 1rem, 1500px); padding-top: 1.25rem; }
    .summary-grid, .split-grid { grid-template-columns: 1fr; }
    .field.compact { max-width: none; }
    .user-item, .reset-form { flex-direction: column; }
    .user-actions { align-items: stretch; }
    .data-table-card { padding: .65rem; }
    .data-table-card .table-wrap { overflow-x: auto; }
    .data-table-card .dt-layout-row { align-items: stretch; flex-direction: column; }
}
