/* Meerana CRM: design tokens, light and dark themes, layout and components. */
:root {
  --brand: #0f8f86; --brand-600: #0b756e; --brand-50: #e3f6f4; --brand-100: #c3ece8; --on-brand: #ffffff;
  --accent: #14b8aa; --accent-2: #6fd8cf; --glow: rgba(20, 184, 170, .28);
  --bg: #f1f5f5; --surface: #ffffff; --surface-2: #f7fafa; --surface-3: #ebf1f1;
  --text: #13201f; --text-2: #3f5352; --muted: #6a7c7b; --border: #dfe8e7; --border-strong: #c7d5d3;
  --green: #2fb344; --green-bg: #e8f7eb; --red: #d63939; --red-bg: #fbebeb; --amber: #f59f00; --amber-bg: #fef4e1;
  --orange: #f76707; --orange-bg: #feefe5; --purple: #ae3ec9; --purple-bg: #f7ecfa; --cyan: #17a2b8; --cyan-bg: #e5f6f8;
  --blue: #0533BF; --blue-bg: #eef2fd; --gray-bg: #edf2f2; --teal: #0ca678; --teal-bg: #e3f7f1;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
  --radius: 10px; --radius-sm: 6px;
  --sidebar: 248px; --topbar: 60px;
  --font: Inter, "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  --chart-1: #0533BF; --chart-2: #2fb344; --chart-3: #f59f00; --chart-4: #ae3ec9; --chart-5: #17a2b8; --chart-6: #f76707; --chart-7: #d63939; --chart-8: #6b778c;
  color-scheme: light;
}
[data-theme="dark"] {
  --brand: #2ee6d6; --brand-600: #5ff0e3; --brand-50: #0f2a29; --brand-100: #154240; --on-brand: #04201e;
  --accent: #2ee6d6; --accent-2: #1fb5a8; --glow: rgba(46, 230, 214, .32);
  --bg: #0a0d0f; --surface: #121619; --surface-2: #161b1f; --surface-3: #1c2327;
  --text: #f1f5f5; --text-2: #b8c4c6; --muted: #7d8b8e; --border: #1f282c; --border-strong: #2c383d;
  --green: #4cc760; --green-bg: #14301c; --red: #f06565; --red-bg: #3a1a1d; --amber: #ffb733; --amber-bg: #3a2c0e;
  --orange: #ff8a3d; --orange-bg: #3b2312; --purple: #d07ae6; --purple-bg: #321a3b; --cyan: #4fc6d8; --cyan-bg: #12313a;
  --blue: #7d99ff; --blue-bg: #1b2550; --gray-bg: #232d42; --teal: #3ad3a4; --teal-bg: #10332a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
  --chart-1: #5b7fff; --chart-2: #4cc760; --chart-3: #ffb733; --chart-4: #d07ae6; --chart-5: #4fc6d8; --chart-6: #ff8a3d; --chart-7: #f06565; --chart-8: #8592a8;
  --gray-bg: #1c2327;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; font-weight: 600; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; } h4 { font-size: 13px; }
p { margin: 0 0 8px; }
small, .small { font-size: 12px; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.hidden { display: none !important; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 12px; }
.gap-sm { gap: 6px; } .gap-lg { gap: 20px; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; } .mt-sm { margin-top: 8px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
svg.i.sm { width: 15px; height: 15px; vertical-align: -3px; }
svg.i.lg { width: 22px; height: 22px; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; z-index: 40; transition: transform .2s; }
.sidebar .brand { height: var(--topbar); display: flex; align-items: center; padding: 0 18px; border-bottom: 1px solid var(--border); }
.brand-logo { height: 34px; width: auto; display: block; }
.brand-logo.dark { display: none; }
[data-theme="dark"] .brand-logo.light { display: none; }
[data-theme="dark"] .brand-logo.dark { display: block; }
.nav { overflow-y: auto; padding: 10px 10px 30px; flex: 1; scrollbar-width: thin; }
.nav-group { margin-top: 6px; }
.nav-group > button { all: unset; box-sizing: border-box; display: flex; width: 100%; align-items: center; justify-content: space-between; cursor: pointer; padding: 8px 10px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.nav-group > button svg { transition: transform .15s; }
.nav-group.closed > button svg { transform: rotate(-90deg); }
.nav-group.closed .nav-items { display: none; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--text-2); font-weight: 500; text-decoration: none; }
.nav a:hover { background: var(--surface-3); color: var(--text); }
.nav a.active { background: var(--brand-50); color: var(--brand); }
.nav a .count { margin-left: auto; background: var(--red); color: #fff; border-radius: 10px; font-size: 11px; padding: 0 6px; line-height: 18px; }
.main { flex: 1; margin-left: var(--sidebar); min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--topbar); background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; padding: 0 20px; }
.search { position: relative; flex: 1; max-width: 460px; }
.search input { width: 100%; padding-left: 36px; background: var(--surface-2); }
.search > svg { position: absolute; left: 11px; top: 10px; color: var(--muted); }
.search-results { position: absolute; top: 44px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); max-height: 420px; overflow: auto; z-index: 50; }
.search-results a { display: flex; justify-content: space-between; padding: 9px 14px; color: var(--text); border-bottom: 1px solid var(--border); }
.search-results a:hover, .search-results a.sel { background: var(--surface-3); text-decoration: none; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn { all: unset; position: relative; cursor: pointer; width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; color: var(--text-2); }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn .dot { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; font-size: 10px; line-height: 16px; text-align: center; background: var(--red); color: #fff; border-radius: 8px; }
.user-chip { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 8px 4px 4px; border-radius: 8px; }
.user-chip:hover { background: var(--surface-3); }
.content { padding: 22px 24px 60px; max-width: 1600px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .pretitle { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.menu-toggle { display: none; }
.demo-banner { background: var(--amber-bg); color: var(--text); border-bottom: 1px solid var(--border); padding: 7px 24px; font-size: 13px; display: flex; gap: 8px; align-items: center; }
.offline-banner { background: var(--red-bg); color: var(--red); padding: 6px 24px; font-size: 13px; }

/* ---------- avatar ---------- */
.avatar { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-size: 11px; font-weight: 600; flex: none; background: var(--muted); }
.avatar.sm { width: 22px; height: 22px; font-size: 9.5px; }
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.avatar-name { display: inline-flex; align-items: center; gap: 7px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); min-height: 52px; }
.card-head h3 { display: flex; align-items: center; gap: 8px; }
.card-body { padding: 16px 18px; }
.card-body.flush { padding: 0; }
.card-foot { padding: 10px 18px; border-top: 1px solid var(--border); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.g-1-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.span2 { grid-column: span 2; }
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; }
.kpi .label { color: var(--muted); font-size: 12.5px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.kpi .value { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
.kpi .sub { font-size: 12.5px; color: var(--text-2); }
.kpi .kpi-icon { position: absolute; right: 16px; top: 16px; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; }
.kpi a.stretch { position: absolute; inset: 0; }
.trend-up { color: var(--green); } .trend-down { color: var(--red); }
.tint-blue { background: var(--blue-bg); color: var(--blue); } .tint-green { background: var(--green-bg); color: var(--green); }
.tint-amber { background: var(--amber-bg); color: var(--amber); } .tint-red { background: var(--red-bg); color: var(--red); }
.tint-purple { background: var(--purple-bg); color: var(--purple); } .tint-cyan { background: var(--cyan-bg); color: var(--cyan); }
.tint-orange { background: var(--orange-bg); color: var(--orange); } .tint-teal { background: var(--teal-bg); color: var(--teal); }

/* ---------- buttons and forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: 500 13.5px var(--font); cursor: pointer; white-space: nowrap; text-decoration: none !important; }
.btn:hover { background: var(--surface-3); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primary:hover { background: var(--brand-600); }
.btn.danger { color: var(--red); }
.btn.danger.solid { background: var(--red); border-color: var(--red); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.xs { height: 24px; padding: 0 8px; font-size: 12px; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.btn-group .btn.on { background: var(--brand-50); color: var(--brand); border-color: var(--brand-100); z-index: 1; }
input, select, textarea { font: 14px var(--font); color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 7px 10px; min-height: 36px; width: 100%; outline: none; }
textarea { min-height: 80px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; min-height: 0; accent-color: var(--brand); padding: 0; }
input[type=color] { padding: 2px; height: 36px; }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); }
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 500; color: var(--text-2); min-width: 0; }
label.field.check { flex-direction: row; align-items: center; gap: 8px; font-size: 14px; color: var(--text); padding-top: 22px; }
.field .req { color: var(--red); }
.field .help { font-weight: 400; color: var(--muted); font-size: 12px; }
.field.error input, .field.error select, .field.error textarea { border-color: var(--red); }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .w2 { grid-column: span 2; } .form-grid .w4 { grid-column: 1 / -1; }
.form-section { margin-top: 22px; }
.form-section > h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.input-group { display: flex; } .input-group input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); } .input-group .btn { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-left: -1px; }
.lookup { position: relative; }
.lookup-list { position: absolute; z-index: 60; top: 100%; left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); max-height: 240px; overflow: auto; }
.lookup-list div { padding: 7px 10px; cursor: pointer; }
.lookup-list div:hover, .lookup-list div.sel { background: var(--brand-50); }
.tags-input { display: flex; flex-wrap: wrap; gap: 4px; }

/* ---------- badges and progress ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 20px; font-size: 11.5px; font-weight: 600; line-height: 18px; white-space: nowrap; background: var(--gray-bg); color: var(--text-2); }
.badge.blue { background: var(--blue-bg); color: var(--blue); } .badge.green { background: var(--green-bg); color: var(--green); }
.badge.red { background: var(--red-bg); color: var(--red); } .badge.amber { background: var(--amber-bg); color: #b07200; }
[data-theme="dark"] .badge.amber { color: var(--amber); }
.badge.purple { background: var(--purple-bg); color: var(--purple); } .badge.cyan { background: var(--cyan-bg); color: var(--cyan); }
.badge.orange { background: var(--orange-bg); color: var(--orange); } .badge.teal { background: var(--teal-bg); color: var(--teal); }
.dot-status { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.progress { height: 6px; background: var(--surface-3); border-radius: 4px; overflow: hidden; min-width: 60px; }
.progress > span { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.progress.green > span { background: var(--green); } .progress.amber > span { background: var(--amber); } .progress.red > span { background: var(--red); }
.progress-label { display: flex; align-items: center; gap: 8px; }
.progress-label .progress { flex: 1; }
.steps { display: flex; gap: 3px; }
.steps span { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-3); }
.steps span.on { background: var(--brand); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.t th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
.t th.sortable { cursor: pointer; user-select: none; }
.t th.sortable:hover { color: var(--text); }
.t td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.t tr:last-child td { border-bottom: 0; }
.t tbody tr:hover { background: var(--surface-2); }
.t tr.clickable { cursor: pointer; }
.t td.num, .t th.num { text-align: right; font-variant-numeric: tabular-nums; }
.t td.check, .t th.check { width: 36px; padding-right: 0; }
.t tfoot td { font-weight: 600; background: var(--surface-2); }
.t.compact td, .t.compact th { padding: 7px 12px; }
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty svg { width: 36px; height: 36px; margin-bottom: 8px; opacity: .6; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 13px; color: var(--muted); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.toolbar input[type=search] { max-width: 260px; }
.toolbar select { width: auto; min-width: 130px; }
.bulkbar { display: flex; gap: 8px; align-items: center; padding: 8px 16px; background: var(--brand-50); border-bottom: 1px solid var(--border); }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 11px 18px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item:hover { background: var(--surface-2); }
.list-item .meta { font-size: 12px; color: var(--muted); }
.prio { width: 4px; align-self: stretch; border-radius: 2px; flex: none; }
.prio.High { background: var(--red); } .prio.Medium { background: var(--amber); } .prio.Low { background: var(--green); }
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.tl-item { position: relative; padding-bottom: 14px; }
.tl-item::before { content: ""; position: absolute; left: -19px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); }
.tl-item .when { font-size: 12px; color: var(--muted); }

/* ---------- detail page ---------- */
.detail-head { display: flex; gap: 16px; align-items: flex-start; }
.detail-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); flex: none; }
.props { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; }
.prop { padding: 10px 18px; border-bottom: 1px solid var(--border); min-width: 0; }
.prop .k { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.prop .v { word-break: break-word; }
.prop.w4 { grid-column: 1 / -1; }
.prop .v.pre { white-space: pre-wrap; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); padding: 0 12px; overflow-x: auto; }
.tabs button { all: unset; cursor: pointer; padding: 12px 12px 10px; font-weight: 500; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }
.tabs .n { background: var(--surface-3); color: var(--text-2); border-radius: 10px; padding: 0 7px; font-size: 11px; }
.stage-path { display: flex; overflow-x: auto; gap: 4px; }
.stage-path button { all: unset; cursor: pointer; flex: 1; min-width: 100px; text-align: center; padding: 8px 12px; font-size: 12.5px; font-weight: 600; background: var(--surface-3); color: var(--text-2); clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%); }
.stage-path button:first-child { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); border-radius: 6px 0 0 6px; }
.stage-path button.done { background: var(--brand-100); color: var(--brand); }
.stage-path button.cur { background: var(--brand); color: var(--on-brand); }
.stage-path button.won { background: var(--green); color: #fff; }
.stage-path button.lost { background: var(--red); color: #fff; }
.note { padding: 12px 18px; border-bottom: 1px solid var(--border); }
.note .by { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.note .body { white-space: pre-wrap; }

/* ---------- kanban ---------- */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; min-height: 60vh; }
.kcol { flex: 0 0 280px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; max-height: calc(100vh - 220px); }
.kcol-head { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.kcol-head .title { font-weight: 600; display: flex; justify-content: space-between; }
.kcol-head .sum { font-size: 12px; color: var(--muted); }
.kcol-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 80px; }
.kcol-body.over { background: var(--brand-50); }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; box-shadow: var(--shadow); cursor: grab; }
.kcard:active { cursor: grabbing; }
.kcard.dragging { opacity: .5; }
.kcard .t1 { font-weight: 600; margin-bottom: 4px; }
.kcard .t2 { font-size: 12.5px; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; align-items: center; }

/* ---------- calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.cal .dow { padding: 8px; font-size: 11.5px; text-transform: uppercase; color: var(--muted); font-weight: 600; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.cal .day { min-height: 112px; padding: 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal .day.other { background: var(--surface-2); }
.cal .day.today .dn { background: var(--brand); color: var(--on-brand); border-radius: 50%; }
.cal .dn { font-size: 12px; font-weight: 600; width: 22px; height: 22px; display: grid; place-items: center; }
.cal .ev { font-size: 11.5px; padding: 2px 6px; border-radius: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); display: block; text-decoration: none !important; }
.ev.event { background: var(--blue-bg); color: var(--blue); } .ev.activity { background: var(--green-bg); color: var(--green); }
.ev.milestone { background: var(--purple-bg); color: var(--purple); } .ev.tender { background: var(--red-bg); color: var(--red); } .ev.renewal { background: var(--amber-bg); color: #9a6500; }
.ev.done { text-decoration: line-through !important; opacity: .65; }
.cal .more { font-size: 11px; color: var(--muted); }
.agenda .when { width: 120px; flex: none; font-size: 12.5px; color: var(--muted); }

/* ---------- charts ---------- */
.chart { width: 100%; display: block; overflow: visible; }
.chart text { fill: var(--muted); font: 11px var(--font); }
.chart .grid-line { stroke: var(--border); stroke-dasharray: 3 3; }
.chart .axis { stroke: var(--border-strong); }
.chart .bar:hover, .chart .slice:hover { opacity: .85; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.chart-tip { position: fixed; pointer-events: none; z-index: 200; background: var(--text); color: var(--surface); padding: 6px 10px; border-radius: 6px; font-size: 12px; white-space: nowrap; box-shadow: var(--shadow-lg); }
.funnel-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.funnel-row .lbl { width: 140px; font-size: 12.5px; color: var(--text-2); flex: none; }
.funnel-row .bar { height: 26px; background: var(--brand); border-radius: 4px; color: var(--on-brand); font-size: 12px; display: flex; align-items: center; padding: 0 8px; white-space: nowrap; min-width: 30px; }
.funnel-row .val { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.gauge-wrap { display: flex; flex-direction: column; align-items: center; }

/* ---------- modal, toast, menus ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(15, 21, 34, .55); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; border: 1px solid var(--border); }
.modal.wide { max-width: 980px; } .modal.mid { max-width: 760px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--text); color: var(--surface); padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow-lg); max-width: 380px; animation: pop .18s ease-out; }
.toast.error { background: var(--red); color: #fff; } .toast.success { background: var(--green); color: #fff; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.dropdown { position: absolute; z-index: 80; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); min-width: 220px; padding: 6px; }
.dropdown a, .dropdown button { all: unset; box-sizing: border-box; display: flex; gap: 8px; align-items: center; width: 100%; padding: 8px 10px; border-radius: 6px; cursor: pointer; color: var(--text); font-size: 13.5px; }
.dropdown a:hover, .dropdown button:hover { background: var(--surface-3); text-decoration: none; }
.dropdown hr { border: 0; border-top: 1px solid var(--border); margin: 6px 0; }
.notif-panel { width: 360px; max-height: 480px; overflow: auto; padding: 0; }
.notif { display: block; padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text); }
.notif.unread { background: var(--brand-50); }
.notif .when { font-size: 11.5px; color: var(--muted); }

/* ---------- auth screens ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1000px 500px at 10% -10%, var(--brand-50), transparent), var(--bg); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .card-body { padding: 28px; }
.auth-logo { display: flex; justify-content: center; margin-bottom: 22px; }
.auth-logo img { height: 46px; }
.alert { padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 12px; }
.alert.error { background: var(--red-bg); color: var(--red); } .alert.info { background: var(--blue-bg); color: var(--blue); }
.alert.warn { background: var(--amber-bg); color: var(--text); } .alert.ok { background: var(--green-bg); color: var(--green); }

/* ---------- misc ---------- */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { padding: 3px 10px; border-radius: 14px; background: var(--surface-3); font-size: 12.5px; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--border); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 6px; }
@keyframes sk { to { background-position: -200% 0; } }
.lines-table input, .lines-table select { min-height: 32px; padding: 5px 8px; }
.lines-table td { padding: 6px 8px; }
.wf-step { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; background: var(--surface-2); position: relative; }
.wf-connector { width: 2px; height: 18px; background: var(--border-strong); margin: 0 auto; }
.wf-head { display: flex; align-items: center; gap: 8px; font-weight: 600; margin-bottom: 8px; }
.perm-table select { min-height: 30px; padding: 4px 6px; font-size: 12.5px; }
.assistant-msg { padding: 12px 14px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); white-space: pre-wrap; }
.assistant-msg.me { background: var(--brand-50); border-color: var(--brand-100); align-self: flex-end; max-width: 80%; }
.insight { display: flex; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.insight .ic { width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--muted); cursor: pointer; }
.dropzone.over { border-color: var(--brand); background: var(--brand-50); }
.sig-img { max-width: 260px; background: #fff; border: 1px solid var(--border); border-radius: 6px; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; }
.settings-nav button { all: unset; cursor: pointer; padding: 9px 12px; border-radius: 6px; display: flex; gap: 8px; align-items: center; color: var(--text-2); }
.settings-nav button.on { background: var(--brand-50); color: var(--brand); font-weight: 600; }
.settings-nav button:hover { background: var(--surface-3); }
.log { background: var(--surface-2); border: 1px solid var(--border); border-radius: 6px; padding: 10px; font: 12px ui-monospace, Consolas, monospace; white-space: pre-wrap; max-height: 260px; overflow: auto; }
.qr { width: 180px; height: 180px; }

/* ---------- print (quotations, invoices) ---------- */
.doc { background: #fff; color: #1d273b; max-width: 860px; margin: 0 auto; padding: 40px 48px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }
.doc h1 { font-size: 26px; color: #0533BF; letter-spacing: .02em; }
.doc .doc-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 28px; }
.doc .doc-head img { height: 48px; }
.doc table { width: 100%; border-collapse: collapse; margin: 18px 0; }
.doc th { background: #0533BF; color: #fff; text-align: left; padding: 8px 10px; font-size: 12px; }
.doc td { padding: 8px 10px; border-bottom: 1px solid #e3e8ef; }
.doc .totals { margin-left: auto; width: 300px; }
.doc .totals td { border: 0; padding: 4px 10px; }
.doc .totals tr.grand td { font-weight: 700; font-size: 15px; border-top: 2px solid #0533BF; }
.doc .parties { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.doc .small { color: #6b778c; }
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .no-print, .demo-banner, .toasts { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; max-width: none; }
  .doc { border: 0; padding: 0; max-width: none; }
}

/* ---------- responsive ---------- */
@media (max-width: 1280px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1100px) {
  .g-2-1, .g-1-2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span2 { grid-column: auto; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 35; }
  .main { margin-left: 0; }
  .menu-toggle { display: grid; }
  .content { padding: 16px 16px 60px; }
  .topbar { padding: 0 12px; }
  .g2, .g4 { grid-template-columns: minmax(0, 1fr); }
  .props { grid-template-columns: minmax(0, 1fr); }
  .user-chip .name { display: none; }
  .t.responsive thead { display: none; }
  .t.responsive tr { display: block; border-bottom: 1px solid var(--border); padding: 8px 0; }
  .t.responsive td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 4px 16px; text-align: right; }
  .t.responsive td::before { content: attr(data-l); color: var(--muted); font-size: 12px; text-align: left; }
  .t.responsive td.check::before { content: none; }
  .doc { padding: 20px; }
  .doc .parties { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .w2 { grid-column: auto; }
  .search { max-width: none; }
  .kv { grid-template-columns: 1fr; }
}

/* ---------- bottom navigation bar (replaces the left sidebar) ---------- */
:root { --dock-bg: #121619; --dock-text: #8d9a9c; --dock-accent: #2ee6d6; --dock-alert: #ff5a36; }
[data-theme="dark"] { --dock-bg: #0f1315; }
.main, .app .main { margin-left: 0; }
.menu-toggle { display: none !important; }
.content { padding-bottom: 140px !important; }
.top-brand { display: flex; align-items: center; flex: none; margin-right: 6px; }
.top-brand .brand-logo { height: 30px; }
.dock { --n: 5; --i: 0; position: fixed; z-index: 45; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(520px, calc(100% - 24px)); height: 70px;
  display: flex; align-items: stretch; padding: 0 8px; background: var(--dock-bg); border-radius: 35px;
  border: 1px solid rgba(255, 255, 255, .07); box-shadow: 0 14px 34px rgba(4, 8, 10, .45), 0 10px 26px -12px var(--dock-accent); }
/* Sliding curve: a raised bump with a glowing ring that moves to the selected tab. */
.dock-indicator { position: absolute; top: 0; left: calc(8px + (100% - 16px) / var(--n) * (var(--i) + .5)); width: 0; height: 100%; pointer-events: none; z-index: 0;
  transition: left .55s cubic-bezier(.34, 1.45, .5, 1); }
.dock-indicator::before { content: ""; position: absolute; top: -26px; left: -42px; width: 84px; height: 84px; border-radius: 50%; background: var(--dock-bg);
  border-top: 1px solid rgba(255, 255, 255, .08); }
.dock-indicator::after { content: ""; position: absolute; top: -14px; left: -25px; width: 50px; height: 50px; box-sizing: border-box; border-radius: 50%; border: 2px solid var(--dock-accent);
  animation: ringpulse 2s ease-in-out infinite; }
.dock-glow { position: absolute; bottom: -1px; height: 2px; width: 120px; left: calc(8px + (100% - 16px) / var(--n) * (var(--i) + .5) - 60px); border-radius: 2px; pointer-events: none;
  background: linear-gradient(90deg, transparent, var(--dock-accent), transparent); box-shadow: 0 0 12px var(--dock-accent); transition: left .55s cubic-bezier(.34, 1.45, .5, 1); }
/* The active tab glows for one second, rests for one second, and repeats. */
.dock-item.on svg.i { animation: iconpulse 2s ease-in-out infinite; }
@keyframes ringpulse {
  0%, 52%, 100% { border-color: rgba(46, 230, 214, .45); box-shadow: 0 0 0 rgba(46, 230, 214, 0), inset 0 0 0 rgba(46, 230, 214, 0); }
  8%, 44% { border-color: #2ee6d6; box-shadow: 0 0 24px rgba(46, 230, 214, .9), 0 0 6px rgba(46, 230, 214, .9), inset 0 0 12px rgba(46, 230, 214, .35); }
}
@keyframes iconpulse {
  0%, 52%, 100% { filter: none; }
  8%, 44% { filter: drop-shadow(0 0 6px rgba(46, 230, 214, .95)) drop-shadow(0 0 2px rgba(46, 230, 214, .9)); }
}
.dock-item { all: unset; box-sizing: border-box; position: relative; z-index: 1; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 5px;
  padding-bottom: 13px; color: var(--dock-text); font: 500 11.5px var(--font); cursor: pointer; text-decoration: none !important; -webkit-tap-highlight-color: transparent; }
.dock-item svg.i { width: 22px; height: 22px; transition: transform .45s cubic-bezier(.34, 1.45, .5, 1), color .2s; }
.dock-item span { transition: color .2s; line-height: 14px; height: 14px; }
/* Lift that puts the icon exactly in the centre of the ring (ring centre is 11px below the bar's top edge;
   icon centre sits 43px above the bottom of the bar's inner area, which is the bar height minus its 2px border: 13 padding + 14 label + 5 gap + 11 half icon). */
.dock { --lift: calc(11px - (68px - 43px)); }
.dock-item:hover { color: #dfe7e8; }
.dock-item.on { color: #fff; }
.dock-item.on svg.i { transform: translateY(var(--lift)); color: #fff; }
.dock-item.on::after { content: ""; position: absolute; bottom: 5px; width: 5px; height: 5px; border-radius: 50%; background: var(--dock-accent); box-shadow: 0 0 6px var(--dock-accent); }
.dock-item:focus-visible { outline: 2px solid var(--dock-accent); outline-offset: -6px; border-radius: 18px; }
.dock-dot { position: absolute; top: 16px; left: calc(50% + 5px); width: 9px; height: 9px; border-radius: 50%; background: var(--dock-alert); box-shadow: 0 0 0 2px var(--dock-bg); transition: transform .45s cubic-bezier(.34, 1.45, .5, 1); }
.dock-item.on .dock-dot { transform: translateY(var(--lift)); }
.dock.no-anim .dock-indicator, .dock.no-anim .dock-glow, .dock.no-anim .dock-item svg.i, .dock.no-anim .dock-dot { transition: none; }
@media (prefers-reduced-motion: reduce) { .dock-indicator, .dock-glow, .dock-item svg.i, .dock-dot { transition: none; } }
/* "More" sheet with every module */
.sidebar.nav-sheet { position: fixed; inset: auto auto 100px 50%; top: auto; transform: translate(-50%, 16px); width: min(960px, calc(100% - 24px)); max-height: min(72vh, 720px);
  display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg); opacity: 0; pointer-events: none; transition: opacity .16s, transform .16s; z-index: 46; }
.app.nav-open .sidebar.nav-sheet { opacity: 1; pointer-events: auto; transform: translate(-50%, 0); }
.app.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(8, 12, 20, .4); z-index: 44; }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--border); }
.sheet-head b { white-space: nowrap; }
.dropdown a.notif { display: block; border-radius: 0; }
.notif-panel { max-width: calc(100vw - 16px); }
.sheet-head input { max-width: 280px; margin-left: auto; }
.nav-sheet .nav { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 14px; padding: 12px 14px 18px; overflow-y: auto; }
.nav-group-title { padding: 10px 10px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.nav-sheet .nav-group { margin: 0; }
@media (max-width: 560px) {
  .dock { bottom: 10px; height: 64px; --lift: calc(11px - (62px - 43px)); }
  .dock-item span { font-size: 10.5px; }
  .sidebar.nav-sheet { bottom: 86px; max-height: 70vh; }
  .sheet-head input { max-width: none; }
  .top-brand .brand-logo { height: 26px; }
  .topbar .search { min-width: 0; }
}
@media print { .dock, .nav-sheet { display: none !important; } }

/* ---------- teal theme surfaces: cards with a soft glow on the bottom edge ---------- */
.card { position: relative; border-radius: 14px; }
.card::after { content: ""; position: absolute; left: 12%; right: 12%; bottom: -1px; height: 1px; pointer-events: none; border-radius: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent); opacity: .35; }
[data-theme="dark"] .card { background: linear-gradient(180deg, #151a1d 0%, #111518 100%); box-shadow: 0 14px 28px -22px var(--glow), 0 1px 0 rgba(255, 255, 255, .03) inset; }
[data-theme="dark"] .card::after { opacity: .7; box-shadow: 0 0 10px var(--glow); }
[data-theme="dark"] .topbar { background: rgba(10, 13, 15, .85); backdrop-filter: blur(10px); }
[data-theme="dark"] .modal, [data-theme="dark"] .dropdown, [data-theme="dark"] .nav-sheet { background: #13181b; }
.accent-text { color: var(--accent); }
[data-theme="light"] .accent-text { color: var(--brand); }
.btn.primary { box-shadow: 0 6px 18px -8px var(--glow); }
.nav a.active, .settings-nav button.on { box-shadow: inset 2px 0 0 var(--accent); }

/* ---------- Overview dashboard (reference layout) ---------- */
.ov { display: grid; grid-template-columns: minmax(0, 2.15fr) minmax(300px, 1fr); gap: 16px; align-items: start; }
.ov-main, .ov-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ov-head h1 { font-size: 24px; }
.ov-select { width: auto; min-width: 150px; height: 36px; padding: 0 10px; border-radius: 10px; background: var(--surface); }
.kpi-link { color: inherit; text-decoration: none !important; }
.kpi-link:hover { border-color: var(--accent); }
.kpi .spark { width: calc(100% + 36px); height: 64px; margin: 6px -18px -16px; display: block; }
.mini-list { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.mini-list a { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: 13px; text-decoration: none; padding: 5px 8px; border-radius: 8px; background: var(--surface-2); }
.mini-list a:hover { background: var(--surface-3); }
.mini-list .rank { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: var(--brand-50); color: var(--brand); flex: none; }
.funnel-wrap { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(200px, 1fr); gap: 18px; align-items: center; }
.funnel-svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 0 14px var(--glow)); }
.funnel-svg path { transition: opacity .2s; cursor: pointer; }
.funnel-svg a:hover path { opacity: 1 !important; }
.funnel-svg .ft1 { fill: var(--on-brand); font: 600 13px var(--font); }
.funnel-svg .ft2 { fill: var(--on-brand); font: 500 11.5px var(--font); opacity: .85; }
.callouts { display: flex; flex-direction: column; gap: 10px; }
.callout { display: flex; flex-direction: column; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--border); border-left: 3px solid var(--accent); background: var(--surface-2); }
.callout span { font-size: 12px; color: var(--muted); }
.callout b { font-size: 18px; }
.callout small { color: var(--muted); font-size: 11.5px; }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); color: inherit; text-decoration: none !important; }
.stat span { font-size: 12px; color: var(--muted); }
.stat b { font-size: 22px; }
.date-chip { width: 40px; height: 40px; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; font-size: 11px; background: var(--brand-50); color: var(--brand); flex: none; }
.tasks .task { cursor: pointer; }
.tasks .task input { position: absolute; opacity: 0; pointer-events: none; }
.tasks .tick { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--border-strong); display: grid; place-items: center; color: transparent; flex: none; transition: all .15s; }
.tasks .task.done .tick { background: var(--accent); border-color: var(--accent); color: var(--on-brand); box-shadow: 0 0 10px var(--glow); }
.tasks .task.done .ellipsis { text-decoration: line-through; color: var(--muted); }
.tasks .task input:focus-visible + .tick { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (max-width: 1200px) { .ov { grid-template-columns: minmax(0, 1fr); } .funnel-wrap { grid-template-columns: minmax(0, 1fr); } }
