:root {
  --bg: #f4f5f7; --surface: #fff; --ink: #1c2330; --ink-soft: #67707f;
  --line: #e4e7ec; --brand: #c96f3b; --brand-dark: #a8542a; --accent: #2f5d50;
  --danger: #b3402f; --radius: 12px; --shadow: 0 4px 18px rgba(28,35,48,.06);
  --font: "Inter", "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 14.5px; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); padding: 42px; width: 400px; }
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-card .sub { color: var(--ink-soft); font-size: 13.5px; margin-bottom: 24px; }

.layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar { background: #1c2330; color: #b9c1cd; padding: 22px 0; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { color: #fff; font-size: 18px; font-weight: 700; padding: 0 22px 20px; border-bottom: 1px solid #2c3542; }
.sidebar .brand span { color: var(--brand); }
.sidebar a { display: flex; gap: 10px; align-items: center; padding: 11px 22px; font-size: 14px; font-weight: 500; border-left: 3px solid transparent; }
.sidebar a:hover { background: #252d3a; }
.sidebar a.on { background: #252d3a; border-left-color: var(--brand); color: #fff; }
.main { padding: 28px 34px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 26px; }
.topbar h1 { font-size: 22px; }
.topbar .who { color: var(--ink-soft); font-size: 13.5px; }
.topbar .who a { color: var(--brand); font-weight: 600; margin-left: 10px; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.kpi { background: var(--surface); border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow); }
.kpi .lbl { color: var(--ink-soft); font-size: 12.5px; text-transform: uppercase; letter-spacing: .6px; }
.kpi .val { font-size: 26px; font-weight: 700; margin-top: 6px; }
.kpi .val.warn { color: var(--danger); }

.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 22px; }
.card h2 { font-size: 16.5px; margin-bottom: 16px; }

table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th { text-align: left; color: var(--ink-soft); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.data td { padding: 10px; border-bottom: 1px solid #f0f2f5; vertical-align: middle; }
table.data tr:hover td { background: #fafbfc; }

.btn { display: inline-flex; align-items: center; gap: 6px; background: var(--brand); color: #fff; border: 0; border-radius: 9px; padding: 9px 18px; font-size: 13.5px; font-weight: 600; }
.btn:hover { background: var(--brand-dark); }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn.sm { padding: 5px 12px; font-size: 12.5px; border-radius: 7px; }
.btn.danger { background: var(--danger); }
.btn:disabled { opacity: .5; }

.badge { display: inline-block; border-radius: 999px; padding: 3px 11px; font-size: 12px; font-weight: 700; text-transform: capitalize; }
.badge.pending { background: #fdf0dc; color: #a06a10; } .badge.paid { background: #e4ecfa; color: #2c4f9e; }
.badge.shipped { background: #e6f3ee; color: #22604b; } .badge.delivered { background: #e3efe7; color: #22604b; }
.badge.cancelled { background: #f7e3e1; color: #a33327; } .badge.active { background: #e3efe7; color: #22604b; }
.badge.draft { background: #eceff3; color: #67707f; }
.badge.low { background: #f7e3e1; color: #a33327; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; }
.field input, .field select, .field textarea { width: 100%; border: 1.5px solid var(--line); border-radius: 9px; padding: 9px 12px; background: var(--surface); outline: none; }
.field input:focus { border-color: var(--brand); }
.frow { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.filters { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.filters select, .filters input { border: 1px solid var(--line); border-radius: 9px; padding: 8px 12px; background: var(--surface); }

.chart { display: flex; align-items: flex-end; gap: 3px; height: 180px; padding: 10px 0 0; }
.chart .bar { flex: 1; background: linear-gradient(180deg, #d98a55, var(--brand)); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.chart .bar:hover::after { content: attr(data-tip); position: absolute; bottom: 105%; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 11px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; z-index: 5; }

.modal-mask { position: fixed; inset: 0; background: rgba(20,25,35,.5); display: flex; align-items: center; justify-content: center; z-index: 90; }
.modal { background: var(--surface); border-radius: 16px; padding: 28px; width: 560px; max-width: 94vw; max-height: 88vh; overflow: auto; }
.modal h3 { font-size: 17px; margin-bottom: 18px; }
.msg { font-size: 13.5px; min-height: 18px; margin: 8px 0; }
.msg.err { color: var(--danger); } .msg.ok { color: var(--accent); }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; display: flex; flex-wrap: wrap; padding: 12px; }
  .sidebar .brand { border: 0; padding: 8px 14px; width: 100%; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .main { padding: 18px; }
  table.data { font-size: 12.5px; }
}
