/* CustomGlide CRM design system */
:root {
  --bg: #f4f5fb;
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --border: #e7e9f2;
  --border-strong: #d6d9e8;
  --text: #1a1c2b;
  --text-2: #5b6079;
  --text-3: #8a8fa8;
  --primary: #4f46e5;
  --primary-600: #4338ca;
  --primary-soft: #eef0fe;
  --success: #10b981;
  --success-soft: #e6f8f1;
  --warning: #f59e0b;
  --warning-soft: #fff5e5;
  --danger: #ef4444;
  --danger-soft: #fdeaea;
  --info: #0ea5e9;
  --info-soft: #e6f6fe;
  --purple: #8b5cf6;
  --pink: #ec4899;
  --shadow-sm: 0 1px 2px rgba(20, 22, 45, .06), 0 1px 3px rgba(20, 22, 45, .04);
  --shadow: 0 4px 12px rgba(20, 22, 45, .08);
  --shadow-lg: 0 20px 45px rgba(20, 22, 45, .18);
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar-w: 250px;
  --sidebar-w-collapsed: 74px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
:root[data-theme="dark"] {
  --bg: #0e1020;
  --surface: #171a2e;
  --surface-2: #1e2136;
  --border: #2a2e48;
  --border-strong: #363b5c;
  --text: #eef0f8;
  --text-2: #a6acce;
  --text-3: #737a9c;
  --primary: #6366f1;
  --primary-600: #818cf8;
  --primary-soft: #232649;
  --success-soft: #14342a;
  --warning-soft: #362a12;
  --danger-soft: #3a1f22;
  --info-soft: #123040;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow: 0 6px 18px rgba(0,0,0,.35);
  --shadow-lg: 0 24px 55px rgba(0,0,0,.55);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  padding: 9px 15px; border-radius: var(--radius-sm); font-weight: 600; font-size: 13.5px;
  transition: all .15s ease; white-space: nowrap; box-shadow: var(--shadow-sm);
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(79,70,229,.28); }
.btn-primary:hover { background: var(--primary-600); border-color: var(--primary-600); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { color: var(--danger); border-color: var(--border); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-lg { padding: 12px 20px; font-size: 15px; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 11px; border: 1px solid transparent; background: transparent; font-size: 18px;
  color: var(--text-2); transition: all .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ---------- Login ---------- */
.login-screen { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.login-card {
  display: flex; flex-direction: column; justify-content: center;
  padding: 6vh 8% ; max-width: 520px; margin: 0 auto; width: 100%;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 42px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: linear-gradient(135deg, #6366f1, #4f46e5); color: #fff; font-weight: 800; font-size: 17px;
  box-shadow: 0 6px 16px rgba(79,70,229,.35); flex: none;
}
.brand-name { font-weight: 800; font-size: 19px; letter-spacing: -.4px; }
.brand-name span { color: var(--primary); }
.brand-tag { font-size: 11px; color: var(--text-3); font-weight: 600; letter-spacing: .3px; text-transform: uppercase; }
.login-card h1 { font-size: 30px; letter-spacing: -.6px; margin-bottom: 6px; }
.login-sub { color: var(--text-2); margin-bottom: 30px; }
.login-form { display: flex; flex-direction: column; gap: 16px; }
.login-form label { display: flex; flex-direction: column; gap: 7px; font-weight: 600; font-size: 13px; color: var(--text-2); }
.login-form input {
  padding: 12px 14px; border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--surface); color: var(--text);
}
.login-form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.login-hint { margin-top: 22px; font-size: 12.5px; color: var(--text-3); text-align: center; }
.login-aside {
  background: linear-gradient(150deg, #4f46e5 0%, #7c3aed 55%, #db2777 130%);
  color: #fff; display: flex; align-items: center; padding: 6vh 6%;
  position: relative; overflow: hidden;
}
.login-aside::before, .login-aside::after {
  content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,.09);
}
.login-aside::before { width: 420px; height: 420px; top: -120px; right: -120px; }
.login-aside::after { width: 300px; height: 300px; bottom: -100px; left: -80px; }
.login-aside-inner { position: relative; z-index: 1; max-width: 440px; }
.login-aside h2 { font-size: 30px; line-height: 1.25; letter-spacing: -.6px; margin-bottom: 30px; font-weight: 800; }
.login-aside ul { list-style: none; display: flex; flex-direction: column; gap: 18px; }
.login-aside li { display: flex; align-items: center; gap: 14px; font-size: 15.5px; font-weight: 500; }
.login-aside li span { font-size: 22px; width: 44px; height: 44px; background: rgba(255,255,255,.14); border-radius: 12px; display: grid; place-items: center; flex: none; }
.login-aside-foot { margin-top: 38px; font-size: 13px; opacity: .8; line-height: 1.6; }
@media (max-width: 900px) { .login-aside { display: none; } .login-screen { grid-template-columns: 1fr; } }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; transition: width .2s ease; z-index: 40;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 20px 14px 20px 16px; position: relative; }
.sidebar-brand .brand-mark { width: 36px; height: 36px; font-size: 15px; }
.sidebar-brand .brand-name { font-size: 15px; letter-spacing: -.5px; white-space: nowrap; overflow: hidden; }
.sidebar-collapse {
  margin-left: auto; width: 24px; height: 24px; flex: none; border-radius: 7px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text-3); font-size: 12px; line-height: 1;
}
.sidebar-collapse:hover { color: var(--text); }
.nav { flex: 1; padding: 8px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.nav-section { font-size: 10.5px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--text-3); padding: 16px 12px 6px; white-space: nowrap; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--text-2); font-weight: 600; font-size: 14px; white-space: nowrap; transition: all .13s; border: 1px solid transparent;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); }
.nav-item .nav-ico { width: 22px; text-align: center; font-size: 17px; flex: none; }
.nav-item .nav-badge { margin-left: auto; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 20px; }
.sidebar-foot { padding: 14px 12px; border-top: 1px solid var(--border); }
.reset-btn { width: 100%; text-align: left; padding: 9px 12px; border-radius: 9px; background: transparent; border: 1px solid var(--border); color: var(--text-3); font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.reset-btn:hover { color: var(--danger); border-color: var(--danger); }

/* collapsed sidebar */
.sidebar.collapsed { width: var(--sidebar-w-collapsed); }
.sidebar.collapsed .brand-name, .sidebar.collapsed .nav-section, .sidebar.collapsed .nav-item span:not(.nav-ico):not(.nav-badge), .sidebar.collapsed .reset-btn { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; }
.sidebar.collapsed .sidebar-collapse { transform: rotate(180deg); }
.sidebar.collapsed .nav-badge { position: absolute; margin: 0; transform: translate(14px,-12px); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---------- Topbar ---------- */
.topbar {
  height: 66px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 22px; position: sticky; top: 0; z-index: 30;
}
.menu-toggle { display: none; }
.global-search { position: relative; flex: 1; max-width: 460px; }
.global-search .gs-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 14px; opacity: .6; }
.global-search input {
  width: 100%; padding: 10px 14px 10px 40px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text);
}
.global-search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); background: var(--surface); }
.gs-results {
  position: absolute; top: 48px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lg); overflow: hidden; z-index: 50; display: none; max-height: 380px; overflow-y: auto;
}
.gs-results.show { display: block; }
.gs-group-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-3); padding: 12px 14px 4px; }
.gs-item { display: flex; align-items: center; gap: 11px; padding: 9px 14px; cursor: pointer; }
.gs-item:hover { background: var(--surface-2); }
.gs-item-title { font-weight: 600; }
.gs-item-sub { font-size: 12px; color: var(--text-3); }
.gs-empty { padding: 20px; text-align: center; color: var(--text-3); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg,#8b5cf6,#ec4899); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }

/* ---------- View / page ---------- */
.view { padding: 26px 28px 60px; flex: 1; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.page-title { font-size: 25px; font-weight: 800; letter-spacing: -.6px; }
.page-sub { color: var(--text-2); margin-top: 3px; font-size: 14px; }
.page-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- Cards & grid ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 15.5px; font-weight: 700; }
.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2,1fr); } .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 720px) { .grid-4, .grid-2 { grid-template-columns: 1fr; } }

/* KPI stat cards */
.stat { position: relative; overflow: hidden; }
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; }
.stat-label { color: var(--text-2); font-weight: 600; font-size: 13px; margin-top: 16px; }
.stat-value { font-size: 27px; font-weight: 800; letter-spacing: -.8px; margin-top: 3px; font-variant-numeric: tabular-nums; }
.tabnum, .stat-value, .dc-val, .kcol-sum, .fn-val, td .money, .kpi-num { font-variant-numeric: tabular-nums; }
.stat-delta { font-size: 12.5px; font-weight: 700; margin-top: 8px; display: inline-flex; align-items: center; gap: 4px; }
.stat-delta.up { color: var(--success); }
.stat-delta.down { color: var(--danger); }
.stat-delta .muted { color: var(--text-3); font-weight: 500; }

/* ---------- Badges / pills ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.no-dot::before { display: none; }
.b-green { background: var(--success-soft); color: #0f9d63; }
.b-red { background: var(--danger-soft); color: #d33; }
.b-amber { background: var(--warning-soft); color: #c47d09; }
.b-blue { background: var(--info-soft); color: #0b83bd; }
.b-purple { background: #f1ecfe; color: #7c3aed; }
.b-gray { background: var(--surface-2); color: var(--text-2); }
:root[data-theme="dark"] .b-purple { background: #241a44; color: #a78bfa; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; }
table.data th {
  text-align: left; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  color: var(--text-3); padding: 13px 18px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2);
}
table.data td { padding: 14px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tbody tr:last-child td, table.data tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background .12s; cursor: pointer; }
table.data tbody tr:hover { background: var(--surface-2); }
.cell-main { font-weight: 600; }
.cell-sub { font-size: 12px; color: var(--text-3); }
.avatar-cell { display: flex; align-items: center; gap: 11px; }
.mini-avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 12px; flex: none; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; opacity: 0; transition: opacity .12s; }
tr:hover .row-actions { opacity: 1; }

/* toolbar above tables */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.search-box { position: relative; flex: 1; min-width: 200px; max-width: 340px; }
.search-box input { width: 100%; padding: 9px 12px 9px 36px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); }
.search-box input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.search-box::before { content: "🔍"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); font-size: 13px; opacity: .5; }
.select { padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font-weight: 600; }
.select:focus { outline: none; border-color: var(--primary); }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: none; background: transparent; padding: 7px 14px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--text-2); }
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

/* ---------- Kanban pipeline ---------- */
.kanban { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.kcol { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); width: 290px; flex: none; display: flex; flex-direction: column; max-height: calc(100vh - 210px); }
.kcol-head { padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; }
.kcol-head .kc-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; }
.kc-dot { width: 9px; height: 9px; border-radius: 50%; }
.kcol-head .kc-count { background: var(--surface); border: 1px solid var(--border); color: var(--text-2); border-radius: 20px; padding: 1px 9px; font-size: 11.5px; font-weight: 700; }
.kcol-sum { padding: 0 16px 10px; font-size: 12.5px; color: var(--text-3); font-weight: 600; }
.kcol-body { padding: 4px 12px 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; flex: 1; min-height: 60px; }
.kcol-body.drag-over { background: var(--primary-soft); border-radius: 10px; outline: 2px dashed var(--primary); outline-offset: -6px; }
.deal-card { background: var(--surface); border: 1px solid var(--border); border-radius: 11px; padding: 13px; box-shadow: var(--shadow-sm); cursor: grab; transition: box-shadow .13s, transform .05s; }
.deal-card:hover { box-shadow: var(--shadow); }
.deal-card:active { cursor: grabbing; }
.deal-card.dragging { opacity: .5; }
.deal-card .dc-name { font-weight: 700; font-size: 13.5px; }
.deal-card .dc-co { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.deal-card .dc-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 11px; }
.deal-card .dc-val { font-weight: 800; font-size: 14.5px; }
.dc-meta { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 11.5px; color: var(--text-3); }
.prob-bar { height: 5px; border-radius: 4px; background: var(--surface-2); overflow: hidden; margin-top: 10px; }
.prob-bar i { display: block; height: 100%; border-radius: 4px; background: var(--primary); }

/* ---------- Detail / two-column ---------- */
.detail-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; align-items: start; }
@media (max-width: 950px) { .detail-grid { grid-template-columns: 1fr; } }
.field-row { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.field-row:last-child { border-bottom: none; }
.field-row .fl { color: var(--text-3); font-weight: 600; font-size: 13px; }
.field-row .fv { font-weight: 600; text-align: right; }
.record-hero { display: flex; align-items: center; gap: 16px; }
.record-hero .mini-avatar { width: 56px; height: 56px; font-size: 18px; border-radius: 15px; }
.record-hero h2 { font-size: 21px; font-weight: 800; letter-spacing: -.4px; }
.chips { display: flex; gap: 7px; flex-wrap: wrap; }

/* timeline */
.timeline { position: relative; padding-left: 6px; }
.tl-item { position: relative; padding: 0 0 20px 30px; }
.tl-item::before { content: ""; position: absolute; left: 8px; top: 22px; bottom: -2px; width: 2px; background: var(--border); }
.tl-item:last-child::before { display: none; }
.tl-dot { position: absolute; left: 0; top: 3px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 9px; color: #fff; }
.tl-title { font-weight: 600; }
.tl-time { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.tl-body { font-size: 13px; color: var(--text-2); margin-top: 5px; background: var(--surface-2); padding: 9px 12px; border-radius: 9px; }

/* ticket conversation */
.conv { display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; gap: 12px; }
.msg.out { flex-direction: row-reverse; }
.msg .bubble { max-width: 78%; background: var(--surface-2); padding: 11px 14px; border-radius: 14px; }
.msg.out .bubble { background: var(--primary); color: #fff; }
.msg .who { font-size: 11.5px; color: var(--text-3); margin-bottom: 4px; font-weight: 600; }
.msg.out .who { color: rgba(255,255,255,.8); text-align: right; }

/* progress + meters */
.meter { height: 8px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 6px; }
.funnel-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.funnel-row .fn-label { width: 120px; font-weight: 600; font-size: 13px; }
.funnel-row .fn-bar { flex: 1; height: 30px; background: var(--surface-2); border-radius: 8px; overflow: hidden; position: relative; }
.funnel-row .fn-fill { height: 100%; display: flex; align-items: center; padding-left: 12px; color: #fff; font-weight: 700; font-size: 12.5px; border-radius: 8px; }
.funnel-row .fn-val { width: 90px; text-align: right; font-weight: 700; }

/* empty state */
.empty { text-align: center; padding: 60px 20px; color: var(--text-3); }
.empty .ico { font-size: 42px; margin-bottom: 12px; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(15,17,35,.55); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; animation: fade .15s ease;
}
.modal {
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px;
  max-height: 92vh; display: flex; flex-direction: column; animation: pop .18s cubic-bezier(.2,.9,.3,1.2);
}
.modal.wide { max-width: 720px; }
.modal-head { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 18px; font-weight: 800; letter-spacing: -.3px; }
.modal-body { padding: 22px 24px; overflow-y: auto; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }

/* forms in modal */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: 12.5px; color: var(--text-2); }
.field input, .field select, .field textarea {
  padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); color: var(--text); width: 100%;
}
.field textarea { resize: vertical; min-height: 84px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }

/* ---------- Toast ---------- */
.toast-root { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--success); border-radius: 12px;
  box-shadow: var(--shadow-lg); padding: 13px 18px; min-width: 260px; display: flex; align-items: center; gap: 11px; animation: slideIn .22s ease;
}
.toast.err { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--info); }
.toast .t-ico { font-size: 18px; }
.toast .t-msg { font-weight: 600; font-size: 13.5px; }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } }

/* utility */
.flex { display: flex; }
.between { justify-content: space-between; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.text-2 { color: var(--text-2); } .text-3 { color: var(--text-3); }
.right { text-align: right; } .center { text-align: center; }
.wrap-actions { display: flex; gap: 6px; }
.tag-owner { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; }

/* chart bits */
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 14px; }
.chart-legend .lg { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.chart-legend .lg i { width: 11px; height: 11px; border-radius: 3px; }
.donut-center { text-align: center; }
.donut-center .dc-num { font-size: 26px; font-weight: 800; }
.donut-center .dc-lbl { font-size: 12px; color: var(--text-3); }

/* mobile */
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: inline-flex; }
  .view { padding: 18px 16px 50px; }
  .detail-grid { grid-template-columns: 1fr; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 39; }
}
