* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:           #111827;
  --bg-deep:      #0b1120;
  --sidebar-bg:   #0f172a;
  --sidebar-hover:#1a253a;
  --sidebar-act:  #1e3a8a;
  --sidebar-bdr:  rgba(148,163,184,.08);
  --card:         #1e2535;
  --card-hi:      #252e42;
  --border:       #2d3a50;
  --border-light: #222d40;
  --primary:      #3b82f6;
  --primary-h:    #2563eb;
  --primary-glow: rgba(59,130,246,.2);
  --accent:       #93c5fd;
  --success:      #22c55e;
  --warning:      #f59e0b;
  --danger:       #ef4444;
  --danger-h:     #dc2626;
  --text:         #f1f5f9;
  --text-2:       #cbd5e1;
  --text-muted:   #64748b;
  --sidebar-text: #475569;
  --sidebar-w:    248px;
  --sidebar-collapsed-w: 64px;
  --header-h:     60px;
  --row-hover:    #252e42;
}

body { font-family: 'Sarabun', sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }
.hidden { display: none !important; }
a { text-decoration: none; }
::selection { background: var(--primary); color: white; }

/* ── SCROLLBAR ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* ── LOGIN ─────────────────────────────────────────────── */
#login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 30% 40%, #1a2540 0%, #0b1120 60%);
  position: relative; overflow: hidden; padding: 16px;
}
#login-screen::before {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, transparent, transparent 40px, rgba(99,130,200,.03) 40px, rgba(99,130,200,.03) 41px),
              repeating-linear-gradient(90deg, transparent, transparent 40px, rgba(99,130,200,.03) 40px, rgba(99,130,200,.03) 41px);
  pointer-events: none;
}
.login-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 40px; width: 100%; max-width: 400px;
  box-shadow: 0 24px 80px rgba(0,0,0,.5), 0 0 40px rgba(59,130,246,.08);
  position: relative; z-index: 1;
}
.login-logo {
  width: 72px; height: 72px; border-radius: 18px;
  background: linear-gradient(145deg, #2563eb 0%, #1e3a8a 55%, #0f172a 100%);
  border: 1px solid rgba(59,130,246,.25);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 20px; color: white;
  box-shadow: 0 8px 32px rgba(37,99,235,.35), inset 0 1px 0 rgba(255,255,255,.12);
}
.login-card h1 { text-align: center; font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.login-sub { text-align: center; color: var(--text-muted); margin-bottom: 28px; font-size: 14px; }

/* ── FORM ──────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; color: var(--text-2); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: 15px; color: var(--text);
  background: var(--bg-deep); transition: border-color .15s, box-shadow .15s; outline: none;
}
.form-group input::placeholder { color: var(--text-muted); }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-group select option { background: #1e2535; }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group .hint { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── BUTTONS ───────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 9px 18px;
  border-radius: 8px; border: none; font-family: inherit; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .15s; text-decoration: none; white-space: nowrap;
}
.btn-primary { background: linear-gradient(135deg, #3b82f6, #2563eb); color: white; box-shadow: 0 4px 14px var(--primary-glow); }
.btn-primary:hover { filter: brightness(1.15); transform: translateY(-1px); box-shadow: 0 6px 20px var(--primary-glow); }
.btn-success { background: linear-gradient(135deg, #22c55e, #15803d); color: white; }
.btn-success:hover { filter: brightness(1.15); }
.btn-danger  { background: var(--danger); color: white; }
.btn-danger:hover  { background: var(--danger-h); }
.btn-outline { background: transparent; color: var(--text-2); border: 1.5px solid var(--border); }
.btn-outline:hover { background: var(--card-hi); border-color: var(--primary); color: var(--accent); }
.btn-ghost  { background: transparent; color: var(--text-muted); border: none; }
.btn-ghost:hover { color: var(--text); background: var(--card-hi); }
.btn-full { width: 100%; justify-content: center; padding: 12px; font-size: 16px; }
.btn svg  { width: 15px; height: 15px; flex-shrink: 0; }
.btn-sm   { padding: 5px 12px; font-size: 13px; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-icon {
  background: none; border: none; cursor: pointer; padding: 7px; border-radius: 7px;
  color: var(--text-muted); display: flex; align-items: center; transition: all .15s;
}
.btn-icon:hover { background: var(--card-hi); color: var(--accent); }
.btn-icon svg { width: 18px; height: 18px; }

/* ── MESSAGES ──────────────────────────────────────────── */
.error-msg   { background: rgba(220,38,38,.15); color: #fca5a5; border: 1px solid rgba(220,38,38,.3); border-radius: 8px; padding: 10px 14px; font-size: 14px; margin-bottom: 12px; }
.success-msg { background: rgba(59,130,246,.12); color: var(--accent); border: 1px solid rgba(59,130,246,.25); border-radius: 8px; padding: 10px 14px; font-size: 14px; margin-bottom: 12px; }

/* ── LAYOUT ────────────────────────────────────────────── */
#app { display: flex; height: 100vh; overflow: hidden; }

/* ── SIDEBAR BACKDROP ──────────────────────────────────── */
#sidebar-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.55); z-index: 499; backdrop-filter: blur(2px);
  transition: opacity .25s;
}
#sidebar-backdrop.visible { display: block; }

/* ── SIDEBAR ───────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w); background: var(--sidebar-bg);
  display: flex; flex-direction: column; flex-shrink: 0;
  border-right: 1px solid var(--sidebar-bdr); overflow-y: auto; overflow-x: hidden;
  transition: width .25s ease, transform .25s ease;
}
.sidebar-header {
  display: flex; align-items: center; gap: 10px; padding: 16px;
  border-bottom: 1px solid var(--sidebar-bdr); min-height: 64px;
}
.sidebar-logo {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(145deg, #2563eb 0%, #1e3a8a 55%, #0f172a 100%);
  display: flex; align-items: center; justify-content: center; color: white;
  box-shadow: 0 4px 14px rgba(37,99,235,.4), inset 0 1px 0 rgba(255,255,255,.14);
  border: 1px solid rgba(59,130,246,.2);
}
.sidebar-logo svg { width: 18px; height: 18px; }
.sidebar-brand { flex: 1; min-width: 0; overflow: hidden; }
.sidebar-title { color: var(--sidebar-title-color, var(--text)); font-size: 14px; font-weight: 700; white-space: nowrap; }
.sidebar-sub { color: var(--sidebar-sub-color, var(--text-muted)); font-size: 11px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-collapse-btn { flex-shrink: 0; transition: transform .25s; }

#nav-menu { flex: 1; padding: 10px 8px; overflow-y: auto; }
#sidebar-version {
  padding: 8px 16px 12px; text-align: center;
  font-size: 11px; letter-spacing: .06em; font-weight: 600;
  color: var(--text-muted); opacity: .5; user-select: none;
  border-top: 1px solid var(--sidebar-bdr); flex-shrink: 0;
  transition: opacity .2s;
}
#sidebar-version:hover { opacity: .85; }
#sidebar.collapsed #sidebar-version { display: none; }
.nav-section { font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--nav-section-color, #334155); padding: 14px 10px 5px; overflow: hidden; white-space: nowrap; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: 8px; color: var(--sidebar-text); font-size: 14px; font-weight: 500;
  transition: all .15s; margin-bottom: 2px; cursor: pointer; white-space: nowrap;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; }
.nav-item span { overflow: hidden; transition: opacity .2s; }
.nav-item:hover { background: var(--sidebar-hover); color: var(--text-2); }
.nav-item.active { background: var(--sidebar-act); color: var(--accent); box-shadow: inset 3px 0 0 #3b82f6; }

.sidebar-footer { display: none; }
.user-info { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; overflow: hidden; }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), #1e3a8a);
  border: 2px solid rgba(59,130,246,.3);
  color: white; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
}
.user-text { min-width: 0; overflow: hidden; }
.user-name  { color: var(--text); font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role  { color: var(--text-muted); font-size: 11px; }

/* ── SIDEBAR COLLAPSED (desktop) ───────────────────────── */
#sidebar.collapsed {
  width: var(--sidebar-collapsed-w);
}
/* Hide text elements — use display:none to avoid gap/flex issues */
#sidebar.collapsed .sidebar-brand  { display: none; }
#sidebar.collapsed .nav-section    { display: none; }
#sidebar.collapsed .nav-item span  { display: none; }
#sidebar.collapsed .user-text      { display: none; }
/* Header: stack logo + collapse-btn vertically, centered */
#sidebar.collapsed .sidebar-header {
  flex-direction: column; justify-content: center; align-items: center;
  padding: 12px 8px; gap: 6px;
}
/* Lock logo dimensions — never distort */
#sidebar.collapsed .sidebar-logo {
  width: 36px; height: 36px; flex-shrink: 0; margin: 0;
}
#sidebar.collapsed .sidebar-collapse-btn { transform: rotate(180deg); }
#sidebar.collapsed .nav-item { justify-content: center; padding: 10px 8px; gap: 0; }

/* ── MAIN ──────────────────────────────────────────────── */
#main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; position: relative; }

#top-bar {
  height: var(--header-h); background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 0 20px; flex-shrink: 0;
}
#top-bar h2 { font-size: 17px; font-weight: 700; flex: 1; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#menu-toggle { display: none; }
#header-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; flex-wrap: wrap; }

/* ── TOPBAR PROFILE (top-right) ────────────────────────── */
#topbar-profile {
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
  padding-left: 12px; border-left: 1px solid var(--border);
}
.tb-logout {
  margin-left: 4px; color: var(--text-muted); opacity: .7;
  transition: color .2s, opacity .2s;
}
.tb-logout:hover { color: #f87171; opacity: 1; }
.tb-avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), #1e3a8a);
  color: white; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.tb-info { line-height: 1.3; }
.tb-name { font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; }
.tb-role { font-size: 11px; color: var(--text-muted); }

#page-content { flex: 1; overflow-y: auto; padding: 24px; }

/* ── STATS GRID ────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px,1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px; display: flex; align-items: center; gap: 14px;
  transition: border-color .2s, box-shadow .2s;
}
.stat-card:hover { border-color: var(--primary); box-shadow: 0 0 20px var(--primary-glow); }
.stat-icon {
  width: 46px; height: 46px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.green  { background: rgba(22,163,74,.15);  color: #4ade80; }
.stat-icon.blue   { background: rgba(59,130,246,.15); color: #93c5fd; }
.stat-icon.teal   { background: rgba(20,184,166,.15); color: #2dd4bf; }
.stat-icon.emerald{ background: rgba(52,211,153,.15); color: #34d399; }
.stat-icon.lime   { background: rgba(101,163,13,.15); color: #a3e635; }
.stat-icon.red    { background: rgba(220,38,38,.15);  color: #f87171; }
.stat-value { font-size: 28px; font-weight: 800; line-height: 1; color: var(--text); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.stat-clickable { cursor: pointer; }
.stat-clickable:hover { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(59,130,246,.15); transform: translateY(-1px); }
.stat-warn  { border-color: rgba(245,158,11,.4)  !important; }
.stat-risk  { border-color: rgba(239,68,68,.4)   !important; }
.stat-warn:hover { border-color: #f59e0b !important; }
.stat-risk:hover { border-color: #ef4444 !important; }

/* KPI status chip */
.kpi-status { display:inline-block; font-size:10px; font-weight:700; padding:1px 6px; border-radius:99px; }
.kpi-status.ok   { background:rgba(52,211,153,.15); color:#34d399; }
.kpi-status.warn { background:rgba(245,158,11,.15); color:#fbbf24; }
.kpi-status.risk { background:rgba(239,68,68,.15);  color:#f87171; }

/* Trend badges */
.trend-up   { font-size:11px; font-weight:600; color:#f87171; }
.trend-down { font-size:11px; font-weight:600; color:#4ade80; }
.trend-flat { font-size:11px; color:var(--text-muted); }

/* ── SEARCHABLE SELECT ──────────────────────────────────── */
.ss-wrap  { position:relative; }
.ss-input { width:100%; }
.ss-list  {
  position:absolute; top:calc(100% + 4px); left:0; right:0; z-index:200;
  background:var(--card); border:1px solid var(--border); border-radius:10px;
  max-height:220px; overflow-y:auto; box-shadow:0 8px 24px rgba(0,0,0,.4);
}
.ss-opt  {
  padding:10px 14px; cursor:pointer; font-size:13px; color:var(--text);
  border-bottom:1px solid var(--border-light); transition:background .1s;
}
.ss-opt:last-child { border-bottom:none; }
.ss-opt:hover      { background:var(--sidebar-hover); }
.ss-opt[hidden]    { display:none; }
.ss-opt[data-disabled="1"] { color:var(--text-muted); opacity:.5; cursor:not-allowed; pointer-events:none; }

/* Alert panel */
.alert-total-badge {
  background:#ef4444; color:white; font-size:11px; font-weight:800;
  min-width:20px; height:20px; border-radius:99px;
  display:inline-flex; align-items:center; justify-content:center; padding:0 5px;
}
.alert-items  { display:flex; flex-direction:column; gap:4px; }
.alert-row    {
  display:flex; align-items:center; gap:10px; padding:8px 10px; border-radius:8px;
  cursor:pointer; font-size:13px; position:relative; overflow:hidden;
  transition: background .18s, box-shadow .18s, transform .15s;
}
.alert-row:hover {
  background: var(--card-hi);
  box-shadow: inset 3px 0 0 var(--primary);
  transform: translateX(3px);
}
.alert-row::after {
  content:''; position:absolute; inset:0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.12) 50%, transparent 100%);
  transform: translateX(-100%); pointer-events:none;
}
.alert-row:hover::after { animation: row-shimmer .45s ease forwards; }
.alert-dot    { width:8px; height:8px; border-radius:50%; flex-shrink:0; }
.alert-dot.red   { background:#ef4444; }
.alert-dot.amber { background:#f59e0b; }
.alert-arrow  { margin-left:auto; color:var(--text-muted); font-size:12px; }

/* ── CARD ──────────────────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 20px; margin-bottom: 16px; }
.card:last-child { margin-bottom: 0; }
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 16px; color: var(--text); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }

/* ── DASH LIST ITEM ────────────────────────────────────── */
.dash-list-item { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-bottom: 1px solid var(--border-light); border-radius: 6px; transition: background .15s; }
.dash-list-item:last-child { border-bottom: none; }
.dash-list-item:hover { background: var(--sidebar-hover); }

/* ── TABLE ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 480px; }
thead th {
  background: rgba(0,0,0,.3); padding: 10px 14px; text-align: left;
  font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap;
}
thead th[data-col]:hover { color: var(--text); background: rgba(59,130,246,.08); }
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border-light); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { position: relative; transition: background .18s, box-shadow .18s, transform .15s; }
tbody tr:hover {
  background: var(--card-hi);
  box-shadow: inset 3px 0 0 var(--primary), 0 2px 10px rgba(0,0,0,.12);
  transform: translateX(3px);
}
tbody tr:hover td:first-child { color: var(--accent); }

/* ── BADGES ────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600;
}
.badge-withdraw { background: rgba(220,38,38,.15);  color: #f87171; }
.badge-transfer { background: rgba(59,130,246,.12); color: var(--accent); }
.badge-receive  { background: rgba(52,211,153,.15); color: #34d399; }
.badge-admin    { background: rgba(99,102,241,.15); color: #a5b4fc; }
.badge-employee { background: rgba(59,130,246,.12); color: var(--accent); }
.badge-owner    { background: rgba(234,179,8,.15);  color: #fde047; }
.badge-ok       { background: rgba(59,130,246,.12); color: var(--accent); }
.badge-low      { background: rgba(202,138,4,.15);  color: #fde047; }
.badge-empty    { background: rgba(220,38,38,.15);  color: #f87171; }
.badge-adjust   { background: rgba(139,92,246,.15); color: #c4b5fd; }
.badge-reversal { background: rgba(107,114,128,.15);color: #9ca3af; }
.badge-truck    { background: rgba(251,146,60,.15); color: #fb923c; }

/* warehouse chip on product row */
.wh-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 6px; font-size: 12px; font-weight: 600;
  background: rgba(59,130,246,.1); border: 1px solid rgba(59,130,246,.2); color: #93c5fd;
  margin: 2px;
}
.wh-chip.low  { background: rgba(202,138,4,.12); border-color: rgba(202,138,4,.25); color: #fde047; }
.wh-chip.empty{ background: rgba(220,38,38,.12); border-color: rgba(220,38,38,.25); color: #fca5a5; }

/* ── TRUCK WAREHOUSES ──────────────────────────────────── */
.wh-type-truck .wh-chip { background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.2); color: #fbbf24; }
.truck-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 6px; font-size: 11px; font-weight: 700; letter-spacing:.05em; text-transform:uppercase; background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.2); color: #fbbf24; margin-left: 6px; }
.wh-truck-row { background: rgba(245,158,11,.04) !important; }

/* ── FORM CARD ─────────────────────────────────────────── */
.form-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 12px; padding: 28px; max-width: 620px;
}
.form-card h3 { font-size: 17px; font-weight: 700; margin-bottom: 20px; color: var(--text); }
.form-divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
.form-section-title { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 12px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.stock-info {
  background: rgba(59,130,246,.08); border: 1px solid rgba(59,130,246,.2);
  border-radius: 8px; padding: 8px 12px; font-size: 13px; color: var(--accent);
  margin-top: -8px; margin-bottom: 4px;
}

/* ── TOAST ─────────────────────────────────────────────── */
#toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 9999; max-width: calc(100vw - 32px); }
.toast {
  padding: 12px 18px; border-radius: 10px; font-size: 14px; font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,.4); animation: slideIn .25s ease;
  min-width: 200px; max-width: 340px; display: flex; align-items: center; gap: 8px; border: 1px solid;
}
.toast-success { background: #0f2040; border-color: rgba(59,130,246,.3); color: #93c5fd; }
.toast-error   { background: #450a0a; border-color: rgba(220,38,38,.3);  color: #fca5a5; }
.toast-info    { background: #0c1a2e; border-color: rgba(59,130,246,.3); color: #93c5fd; }
@keyframes slideIn { from { transform: translateX(40px); opacity:0; } to { transform: translateX(0); opacity:1; } }

/* ── MODAL ─────────────────────────────────────────────── */
#modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 16px;
}
#modal-box {
  background: var(--card); border: 1px solid var(--border);
  border-radius: 14px; width: 100%; max-width: 520px;
  box-shadow: 0 24px 60px rgba(0,0,0,.5), 0 0 40px var(--primary-glow);
  max-height: 90vh; overflow-y: auto;
}
#modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
#modal-title  { font-size: 16px; font-weight: 700; color: var(--text); }
#modal-body   { padding: 20px 22px; }
#modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

/* ── CONFIRM ───────────────────────────────────────────── */
.confirm-text { font-size: 15px; line-height: 1.6; color: var(--text-2); }
.confirm-detail {
  background: rgba(0,0,0,.3); border: 1px solid var(--border);
  border-radius: 8px; padding: 14px; margin-top: 14px; font-size: 14px; line-height: 1.9;
}
.confirm-detail strong { color: var(--accent); }

/* ── EMPTY STATE ───────────────────────────────────────── */
.empty-state { text-align: center; padding: 52px 20px; color: var(--text-muted); }
.empty-state svg { width: 48px; height: 48px; margin-bottom: 14px; opacity: .3; }
.empty-state p { font-size: 15px; }

/* ── FILTER BAR ────────────────────────────────────────── */
.filter-bar { display: flex; gap: 10px; align-items: flex-end; margin-bottom: 16px; flex-wrap: wrap; }
.filter-bar .form-group { margin-bottom: 0; min-width: 140px; }

/* ── OWNER ACCOUNT CARDS ───────────────────────────────── */
.accounts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px,1fr)); gap: 16px; }
.account-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 20px;
  transition: border-color .2s, box-shadow .2s; display: flex; flex-direction: column;
}
.account-card:hover { border-color: var(--primary); box-shadow: 0 0 24px var(--primary-glow); }
.account-name-big { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 5px; }
.account-admin-info { font-size: 13px; color: var(--text-muted); }
.account-meta { display: flex; gap: 12px; flex-wrap: wrap; }
.account-meta-item { display: flex; align-items: center; gap: 5px; font-size: 13px; color: var(--text-2); }
.account-meta-item svg { width: 14px; height: 14px; color: var(--text-muted); }
.account-card-actions {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  border-top: 1px solid var(--border-light); padding-top: 12px; margin-top: auto;
}

/* ── IMPORT/EXPORT ─────────────────────────────────────── */
.import-zone {
  border: 2px dashed var(--border); border-radius: 10px; padding: 28px;
  text-align: center; cursor: pointer; transition: all .2s;
}
.import-zone:hover, .import-zone.drag-over { border-color: var(--primary); background: rgba(59,130,246,.05); }
.import-zone svg { width: 36px; height: 36px; color: var(--text-muted); margin-bottom: 10px; }
.import-zone p { color: var(--text-muted); font-size: 14px; }
.import-zone strong { color: var(--accent); }
.import-result { border-radius: 8px; padding: 12px 16px; font-size: 14px; margin-top: 12px; }
.import-result.success { background: rgba(59,130,246,.1); border: 1px solid rgba(59,130,246,.2); color: var(--accent); }
.import-result.error   { background: rgba(220,38,38,.1);  border: 1px solid rgba(220,38,38,.2);  color: #fca5a5; }

/* ── CSV TEMPLATE ──────────────────────────────────────── */
.csv-format {
  background: rgba(0,0,0,.3); border: 1px solid var(--border-light);
  border-radius: 8px; padding: 12px 16px; font-family: monospace; font-size: 13px;
  color: var(--text-2); margin-top: 12px; white-space: pre; overflow-x: auto;
}

/* ── OWNER OVERVIEW CHART ──────────────────────────────── */
.owner-chart-bar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13px;
}
.owner-chart-label { width: 140px; flex-shrink: 0; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.owner-chart-track { flex: 1; background: var(--border); border-radius: 99px; height: 10px; overflow: hidden; }
.owner-chart-fill  { height: 100%; border-radius: 99px; transition: width .6s ease; }
.owner-chart-val   { width: 40px; text-align: right; font-weight: 700; color: var(--accent); flex-shrink: 0; }

/* ── PLATFORM KPI GRID ─────────────────────────────────── */
.platform-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px,1fr));
  gap: 14px; margin-bottom: 20px;
}
.platform-kpi { cursor: default; }
.stat-icon.purple { background: rgba(139,92,246,.15); color: #c4b5fd; }
.stat-icon.amber  { background: rgba(245,158,11,.15); color: #fbbf24; }
.stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; opacity: .8; }

/* ── HEALTH BADGES ──────────────────────────────────────── */
.health-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 700;
  white-space: nowrap;
}
.health-good     { background: rgba(34,197,94,.15);  color: #4ade80; }
.health-warning  { background: rgba(245,158,11,.15); color: #fbbf24; }
.health-risk     { background: rgba(239,68,68,.15);  color: #f87171; }
.health-inactive { background: rgba(107,114,128,.15);color: #9ca3af; }

/* ── BADGE COUNT ────────────────────────────────────────── */
.badge-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  background: rgba(239,68,68,.2); color: #f87171;
  border-radius: 99px; font-size: 11px; font-weight: 700;
}

/* ── ONBOARDING FUNNEL ──────────────────────────────────── */
.funnel-step {
  display: grid; grid-template-columns: 160px 1fr auto;
  align-items: center; gap: 12px; margin-bottom: 10px;
}
.funnel-step.funnel-zero .funnel-label { color: var(--text-muted); }
.funnel-label { font-size: 13px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.funnel-track { background: var(--border); border-radius: 99px; height: 8px; overflow: hidden; }
.funnel-fill  { height: 100%; background: var(--accent); border-radius: 99px; transition: width .6s ease; }
.funnel-meta  { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.funnel-n     { font-size: 12px; font-weight: 700; color: var(--text); }
.funnel-drop  { font-size: 11px; color: #f87171; font-weight: 600; }

/* ── RISK LIST ──────────────────────────────────────────── */
.risk-list  { display: flex; flex-direction: column; gap: 8px; }
.risk-item  {
  background: rgba(0,0,0,.2); border: 1px solid var(--border-light);
  border-radius: 8px; padding: 10px 12px;
}
.risk-item-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.risk-issues   { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.risk-tag {
  font-size: 11px; padding: 2px 7px; border-radius: 4px;
  background: rgba(245,158,11,.12); color: #fbbf24; font-weight: 600;
}

/* ── ACTIVITY FEED ──────────────────────────────────────── */
.activity-feed { display: flex; flex-direction: column; gap: 0; }
.af-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border-light);
}
.af-item:last-child { border-bottom: none; }
.af-icon {
  width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.af-icon svg { width: 16px; height: 16px; }
.af-move  { background: rgba(59,130,246,.15);  color: #93c5fd; }
.af-prod  { background: rgba(20,184,166,.15);  color: #2dd4bf; }
.af-wh    { background: rgba(245,158,11,.15);  color: #fbbf24; }
.af-acct  { background: rgba(139,92,246,.15);  color: #c4b5fd; }
.af-body  { flex: 1; min-width: 0; }
.af-text  { font-size: 13px; color: var(--text-2); line-height: 1.45; }
.af-text strong { color: var(--text); }
.af-text em     { font-style: normal; color: var(--accent); }
.af-time  { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── TENANT TABLE ───────────────────────────────────────── */
.tenant-table { min-width: 700px; }
.ob-bar-wrap { background: var(--border); border-radius: 99px; height: 5px; overflow: hidden; margin-bottom: 2px; }
.ob-bar      { height: 100%; border-radius: 99px; transition: width .4s ease; }

/* ── TWO COLUMN LAYOUT ──────────────────────────────────── */
.dash-two-col {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px;
}

/* ── QUICK ACTION BUTTONS (employee) ───────────────────── */
.quick-action-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
}
.quick-action-btn {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 20px 12px; border-radius: 12px; border: none; cursor: pointer;
  font-size: 14px; font-weight: 700; color: white; transition: transform .15s, opacity .15s;
  font-family: inherit;
}
.quick-action-btn:hover  { opacity: .9; transform: translateY(-2px); }
.quick-action-btn:active { transform: translateY(0); }
.quick-action-btn svg   { width: 28px; height: 28px; }
.quick-action-btn.bg-green  { background: linear-gradient(135deg,#22c55e,#16a34a); box-shadow: 0 6px 18px rgba(34,197,94,.3); }
.quick-action-btn.bg-red    { background: linear-gradient(135deg,#ef4444,#dc2626); box-shadow: 0 6px 18px rgba(239,68,68,.3); }
.quick-action-btn.bg-blue   { background: linear-gradient(135deg,#3b82f6,#2563eb); box-shadow: 0 6px 18px rgba(59,130,246,.3); }
.quick-action-btn.bg-amber  { background: linear-gradient(135deg,#f59e0b,#d97706); box-shadow: 0 6px 18px rgba(245,158,11,.3); }

/* ── STAT ALERT CARD ────────────────────────────────────── */
.stat-alert { border-color: rgba(239,68,68,.3) !important; }
.stat-sub   { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── DASHBOARD ALERT CARD ───────────────────────────────── */
.dash-alert-card { border-color: rgba(239,68,68,.25); background: rgba(239,68,68,.04); }

/* ── MOVEMENT REVERSAL ROW ──────────────────────────────── */
.mv-reversal-row td { opacity: .65; }
.mv-rev-tag {
  display: inline-block; font-size: 10px; font-weight: 700;
  padding: 1px 5px; border-radius: 4px; margin-left: 6px;
  background: rgba(239,68,68,.15); color: #f87171;
}

/* ── SPIN ANIMATION ─────────────────────────────────────── */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }

/* ── RESPONSIVE ────────────────────────────────────────── */
@media (max-width: 900px) {
  .stats-grid        { grid-template-columns: repeat(2, 1fr); }
  .platform-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-two-col      { grid-template-columns: 1fr !important; }
  .funnel-step       { grid-template-columns: 120px 1fr auto; }
}

@media (max-width: 768px) {
  /* Sidebar overlay */
  #sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 500;
    transform: translateX(-100%); width: var(--sidebar-w) !important;
  }
  #sidebar.open { transform: translateX(0); }
  /* Restore collapsed overrides on mobile */
  #sidebar.collapsed.open .sidebar-brand,
  #sidebar.collapsed.open .nav-section,
  #sidebar.collapsed.open .nav-item span,
  #sidebar.collapsed.open .user-text { opacity: 1; width: auto; overflow: visible; pointer-events: auto; }
  #sidebar.collapsed.open .sidebar-header { justify-content: flex-start; padding: 16px; }
  #sidebar.collapsed.open .nav-item { justify-content: flex-start; padding: 9px 12px; gap: 10px; }
  #sidebar.collapsed.open .user-info { justify-content: flex-start; }

  #sidebar-collapse { display: none; }
  #menu-toggle { display: flex; }

  .tb-info { display: none; }
  #topbar-profile { padding-left: 8px; gap: 6px; }

  /* Top bar: allow wrapping so action buttons get their own row */
  #top-bar {
    flex-wrap: wrap; height: auto; min-height: var(--header-h);
    padding: 8px 14px; gap: 8px;
  }
  #top-bar h2 { font-size: 15px; }
  /* Header actions move to own row below title */
  #header-actions {
    order: 10; width: 100%; flex-wrap: wrap; gap: 6px;
    padding-top: 6px; border-top: 1px solid var(--border-light);
  }
  #header-actions:empty { display: none !important; padding: 0; margin: 0; border: none; }

  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  #page-content { padding: 12px; }
  .accounts-grid { grid-template-columns: 1fr; }
  .form-card { padding: 20px; max-width: 100%; }
  .card { padding: 14px; }
  #modal-box { max-height: 88vh; }
  #modal-body { padding: 16px; }
  #modal-header { padding: 14px 16px; }
  #modal-footer { padding: 12px 16px; }
  .login-card { padding: 28px 20px; }
  .owner-chart-label { width: 100px; }
  #toast-container { bottom: 16px; right: 12px; left: 12px; }
  .toast { min-width: unset; max-width: 100%; }
  .platform-kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .funnel-step { grid-template-columns: 1fr; gap: 4px; }
  .funnel-track { margin-top: 2px; }
  .quick-action-grid { grid-template-columns: repeat(2, 1fr); }

  /* Filter bar: 2 items per row */
  .filter-bar { gap: 8px; }
  .filter-bar .form-group { flex: 1 1 calc(50% - 4px) !important; min-width: calc(50% - 4px) !important; }

  /* Table: tighter cells */
  thead th { padding: 9px 10px; }
  tbody td { padding: 9px 10px; }

  /* Task rows: allow wrapping */
  .task-check-row { flex-wrap: wrap; }

  /* Card header: stack on mobile */
  .card-header { gap: 10px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 14px 10px; gap: 8px; }
  .stat-value { font-size: 20px; }
  .stat-icon { width: 36px; height: 36px; border-radius: 10px; }
  .stat-icon svg { width: 18px; height: 18px; }
  #page-content { padding: 10px; }
  .card { padding: 12px; }
  table { min-width: 360px; }
  .accounts-grid { gap: 10px; }
  #header-actions .btn span { display: none; }
  #header-actions .btn svg { margin: 0; }

  /* Top bar */
  #top-bar h2 { font-size: 14px; }
  .tb-avatar { width: 28px; height: 28px; font-size: 11px; }

  /* Filter bar: full width per item */
  .filter-bar .form-group { flex: 1 1 100% !important; min-width: 0 !important; }
  .filter-bar { gap: 8px; }

  /* Table: smaller text + tighter padding */
  thead th { padding: 7px 8px; font-size: 11px; }
  tbody td { padding: 8px 8px; font-size: 13px; }
  .btn-sm { padding: 4px 8px; font-size: 12px; }
  .btn-sm svg { width: 11px; height: 11px; }

  /* Modal */
  #modal-box { max-height: 92vh; }
  #modal-body { padding: 14px; }
  #modal-header { padding: 12px 14px; }
  #modal-footer { padding: 10px 14px; gap: 6px; }
  #modal-footer .btn { flex: 1; justify-content: center; }

  /* Form card */
  .form-card { padding: 16px; }
  .form-actions { gap: 8px; }
  .form-actions .btn { flex: 1; justify-content: center; }

  /* Card header: allow wrap */
  .card-header { flex-direction: column; align-items: flex-start; }

  /* Badge */
  .badge { padding: 2px 7px; font-size: 11px; }
}

@media (max-width: 380px) {
  .stats-grid { grid-template-columns: 1fr; }
  #page-content { padding: 8px; }
  .card { padding: 10px; }
  #top-bar h2 { font-size: 13px; }
}

/* ── Nav Badge ─────────────────────────────── */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  margin-left: auto;
}

/* ── Task styles ───────────────────────────── */
.task-card { margin-bottom: 16px; }
.task-item-row { border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 12px; }
.task-item-row:last-child { border-bottom: none; margin-bottom: 0; }
.task-items-list { padding: 8px 0; }
.task-check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: default;
}
.task-check-row:last-child { border-bottom: none; }
.task-check-row.clickable { cursor: pointer; }
.task-check-row.clickable:hover { background: rgba(255,255,255,.03); border-radius: 6px; }

/* ── Employee-only nav items ───────────────── */
.employee-only { display: none !important; }
.role-employee .employee-only { display: flex !important; }

/* ── LOGO OVERRIDES ─────────────────────────── */
.login-logo  { width: 90px !important; height: 90px !important; border-radius: 50% !important; background: transparent !important; border: none !important; box-shadow: none !important; }
.login-logo  svg { width: 100%; height: 100%; display: block; }
.sidebar-logo { width: 40px !important; height: 40px !important; border-radius: 50% !important; padding: 0 !important; background: transparent !important; border: none !important; box-shadow: none !important; }
.sidebar-logo svg { width: 100%; height: 100%; display: block; }

/* ── THEME VARIABLES ────────────────────────── */
[data-theme="light"] {
  --bg:           #f1f5f9;
  --bg-deep:      #e2e8f0;
  --sidebar-bg:   #1e293b;
  --sidebar-hover:#273449;
  --sidebar-act:  #1e3a8a;
  --sidebar-bdr:  rgba(148,163,184,.15);
  --card:         #ffffff;
  --card-hi:      #f8fafc;
  --border:       #cbd5e1;
  --border-light: #e2e8f0;
  --primary:      #3b82f6;
  --primary-h:    #2563eb;
  --primary-glow: rgba(59,130,246,.2);
  --accent:       #1d4ed8;
  --success:      #16a34a;
  --warning:      #d97706;
  --danger:       #dc2626;
  --danger-h:     #b91c1c;
  --text:         #0f172a;
  --text-2:       #334155;
  --text-muted:   #64748b;
  --sidebar-text: #ffffff;
  --sidebar-title-color: #ffffff;
  --sidebar-sub-color:   #94a3b8;
  --nav-section-color:   #64748b;
  --row-hover:           #f1f5f9;
}
[data-theme="light"] body { background: var(--bg); color: var(--text); }
[data-theme="light"] .form-group input,
[data-theme="light"] .form-group select,
[data-theme="light"] .form-group textarea { background: #fff; color: #0f172a; }
[data-theme="light"] .form-group select option { background: #fff; color: #0f172a; }
[data-theme="light"] .modal-body { background: #f8fafc; }
[data-theme="light"] #modal-box { background: #fff; }
[data-theme="light"] #modal-header { background: #fff; border-bottom: 1px solid #e2e8f0; }
[data-theme="light"] #modal-footer { background: #f8fafc; border-top: 1px solid #e2e8f0; }
[data-theme="light"] .ss-dropdown { background: #fff; border-color: #cbd5e1; }
[data-theme="light"] .ss-item:hover      { background: #f1f5f9; }
[data-theme="light"] .alert-row:hover      { background: #f1f5f9; box-shadow: inset 3px 0 0 #3b82f6; }
[data-theme="light"] .dash-list-item:hover { background: #f1f5f9; }
[data-theme="light"] #login-screen { background: radial-gradient(ellipse at 30% 40%, #dbeafe 0%, #eff6ff 60%); }
[data-theme="light"] .login-card { background: #fff; border-color: #e2e8f0; box-shadow: 0 24px 80px rgba(0,0,0,.08); }
[data-theme="light"] .stat-card { background: #fff; border-color: #e2e8f0; }
[data-theme="light"] .card { background: #fff; border-color: #e2e8f0; }
[data-theme="light"] .top-bar-bg { background: #fff; }
[data-theme="light"] #top-bar { background: #fff; border-bottom: 1px solid #e2e8f0; }

/* ══════════════════════════════════════════════════════════════
   KORDI THEME — Monochrome Premium
   Dark sidebar · frosted-glass cards · grain texture · shimmer
   ══════════════════════════════════════════════════════════════ */

/* Keyframes — scoped for kordi effects */
@keyframes k-shimmer {
  0%   { transform: translateX(-100%) skewX(-12deg); }
  100% { transform: translateX(220%)  skewX(-12deg); }
}
@keyframes k-pulse-bar {
  0%, 100% { opacity: .7; }
  50%       { opacity: 1;  }
}
@keyframes k-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0);   }
}

[data-theme="kordi"] {
  --bg:           #e9e6e0;
  --bg-deep:      #dedad3;
  --sidebar-bg:   #080808;
  --sidebar-hover:#161616;
  --sidebar-act:  #1e1e1e;
  --sidebar-bdr:  rgba(255,255,255,.05);
  --card:         rgba(255,255,255,.78);
  --card-hi:      rgba(255,255,255,.55);
  --border:       rgba(0,0,0,.1);
  --border-light: rgba(0,0,0,.06);
  --primary:      #0a0a0a;
  --primary-h:    #252525;
  --primary-glow: rgba(10,10,10,.15);
  --accent:       #0a0a0a;
  --success:      #15803d;
  --warning:      #b45309;
  --danger:       #b91c1c;
  --danger-h:     #991b1b;
  --text:         #0a0a0a;
  --text-2:       #383838;
  --text-muted:   #9a9590;
  --sidebar-text: #505050;
  --sidebar-title-color: #d8d8d8;
  --sidebar-sub-color:   #555555;
  --row-hover:           rgba(0,0,0,.05);
}

/* ── Base + grain texture ─────────────────── */
[data-theme="kordi"] body {
  background: var(--bg);
  color: var(--text);
  /* subtle radial light from top-center */
  background-image: radial-gradient(ellipse 100% 60% at 60% 0%, rgba(255,255,255,.55) 0%, transparent 70%);
}
/* paper grain overlay — content area only */
[data-theme="kordi"] #main-content::before {
  content: '';
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.72' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23g)' opacity='1'/%3E%3C/svg%3E");
  background-size: 200px;
  opacity: .03;
  mix-blend-mode: multiply;
}
[data-theme="kordi"] ::selection { background: #0a0a0a; color: #fff; }

/* Scrollbar */
[data-theme="kordi"] ::-webkit-scrollbar-track { background: #dedad3; }
[data-theme="kordi"] ::-webkit-scrollbar-thumb { background: #bfbbb3; border-radius: 4px; }
[data-theme="kordi"] ::-webkit-scrollbar-thumb:hover { background: #0a0a0a; }

/* ── Login screen ─────────────────────────── */
[data-theme="kordi"] #login-screen {
  background: #070707;
  background-image:
    radial-gradient(ellipse 90% 60% at 50% -5%,  rgba(255,255,255,.06) 0%, transparent 55%),
    radial-gradient(ellipse 50% 50% at 10% 110%,  rgba(255,255,255,.03) 0%, transparent 50%),
    repeating-linear-gradient(0deg,  transparent, transparent 59px, rgba(255,255,255,.022) 59px, rgba(255,255,255,.022) 60px),
    repeating-linear-gradient(90deg, transparent, transparent 59px, rgba(255,255,255,.022) 59px, rgba(255,255,255,.022) 60px);
}
/* login card — frosted glass on dark stage */
[data-theme="kordi"] .login-card {
  background: rgba(255,255,255,.86);
  backdrop-filter: blur(28px) saturate(1.6);
  -webkit-backdrop-filter: blur(28px) saturate(1.6);
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 18px;
  box-shadow:
    0 0 0 1px rgba(0,0,0,.07),
    0 5px 0 #0a0a0a,
    0 24px 48px rgba(0,0,0,.6),
    0 60px 120px rgba(0,0,0,.35);
  animation: k-fade-in .4s ease both;
}
[data-theme="kordi"] .login-card h1 {
  letter-spacing: .2em;
  text-transform: uppercase;
  font-size: 12.5px;
  font-weight: 800;
  color: #0a0a0a;
}
[data-theme="kordi"] .login-sub { color: #a09890; font-size: 13px; }
[data-theme="kordi"] .login-logo {
  background: #0a0a0a;
  border-color: rgba(255,255,255,.08);
  box-shadow: 0 8px 28px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.07);
  border-radius: 50% !important;
}

/* ── Sidebar ──────────────────────────────── */
[data-theme="kordi"] #sidebar {
  border-right: 1px solid rgba(255,255,255,.05);
  box-shadow: 6px 0 32px rgba(0,0,0,.28);
  background: #080808;
}
[data-theme="kordi"] .sidebar-logo {
  background: rgba(255,255,255,.08) !important;
  border: 1px solid rgba(255,255,255,.1) !important;
  box-shadow: none !important;
}
[data-theme="kordi"] .sidebar-brand {
  color: #e0e0e0;
  font-weight: 700;
  letter-spacing: .06em;
  font-size: 14px;
}
[data-theme="kordi"] .nav-section {
  color: #555555;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
  border-top: 1px solid rgba(255,255,255,.06);
  margin-top: 6px; padding-top: 16px;
}
[data-theme="kordi"] .nav-item { color: #909090; transition: background .12s, color .12s; }
[data-theme="kordi"] .nav-item:hover { background: #181818; color: #e8e8e8; }
[data-theme="kordi"] .nav-item.active {
  background: #242424;
  color: #ffffff;
  box-shadow: inset 3px 0 0 #ffffff;
  font-weight: 600;
  position: relative;
}
/* glow dot on active */
[data-theme="kordi"] .nav-item.active::after {
  content: '';
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 5px; height: 5px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6px 2px rgba(255,255,255,.35);
  animation: k-pulse-bar 2.4s ease-in-out infinite;
}

/* ── Top bar ──────────────────────────────── */
[data-theme="kordi"] #top-bar {
  background: rgba(255,255,255,.82);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid rgba(0,0,0,.08);
  box-shadow: 0 1px 0 rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.04);
}
[data-theme="kordi"] #top-bar h2 {
  font-weight: 800;
  letter-spacing: -.025em;
  color: #0a0a0a;
  font-size: 18px;
}

/* ── Cards — frosted glass ────────────────── */
[data-theme="kordi"] .card {
  background: rgba(255,255,255,.75);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid rgba(255,255,255,.6);
  border-radius: 14px;
  box-shadow: 0 1px 1px rgba(0,0,0,.04), 0 6px 20px rgba(0,0,0,.07), inset 0 1px 0 rgba(255,255,255,.9);
  transition: box-shadow .22s, border-color .22s, transform .22s;
  position: relative; overflow: hidden;
}
/* inner top shine */
[data-theme="kordi"] .card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent 5%, rgba(255,255,255,.9) 50%, transparent 95%);
  pointer-events: none;
}
[data-theme="kordi"] .card:hover {
  border-color: rgba(255,255,255,.75);
  box-shadow: 0 2px 4px rgba(0,0,0,.06), 0 16px 40px rgba(0,0,0,.12), inset 0 1px 0 rgba(255,255,255,.95);
  transform: translateY(-2px);
}
[data-theme="kordi"] .card-title {
  color: #0a0a0a;
  font-weight: 800;
  letter-spacing: -.025em;
  font-size: 15px;
}

/* ── Stat cards — glass + shimmer ────────── */
[data-theme="kordi"] .stat-card {
  background: rgba(255,255,255,.75);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid rgba(255,255,255,.6);
  border-radius: 14px;
  box-shadow: 0 1px 1px rgba(0,0,0,.04), 0 6px 20px rgba(0,0,0,.07), inset 0 1px 0 rgba(255,255,255,.9);
  position: relative; overflow: hidden;
  transition: box-shadow .22s, transform .22s;
}
/* left accent bar */
[data-theme="kordi"] .stat-card::before {
  content: '';
  position: absolute; top: 14px; bottom: 14px; left: 0; width: 3px;
  background: #0a0a0a;
  border-radius: 0 3px 3px 0;
}
/* shimmer sweep on hover */
[data-theme="kordi"] .stat-card::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.55) 50%, transparent 65%);
  transform: translateX(-100%) skewX(-12deg);
  pointer-events: none;
}
[data-theme="kordi"] .stat-card:hover { box-shadow: 0 4px 8px rgba(0,0,0,.08), 0 16px 40px rgba(0,0,0,.13); transform: translateY(-2px); }
[data-theme="kordi"] .stat-card:hover::after { animation: k-shimmer .65s ease forwards; }
[data-theme="kordi"] .stat-value {
  font-weight: 900;
  letter-spacing: -.03em;
  background: linear-gradient(135deg, #0a0a0a 0%, #3a3a3a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
[data-theme="kordi"] .stat-label {
  color: #9a9590;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: .07em;
  text-transform: uppercase;
}
[data-theme="kordi"] .stat-icon {
  background: rgba(10,10,10,.07);
  color: #0a0a0a;
  border-radius: 10px;
}

/* ── Buttons ──────────────────────────────── */
[data-theme="kordi"] .btn-primary {
  background: #0a0a0a;
  color: #ffffff;
  border: 1px solid #0a0a0a;
  box-shadow: 0 1px 3px rgba(0,0,0,.4), inset 0 1px 0 rgba(255,255,255,.08);
  font-weight: 700; letter-spacing: .02em;
  position: relative; overflow: hidden;
  transition: background .14s, box-shadow .14s, transform .1s;
}
/* shimmer on btn hover */
[data-theme="kordi"] .btn-primary::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(255,255,255,.18) 50%, transparent 70%);
  transform: translateX(-100%) skewX(-12deg);
  pointer-events: none;
}
[data-theme="kordi"] .btn-primary:hover { background: #222; transform: translateY(-1px); box-shadow: 0 5px 18px rgba(0,0,0,.32); }
[data-theme="kordi"] .btn-primary:hover::after { animation: k-shimmer .55s ease forwards; }
[data-theme="kordi"] .btn-primary:active { transform: none; box-shadow: inset 0 2px 5px rgba(0,0,0,.35); }
[data-theme="kordi"] .btn-outline {
  background: rgba(255,255,255,.7);
  backdrop-filter: blur(8px);
  border-color: rgba(0,0,0,.15);
  color: #383838;
  box-shadow: 0 1px 3px rgba(0,0,0,.07), inset 0 1px 0 rgba(255,255,255,.8);
}
[data-theme="kordi"] .btn-outline:hover {
  background: rgba(255,255,255,.9);
  border-color: #0a0a0a;
  color: #0a0a0a;
  box-shadow: 0 3px 10px rgba(0,0,0,.12);
}
[data-theme="kordi"] .btn-ghost { color: #9a9590; }
[data-theme="kordi"] .btn-ghost:hover { background: rgba(0,0,0,.05); color: #0a0a0a; }

/* ── Forms ────────────────────────────────── */
[data-theme="kordi"] .form-group label {
  color: #383838; font-weight: 700; letter-spacing: .04em;
  font-size: 12px; text-transform: uppercase;
}
[data-theme="kordi"] .form-group input,
[data-theme="kordi"] .form-group select,
[data-theme="kordi"] .form-group textarea {
  background: rgba(255,255,255,.75);
  backdrop-filter: blur(8px);
  color: #0a0a0a;
  border: 1.5px solid rgba(0,0,0,.13);
  box-shadow: inset 0 1px 3px rgba(0,0,0,.05), inset 0 1px 0 rgba(255,255,255,.8);
}
[data-theme="kordi"] .form-group input::placeholder { color: #b5b0a8; }
[data-theme="kordi"] .form-group select option { background: #f5f2ed; color: #0a0a0a; }
[data-theme="kordi"] .form-group input:focus,
[data-theme="kordi"] .form-group select:focus,
[data-theme="kordi"] .form-group textarea:focus {
  border-color: #0a0a0a;
  background: rgba(255,255,255,.92);
  box-shadow: 0 0 0 3px rgba(10,10,10,.1), inset 0 1px 3px rgba(0,0,0,.04);
}

/* ── Tables ───────────────────────────────── */
[data-theme="kordi"] .table-wrap {
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 14px;
  overflow-x: auto;
  background: rgba(255,255,255,.6);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: 0 1px 1px rgba(0,0,0,.04), 0 6px 20px rgba(0,0,0,.08), inset 0 1px 0 rgba(255,255,255,.9);
}
[data-theme="kordi"] table { border-collapse: collapse; }
[data-theme="kordi"] table thead tr { background: #0a0a0a; }
[data-theme="kordi"] table thead th {
  color: #707070;
  font-size: 10.5px; font-weight: 800;
  letter-spacing: .1em; text-transform: uppercase;
  border-bottom: none; padding: 12px 16px;
}
[data-theme="kordi"] table thead th:first-child { border-radius: 13px 0 0 0; }
[data-theme="kordi"] table thead th:last-child  { border-radius: 0 13px 0 0; }
[data-theme="kordi"] table thead th[data-col]:hover { color: #d5d5d5; }
[data-theme="kordi"] table tbody tr { background: transparent; border-bottom: 1px solid rgba(0,0,0,.05); transition: background .1s; }
[data-theme="kordi"] table tbody tr:last-child { border-bottom: none; }
[data-theme="kordi"] table tbody tr,
[data-theme="kordi"] tr.dead-tr { overflow: hidden; }
tr.dead-tr { position: relative; transition: background .18s, box-shadow .18s, transform .15s; }
tr.dead-tr:hover {
  background: var(--row-hover) !important;
  box-shadow: inset 3px 0 0 var(--primary), 0 2px 10px rgba(0,0,0,.12);
  transform: translateX(3px);
}
[data-theme="kordi"] tr.dead-tr:hover {
  background: rgba(255,255,255,.6) !important;
  box-shadow: inset 3px 0 0 #0a0a0a, 0 2px 16px rgba(0,0,0,.1);
}
[data-theme="kordi"] tr.dead-tr::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.35) 50%, transparent 100%);
  transform: translateX(-100%); pointer-events: none;
}
[data-theme="kordi"] tr.dead-tr:hover::after { animation: row-shimmer .5s ease forwards; }
[data-theme="kordi"] table tbody tr:hover {
  background: rgba(255,255,255,.6);
  box-shadow: inset 3px 0 0 #0a0a0a, 0 2px 16px rgba(0,0,0,.1);
  transform: translateX(3px);
}
[data-theme="kordi"] table tbody tr:hover td:first-child { color: #0a0a0a; font-weight: 700; }
[data-theme="kordi"] table tbody tr::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.35) 50%, transparent 100%);
  transform: translateX(-100%);
  pointer-events: none;
  transition: none;
}
[data-theme="kordi"] table tbody tr:hover::after {
  animation: row-shimmer .5s ease forwards;
}
@keyframes row-shimmer {
  0%   { transform: translateX(-100%); opacity: 1; }
  100% { transform: translateX(200%);  opacity: 0; }
}
[data-theme="kordi"] table tbody td { color: #0a0a0a; }
[data-theme="kordi"] .alert-row:hover      { background: rgba(255,255,255,.55); box-shadow: inset 3px 0 0 #0a0a0a; }
[data-theme="kordi"] .alert-row::after     { background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.4) 50%, transparent 100%); }
[data-theme="kordi"] .dash-list-item:hover { background: rgba(0,0,0,.05); }
[data-theme="kordi"] .theme-btn:hover      { background: rgba(0,0,0,.05); }

/* ── Badges ───────────────────────────────── */
[data-theme="kordi"] .badge-ok    { background: #f0fdf4; color: #166534; border: 1px solid #c6f0d0; font-weight: 700; letter-spacing: .03em; }
[data-theme="kordi"] .badge-low   { background: #fefce8; color: #92400e; border: 1px solid #fde68a; font-weight: 700; letter-spacing: .03em; }
[data-theme="kordi"] .badge-empty { background: #fff1f2; color: #9f1239; border: 1px solid #fecdd3; font-weight: 700; letter-spacing: .03em; }

/* ── Modal ────────────────────────────────── */
[data-theme="kordi"] #modal-overlay {
  backdrop-filter: blur(6px) brightness(.92);
  -webkit-backdrop-filter: blur(6px) brightness(.92);
}
[data-theme="kordi"] #modal-box {
  background: rgba(252,250,248,.9);
  backdrop-filter: blur(32px) saturate(1.6);
  -webkit-backdrop-filter: blur(32px) saturate(1.6);
  border: 1px solid rgba(255,255,255,.65);
  border-radius: 18px;
  box-shadow:
    0 0 0 1px rgba(0,0,0,.06),
    0 5px 0 #0a0a0a,
    0 28px 56px rgba(0,0,0,.28),
    0 70px 100px rgba(0,0,0,.14);
  animation: k-fade-in .25s ease both;
}
[data-theme="kordi"] #modal-header {
  background: #0a0a0a;
  border-bottom: none;
  border-radius: 17px 17px 0 0;
}
[data-theme="kordi"] #modal-header h2 {
  color: #e0e0e0;
  letter-spacing: .12em;
  font-size: 12.5px; font-weight: 800;
  text-transform: uppercase;
}
[data-theme="kordi"] #modal-header .btn-icon { color: #505050; }
[data-theme="kordi"] #modal-header .btn-icon:hover { background: rgba(255,255,255,.08); color: #ccc; }
[data-theme="kordi"] .modal-body { background: rgba(240,237,232,.7); }
[data-theme="kordi"] #modal-footer { background: rgba(255,255,255,.7); border-top: 1px solid rgba(0,0,0,.07); }

/* ── Searchable select ────────────────────── */
[data-theme="kordi"] .ss-wrap input {
  background: rgba(255,255,255,.75); backdrop-filter: blur(8px);
  color: #0a0a0a; border-color: rgba(0,0,0,.13);
  box-shadow: inset 0 1px 3px rgba(0,0,0,.05);
}
[data-theme="kordi"] .ss-wrap input:focus { border-color: #0a0a0a; box-shadow: 0 0 0 3px rgba(10,10,10,.1); }
[data-theme="kordi"] .ss-dropdown {
  background: rgba(252,250,248,.92);
  backdrop-filter: blur(24px) saturate(1.5);
  -webkit-backdrop-filter: blur(24px) saturate(1.5);
  border: 1px solid rgba(255,255,255,.6);
  box-shadow: 0 8px 32px rgba(0,0,0,.18), 0 2px 6px rgba(0,0,0,.07);
  border-radius: 12px;
}
[data-theme="kordi"] .ss-item:hover { background: rgba(0,0,0,.05); color: #0a0a0a; }
[data-theme="kordi"] .ss-item.selected { background: #0a0a0a; color: #ffffff; }

/* ── Error / success messages ─────────────── */
[data-theme="kordi"] .error-msg   { background: rgba(255,241,242,.85); backdrop-filter: blur(8px); color: #9f1239; border-color: rgba(254,205,211,.8); }
[data-theme="kordi"] .success-msg { background: rgba(240,253,244,.85); backdrop-filter: blur(8px); color: #166534; border-color: rgba(198,240,208,.8); }

/* ── Dashboard drag ───────────────────────── */
[data-theme="kordi"] .dash-drag-handle { color: #b8b3ab; }
[data-theme="kordi"] .dash-section.drag-over { border-color: rgba(10,10,10,.3) !important; background: rgba(255,255,255,.3) !important; }

/* ── LOGIN BG WATERMARK ─────────────────────── */
.login-bg::after {
  content: 'KOCKI';
  position: absolute;
  bottom: 5%;
  right: 3%;
  font-family: 'Arial Black', 'Helvetica Neue', Impact, sans-serif;
  font-size: clamp(80px, 18vw, 220px);
  font-weight: 900;
  letter-spacing: 0.12em;
  line-height: 1;
  pointer-events: none;
  user-select: none;
  z-index: 0;
  /* dark theme default — faint blue */
  color: rgba(93, 130, 246, 0.06);
}
/* light theme — faint navy */
[data-theme="light"] .login-bg::after {
  color: rgba(30, 58, 138, 0.05);
}
/* kordi theme — gold tone */
[data-theme="kordi"] .login-bg::after {
  color: rgba(200, 160, 50, 0.09);
}

/* ══════════════════════════════════════════════════════════════
   UNIFIED BACKGROUND SYSTEM — shared by login + all app pages
   ══════════════════════════════════════════════════════════════ */

/* Layer 1 — grid only, fixed behind all content */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  /* dark (default): grid เส้นจางๆ ไม่มี gradient overlay */
  background:
    repeating-linear-gradient(  0deg, transparent, transparent 59px, rgba(255,255,255,.018) 59px, rgba(255,255,255,.018) 60px),
    repeating-linear-gradient( 90deg, transparent, transparent 59px, rgba(255,255,255,.018) 59px, rgba(255,255,255,.018) 60px);
}

/* Layer 2 — "KOCKI" watermark, centered full-screen behind all content */
body::after {
  content: 'KOCKI';
  position: fixed;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%) rotate(-15deg);
  z-index: -1; pointer-events: none; user-select: none;
  white-space: nowrap;
  font-family: 'Arial Black', 'Helvetica Neue', Impact, sans-serif;
  font-size: clamp(120px, 26vw, 420px);
  font-weight: 900; letter-spacing: 0.03em; line-height: 1;
  color: rgba(93, 130, 246, 0.06); /* dark: subtle blue-white */
}

/* Light theme — grid only, no heavy gradient overlay */
[data-theme="light"] body::before {
  background:
    repeating-linear-gradient(  0deg, transparent, transparent 59px, rgba(99,130,200,.03) 59px, rgba(99,130,200,.03) 60px),
    repeating-linear-gradient( 90deg, transparent, transparent 59px, rgba(99,130,200,.03) 59px, rgba(99,130,200,.03) 60px);
}
[data-theme="light"] body::after  { color: rgba(100, 116, 139, 0.10); } /* light: slate gray เหมือน screenshot */

/* Kordi theme — grid only (body already has the warm radial glow) */
[data-theme="kordi"] body::before {
  background:
    repeating-linear-gradient(  0deg, transparent, transparent 59px, rgba(0,0,0,.018) 59px, rgba(0,0,0,.018) 60px),
    repeating-linear-gradient( 90deg, transparent, transparent 59px, rgba(0,0,0,.018) 59px, rgba(0,0,0,.018) 60px);
}
[data-theme="kordi"] body::after  { color: rgba(0, 0, 0, 0.07); } /* kordi: dark on cream, เข้ม subtle เหมือน screenshot */

/* ── Neutralise all per-page login backgrounds ───────────── */
/* All themes: remove background-color AND background-image from login-screen */
#login-screen {
  background-color: transparent !important;
  background-image: none !important;
}
[data-theme="light"] #login-screen {
  background-color: transparent !important;
  background-image: none !important;
}
[data-theme="kordi"] #login-screen {
  background-color: transparent !important;
  background-image: none !important;
}
/* Remove old grid overlay baked into login-screen */
#login-screen::before { display: none; }
/* Suppress login-specific watermark (body::after handles it globally) */
.login-bg::after { content: none; }

/* Kordi: add grain to login page — matches #main-content::before texture */
[data-theme="kordi"] #login-screen::after {
  content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.72' numOctaves='4' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='300' height='300' filter='url(%23g)' opacity='1'/%3E%3C/svg%3E");
  background-size: 200px; opacity: .03; mix-blend-mode: multiply;
}

/* ── MULTI-ITEM FORM ────────────────────────── */
.multi-items-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px 8px; margin-top: 6px;
  background: var(--card-hi, rgba(255,255,255,.03));
  border-radius: 10px 10px 0 0;
  border: 1px solid var(--border); border-bottom: none;
}
.multi-items-header > span { font-size: 13px; font-weight: 700; color: var(--text); }
.mir-list-wrap {
  border: 1px solid var(--border); border-radius: 0 0 10px 10px;
  overflow: hidden; margin-bottom: 12px;
}
.multi-item-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  background: transparent;
  transition: background .12s;
}
.multi-item-row:last-child { border-bottom: none; }
.multi-item-row:hover { background: var(--row-hover, rgba(255,255,255,.02)); }
.mir-num {
  color: var(--text-muted); font-size: 11px; font-weight: 700;
  min-width: 16px; text-align: right; flex-shrink: 0;
}
.mir-prod-col { flex: 1; min-width: 0; }
.mir-prod-col select { width: 100%; }
.mir-stock { font-size: 11px; margin-top: 3px; line-height: 1.3; }
.mir-qty-col {
  display: flex; align-items: center; gap: 4px; flex-shrink: 0;
}
.mir-qty-col input[type="number"] {
  width: 62px; text-align: center; padding: 6px 4px; font-size: 13px;
}
.mir-unit {
  color: var(--text-muted); font-size: 11px; white-space: nowrap; flex-shrink: 0;
}
.mir-sep {
  color: var(--border); font-size: 14px; flex-shrink: 0; margin: 0 1px;
}
.mir-del-btn {
  width: 28px; height: 28px; border-radius: 6px; flex-shrink: 0;
  background: rgba(239,68,68,.08); color: #f87171;
  border: 1px solid rgba(239,68,68,.15); cursor: pointer;
  font-size: 12px; display: flex; align-items: center; justify-content: center;
  transition: background .15s, border-color .15s;
}
.mir-del-btn:hover { background: rgba(239,68,68,.2); border-color: rgba(239,68,68,.4); }
.mir-empty {
  text-align: center; padding: 20px; color: var(--text-muted); font-size: 13px;
  background: var(--card-hi, rgba(255,255,255,.02));
}

/* ── GUIDE PAGE ─────────────────────────────── */
.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 16px;
}
/* ── Guide hero banner — theme-aware ───────── */
.guide-hero-banner {
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%) !important;
  color: #fff !important;
}
[data-theme="light"] .guide-hero-banner {
  background: linear-gradient(135deg, #1d4ed8 0%, #3b82f6 100%) !important;
  color: #fff !important;
}
[data-theme="kordi"] .guide-hero-banner {
  background: linear-gradient(135deg, #1a1a1a 0%, #080808 100%) !important;
  color: #e8e8e8 !important;
  border: 1px solid rgba(255,255,255,.08) !important;
  box-shadow: 0 4px 24px rgba(0,0,0,.3) !important;
}

.guide-section {
  border-left: 3px solid var(--guide-color, var(--primary));
  transition: transform .18s, box-shadow .18s;
}
.guide-section:hover { transform: translateY(-2px); }
.guide-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px;
}
.guide-icon {
  width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.guide-icon svg { width: 20px; height: 20px; }
.guide-title {
  font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: -.01em;
}
.guide-steps { display: flex; flex-direction: column; gap: 10px; }
.guide-step {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 13.5px; color: var(--text-2); line-height: 1.5;
}
.guide-step-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.guide-step-text { flex: 1; }
/* table in guide */
.guide-section table, .card table { border-collapse: collapse; }
@media (max-width: 768px) {
  .guide-grid { grid-template-columns: 1fr; }
}

/* ── THEME SWITCHER ─────────────────────────── */
.theme-switcher {
  padding: 8px 8px 14px;
  border-top: 1px solid var(--sidebar-bdr);
  margin-top: auto;
}
.theme-switcher-label {
  font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: #334155; padding: 0 6px 6px; display: block; white-space: nowrap; overflow: hidden;
}
.theme-btns { display: flex; gap: 4px; }
.theme-btn {
  flex: 1; padding: 6px 2px; border-radius: 7px;
  border: 1.5px solid var(--border); background: transparent;
  color: var(--sidebar-text); font-family: inherit; font-size: 11px; font-weight: 600;
  cursor: pointer; transition: all .15s; text-align: center; white-space: nowrap; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; gap: 3px; line-height: 1;
}
.theme-btn:hover { border-color: var(--primary); color: var(--accent); background: var(--sidebar-hover); }
.theme-btn.active { border-color: var(--primary); background: var(--sidebar-act); color: white; }
.theme-btn .tb-swatch { width: 12px; height: 12px; border-radius: 3px; }
#sidebar.collapsed .theme-switcher-label { display: none; }
#sidebar.collapsed .theme-btns { flex-direction: column; }
#sidebar.collapsed .theme-btn span { display: none; }

/* ── DASHBOARD DRAG & DROP ──────────────────── */
.dash-section { position: relative; }
.dash-section.drag-over { outline: 2px dashed var(--primary); outline-offset: 4px; border-radius: 12px; }
.dash-section.dragging  { opacity: 0.4; }
.dash-drag-handle {
  position: absolute; top: 6px; right: 8px; z-index: 10;
  background: var(--card-hi); border: 1px solid var(--border);
  border-radius: 6px; padding: 3px 8px; cursor: grab;
  color: var(--text-muted); font-size: 11px; opacity: 0;
  transition: opacity .15s; user-select: none;
  display: inline-flex; align-items: center; gap: 4px;
}
.dash-section:hover .dash-drag-handle { opacity: 1; }
.dash-drag-handle:active { cursor: grabbing; }
