/* D&D Energy CRM — design tokens */
@import url('https://fonts.googleapis.com/css2?family=Georama:wght@300;400;500;600;700;800&display=swap');

:root {
  /* Brand */
  --navy-900: #0e2744;
  --navy-800: #133258;
  --navy-700: #1a3f6b;
  --navy-600: #23507f;
  --navy-500: #3a6da0;
  --navy-400: #6a91bb;
  --blue-100: #e6eef7;
  --blue-50:  #f1f5fb;
  --bg:       #f6f8fc;
  --card:     #ffffff;
  --border:   #e2e8f0;
  --border-strong: #cbd5e1;
  --ink-900:  #0b1a2e;
  --ink-700:  #2a3a52;
  --ink-500:  #5b6b82;
  --ink-400:  #8695ab;
  --ink-300:  #aab6c7;

  --amber-500: #f3a712;
  --amber-400: #f6bf47;
  --amber-100: #fdefc9;

  --green-500: #2a9d5f;
  --green-100: #dcf3e5;
  --red-500:   #d64545;
  --red-100:   #fce1e1;

  /* Type */
  --font: 'Georama', system-ui, -apple-system, sans-serif;

  /* Radius + spacing (kompakt) */
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 10px;

  --shadow-sm: 0 1px 2px rgba(14,39,68,0.06);
  --shadow-md: 0 2px 6px rgba(14,39,68,0.08), 0 1px 2px rgba(14,39,68,0.04);
  --shadow-lg: 0 10px 30px rgba(14,39,68,0.12);
}

* { box-sizing: border-box; }

body, html {
  margin: 0;
  font-family: var(--font);
  color: var(--ink-900);
  font-size: 13px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
}

.app {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink-900);
  width: 100%;
  height: 100%;
  display: flex;
  overflow: hidden;
}

/* ───── Sidebar ───── */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--navy-900);
  color: #e6eef7;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #081a2f;
}
.sidebar.collapsed { width: 56px; }

.sb-logo {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  min-height: 56px;
}
.sb-logo-mark {
  width: 32px; height: 32px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #f6bf47, #f3a712 60%, #c47a00);
  box-shadow: inset 0 -2px 0 rgba(0,0,0,0.18), 0 0 0 2px #0e2744;
  flex-shrink: 0;
  position: relative;
}
.sb-logo-mark::after{
  content:'';position:absolute;inset:6px;border-radius:50%;
  background:conic-gradient(from 200deg,#fff3c4 0deg,transparent 90deg);
  opacity:.5;
}
.sb-logo-text { font-weight: 800; font-size: 14px; letter-spacing: 0.02em; }
.sb-logo-text small {
  display: block; font-weight: 400; font-size: 9.5px; color: #8ea8c9; letter-spacing: 0.16em; text-transform: uppercase;
}

.sb-section {
  padding: 14px 14px 4px;
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase; color: #6a8bb3; font-weight: 600;
}

.sb-nav {
  padding: 4px 8px;
  display: flex; flex-direction: column; gap: 1px;
  flex: 1; overflow: auto;
}
.sb-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 6px;
  color: #b8c9e0; font-size: 13px; font-weight: 500;
  text-decoration: none; cursor: pointer;
  border: 1px solid transparent;
}
.sb-nav a:hover { background: rgba(255,255,255,0.04); color: #fff; }
.sb-nav a.active {
  background: linear-gradient(180deg, #1a3f6b, #133258);
  color: #fff;
  border-color: rgba(246,191,71,0.25);
  box-shadow: inset 2px 0 0 var(--amber-500);
}
.sb-nav a .badge {
  margin-left: auto;
  background: var(--amber-500); color: #1a1200;
  font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 999px;
  min-width: 18px; text-align: center;
}
.sb-nav a .ico {
  width: 16px; height: 16px; flex-shrink: 0; opacity: .9;
}

.sb-user {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.sb-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, #f6bf47, #f3a712);
  display: flex; align-items: center; justify-content: center;
  color: #1a1200; font-weight: 700; font-size: 12px;
  flex-shrink: 0;
}
.sb-user-name { font-size: 12px; font-weight: 600; color: #fff; line-height: 1.2; }
.sb-user-role { font-size: 10.5px; color: #8ea8c9; }

/* ───── Topbar ───── */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.topbar {
  height: 48px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 16px;
  gap: 14px;
  flex-shrink: 0;
}
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-500); }
.crumbs b { color: var(--ink-900); font-weight: 600; }
.crumbs .sep { color: var(--ink-300); }

.topbar-search {
  margin-left: auto;
  width: 280px;
  position: relative;
}
.topbar-search input {
  width: 100%;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0 10px 0 30px;
  font-family: var(--font);
  font-size: 12.5px;
  background: var(--bg);
  color: var(--ink-900);
}
.topbar-search input:focus { outline: none; border-color: var(--navy-500); background: #fff; }
.topbar-search .ico { position: absolute; left: 9px; top: 7px; color: var(--ink-400); }
.topbar-search kbd {
  position: absolute; right: 8px; top: 6px;
  font-family: var(--font); font-size: 10px; color: var(--ink-500);
  border: 1px solid var(--border-strong); padding: 0 5px; border-radius: 3px; height: 18px; line-height: 17px;
  background: #fff;
}

.topbar-btn {
  width: 30px; height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--ink-700);
  position: relative;
}
.topbar-btn:hover { background: var(--bg); }
.topbar-btn .dot {
  position: absolute; top: 5px; right: 5px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--amber-500); border: 2px solid #fff;
}

.launcher-btn {
  display: flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff; cursor: pointer;
  font-family: var(--font); font-size: 12px; font-weight: 500; color: var(--ink-700);
}
.launcher-btn:hover { background: var(--bg); }

/* ───── Content ───── */
.content {
  flex: 1; overflow: auto;
  padding: 18px 20px;
}
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 14px; gap: 16px;
}
.page-head h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.page-head p { margin: 2px 0 0; font-size: 12.5px; color: var(--ink-500); }
.page-head-actions { display: flex; gap: 8px; }

/* ───── Buttons ───── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  font-family: var(--font); font-weight: 500; font-size: 12.5px; color: var(--ink-900);
  cursor: pointer;
}
.btn:hover { background: var(--bg); }
.btn-primary {
  background: var(--navy-800); border-color: var(--navy-900); color: #fff;
}
.btn-primary:hover { background: var(--navy-700); }
.btn-amber {
  background: var(--amber-500); border-color: #d8900a; color: #1a1200;
}
.btn-amber:hover { background: var(--amber-400); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: rgba(14,39,68,0.06); }
.btn-danger { color: var(--red-500); border-color: var(--border); }
.btn-danger:hover { background: var(--red-100); }
.btn-sm { height: 26px; padding: 0 8px; font-size: 11.5px; }
.btn-xs { height: 22px; padding: 0 6px; font-size: 11px; border-radius: 4px; }

/* ───── Cards / panels ───── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.card-head {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-head h3 { margin: 0; font-size: 13.5px; font-weight: 600; }
.card-head .muted { color: var(--ink-500); font-size: 11.5px; font-weight: 400; }
.card-body { padding: 14px; }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.kpi {
  background: #fff; border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 12px 14px; position: relative; overflow: hidden;
}
.kpi .label { font-size: 11px; color: var(--ink-500); font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; }
.kpi .value { font-size: 24px; font-weight: 700; margin-top: 4px; letter-spacing: -0.02em; }
.kpi .delta { font-size: 11px; font-weight: 600; display: inline-flex; align-items: center; gap: 3px; margin-top: 4px; }
.kpi .delta.up { color: var(--green-500); }
.kpi .delta.down { color: var(--red-500); }
.kpi .spark { position: absolute; right: 10px; bottom: 10px; opacity: .6; }

.kpi.accent {
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700));
  color: #fff; border-color: var(--navy-900);
}
.kpi.accent .label { color: #a6c0df; }
.kpi.accent .value { color: #fff; }

/* ───── Tables ───── */
table.tbl {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: 12.5px;
}
table.tbl th {
  text-align: left; font-weight: 600; color: var(--ink-500);
  padding: 8px 12px; border-bottom: 1px solid var(--border);
  background: var(--blue-50);
  font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase;
  position: sticky; top: 0;
}
table.tbl td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.tbl tr:hover td { background: var(--blue-50); }
table.tbl tr.sel td { background: #fff8e4; }
table.tbl tr:last-child td { border-bottom: none; }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  background: var(--blue-100); color: var(--navy-800);
  border: 1px solid transparent;
}
.chip.green { background: var(--green-100); color: #135e37; }
.chip.amber { background: var(--amber-100); color: #7d5500; }
.chip.red   { background: var(--red-100); color: #7c1d1d; }
.chip.gray  { background: #eef2f7; color: var(--ink-500); }
.chip.navy  { background: var(--navy-800); color: #fff; }
.chip.dot::before{ content:''; width:6px; height:6px; border-radius:50%; background:currentColor; opacity:.9; }

/* Forms */
.field { display: flex; flex-direction: column; gap: 4px; }
.field label { font-size: 11.5px; color: var(--ink-700); font-weight: 500; }
.field .hint { font-size: 11px; color: var(--ink-500); }
.input, .select, .textarea {
  height: 30px;
  border: 1px solid var(--border-strong); border-radius: 6px;
  padding: 0 10px;
  font-family: var(--font); font-size: 12.5px; color: var(--ink-900);
  background: #fff;
}
.textarea { height: auto; padding: 8px 10px; min-height: 60px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--navy-500); box-shadow: 0 0 0 3px rgba(58,109,160,0.18); }

.checkbox {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; cursor: pointer;
}
.checkbox input { margin: 0; accent-color: var(--navy-700); }

.toggle {
  width: 32px; height: 18px; border-radius: 999px;
  background: var(--border-strong); position: relative; cursor: pointer;
  transition: background .15s;
}
.toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  transition: left .15s;
}
.toggle.on { background: var(--navy-700); }
.toggle.on::after { left: 16px; }

/* Login */
.auth-wrap {
  width: 100%; height: 100%;
  display: flex;
  background: linear-gradient(135deg, var(--navy-900), var(--navy-700) 60%, var(--navy-600));
  position: relative; overflow: hidden;
}
.auth-wrap::before {
  content:''; position: absolute; inset: 0;
  background:
    radial-gradient(circle at 20% 30%, rgba(246,191,71,0.18), transparent 40%),
    radial-gradient(circle at 85% 75%, rgba(58,109,160,0.3), transparent 45%);
}
.auth-left {
  flex: 1; color: #fff;
  padding: 48px 56px;
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative;
}
.auth-logo { display: flex; align-items: center; gap: 12px; }
.auth-logo .sb-logo-mark { width: 40px; height: 40px; }
.auth-logo-text { font-weight: 800; font-size: 16px; letter-spacing: 0.02em; }
.auth-logo-text small { display:block; font-weight: 400; font-size: 10.5px; color: #a6c0df; letter-spacing: 0.2em; text-transform: uppercase; }

.auth-tagline h2 { font-size: 34px; font-weight: 700; margin: 0 0 12px; letter-spacing: -0.02em; line-height: 1.1; }
.auth-tagline h2 span { color: var(--amber-400); }
.auth-tagline p { color: #b8c9e0; max-width: 420px; font-size: 14px; line-height: 1.5; }

.auth-foot { font-size: 11.5px; color: #7a97bd; display: flex; gap: 20px; }

.auth-right {
  width: 440px;
  background: #fff;
  padding: 48px 44px;
  display: flex; flex-direction: column; justify-content: center;
  position: relative; z-index: 1;
}
.auth-right h3 { font-size: 20px; font-weight: 700; margin: 0 0 4px; }
.auth-right .sub { font-size: 13px; color: var(--ink-500); margin-bottom: 24px; }

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form .input { height: 38px; font-size: 13.5px; }
.auth-form .field label { font-size: 12.5px; font-weight: 600; }
.btn-lg { height: 38px; padding: 0 16px; font-size: 13.5px; font-weight: 600; }

.row-between { display: flex; justify-content: space-between; align-items: center; }

/* 2FA otp boxes */
.otp-row { display: flex; gap: 8px; justify-content: center; }
.otp-box {
  width: 46px; height: 54px;
  border: 1.5px solid var(--border-strong); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 600; color: var(--navy-900);
  background: #fff;
}
.otp-box.filled { border-color: var(--navy-700); background: var(--blue-50); }
.otp-box.focus { border-color: var(--navy-700); box-shadow: 0 0 0 3px rgba(58,109,160,0.22); }

/* Sparkline svg defaults */
svg { display: block; }

/* Segmented */
.seg {
  display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; background: #fff;
}
.seg button {
  border: none; background: transparent;
  font-family: var(--font); font-size: 12px; font-weight: 500; color: var(--ink-500);
  padding: 6px 12px; cursor: pointer;
  border-right: 1px solid var(--border);
}
.seg button:last-child { border-right: none; }
.seg button.active { background: var(--navy-800); color: #fff; }

/* Filters bar */
.filters {
  display: flex; gap: 8px; align-items: center;
  padding: 10px 12px;
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.filters .sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }

/* Tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tabs button {
  background: transparent; border: none; cursor: pointer;
  font-family: var(--font); font-size: 13px; font-weight: 500; color: var(--ink-500);
  padding: 8px 14px; position: relative;
}
.tabs button.active { color: var(--navy-900); font-weight: 600; }
.tabs button.active::after {
  content:''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--amber-500);
}

/* Module tile */
.mod-tile {
  background: #fff; border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 14px; display: flex; flex-direction: column; gap: 8px;
  position: relative; transition: all .15s;
}
.mod-tile:hover { border-color: var(--navy-400); box-shadow: var(--shadow-md); }
.mod-tile .mod-ico {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--blue-100); color: var(--navy-700);
  display: flex; align-items: center; justify-content: center;
}
.mod-tile.off { opacity: 0.55; background: #fafbfd; }
.mod-tile.off .mod-ico { background: #eef2f7; color: var(--ink-400); }
.mod-tile h4 { margin: 0; font-size: 13.5px; font-weight: 600; }
.mod-tile p { margin: 0; font-size: 11.5px; color: var(--ink-500); line-height: 1.4; }
.mod-tile .mod-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.mod-tile .mod-users { font-size: 11px; color: var(--ink-500); }

/* permission matrix */
.perm-matrix { width: 100%; border-collapse: collapse; font-size: 12px; }
.perm-matrix th, .perm-matrix td {
  border-bottom: 1px solid var(--border);
  padding: 6px 10px; text-align: center;
}
.perm-matrix th.lbl, .perm-matrix td.lbl { text-align: left; }
.perm-matrix thead th {
  background: var(--blue-50); font-size: 10.5px; color: var(--ink-500);
  letter-spacing: 0.06em; text-transform: uppercase; font-weight: 600;
}
.perm-matrix tbody tr:hover td { background: var(--blue-50); }
.dot-perm {
  width: 16px; height: 16px; border-radius: 4px; margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
}
.dot-perm.y { background: var(--green-100); color: #135e37; }
.dot-perm.n { background: #f2f4f7; color: var(--ink-300); }
.dot-perm.p { background: var(--amber-100); color: #7d5500; }

/* utility */
.hstack { display: flex; align-items: center; gap: 8px; }
.vstack { display: flex; flex-direction: column; gap: 8px; }
.muted { color: var(--ink-500); }
.small { font-size: 11.5px; }
.mono { font-family: 'SF Mono', Menlo, Consolas, monospace; font-size: 12px; }
.divider { height: 1px; background: var(--border); margin: 12px 0; }

/* order detail 2-col */
.split { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }

/* Timeline */
.tl { position: relative; padding-left: 18px; }
.tl::before { content:''; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.tl .tl-item { position: relative; padding: 0 0 12px; font-size: 12px; }
.tl .tl-item::before {
  content:''; position: absolute; left: -15px; top: 4px; width: 10px; height: 10px; border-radius: 50%;
  background: #fff; border: 2px solid var(--navy-500);
}
.tl .tl-item .t { font-size: 11px; color: var(--ink-500); }

/* ───── Auth — interactive additions ───── */
.input-wrap { position: relative; }
.input-wrap .input { width: 100%; padding-left: 34px; }
.input-wrap .input-ico {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--ink-400); pointer-events: none;
}
.input-wrap .input-action {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; border-radius: 6px;
  border: none; background: transparent; cursor: pointer;
  color: var(--ink-500);
  display: flex; align-items: center; justify-content: center;
}
.input-wrap .input-action:hover { background: var(--blue-50); color: var(--navy-700); }
.input-wrap .input-action:focus-visible { outline: 2px solid var(--navy-500); outline-offset: 1px; }

.input.is-invalid { border-color: var(--red-500); }
.input.is-invalid:focus { box-shadow: 0 0 0 3px rgba(214,69,69,0.18); }

.field-err { font-size: 11.5px; color: var(--red-500); margin-top: 2px; }
.field-warn { font-size: 11.5px; color: #8a5a00; margin-top: 2px; display: inline-flex; align-items: center; gap: 4px; }

.auth-alert {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: 8px;
  background: var(--red-100); color: #7c1d1d;
  font-size: 12.5px; font-weight: 500;
  border: 1px solid rgba(214,69,69,0.25);
  margin-bottom: 12px;
}
.auth-alert svg { flex-shrink: 0; }

.auth-badge {
  width: 44px; height: 44px; border-radius: 10px;
  background: var(--blue-100); color: var(--navy-700);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}

.btn-block { width: 100%; justify-content: center; }
.btn-sso {
  background: #fff; color: var(--ink-900); border-color: var(--border-strong);
  font-weight: 600;
}
.btn-sso:hover { background: var(--bg); }

.btn:disabled, .btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-primary:disabled { background: var(--navy-700); }

.auth-sep {
  display: flex; align-items: center; gap: 10px;
  color: var(--ink-400); font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em;
  margin: 6px 0 2px;
}
.auth-sep::before, .auth-sep::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.auth-links {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center;
  gap: 6px; font-size: 12px; margin-top: 6px;
}
.auth-links a {
  color: var(--navy-700); font-weight: 500; cursor: pointer; text-decoration: none;
}
.auth-links a:hover { text-decoration: underline; }
.auth-links a.muted { color: var(--ink-500); font-weight: 400; }
.auth-links a.disabled { color: var(--ink-400); pointer-events: none; }
.auth-links .sep { color: var(--ink-300); }

.link-muted {
  font-size: 11.5px; color: var(--navy-700); text-decoration: none; font-weight: 500; cursor: pointer;
}
.link-muted:hover { text-decoration: underline; }

/* honeypot — invisible, but still submittable; not display:none (bots skip those) */
.hp-trap {
  position: absolute; left: -9999px; top: -9999px;
  width: 1px; height: 1px; overflow: hidden;
}

/* 2FA — interactive inputs */
.otp-box {
  font-family: var(--font);
  outline: none;
  transition: border-color .12s, box-shadow .12s, background .12s;
  padding: 0;
  text-align: center;
}
.otp-box:focus { border-color: var(--navy-700); box-shadow: 0 0 0 3px rgba(58,109,160,0.22); background: #fff; }

/* loader spin */
.spin { animation: dd-spin 0.85s linear infinite; }
@keyframes dd-spin { to { transform: rotate(360deg); } }

/* ───── Modal ───── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(14, 39, 68, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  animation: dd-fade 0.15s ease;
}
.modal {
  background: #fff; border-radius: 12px;
  box-shadow: var(--shadow-lg);
  max-width: 100%;
  max-height: calc(100vh - 40px);
  display: flex; flex-direction: column;
  animation: dd-pop 0.15s ease;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-body { padding: 16px; overflow: auto; }
.modal-foot {
  padding: 12px 16px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
}
@keyframes dd-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes dd-pop { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Select in compact tables */
table.tbl .select { height: 26px; font-size: 11.5px; padding: 0 6px; }

/* AI typing dots */
.typing {
  display: inline-block;
  font-size: 14px;
  letter-spacing: 3px;
  animation: dd-typing 1.4s infinite;
}
@keyframes dd-typing {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}

/* Responsive — CRM sa prispôsobí tabletu aj mobilu */
@media (max-width: 1024px) {
  .sidebar { width: 56px !important; }
  .sb-logo-text, .sb-nav a span:not(.badge), .sb-user-name, .sb-user-role, .sb-section { display: none; }
  .sb-logo { justify-content: center; padding: 14px 8px; }
  .sb-nav a { justify-content: center; padding: 8px; position: relative; }
  .sb-nav a .badge { position: absolute; top: 2px; right: 2px; }
  .sb-user { justify-content: center; padding: 10px 8px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1fr; }
  .topbar-search { display: none; }
  .auth-right { width: 420px; }
}

@media (max-width: 820px) {
  .auth-wrap { flex-direction: column; }
  .auth-left {
    flex: 0 0 auto;
    padding: 24px 24px 18px;
    background: transparent;
  }
  .auth-tagline { display: none; }
  .auth-foot { display: none; }
  .auth-right {
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    padding: 22px 22px 28px;
    border-radius: 14px 14px 0 0;
    flex: 1;
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .sidebar { display: none; }
  .topbar { padding: 0 12px; gap: 8px; }
  .launcher-btn span { display: none; }
  .content { padding: 12px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .page-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .page-head-actions { flex-wrap: wrap; width: 100%; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi .value { font-size: 18px; }
  .filters { flex-direction: column; align-items: stretch; gap: 6px; }
  .filters > * { width: 100%; }
  table.tbl { font-size: 11.5px; }
  table.tbl th, table.tbl td { padding: 6px 8px; }

  /* Auth on phones */
  .auth-right { padding: 18px 16px 24px; }
  .auth-right h3 { font-size: 18px; }
  .auth-right .sub { font-size: 12.5px; margin-bottom: 16px; }
  .auth-form { gap: 12px; }
  /* Touch-friendly minimum */
  .auth-form .input { height: 42px; font-size: 14px; }
  .btn-lg { height: 44px; font-size: 14px; }
  .otp-row { gap: 6px; }
  .otp-box { width: 14vw; max-width: 48px; min-width: 38px; height: 54px; font-size: 22px; }
  .auth-logo-text { font-size: 14px; }
}

@media (max-width: 380px) {
  .otp-box { font-size: 20px; height: 50px; }
  .auth-left { padding: 18px 16px 12px; }
}

/* Reduce motion preference */
@media (prefers-reduced-motion: reduce) {
  .spin { animation: none; }
  .splash .dot { animation: none; }
  * { transition: none !important; }
}

