/* V9 Demo — shared design system, matched to the V9 Admin Panel */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --bg: #F4F6F8;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --line: #E8ECF2;
  --line-strong: #D9E0E8;

  --text: #0F172A;
  --text-2: #475569;
  --text-3: #8A96A6;

  --brand: #2F5FF4;
  --brand-dark: #1E40E0;
  --brand-soft: #EEF3FF;
  --navy: #111827;

  --green: #15803D;  --green-bg: #DCFCE7;
  --amber: #B45309;  --amber-bg: #FEF3C7;
  --red: #B91C1C;    --red-bg: #FEE2E2;
  --blue: #1D4ED8;   --blue-bg: #DBEAFE;
  --gray-bg: #F1F5F9;

  --r-sm: 8px; --r: 12px; --r-lg: 16px;
  --shadow: 0 1px 2px rgba(16,24,40,.04), 0 1px 3px rgba(16,24,40,.06);
  --shadow-lg: 0 10px 30px rgba(16,24,40,.10);
  --sidebar-w: 256px;
  --topbar-h: 62px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); background: var(--bg); color: var(--text);
  font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { display: block; }

/* ---------------------------------------------------------------- layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w); background: var(--surface);
  border-right: 1px solid var(--line); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-logo {
  height: var(--topbar-h); display: flex; align-items: center; gap: 8px;
  padding: 0 20px; flex: 0 0 auto; border-bottom: 1px solid transparent;
}
.logo-mark { width: 27px; flex: 0 0 27px; display: grid; place-items: center; }
.logo-mark svg { width: 100%; height: auto; }
.logo-word { font-size: 23px; font-weight: 800; letter-spacing: -.02em; }
.logo-word .a { color: #3B9BFF; }
.logo-word .b { color: #A06BFF; }

.nav { flex: 1; overflow-y: auto; padding: 8px 14px 20px; }
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: #DDE3EA; border-radius: 3px; }
.nav-section { font-size: 10.5px; font-weight: 700; letter-spacing: .09em; color: var(--text-3);
  padding: 18px 10px 7px; text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 11px;
  color: #1E293B; cursor: pointer; font-size: 13.5px; font-weight: 500; user-select: none;
  margin-bottom: 2px; border: none; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: #F2F5F9; }
.nav-item .ico { color: #64748B; flex: 0 0 18px; }
.nav-item .lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item .chev { color: #94A3B8; transition: transform .16s; }
.nav-item.open { background: var(--navy); color: #fff; }
.nav-item.open .ico, .nav-item.open .chev { color: #fff; }
.nav-item.open .chev { transform: rotate(90deg); }
.nav-item.active { background: var(--brand); color: #fff; box-shadow: 0 2px 8px rgba(47,95,244,.28); }
.nav-item.active .ico { color: #fff; }
.nav-badge {
  background: #F5A524; color: #3B2600; font-size: 11px; font-weight: 700; border-radius: 999px;
  min-width: 21px; height: 21px; display: inline-flex; align-items: center;
  justify-content: center; padding: 0 6px;
}
.nav-item.active .nav-badge { background: #fff; color: var(--brand); }
.nav-sub { padding-left: 4px; margin-bottom: 4px; }
.nav-sub .nav-item { font-size: 13px; padding-left: 14px; }
.nav-sub .dot { width: 13px; height: 13px; border: 1.6px solid #CBD5E1; border-radius: 50%;
  flex: 0 0 13px; }
.nav-sub .nav-item.active .dot { border-color: #fff; background: rgba(255,255,255,.3); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); background: var(--surface); display: flex; align-items: center;
  gap: 16px; padding: 0 22px; position: sticky; top: 0; z-index: 30;
}
.crumb { font-size: 14.5px; font-weight: 600; color: #1E293B; white-space: nowrap; }
.topsearch { display: flex; align-items: center; gap: 9px; flex: 1; color: var(--text-3); }
.topsearch input { border: none; background: none; outline: none; font-size: 14px; width: 100%;
  max-width: 260px; }
.topsearch kbd {
  font: 600 11px var(--font); background: #F1F5F9; border: 1px solid var(--line);
  border-radius: 6px; padding: 2px 6px; color: #64748B;
}
.topicons { display: flex; align-items: center; gap: 6px; }
.iconbtn {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px;
  border: none; background: none; color: #475569; cursor: pointer; position: relative;
}
.iconbtn:hover { background: #F1F5F9; }
.bell-badge {
  position: absolute; top: 1px; right: 0px; background: #EF4444; color: #fff;
  font-size: 10px; font-weight: 700; border-radius: 999px; padding: 1px 5px; min-width: 18px;
  text-align: center; line-height: 1.4;
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: #DBE4F5; display: grid;
  place-items: center; color: #42506B; position: relative; cursor: pointer; font-weight: 700;
  font-size: 12.5px;
}
.avatar .online { position: absolute; right: -1px; bottom: -1px; width: 9px; height: 9px;
  background: #22C55E; border: 2px solid #fff; border-radius: 50%; }

.content { flex: 1; padding: 20px 22px 40px; }
.footer { color: var(--text-3); font-size: 12px; padding: 18px 22px 24px; border-top: 1px solid var(--line);
  margin: 24px 22px 0; }

/* ---------------------------------------------------------------- banner */
.demo-banner {
  background: #FDF4E7; border-radius: var(--r); padding: 13px 18px; margin-bottom: 18px;
  font-size: 13.5px; color: #7C4A0B; display: flex; gap: 10px; align-items: baseline;
}
.demo-banner b { color: #9A3412; font-weight: 700; }

/* ---------------------------------------------------------------- cards */
.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow);
  margin-bottom: 18px; overflow: hidden; }
.card-head { padding: 18px 22px; display: flex; align-items: flex-start; gap: 14px;
  justify-content: space-between; flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.01em; }
.card-head p { margin: 3px 0 0; color: var(--text-2); font-size: 13px; }
.card-head .spacer { flex: 1; }
.card-body { padding: 0 22px 20px; }
.card-sep { border-top: 1px solid var(--line); }
.section-title { padding: 15px 22px; font-size: 14px; font-weight: 600; letter-spacing: .01em;
  color: #334155; text-transform: uppercase; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px;
  margin-bottom: 18px; }
.kpi { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow);
  padding: 18px 20px; }
.kpi .top { display: flex; justify-content: space-between; align-items: flex-start; }
.kpi .label { font-size: 14.5px; font-weight: 600; color: #1E293B; }
.kpi .value { font-size: 25px; font-weight: 700; margin: 6px 0 2px; letter-spacing: -.02em; }
.kpi .value small { font-size: 14px; font-weight: 600; color: #16A34A; margin-left: 6px; }
.kpi .sub { font-size: 12.5px; color: var(--text-3); }
.kpi .ico-box { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; }

/* ---------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 4px; background: var(--surface); border-radius: var(--r-lg);
  padding: 9px; box-shadow: var(--shadow); margin-bottom: 18px; overflow-x: auto; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 9px 15px; border-radius: 10px;
  font-size: 13.5px; font-weight: 600; color: #475569; cursor: pointer; border: none;
  background: none; white-space: nowrap; }
.tab:hover { background: #F1F5F9; }
.tab.active { background: var(--navy); color: #fff; }
.tabs.pill .tab.active { background: #EEF2F7; color: #0F172A; }
.tab .cnt { font-size: 12px; font-weight: 700; color: #64748B; }
.tab.active .cnt { color: #CBD5E1; }

.subtabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); padding: 0 22px;
  overflow-x: auto; }
.subtab { padding: 13px 2px; font-size: 13.5px; font-weight: 600; color: #64748B; cursor: pointer;
  border: none; background: none; border-bottom: 2px solid transparent; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 8px; }
.subtab.active { color: var(--brand); border-bottom-color: var(--brand); }
.subtab .cnt { background: #F1F5F9; border-radius: 999px; padding: 1px 8px; font-size: 11.5px; }
.subtab.active .cnt { background: var(--brand-soft); color: var(--brand); }

/* ---------------------------------------------------------------- forms */
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 15px;
  padding: 18px 22px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 12.5px; color: #475569; font-weight: 500; }
.inp, .sel, textarea.inp {
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px; font-size: 13.5px;
  background: #fff; outline: none; width: 100%; min-width: 0;
}
.inp:focus, .sel:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(47,95,244,.1); }
.inp::placeholder { color: #A7B2C0; }
.sel { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }
textarea.inp { min-height: 90px; resize: vertical; }
.switch { position: relative; width: 40px; height: 22px; flex: 0 0 40px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #CBD5E1; border-radius: 999px;
  cursor: pointer; transition: .18s; }
.switch span::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px;
  top: 3px; background: #fff; border-radius: 50%; transition: .18s; }
.switch input:checked + span { background: var(--brand); }
.switch input:checked + span::before { transform: translateX(18px); }
.switch-row { display: flex; align-items: center; gap: 11px; font-size: 13.5px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 17px;
  border-radius: 10px; font-size: 13.5px; font-weight: 600; cursor: pointer; border: 1px solid transparent;
  background: #fff; color: #334155; white-space: nowrap;
}
.btn:hover { background: #F8FAFC; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.outline { border-color: var(--line-strong); }
.btn.ghost { background: none; color: var(--brand); }
.btn.ghost:hover { background: var(--brand-soft); }
.btn.danger { background: #FEF2F2; color: var(--red); border-color: #FECACA; }
.btn.danger:hover { background: #FEE2E2; }
.btn.success { background: #F0FDF4; color: var(--green); border-color: #BBF7D0; }
.btn.dark { background: var(--navy); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 7px 12px; font-size: 12.5px; border-radius: 9px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .055em; color: #64748B;
  text-transform: uppercase; padding: 13px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap; background: #fff; position: sticky; top: 0;
}
table.tbl td { padding: 13px 14px; border-bottom: 1px solid #F1F5F9; vertical-align: middle; }
table.tbl tbody tr:hover { background: #FAFBFD; }
table.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 38px; text-align: center; color: var(--text-3); font-size: 13.5px; }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; letter-spacing: .01em; }
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.amber { background: var(--amber-bg); color: var(--amber); }
.pill.red   { background: var(--red-bg);   color: var(--red); }
.pill.blue  { background: var(--blue-bg);  color: var(--blue); }
.pill.gray  { background: var(--gray-bg);  color: #64748B; }
.pill.outline { background: #fff; border: 1px solid var(--line-strong); color: #64748B;
  font-weight: 600; }

.idchip { background: #F1F5F9; border-radius: 7px; padding: 3px 9px; font-size: 12.5px;
  font-weight: 700; color: #334155; display: inline-block; }
.subtle { color: var(--text-3); font-size: 12px; }
.mono { font-family: var(--mono); font-size: 12px; }
.ava-sm { width: 30px; height: 30px; border-radius: 50%; background: #E2E8F0; display: grid;
  place-items: center; font-size: 11px; font-weight: 700; color: #64748B; flex: 0 0 30px; }
.cell-user { display: flex; align-items: center; gap: 10px; }
.cell-user .nm { font-weight: 600; font-size: 13px; }
.cell-user .em { font-size: 11.5px; color: var(--text-3); max-width: 190px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 22px; flex-wrap: wrap; }
.pager .btns { display: flex; gap: 5px; }
.pgbtn { width: 33px; height: 33px; border-radius: 9px; border: 1px solid var(--line);
  background: #fff; display: grid; place-items: center; cursor: pointer; color: #475569;
  font-size: 13px; }
.pgbtn:hover:not(:disabled) { background: #F1F5F9; }
.pgbtn.on { background: var(--brand-soft); border-color: #C7D7FB; color: var(--brand);
  font-weight: 700; }
.pgbtn:disabled { opacity: .4; cursor: not-allowed; }

/* ---------------------------------------------------------------- modal / toast */
.modal-bg { position: fixed; inset: 0; background: rgba(15,23,42,.42); z-index: 200;
  display: grid; place-items: center; padding: 22px; }
.modal { background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  width: min(620px, 100%); max-height: 88vh; display: flex; flex-direction: column; }
.modal.wide { width: min(940px, 100%); }
.modal-head { padding: 19px 22px; border-bottom: 1px solid var(--line); display: flex;
  align-items: center; justify-content: space-between; }
.modal-head h3 { margin: 0; font-size: 17px; font-weight: 700; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { padding: 15px 22px; border-top: 1px solid var(--line); display: flex;
  justify-content: flex-end; gap: 10px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px,1fr)); gap: 15px; }
.form-grid .full { grid-column: 1 / -1; }

#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 300; display: flex;
  flex-direction: column; gap: 10px; }
.toast { background: #fff; border-radius: 12px; box-shadow: var(--shadow-lg); padding: 13px 17px;
  font-size: 13.5px; min-width: 260px; max-width: 420px; border-left: 4px solid var(--brand);
  animation: slidein .18s ease; }
.toast.ok { border-left-color: #16A34A; }
.toast.err { border-left-color: #DC2626; }
@keyframes slidein { from { opacity: 0; transform: translateY(8px); } }

.loading { padding: 40px; text-align: center; color: var(--text-3); }
.skel { height: 14px; background: linear-gradient(90deg,#EEF1F5,#F7F9FB,#EEF1F5);
  background-size: 200% 100%; animation: sh 1.2s infinite; border-radius: 6px; }
@keyframes sh { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ---------------------------------------------------------------- misc */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 1100px) { .grid2, .grid3 { grid-template-columns: 1fr; } }
.chart { width: 100%; }
.bar-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; font-size: 13px; }
.bar-track { flex: 1; height: 9px; background: #EEF2F7; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--brand); border-radius: 999px; }
.info-note { background: #EFF6FF; border-radius: var(--r); padding: 13px 16px; font-size: 13px;
  color: #1E40AF; display: flex; gap: 10px; margin: 0 22px 16px; }
.warn-note { background: #FFFBEB; border-radius: var(--r); padding: 13px 16px; font-size: 13px;
  color: #92400E; display: flex; gap: 10px; margin: 0 22px 16px; }
.err-note { background: #FEF2F2; border-radius: var(--r); padding: 13px 16px; font-size: 13px;
  color: #991B1B; display: flex; gap: 10px; margin: 0 22px 16px; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: 9px 18px; font-size: 13.5px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; font-weight: 500; }
.stat-row { display: flex; gap: 30px; padding: 16px 22px; flex-wrap: wrap; }
.stat-row .s .l { font-size: 12.5px; color: var(--text-3); }
.stat-row .s .v { font-size: 17px; font-weight: 700; margin-top: 2px; }
.list-pick { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.list-pick .it { padding: 12px 15px; cursor: pointer; border-bottom: 1px solid #F1F5F9; }
.list-pick .it:last-child { border-bottom: none; }
.list-pick .it:hover { background: #F8FAFC; }
.list-pick .it.on { background: var(--brand-soft); }
.list-pick .it .t { font-weight: 600; font-size: 13.5px; }
.list-pick .it .s { font-size: 12px; color: var(--text-3); }
.checkbox { width: 17px; height: 17px; accent-color: var(--brand); cursor: pointer; }
.floating-phone { position: fixed; right: 22px; bottom: 22px; width: 46px; height: 46px;
  border-radius: 13px; background: var(--brand); color: #fff; display: grid; place-items: center;
  box-shadow: 0 6px 18px rgba(47,95,244,.35); cursor: pointer; border: none; z-index: 50; }
.guide-dock { position: fixed; left: 14px; bottom: 14px; background: #fff; border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 11px 16px 11px 12px; display: flex; align-items: center;
  gap: 10px; font-size: 13.5px; font-weight: 600; z-index: 40; cursor: pointer; }
.guide-dock .bot { width: 30px; height: 30px; border-radius: 9px; background: #EEF3FF;
  display: grid; place-items: center; }
