/* Admin panel */
.login { min-height: 100%; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, #2a211b, #4a2b1f); }
.login-card { background: #fff; border-radius: 18px; padding: 32px; width: min(400px, 100%); display: grid; gap: 14px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 24px; } .login-card p { margin: -6px 0 4px; }
.login-card label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
.err { color: var(--bad); font-weight: 600; min-height: 20px; }

.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.nav { background: var(--ink); color: #f3ebe0; padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.nav .brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 16px; font-weight: 800; font-size: 17px; }
.nav .brand img { width: 34px; height: 34px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: inherit; text-decoration: none; font-weight: 600; }
.nav a:hover { background: rgba(255,255,255,.08); } .nav a.on { background: var(--brand); color: #fff; }
.nav a span.i { width: 22px; text-align: center; }
.nav .sp { flex: 1; }
.nav .who { font-size: 13px; opacity: .7; padding: 8px 12px; }
.view { padding: 24px 28px 60px; max-width: 1280px; width: 100%; }
.mobilebar { display: none; }
.page-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-h h1 { font-size: 26px; }

/* controls */
input, select, textarea { background: #fff; border: 1.5px solid var(--line); border-radius: 9px; padding: 9px 11px; min-height: 40px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
input[type=checkbox] { width: 18px; height: 18px; min-height: 0; accent-color: var(--brand); }
input[type=color] { padding: 2px; width: 56px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px; border-radius: 9px; border: 1.5px solid var(--line); background: #fff; font-weight: 700; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: #cdbfae; } .btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; } .btn.danger { color: var(--bad); border-color: var(--bad-soft); background: var(--bad-soft); }
.btn.sm { min-height: 32px; padding: 0 10px; font-size: 13px; } .btn:disabled { opacity: .5; cursor: default; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar select, .toolbar input { width: auto; min-width: 140px; }
.seg { display: inline-flex; background: #fff; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; background: none; padding: 8px 13px; font-weight: 700; font-size: 14px; border-right: 1px solid var(--line); }
.seg button:last-child { border: 0; } .seg button.on { background: var(--ink); color: #fff; }
.field { display: grid; gap: 5px; margin-bottom: 12px; } .field > span { font-weight: 700; font-size: 13px; } .field small { color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; } .grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
.chk { display: flex; gap: 8px; align-items: center; font-weight: 600; margin-bottom: 12px; }

/* panels + kpis */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.panel h2 { font-size: 16px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.panel h2 small { font-weight: 500; color: var(--muted); font-size: 13px; }
.cols { display: grid; grid-template-columns: repeat(12, 1fr); gap: 16px; margin-bottom: 16px; }
.c4 { grid-column: span 4; } .c5 { grid-column: span 5; } .c6 { grid-column: span 6; } .c7 { grid-column: span 7; } .c8 { grid-column: span 8; } .c12 { grid-column: span 12; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.kpi .l { color: var(--muted); font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; }
.kpi .v { font-size: 28px; font-weight: 800; letter-spacing: -.5px; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.kpi .s { color: var(--muted); font-size: 13px; }
.kpi.hero { border-width: 2px; } .kpi.hero.profit { border-color: var(--good); background: var(--good-soft); } .kpi.hero.loss { border-color: var(--bad); background: var(--bad-soft); }
.kpi.hero.profit .v { color: var(--good); } .kpi.hero.loss .v { color: var(--bad); }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); } .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; }
.banner { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 11px 14px; font-weight: 600; margin-bottom: 14px; }

/* progress + bars */
.prog { height: 14px; border-radius: 7px; background: var(--line); overflow: hidden; margin: 8px 0 14px; } .prog > i { display: block; height: 100%; background: var(--good); border-radius: 7px; }
.kv { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px dashed var(--line); gap: 12px; } .kv:last-child { border: 0; } .kv b { font-variant-numeric: tabular-nums; }
.hbar { display: grid; grid-template-columns: 90px 1fr 80px; gap: 10px; align-items: center; padding: 5px 0; font-size: 14px; } .hbar .tr { background: var(--surface-2); border-radius: 5px; height: 16px; } .hbar .tr i { display: block; height: 100%; background: var(--brand); border-radius: 5px; }

/* tables */
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table.t { border-collapse: collapse; width: 100%; font-size: 14px; }
.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); white-space: nowrap; position: sticky; top: 0; }
.t td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; } .t tr.click { cursor: pointer; } .t tr.click:hover td { background: var(--surface-2); }
.t .r, .t th.r { text-align: right; font-variant-numeric: tabular-nums; } .t tr.off td { opacity: .5; } .t tfoot td { font-weight: 800; background: var(--surface-2); }
.empty { padding: 40px; text-align: center; color: var(--muted); }

/* modal */
.modal-bg { position: fixed; inset: 0; background: rgba(30,22,17,.55); display: grid; place-items: start center; padding: 40px 14px; overflow-y: auto; z-index: 100; }
.modal { background: #fff; border-radius: 16px; width: min(var(--w, 560px), 100%); box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.modal-h { padding: 18px 22px 6px; display: flex; justify-content: space-between; align-items: center; } .modal-h h2 { font-size: 19px; }
.modal-h button { border: 0; background: var(--surface-2); width: 34px; height: 34px; border-radius: 50%; font-size: 16px; }
.modal-b { padding: 10px 22px 6px; } .modal-f { padding: 14px 22px 20px; display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

@media (max-width: 960px) {
  .shell { grid-template-columns: 1fr; }
  .mobilebar { display: flex; align-items: center; gap: 12px; background: var(--ink); color: #fff; padding: 10px 14px; position: sticky; top: 0; z-index: 20; }
  .mobilebar button { background: none; border: 0; color: #fff; font-size: 24px; }
  .nav { position: fixed; left: 0; top: 0; z-index: 30; width: 250px; transform: translateX(-100%); transition: transform .2s; }
  .nav.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); }
  .view { padding: 16px 14px 60px; }
  .cols > * { grid-column: span 12 !important; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
}
