/* ===============================================================
   NEXUS — Business Dashboard
   Design system + layout + components
   =============================================================== */

/* ---------- Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=Inter:wght@400;500;600&display=swap');

/* ---------- Tokens ---------- */
:root {
  --font-display: 'Plus Jakarta Sans', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;

  /* brand */
  --brand: #6c5ce7;
  --brand-2: #a78bfa;
  --brand-grad: linear-gradient(135deg, #6c5ce7 0%, #8b7cf6 60%, #a78bfa 100%);
  --accent: #00d4ff;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --pink: #ec4899;

  --radius: 18px;
  --radius-sm: 12px;
  --radius-lg: 26px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.06);
  --shadow: 0 10px 30px -12px rgba(20,20,50,.25);
  --shadow-lg: 0 30px 60px -20px rgba(20,20,50,.35);
  --ring: 0 0 0 4px color-mix(in srgb, var(--brand) 22%, transparent);
  --tr: .28s cubic-bezier(.4,0,.2,1);

  --sidebar-w: 264px;
  --sidebar-w-collapsed: 82px;
}

/* ---------- Dark theme (default) ---------- */
[data-theme="dark"] {
  --bg: #0b0d1a;
  --bg-grad: radial-gradient(1200px 600px at 80% -10%, rgba(108,92,231,.18), transparent 60%),
             radial-gradient(1000px 500px at -10% 10%, rgba(0,212,255,.10), transparent 55%);
  --surface: #12142400;
  --card: rgba(255,255,255,.035);
  --card-solid: #151827;
  --card-border: rgba(255,255,255,.08);
  --elevated: #1a1d30;
  --text: #eef0fb;
  --text-dim: #9aa0bf;
  --text-mute: #6b7099;
  --line: rgba(255,255,255,.08);
  --hover: rgba(255,255,255,.05);
  --glass-blur: saturate(140%) blur(16px);
  color-scheme: dark;
}

/* ---------- Light theme ---------- */
[data-theme="light"] {
  --bg: #f4f5fb;
  --bg-grad: radial-gradient(1200px 600px at 85% -15%, rgba(108,92,231,.14), transparent 60%),
             radial-gradient(900px 500px at -10% 5%, rgba(0,212,255,.10), transparent 55%);
  --surface: #ffffff00;
  --card: rgba(255,255,255,.75);
  --card-solid: #ffffff;
  --card-border: rgba(20,20,60,.07);
  --elevated: #ffffff;
  --text: #1a1c31;
  --text-dim: #5b6183;
  --text-mute: #9096b5;
  --line: rgba(20,20,60,.08);
  --hover: rgba(20,20,60,.04);
  --glass-blur: saturate(160%) blur(14px);
  --shadow: 0 12px 34px -14px rgba(60,60,120,.22);
  color-scheme: light;
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input { font: inherit; }
h1,h2,h3,h4 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 20px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-mute); background-clip: content-box; }

/* ===============================================================
   Splash
   =============================================================== */
.splash {
  position: fixed; inset: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px;
  background: var(--bg); background-image: var(--bg-grad);
  transition: opacity .5s ease, visibility .5s;
}
.splash.hide { opacity: 0; visibility: hidden; }
.splash-logo { display: flex; align-items: center; gap: 14px; color: var(--brand-2); font-family: var(--font-display); font-weight: 800; font-size: 30px; letter-spacing: .12em; }
.splash-logo svg { animation: float 2.4s ease-in-out infinite; }
.splash-bar { width: 190px; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.splash-bar span { display: block; height: 100%; width: 40%; border-radius: 4px; background: linear-gradient(90deg, var(--brand), var(--accent)); animation: load 1.1s ease-in-out infinite; }
@keyframes load { 0% { transform: translateX(-120%);} 100% { transform: translateX(360%);} }
@keyframes float { 0%,100% { transform: translateY(0);} 50% { transform: translateY(-8px);} }

/* ===============================================================
   Layout
   =============================================================== */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; transition: grid-template-columns var(--tr); }
.app.collapsed { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

/* ===============================================================
   Sidebar
   =============================================================== */
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: 20px 16px; gap: 8px;
  background: var(--card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--card-border);
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 16px; }
.brand-mark {
  display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 42px;
  border-radius: 13px; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 8px 20px -6px var(--brand);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; overflow: hidden; white-space: nowrap; }
.brand-text strong { font-family: var(--font-display); font-size: 18px; font-weight: 800; }
.brand-text small { color: var(--text-mute); font-size: 11.5px; letter-spacing: .04em; }
.sidebar-collapse { margin-left: auto; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; color: var(--text-dim); transition: var(--tr); }
.sidebar-collapse:hover { background: var(--hover); color: var(--text); }

.nav { display: flex; flex-direction: column; gap: 3px; overflow-y: auto; flex: 1; padding-right: 2px; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em; color: var(--text-mute); font-weight: 600; padding: 14px 12px 6px; white-space: nowrap; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 13px;
  padding: 11px 12px; border-radius: 12px; color: var(--text-dim);
  font-weight: 500; font-size: 14.5px; white-space: nowrap; transition: var(--tr);
}
.nav-item:hover { background: var(--hover); color: var(--text); }
.nav-item .ni-icon { flex: 0 0 22px; height: 22px; display: grid; place-items: center; }
.nav-item .ni-icon svg { width: 21px; height: 21px; }
.nav-item.active { color: #fff; background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 60%, var(--accent))); box-shadow: 0 10px 24px -10px var(--brand); }
.nav-item.active::before { content: ""; position: absolute; left: -16px; top: 50%; transform: translateY(-50%); width: 4px; height: 22px; border-radius: 4px; background: var(--brand-2); }
.ni-badge { margin-left: auto; font-size: 11px; font-weight: 700; background: var(--danger); color: #fff; padding: 1px 7px; border-radius: 20px; }
.nav-item.active .ni-badge { background: rgba(255,255,255,.25); }

.sidebar-foot { display: flex; flex-direction: column; gap: 14px; padding-top: 8px; }
.upgrade-card {
  position: relative; overflow: hidden; border-radius: 16px; padding: 16px;
  background: linear-gradient(150deg, var(--brand), #4b3fb8);
  color: #fff; box-shadow: var(--shadow);
}
.upgrade-card strong { font-family: var(--font-display); font-size: 15px; }
.upgrade-card p { font-size: 12px; opacity: .82; margin: 4px 0 12px; line-height: 1.4; }
.uc-glow { position: absolute; width: 120px; height: 120px; border-radius: 50%; background: var(--accent); filter: blur(40px); opacity: .5; top: -40px; right: -30px; }
.user-chip { display: flex; align-items: center; gap: 11px; padding: 8px; border-radius: 14px; transition: var(--tr); }
.user-chip:hover { background: var(--hover); }
.user-chip img { width: 40px; height: 40px; border-radius: 11px; }
.uc-info { display: flex; flex-direction: column; line-height: 1.2; overflow: hidden; white-space: nowrap; }
.uc-info strong { font-size: 14px; }
.uc-info small { color: var(--text-mute); font-size: 12px; }

/* Collapsed state */
.app.collapsed .brand-text,
.app.collapsed .nav-item .ni-text,
.app.collapsed .ni-badge,
.app.collapsed .nav-label,
.app.collapsed .upgrade-card,
.app.collapsed .uc-info { display: none; }
.app.collapsed .brand { justify-content: center; }
.app.collapsed .sidebar-collapse { transform: rotate(180deg); }
.app.collapsed .nav-item { justify-content: center; padding: 12px; }
.app.collapsed .user-chip { justify-content: center; }

/* ===============================================================
   Main / Topbar
   =============================================================== */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 16px;
  padding: 16px 26px;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--line);
}
.menu-toggle { display: none; }
.page-title h1 { font-size: 21px; }
.page-title p { font-size: 12.5px; color: var(--text-mute); margin-top: 1px; }

.search { position: relative; margin-left: 12px; flex: 1; max-width: 420px; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-mute); }
.search input {
  width: 100%; padding: 11px 14px 11px 42px; border-radius: 13px;
  background: var(--card); border: 1px solid var(--card-border); color: var(--text);
  transition: var(--tr); outline: none;
}
.search input:focus { border-color: var(--brand); box-shadow: var(--ring); }
.search input::placeholder { color: var(--text-mute); }

.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.icon-btn {
  position: relative; display: grid; place-items: center; width: 42px; height: 42px;
  border-radius: 12px; color: var(--text-dim); background: var(--card); border: 1px solid var(--card-border); transition: var(--tr);
}
.icon-btn:hover { color: var(--text); transform: translateY(-2px); box-shadow: var(--shadow); }
.icon-btn.has-dot::after { content: ""; position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--bg); }
#themeToggle .ic-sun { display: none; }
[data-theme="light"] #themeToggle .ic-moon { display: none; }
[data-theme="light"] #themeToggle .ic-sun { display: block; }

/* ===============================================================
   Buttons
   =============================================================== */
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 11px 18px; border-radius: 12px; font-weight: 600; font-family: var(--font-display);
  font-size: 14px; transition: var(--tr); white-space: nowrap;
}
.btn-sm { padding: 9px 14px; font-size: 13px; }
.btn-primary { background: linear-gradient(135deg, var(--brand), color-mix(in srgb, var(--brand) 55%, var(--accent))); color: #fff; box-shadow: 0 12px 24px -10px var(--brand); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 30px -10px var(--brand); }
.btn-light { background: #fff; color: var(--brand); }
.btn-light:hover { transform: translateY(-2px); }
.btn-ghost { background: var(--card); border: 1px solid var(--card-border); color: var(--text-dim); }
.btn-ghost:hover { color: var(--text); background: var(--hover); }

/* ===============================================================
   Views + animations
   =============================================================== */
.views { padding: 26px; }
.view { display: none; }
.view.active { display: block; animation: viewIn .5s cubic-bezier(.2,.7,.3,1); }
@keyframes viewIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* staggered reveal for cards */
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
.reveal { opacity: 0; animation: rise .55s cubic-bezier(.2,.7,.3,1) forwards; }

.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 4px 0 18px; flex-wrap: wrap; }
.section-head h2 { font-size: 18px; }
.section-head .sub { color: var(--text-mute); font-size: 13px; margin-top: 2px; }

/* ---------- Grid ---------- */
.grid { display: grid; gap: 20px; }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.col-2 { grid-column: span 2; }
.col-3 { grid-column: span 3; }

/* ---------- Card ---------- */
.card {
  position: relative; background: var(--card); border: 1px solid var(--card-border);
  border-radius: var(--radius); padding: 22px;
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  box-shadow: var(--shadow-sm); transition: transform var(--tr), box-shadow var(--tr), border-color var(--tr);
}
.card:hover { box-shadow: var(--shadow); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.card-head h3 { font-size: 15.5px; }
.card-head .sub { color: var(--text-mute); font-size: 12.5px; margin-top: 2px; }

/* ---------- KPI / Stat cards ---------- */
.stat { overflow: hidden; }
.stat::after { content:""; position:absolute; inset:0; border-radius: inherit; padding:1px; background: linear-gradient(135deg, transparent, color-mix(in srgb, var(--k) 40%, transparent)); -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; opacity:.5; pointer-events:none; }
.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.stat-ic { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; color: var(--k); background: color-mix(in srgb, var(--k) 15%, transparent); }
.stat-ic svg { width: 24px; height: 24px; }
.stat-val { font-family: var(--font-display); font-size: 30px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.stat-label { color: var(--text-dim); font-size: 13.5px; margin-top: 7px; }
.trend { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 700; padding: 4px 9px; border-radius: 20px; }
.trend.up { color: var(--success); background: color-mix(in srgb, var(--success) 14%, transparent); }
.trend.down { color: var(--danger); background: color-mix(in srgb, var(--danger) 14%, transparent); }
.stat-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.spark { width: 84px; height: 34px; }

/* ---------- Chart area ---------- */
.chart-wrap { width: 100%; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 14px; }
.lg { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-dim); }
.lg .dot { width: 9px; height: 9px; border-radius: 3px; }
.chip-row { display: inline-flex; background: var(--card); border: 1px solid var(--card-border); border-radius: 11px; padding: 3px; gap: 2px; }
.chip { padding: 6px 13px; border-radius: 8px; font-size: 12.5px; font-weight: 600; color: var(--text-dim); transition: var(--tr); }
.chip.active { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }

svg .grid-line { stroke: var(--line); stroke-width: 1; }
svg .axis-label { fill: var(--text-mute); font-size: 11px; font-family: var(--font-body); }
.bar { transition: opacity .2s; cursor: pointer; }
.bar:hover { opacity: .82; }
.dot-pt { cursor: pointer; transition: r .2s; }

/* line draw animation */
.line-path { stroke-dasharray: 2000; stroke-dashoffset: 2000; animation: draw 1.6s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes growBar { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.bar-anim { transform-box: fill-box; transform-origin: bottom; animation: growBar .9s cubic-bezier(.2,.8,.2,1) both; }

/* donut */
.donut-center { text-align: center; }
.donut-center .dv { font-family: var(--font-display); font-weight: 800; font-size: 26px; }
.donut-center .dl { color: var(--text-mute); font-size: 12px; }
.donut-seg { transition: stroke-width .25s, opacity .25s; cursor: pointer; }
.donut-seg:hover { stroke-width: 26; }

/* ---------- Lists / progress ---------- */
.rank-row { display: flex; align-items: center; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.rank-row:last-child { border-bottom: none; }
.rank-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; flex: 0 0 42px; background: var(--hover); }
.rank-main { flex: 1; min-width: 0; }
.rank-main strong { font-size: 14px; display: block; }
.rank-main small { color: var(--text-mute); font-size: 12px; }
.rank-val { font-family: var(--font-display); font-weight: 700; font-size: 14.5px; }
.progress { height: 7px; border-radius: 20px; background: var(--hover); overflow: hidden; margin-top: 7px; }
.progress span { display: block; height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--brand), var(--accent)); transform-origin: left; animation: growX 1.1s cubic-bezier(.2,.8,.2,1) both; }
@keyframes growX { from { transform: scaleX(0);} to { transform: scaleX(1);} }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; padding: 12px 14px; color: var(--text-mute); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr { transition: background var(--tr); }
.tbl tbody tr:hover { background: var(--hover); }
.tbl tbody tr:last-child td { border-bottom: none; }
.cell-user { display: flex; align-items: center; gap: 11px; }
.avatar { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px; flex: 0 0 36px; }
.cell-user small { color: var(--text-mute); display: block; font-size: 12px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge::before { content:""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { color: var(--success); background: color-mix(in srgb, var(--success) 13%, transparent); }
.badge.pend { color: var(--warning); background: color-mix(in srgb, var(--warning) 13%, transparent); }
.badge.fail { color: var(--danger); background: color-mix(in srgb, var(--danger) 13%, transparent); }
.badge.info { color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, transparent); }

.tbl-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.tbl-search { position: relative; flex: 1; min-width: 180px; max-width: 280px; }
.tbl-search input { width: 100%; padding: 9px 12px 9px 34px; border-radius: 10px; background: var(--card); border: 1px solid var(--card-border); color: var(--text); outline: none; }
.tbl-search input:focus { border-color: var(--brand); box-shadow: var(--ring); }
.tbl-search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-mute); }
.iconlink { color: var(--text-mute); display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; transition: var(--tr); }
.iconlink:hover { color: var(--text); background: var(--hover); }

/* pagination */
.pager { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; gap: 12px; flex-wrap: wrap; }
.pager .pages { display: flex; gap: 5px; }
.pg { min-width: 34px; height: 34px; padding: 0 8px; border-radius: 9px; display: grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--text-dim); border: 1px solid var(--card-border); transition: var(--tr); }
.pg:hover { background: var(--hover); color: var(--text); }
.pg.active { background: var(--brand); color: #fff; border-color: transparent; }
.pg:disabled { opacity: .4; cursor: not-allowed; }

/* ---------- Misc widgets ---------- */
.mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mini { background: var(--card); border: 1px solid var(--card-border); border-radius: 14px; padding: 14px; }
.mini .mv { font-family: var(--font-display); font-weight: 800; font-size: 20px; }
.mini .ml { color: var(--text-mute); font-size: 12px; margin-top: 3px; }

.activity { display: flex; gap: 13px; padding: 12px 0; position: relative; }
.activity:not(:last-child)::before { content:""; position: absolute; left: 15px; top: 38px; bottom: -6px; width: 2px; background: var(--line); }
.act-dot { width: 32px; height: 32px; flex: 0 0 32px; border-radius: 50%; display: grid; place-items: center; color: #fff; z-index: 1; }
.act-body strong { font-size: 13.5px; }
.act-body p { color: var(--text-dim); font-size: 12.5px; margin-top: 2px; }
.act-body time { color: var(--text-mute); font-size: 11.5px; }

.goal-ring { display: flex; align-items: center; gap: 18px; }
.tag { font-size: 11.5px; font-weight: 600; padding: 4px 10px; border-radius: 8px; background: var(--hover); color: var(--text-dim); }

.seg-tabs { display: inline-flex; gap: 4px; background: var(--card); border: 1px solid var(--card-border); border-radius: 12px; padding: 4px; }
.seg-tabs button { padding: 8px 16px; border-radius: 9px; font-weight: 600; font-size: 13px; color: var(--text-dim); transition: var(--tr); }
.seg-tabs button.active { background: var(--brand); color: #fff; }

/* settings */
.form-row { display: grid; grid-template-columns: 200px 1fr; gap: 20px; padding: 18px 0; border-bottom: 1px solid var(--line); align-items: center; }
.form-row:last-child { border-bottom: none; }
.form-row label strong { display: block; font-size: 14px; }
.form-row label small { color: var(--text-mute); font-size: 12.5px; }
.input, .select { width: 100%; padding: 11px 14px; border-radius: 11px; background: var(--card); border: 1px solid var(--card-border); color: var(--text); outline: none; transition: var(--tr); }
.input:focus, .select:focus { border-color: var(--brand); box-shadow: var(--ring); }
.switch { position: relative; width: 48px; height: 27px; border-radius: 20px; background: var(--line); transition: var(--tr); flex: 0 0 48px; }
.switch::after { content:""; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%; background: #fff; transition: var(--tr); box-shadow: var(--shadow-sm); }
.switch.on { background: var(--brand); }
.switch.on::after { left: 24px; }
.avatar-lg { width: 72px; height: 72px; border-radius: 20px; }

/* ---------- Drawer / notifications ---------- */
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 380px; max-width: 90vw; z-index: 60;
  background: var(--card-solid); border-left: 1px solid var(--card-border);
  transform: translateX(100%); transition: transform .35s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
}
.drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 20px; border-bottom: 1px solid var(--line); font-family: var(--font-display); font-size: 16px; }
.drawer-body { overflow-y: auto; padding: 8px 12px; }
.notif-item { display: flex; gap: 12px; padding: 13px; border-radius: 12px; transition: var(--tr); cursor: pointer; }
.notif-item:hover { background: var(--hover); }
.notif-item .ni { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 11px; display: grid; place-items: center; color: #fff; }
.notif-item strong { font-size: 13.5px; }
.notif-item p { font-size: 12.5px; color: var(--text-dim); margin-top: 2px; }
.notif-item time { font-size: 11px; color: var(--text-mute); }
.scrim { position: fixed; inset: 0; background: rgba(5,6,15,.5); backdrop-filter: blur(2px); opacity: 0; visibility: hidden; transition: var(--tr); z-index: 50; }
.scrim.show { opacity: 1; visibility: visible; }

/* ---------- Toast ---------- */
.toast-host { position: fixed; bottom: 22px; right: 22px; z-index: 90; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-radius: 14px;
  background: var(--card-solid); border: 1px solid var(--card-border); box-shadow: var(--shadow-lg);
  min-width: 260px; animation: toastIn .4s cubic-bezier(.2,.8,.2,1);
}
.toast.out { animation: toastOut .3s forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px);} to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px);} }
.toast .ti { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; }
.toast strong { font-size: 13.5px; }
.toast small { font-size: 12px; color: var(--text-dim); display: block; }

/* tooltip for charts */
.chart-tip { position: fixed; z-index: 80; pointer-events: none; background: var(--card-solid); border: 1px solid var(--card-border); padding: 8px 12px; border-radius: 10px; font-size: 12.5px; box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(4px); transition: opacity .15s, transform .15s; white-space: nowrap; }
.chart-tip.show { opacity: 1; transform: none; }
.chart-tip b { font-family: var(--font-display); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .g-4 { grid-template-columns: repeat(2, 1fr); }
  .g-3 { grid-template-columns: 1fr; }
  .col-2, .col-3 { grid-column: span 2; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: var(--sidebar-w); transform: translateX(-105%); transition: transform var(--tr); }
  .app.nav-open .sidebar { transform: none; }
  .menu-toggle { display: grid; }
  .search { display: none; }
  .app.collapsed { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .g-4, .g-2 { grid-template-columns: 1fr; }
  .col-2, .col-3 { grid-column: span 1; }
  .views, .topbar { padding-left: 16px; padding-right: 16px; }
  .btn-primary span { display: none; }
  .form-row { grid-template-columns: 1fr; gap: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
