/* ── VARIABLES ── */
:root {
  --teal:      #0F6E56;
  --teal-mid:  #18A37E;
  --teal-lt:   #D1F0E7;
  --teal-xlt:  #EBF9F4;
  --dark:      #0D1117;
  --sidebar:   #111820;
  --mid:       #4A5568;
  --muted:     #8A9BB0;
  --border:    #E2E8F0;
  --border-dk: #1E2A38;
  --white:     #FFFFFF;
  --bg:        #F0F4F8;
  --amber:     #E59A00;
  --amber-lt:  #FEF3C7;
  --red:       #D63B3B;
  --red-lt:    #FEE8E8;
  --blue:      #2B6CB0;
  --blue-lt:   #EBF4FF;
  --green:     #1A7A4A;
  --green-lt:  #E6F6EE;
  --purple:    #6B46C1;
  --purple-lt: #EDE9FE;
  --orange:    #C05621;
  --orange-lt: #FFF0E6;
  --radius:    10px;
  --radius-lg: 14px;
  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.04);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: 'Sora', sans-serif; font-size: 14px; color: #111827; background: var(--bg); }
button { font-family: 'Sora', sans-serif; cursor: pointer; }
input, select, textarea { font-family: 'Sora', sans-serif; }
a { color: var(--teal); text-decoration: none; }

/* ── PAGES ── */
.page { display: none; }
.page.active { display: block; }
.hidden { display: none !important; }

/* ── LOGIN ── */
.login-bg {
  min-height: 100vh;
  background: linear-gradient(135deg, #0D1117 0%, #111820 60%, #0F1E15 100%);
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 20px;
  padding: 40px;
  width: 380px;
  backdrop-filter: blur(20px);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo-icon {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--teal), var(--teal-mid));
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; margin: 0 auto 12px;
  box-shadow: 0 8px 32px rgba(15,110,86,.4);
}
.login-logo-name { font-size: 24px; font-weight: 700; color: white; letter-spacing: -.5px; }
.login-logo-sub  { font-size: 11px; color: #3D5166; margin-top: 3px; }
.login-footer { text-align: center; font-size: 10px; color: #2D4055; margin-top: 20px; }

/* ── APP SHELL ── */
.app-shell { display: grid; grid-template-columns: 220px 1fr; height: 100vh; overflow: hidden; }

/* ── SIDEBAR ── */
.sidebar {
  background: var(--sidebar);
  display: flex; flex-direction: column;
  border-right: 1px solid var(--border-dk);
  overflow-y: auto;
}
.sb-logo { padding: 20px 18px 16px; border-bottom: 1px solid var(--border-dk); }
.sb-logo-mark { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.sb-logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--teal), var(--teal-mid));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.sb-logo-name { font-size: 16px; font-weight: 700; color: white; letter-spacing: -.3px; }
.sb-logo-sub  { font-size: 10px; color: #3D5166; padding-left: 42px; }
.sb-section   { font-size: 9px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: #2D4055; padding: 14px 18px 4px; }
.sb-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 18px; font-size: 12px; color: #4A6580;
  cursor: pointer; border-left: 3px solid transparent;
  transition: all .15s; position: relative;
}
.sb-item.active { color: white; background: rgba(15,110,86,.12); border-left-color: var(--teal-mid); }
.sb-item:hover  { color: #8AA5BE; }
.sb-icon  { font-size: 14px; width: 18px; text-align: center; flex-shrink: 0; }
.sb-badge {
  margin-left: auto; background: var(--red); color: white;
  font-size: 9px; font-weight: 700; padding: 1px 6px; border-radius: 8px;
}
.sb-badge-amber { background: var(--amber) !important; }
.sb-user {
  margin-top: auto; padding: 14px 18px;
  border-top: 1px solid var(--border-dk);
  display: flex; align-items: center; gap: 10px;
}
.sb-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--teal-mid));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: white; flex-shrink: 0;
}
.sb-user-name { font-size: 11.5px; font-weight: 600; color: #8AA5BE; }
.sb-user-role { font-size: 9.5px; color: #3D5166; }
.sb-logout { margin-left: auto; color: #3D5166; font-size: 16px; cursor: pointer; }
.sb-logout:hover { color: var(--red); }

/* ── MAIN CONTENT ── */
.main-content { display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }
.topbar {
  background: white; border-bottom: 1px solid var(--border);
  padding: 0 24px; height: 56px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
}
.topbar-left h2 { font-size: 15px; font-weight: 600; }
.topbar-left p  { font-size: 11px; color: var(--muted); margin-top: 1px; }
.topbar-right   { display: flex; align-items: center; gap: 10px; }
.notif-btn {
  position: relative; cursor: pointer; font-size: 18px;
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; transition: background .15s;
}
.notif-btn:hover { background: var(--bg); }
.notif-count {
  position: absolute; top: 2px; right: 2px;
  background: var(--red); color: white;
  font-size: 9px; font-weight: 700; padding: 0 4px; border-radius: 6px; min-width: 14px; text-align: center;
}
.content-area { flex: 1; overflow-y: auto; padding: 24px; }

/* ── FORMS ── */
.form-group  { margin-bottom: 16px; }
.form-label  { display: block; font-size: 11px; font-weight: 600; color: #4A6580; margin-bottom: 6px; }
.form-input, .form-select {
  width: 100%; padding: 10px 14px; border-radius: 8px;
  border: 1px solid var(--border); font-size: 13px; outline: none;
  transition: border-color .15s; background: white;
}
.form-input:focus, .form-select:focus { border-color: var(--teal); }
.form-input.dark {
  background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.1);
  color: white;
}
.form-input.dark::placeholder { color: #2D4055; }
.form-select-sm {
  padding: 5px 10px; border-radius: 6px; border: 1px solid var(--border);
  font-size: 12px; background: white; outline: none;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
textarea.form-input { resize: vertical; min-height: 80px; }

/* ── BUTTONS ── */
.btn {
  padding: 8px 18px; border-radius: 8px; font-size: 12px;
  font-weight: 600; border: none; cursor: pointer; transition: all .15s;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-teal   { background: var(--teal); color: white; }
.btn-teal:hover { background: #0d5e49; }
.btn-red    { background: var(--red-lt); color: var(--red); border: 1px solid #FECACA; }
.btn-outline { background: white; color: #374151; border: 1px solid var(--border); }
.btn-outline:hover { background: var(--bg); }
.btn-green  { background: var(--green-lt); color: var(--green); border: 1px solid #BBF7D0; }
.btn-amber  { background: var(--amber-lt); color: var(--amber); border: 1px solid #FDE68A; }
.btn-full   { width: 100%; justify-content: center; padding: 12px; font-size: 13px; }
.btn-sm     { padding: 5px 12px; font-size: 11px; }
.btn-icon   { padding: 6px 10px; }

/* ── CARDS ── */
.card {
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.card-hdr {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 13px; font-weight: 600; }
.card-body  { padding: 16px 18px; }
.card-count {
  font-size: 11px; color: var(--muted);
  background: var(--bg); padding: 2px 10px; border-radius: 10px;
}

/* ── STAT CARDS ── */
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: white; border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 16px;
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
}
.stat-teal::before   { background: var(--teal); }
.stat-amber::before  { background: var(--amber); }
.stat-green::before  { background: var(--green); }
.stat-blue::before   { background: var(--blue); }
.stat-red::before    { background: var(--red); }
.stat-lbl { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stat-val { font-size: 26px; font-weight: 700; margin: 5px 0 2px; letter-spacing: -1px; }
.stat-sub { font-size: 10.5px; color: var(--muted); }
.stat-icon { position: absolute; right: 14px; top: 14px; font-size: 22px; opacity: .1; }

/* ── TABLE ── */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  padding: 10px 16px; background: #FAFBFC; border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 11px 16px; font-size: 12px;
  border-bottom: 1px solid var(--border); vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr.hl td { background: #FFFBF0; }
tr.danger td { background: var(--red-lt); }
tbody tr:hover td { background: var(--teal-xlt); cursor: pointer; }
.mono { font-family: 'JetBrains Mono', monospace; font-size: 10.5px; color: var(--muted); }
.cell-name { font-weight: 600; font-size: 12px; }
.cell-sub  { font-size: 10.5px; color: var(--muted); margin-top: 1px; }

/* ── PILLS ── */
.pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 10px;
  font-size: 10px; font-weight: 600; white-space: nowrap;
}
.pill-pending   { background: var(--amber-lt); color: var(--amber); }
.pill-approved  { background: var(--green-lt); color: var(--green); }
.pill-quoted    { background: var(--blue-lt);  color: var(--blue); }
.pill-confirmed { background: #E0F2FE; color: #0369A1; }
.pill-delivered { background: var(--teal-lt);  color: var(--teal); }
.pill-returned  { background: #F1F5F9; color: #475569; }
.pill-rejected  { background: var(--red-lt);   color: var(--red); }
.pill-flagged   { background: var(--red-lt);   color: var(--red); }
.pill-member    { background: var(--purple-lt); color: var(--purple); }
.pill-free      { background: var(--green-lt); color: var(--green); }
.pill-active    { background: var(--green-lt); color: var(--green); }
.pill-used      { background: #F1F5F9; color: #475569; }
.pill-paid      { background: var(--green-lt); color: var(--green); }
.pill-unpaid    { background: var(--red-lt);   color: var(--red); }

/* ── ALERTS ── */
.alert {
  padding: 10px 14px; border-radius: 8px;
  font-size: 12px; margin-bottom: 14px;
}
.alert-error { background: var(--red-lt); color: var(--red); border: 1px solid #FECACA; }
.alert-success { background: var(--green-lt); color: var(--green); border: 1px solid #BBF7D0; }
.alert-warn { background: var(--amber-lt); color: var(--amber); border: 1px solid #FDE68A; }
.alert-info { background: var(--blue-lt); color: var(--blue); border: 1px solid #BFDBFE; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.modal {
  background: white; border-radius: var(--radius-lg);
  width: 560px; max-width: 95vw; max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 60px rgba(0,0,0,.2);
}
.modal-hdr {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
}
.modal-hdr h3 { font-size: 15px; font-weight: 600; }
.modal-close  { background: none; border: none; font-size: 18px; color: var(--muted); cursor: pointer; }
.modal-body   { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
.modal-lg     { width: 760px; }
.modal-xl     { width: 960px; }

/* ── TOAST ── */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--dark); color: white;
  padding: 12px 20px; border-radius: 10px;
  font-size: 13px; font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
  z-index: 2000; transition: opacity .3s;
}
.toast.success { background: var(--green); }
.toast.error   { background: var(--red); }
.toast.warn    { background: var(--amber); }

/* ── GRID LAYOUTS ── */
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.g3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.page-grid { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }

/* ── INV BARS ── */
.inv-bar-wrap { flex: 1; }
.inv-bar-lbl  { display: flex; justify-content: space-between; font-size: 10px; color: var(--muted); margin-bottom: 4px; }
.inv-bar      { height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.inv-bar-fill { height: 100%; border-radius: 3px; background: linear-gradient(90deg, var(--teal), var(--teal-mid)); }
.inv-bar-fill.warn { background: var(--amber); }
.inv-bar-fill.low  { background: var(--red); }

/* ── DETAIL ROWS ── */
.detail-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 12px;
}
.detail-row:last-child { border-bottom: none; }
.detail-key { color: var(--muted); font-size: 11px; }
.detail-val { font-weight: 500; }

/* ── SPECIAL BLOCKS ── */
.npp-block {
  background: var(--purple-lt); border-left: 3px solid var(--purple);
  border-radius: 8px; padding: 10px 13px; margin: 10px 0;
}
.npp-title { font-size: 10px; font-weight: 700; color: var(--purple); text-transform: uppercase; letter-spacing: .06em; }
.pricing-block { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin: 10px 0; }
.pricing-row {
  display: flex; justify-content: space-between;
  padding: 7px 12px; font-size: 11.5px; border-bottom: 1px solid var(--border);
}
.pricing-row:last-child { border-bottom: none; font-weight: 700; background: var(--teal-xlt); }
.strike { text-decoration: line-through; color: var(--muted); font-size: 11px; }

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center; padding: 60px 20px; color: var(--muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 12px; opacity: .5; }
.empty-state h3   { font-size: 15px; font-weight: 600; color: #374151; margin-bottom: 6px; }
.empty-state p    { font-size: 13px; }

/* ── LOADING ── */
.loading {
  display: flex; align-items: center; justify-content: center;
  padding: 48px; color: var(--muted); font-size: 13px; gap: 10px;
}
.spinner {
  width: 20px; height: 20px; border: 2px solid var(--border);
  border-top-color: var(--teal); border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── UNIT BADGE ── */
.unit-adabraka { background: #EEF2FF; color: #4338CA; border-radius: 6px; padding: 2px 8px; font-size: 10px; font-weight: 600; }
.unit-osu      { background: #FFF7ED; color: #C05621; border-radius: 6px; padding: 2px 8px; font-size: 10px; font-weight: 600; }

/* ── RESPONSIVE ── */
@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar   { display: none; }
  .stats-grid { grid-template-columns: repeat(2,1fr); }
  .page-grid  { grid-template-columns: 1fr; }
  .g2, .g3, .form-row, .form-row-3 { grid-template-columns: 1fr; }
}