/* DistriSys SaaS — dark glass */
:root {
  --bg: #0b1020;
  --bg2: #0e1530;
  --panel: rgba(255,255,255,.045);
  --panel2: rgba(255,255,255,.07);
  --border: rgba(255,255,255,.10);
  --text: #e8ecf8;
  --muted: #9aa5c3;
  --primary: #6366f1;
  --primary2: #8b5cf6;
  --green: #22c55e;
  --red: #ef4444;
  --yellow: #f59e0b;
  --blue: #3b82f6;
  --radius: 14px;
  --sidebar-w: 232px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: radial-gradient(1200px 700px at 80% -10%, rgba(99,102,241,.18), transparent 60%),
              radial-gradient(900px 600px at -10% 110%, rgba(139,92,246,.14), transparent 55%),
              var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h2, h3 { margin: 0 0 8px; font-weight: 700; }
.muted { color: var(--muted); }
.sm { font-size: 12px; }
.mono { font-family: 'JetBrains Mono', 'Fira Code', monospace; }
.r { text-align: right; }
.bad { color: var(--red); }
.good { color: var(--green); }
.link { font-size: 12px; color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 22px !important; }
.glass {
  background: linear-gradient(160deg, rgba(255,255,255,.07), rgba(255,255,255,.03));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* ---------- layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  padding: 18px 14px;
  position: fixed; top: 0; bottom: 0; left: 0;
  background: rgba(10,14,30,.72);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(16px);
  display: flex; flex-direction: column;
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 17px; color: #fff;
  box-shadow: 0 4px 18px rgba(99,102,241,.45);
}
.brand-logo.big { width: 46px; height: 46px; font-size: 22px; border-radius: 13px; }
.brand-name { font-weight: 800; font-size: 16px; letter-spacing: .3px; }
.brand-sub { font-size: 11px; color: var(--muted); }
.nav { flex: 1; overflow-y: auto; margin-top: 6px; }
.nav-section { font-size: 10px; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); padding: 14px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; margin: 2px 0;
  border-radius: 10px;
  color: var(--muted); font-weight: 500; font-size: 13.5px;
  transition: all .15s;
}
.nav a:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.nav a.active { background: linear-gradient(90deg, rgba(99,102,241,.28), rgba(139,92,246,.14)); color: #fff; border: 1px solid rgba(99,102,241,.35); }
.nav .ico { width: 20px; text-align: center; }
.sidebar-foot { padding-top: 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.sidebar-foot .who { color: var(--text); font-weight: 600; }
.main { flex: 1; margin-left: var(--sidebar-w); padding: 22px 26px 60px; max-width: 1400px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.topbar h1 { font-size: 21px; margin: 0; }
.topbar .tenant-chip {
  font-size: 12px; color: var(--muted);
  background: var(--panel); border: 1px solid var(--border);
  padding: 6px 12px; border-radius: 999px;
}

/* ---------- cards / stats ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; backdrop-filter: blur(10px); margin-bottom: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 10px; }
.card-head h3 { margin: 0; font-size: 15px; }
.stat { position: relative; overflow: hidden; }
.stat::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--primary), var(--primary2)); opacity: .8; }
.stat-num { font-size: 22px; font-weight: 800; letter-spacing: .2px; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 4px; }
.accent-1::before { background: linear-gradient(90deg, #22c55e, #16a34a); }
.accent-2::before { background: linear-gradient(90deg, #3b82f6, #6366f1); }
.accent-3::before { background: linear-gradient(90deg, #f59e0b, #f97316); }
.accent-4::before { background: linear-gradient(90deg, #8b5cf6, #d946ef); }
.accent-red::before { background: linear-gradient(90deg, #ef4444, #f97316); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 1000px) { .row2 { grid-template-columns: 1fr; } }

/* ---------- chart ---------- */
.chart { display: flex; align-items: flex-end; gap: 10px; height: 170px; padding-top: 8px; }
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.chart-bar {
  width: 100%; max-width: 44px; border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, var(--primary), rgba(99,102,241,.25));
  box-shadow: 0 0 14px rgba(99,102,241,.35);
  min-height: 4px;
}
.chart-lbl { font-size: 11px; color: var(--muted); }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; }
.card table { margin: 0 -4px; width: calc(100% + 8px); }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid rgba(255,255,255,.06); vertical-align: middle; }
thead th { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--border); }
tbody tr:hover { background: rgba(255,255,255,.025); }
tbody tr:last-child td { border-bottom: none; }
.badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: .3px;
  border: 1px solid transparent;
}
.badge-green { background: rgba(34,197,94,.14); color: #4ade80; border-color: rgba(34,197,94,.35); }
.badge-red { background: rgba(239,68,68,.14); color: #f87171; border-color: rgba(239,68,68,.35); }
.badge-yellow { background: rgba(245,158,11,.14); color: #fbbf24; border-color: rgba(245,158,11,.35); }
.badge-blue { background: rgba(59,130,246,.14); color: #60a5fa; border-color: rgba(59,130,246,.35); }
.badge-gray { background: rgba(148,163,184,.12); color: #94a3b8; border-color: rgba(148,163,184,.3); }
.pager { display: flex; gap: 6px; justify-content: center; padding-top: 14px; }
.page-link {
  padding: 5px 11px; border-radius: 8px; font-size: 12.5px;
  background: var(--panel); border: 1px solid var(--border); color: var(--muted);
}
.page-link.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- toolbar / tabs ---------- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar-actions { display: flex; gap: 8px; align-items: center; }
.search-form { display: flex; gap: 8px; align-items: center; }
.search-form input[type=search], .search-form select { min-width: 220px; }
.tabs { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--border); padding: 4px; border-radius: 11px; }
.tab { padding: 7px 14px; border-radius: 8px; color: var(--muted); font-size: 13px; font-weight: 600; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { background: var(--primary); color: #fff; }

/* ---------- forms ---------- */
label { display: block; margin-bottom: 12px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
input, select, textarea {
  width: 100%; margin-top: 5px;
  background: rgba(10,14,30,.55);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.18); }
select option { background: #121735; }
.toolbar input, .toolbar select { margin-top: 0; width: auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.span2 { grid-column: span 2; }
.inline { display: inline; }
form.inline { display: inline-flex; gap: 4px; align-items: center; margin-left: 4px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel2); color: var(--text);
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: all .15s; font-family: inherit;
}
.btn:hover { filter: brightness(1.15); text-decoration: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  border: none; color: #fff;
  box-shadow: 0 4px 16px rgba(99,102,241,.35);
}
.btn-success { background: rgba(34,197,94,.2); border-color: rgba(34,197,94,.4); color: #4ade80; }
.btn-danger { background: rgba(239,68,68,.16); border-color: rgba(239,68,68,.4); color: #f87171; }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; justify-content: center; padding: 11px; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }

/* ---------- kv ---------- */
.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin-bottom: 14px; }
.kv > div { display: flex; flex-direction: column; gap: 2px; background: rgba(255,255,255,.03); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; }
.kv span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }

/* ---------- PDV ---------- */
.pdv-wrap { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 1100px) { .pdv-wrap { grid-template-columns: 1fr; } }
.pdv-cart { min-height: 300px; }
.pdv-totals { border-top: 1px solid var(--border); margin-top: 12px; padding-top: 12px; }
.pdv-row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 14px; color: var(--muted); }
.pdv-row.total { font-size: 20px; font-weight: 800; color: var(--text); padding-top: 8px; }
.pdv-item-remove { background: none; border: none; color: var(--red); cursor: pointer; font-size: 15px; padding: 2px 6px; }
.pdv-pay-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.pdv-pay-grid .pay-opt {
  padding: 10px 6px; border-radius: 10px; text-align: center;
  background: var(--panel); border: 1px solid var(--border);
  cursor: pointer; font-size: 12px; font-weight: 600; color: var(--muted);
  transition: all .12s;
}
.pdv-pay-grid .pay-opt:hover { color: var(--text); }
.pdv-pay-grid .pay-opt.selected { background: rgba(99,102,241,.22); border-color: var(--primary); color: #fff; }

/* ---------- modal ---------- */
.modal {
  position: fixed; inset: 0; z-index: 90;
  display: none; align-items: flex-start; justify-content: center;
  background: rgba(5,8,20,.72);
  backdrop-filter: blur(4px);
  padding: 6vh 16px;
  overflow-y: auto;
}
.modal.open { display: flex; animation: fadeIn .15s ease; }
.modal-box {
  width: 100%; max-width: 640px;
  background: linear-gradient(165deg, #161c3a, #101430);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 22px;
  box-shadow: 0 24px 70px rgba(0,0,0,.55);
  animation: popIn .18s ease;
}
.modal-box.sm { max-width: 460px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-x { background: none; border: none; color: var(--muted); font-size: 22px; cursor: pointer; line-height: 1; }
.modal-x:hover { color: var(--text); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- toast ---------- */
.toast {
  padding: 11px 15px; border-radius: 10px; margin-bottom: 14px;
  font-size: 13.5px; font-weight: 500;
  border: 1px solid;
  animation: fadeIn .2s ease;
}
.toast-success { background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.4); color: #4ade80; }
.toast-error { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.4); color: #f87171; }
.toast-fixed { position: fixed; top: 18px; right: 18px; z-index: 120; min-width: 260px; box-shadow: 0 10px 40px rgba(0,0,0,.4); }

/* ---------- auth ---------- */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.auth-wrap { width: 100%; max-width: 430px; }
.auth-card { padding: 30px 30px 26px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-title { font-size: 19px; margin: 0 0 16px; }
.auth-alt { margin-top: 18px; text-align: center; font-size: 13px; color: var(--muted); }
.auth-alt a { display: block; margin-top: 5px; font-weight: 600; }

/* ---------- misc ---------- */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }
@media (max-width: 860px) {
  .sidebar { position: static; width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .layout { flex-direction: column; }
  .main { margin-left: 0; }
  .nav { display: flex; flex-wrap: wrap; }
  .nav-section { display: none; }
}
