/* Ctech CRM — no external dependencies */
:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --ink: #142033;
  --ink-2: #4a5872;
  --muted: #7b879c;
  --line: #e2e7ef;
  --side: #0c1d36;
  --side-ink: #b9c5d8;
  --primary: #1565d8;
  --primary-ink: #ffffff;
  --primary-soft: #e6effc;
  --primary-dark: #0f55bb;
  --side-2: #23406b;
  --ok: #138a4f;
  --ok-soft: #e3f5ec;
  --warn: #b26b00;
  --warn-soft: #fff3dc;
  --bad: #c53030;
  --bad-soft: #fde8e8;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 30, 54, .06), 0 1px 8px rgba(16, 30, 54, .04);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 12px; }
code { background: #eef1f6; padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.ic { width: 18px; height: 18px; flex: none; }

/* ---------- shell ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 236px; background: var(--side); color: var(--side-ink);
  display: flex; flex-direction: column; z-index: 40; transition: transform .2s;
}
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 16px; border-bottom: 1px solid rgba(255,255,255,.07); }
.brand-mark {
  width: 36px; height: 36px; border-radius: 9px; background: var(--primary);
  color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 18px; flex: none;
}
.brand-mark.big { width: 56px; height: 56px; font-size: 28px; border-radius: 14px; }
.brand-name { color: #fff; font-weight: 700; font-size: 14px; line-height: 1.2; }
.brand-sub { font-size: 11.5px; opacity: .7; }
.sidebar nav { padding: 10px 8px; flex: 1; overflow-y: auto; }
.sidebar nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 8px;
  color: var(--side-ink); font-weight: 500; margin-bottom: 2px;
}
.sidebar nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.sidebar nav a.active { background: var(--primary); color: #fff; }
.sidebar nav a span { flex: 1; }
.count { font-style: normal; background: #f59e0b; color: #1a1200; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 10px; }
.nav-sep { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; opacity: .5; padding: 16px 12px 6px; }
.side-user { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid rgba(255,255,255,.07); }
.side-user-info { flex: 1; min-width: 0; }
.side-user-info a { color: #fff; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-info small { font-size: 11px; opacity: .7; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--side-2); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.icon-btn { background: none; border: 0; color: inherit; padding: 6px; border-radius: 7px; cursor: pointer; display: inline-grid; place-items: center; }
.icon-btn:hover { background: rgba(127,127,127,.15); }

.main { margin-left: 236px; min-height: 100vh; display: flex; flex-direction: column; }
.main-solo { margin-left: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30; background: rgba(243,245,249,.92); backdrop-filter: blur(6px);
  display: flex; align-items: center; gap: 12px; padding: 12px 28px; border-bottom: 1px solid var(--line);
}
.menu-btn { display: none; color: var(--ink); }
.search { flex: 1; max-width: 520px; position: relative; display: flex; align-items: center; }
.search .ic { position: absolute; left: 11px; color: var(--muted); width: 16px; height: 16px; }
.search input[type=search] { width: 100%; padding: 9px 12px 9px 34px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font: inherit; }
.quick { margin-left: auto; }
.content { padding: 24px 28px 40px; flex: 1; width: 100%; max-width: 1400px; }
.foot { padding: 14px 28px; color: var(--muted); font-size: 12px; }
.scrim { display: none; }

/* ---------- page header ---------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--ink); font: 600 13.5px var(--font); cursor: pointer; white-space: nowrap;
}
.btn:hover { text-decoration: none; border-color: #c9d2e0; }
.btn .ic { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); border-color: #f2b8b8; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-block { width: 100%; justify-content: center; padding: 11px; }
.inline { display: inline; }

/* ---------- cards & grid ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; }
.card-head h2, .card-head h3 { margin: 0; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.cols-3-2 { display: grid; grid-template-columns: 3fr 2fr; gap: 18px; align-items: start; }
.cols-2-3 { display: grid; grid-template-columns: minmax(280px, 2fr) 3fr; gap: 18px; align-items: start; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.kpi-label { color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font-size: 24px; font-weight: 750; margin-top: 4px; letter-spacing: -.02em; }
.kpi-sub { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.kpi.alert-kpi .kpi-value { color: var(--bad); }
.progress { height: 7px; border-radius: 6px; background: #e8edf5; overflow: hidden; margin-top: 8px; }
.progress > i { display: block; height: 100%; background: var(--primary); border-radius: 6px; }
.progress.good > i { background: var(--ok); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 -18px; }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { padding: 10px 18px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data th { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; background: #fafbfd; white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: #fafcff; }
table.data .num { text-align: right; white-space: nowrap; }
table.data td.actions { white-space: nowrap; text-align: right; }
.cell-main { font-weight: 600; color: var(--ink); }
.cell-sub { font-size: 12.5px; color: var(--muted); }
.wa { font-size: 10px; font-weight: 700; background: #25d366; color: #fff; border-radius: 4px; padding: 1px 4px; margin-left: 2px; }
.wa:hover { text-decoration: none; opacity: .85; }

/* ---------- badges ---------- */
.badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11.5px; font-weight: 650; background: #eef1f6; color: var(--ink-2); white-space: nowrap; }
.b-new, .b-prospecting, .b-planned { background: #eef1f6; color: #3e4c63; }
.b-contacted, .b-qualification, .b-pending { background: var(--primary-soft); color: #0d4fae; }
.b-qualified, .b-proposal, .b-active { background: #efe8fd; color: #5b2fc2; }
.b-negotiation { background: var(--warn-soft); color: var(--warn); }
.b-converted, .b-won, .b-done, .b-completed { background: var(--ok-soft); color: var(--ok); }
.b-unqualified, .b-lost, .b-cancelled, .b-inactive { background: #f1f2f4; color: #7d8592; }
.b-overdue { background: var(--bad-soft); color: var(--bad); }
.b-admin { background: #fde8e8; color: #9b1c1c; }
.b-manager { background: #efe8fd; color: #5b2fc2; }
.b-agent { background: var(--primary-soft); color: #0d4fae; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field-wide { grid-column: 1 / -1; }
.req { color: var(--bad); font-weight: 700; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local],
input[type=search], input[type=tel], input:not([type]), select, textarea {
  font: inherit; color: var(--ink); padding: 9px 11px; border: 1px solid #d3dae6; border-radius: 8px; background: #fff; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
a:focus-visible, button:focus-visible, summary:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
textarea { resize: vertical; }
textarea.code { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.check { display: flex; gap: 8px; align-items: center; margin: 4px 0 14px; color: var(--ink-2); }
.check input { width: 16px; height: 16px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 14px; margin-top: 4px; }
.form-section { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 6px 0 10px; font-weight: 700; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filters input, .filters select { width: auto; min-width: 150px; padding: 7px 10px; }
.filters input[type=search] { min-width: 220px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--ink-2); font-weight: 600; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a.active { color: var(--primary); border-color: var(--primary); }
.tabs a em { font-style: normal; background: #eef1f6; border-radius: 10px; padding: 0 7px; font-size: 11.5px; margin-left: 4px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.seg a { padding: 7px 11px; color: var(--ink-2); display: inline-flex; gap: 5px; align-items: center; font-weight: 600; font-size: 13px; }
.seg a.active { background: var(--primary-soft); color: var(--primary); }
.seg a:hover { text-decoration: none; }
.seg .ic { width: 15px; height: 15px; }

/* ---------- alerts ---------- */
.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid; }
.alert-success { background: var(--ok-soft); border-color: #b5e2c9; color: #0d5c35; }
.alert-error { background: var(--bad-soft); border-color: #f4bcbc; color: #8c1d1d; }
.alert-warning { background: var(--warn-soft); border-color: #f1d49a; color: #6e4300; }
.alert-info { background: var(--primary-soft); border-color: #bcd3f6; color: #0b3f8a; }

/* ---------- detail views ---------- */
dl.details { display: grid; grid-template-columns: 130px 1fr; gap: 9px 12px; margin: 0; }
dl.details dt { color: var(--muted); font-size: 12.5px; }
dl.details dd { margin: 0; word-break: break-word; }
.notes-box { background: #fafbfd; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; margin-top: 12px; }
.empty { color: var(--muted); padding: 10px 0; }
.empty-state { text-align: center; padding: 40px; }

/* ---------- timeline ---------- */
.timeline { list-style: none; padding: 0; margin: 0; }
.tl-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.tl-item:last-child { border-bottom: 0; }
.tl-dot { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }
.tl-dot .ic { width: 15px; height: 15px; }
.tl-done .tl-dot { background: var(--ok-soft); color: var(--ok); }
.tl-overdue .tl-dot { background: var(--bad-soft); color: var(--bad); }
.tl-body { flex: 1; min-width: 0; }
.tl-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tl-meta { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.tl-notes { margin-top: 6px; color: var(--ink-2); }
.tl-outcome { margin-top: 6px; background: var(--ok-soft); color: #0d5c35; padding: 6px 10px; border-radius: 6px; font-size: 13px; }
.tl-done summary, details summary { cursor: pointer; color: var(--primary); font-weight: 600; font-size: 13px; margin-top: 6px; }
.tl-done form { margin-top: 10px; background: #fafbfd; border: 1px solid var(--line); padding: 12px; border-radius: 8px; }
.quick-act h3 { margin-bottom: 10px; }

/* ---------- pipeline board ---------- */
.board { display: grid; grid-template-columns: repeat(6, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: #e9edf4; border-radius: var(--radius); padding: 10px; min-height: 200px; display: flex; flex-direction: column; gap: 8px; }
.col.drag-over { background: #dce7fa; outline: 2px dashed var(--primary); }
.col-head { display: flex; justify-content: space-between; align-items: baseline; padding: 2px 4px 6px; }
.col-head b { font-size: 13px; }
.col-head small { color: var(--ink-2); font-size: 12px; }
.col-won { background: #e0f2e9; }
.col-lost { background: #eeeff1; }
.deal-card { background: #fff; border-radius: 8px; padding: 10px 11px; box-shadow: var(--shadow); border: 1px solid var(--line); cursor: grab; }
.deal-card.dragging { opacity: .5; }
.deal-card a.t { font-weight: 650; color: var(--ink); display: block; line-height: 1.3; }
.deal-card .v { font-weight: 700; margin-top: 4px; }
.deal-card .m { font-size: 12px; color: var(--muted); margin-top: 2px; }
.deal-card select { margin-top: 8px; padding: 4px 6px; font-size: 12px; }
.deal-card.late { border-left: 3px solid var(--bad); }

/* ---------- bar charts (pure CSS) ---------- */
.bars { display: flex; flex-direction: column; gap: 9px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.bar-track { height: 10px; background: #edf1f7; border-radius: 6px; overflow: hidden; }
.bar-track i { display: block; height: 100%; background: var(--primary); border-radius: 6px; min-width: 2px; }
.bar-row .lbl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.vbars { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-top: 10px; }
.vbar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; }
.vbar i { width: 100%; max-width: 46px; background: var(--primary); border-radius: 5px 5px 0 0; min-height: 2px; }
.vbar small { font-size: 11px; color: var(--muted); }
.vbar b { font-size: 11px; color: var(--ink-2); font-weight: 600; white-space: nowrap; }

.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: 9px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; }
.list-plain li:last-child { border-bottom: 0; }
.list-plain li > b { white-space: nowrap; }

.pager { display: flex; gap: 4px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.pager a { padding: 5px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink-2); }
.pager a.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pager .muted { margin-left: 8px; font-size: 12.5px; }

/* ---------- auth & install ---------- */
.auth-body { background: linear-gradient(140deg, var(--side) 0%, var(--side) 35%, var(--primary) 100%); min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.auth-wrap { display: grid; grid-template-columns: 1fr 380px; gap: 40px; max-width: 860px; width: 100%; align-items: center; }
.auth-side { color: #dbe6f7; }
.auth-side h1 { color: #fff; font-size: 30px; margin: 18px 0 8px; }
.auth-side p { font-size: 16px; max-width: 380px; }
.auth-card { background: #fff; border-radius: 14px; padding: 28px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.install { max-width: 720px; width: 100%; }
.install-head { display: flex; gap: 14px; align-items: center; color: #fff; margin-bottom: 18px; }
.install-head h1 { color: #fff; }
.install-head .muted { color: #b9c9e4; margin: 2px 0 0; }
.install .card h3 { margin-top: 10px; }
.radio-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.radio-cards label { border: 1px solid var(--line); border-radius: 9px; padding: 12px; cursor: pointer; }
.radio-cards small { display: block; color: var(--muted); margin-top: 4px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .cols, .cols-3-2, .cols-2-3 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 35; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 10px 14px; }
  .content { padding: 16px 14px 30px; }
  .quick .btn span { display: none; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { text-align: center; }
  .auth-side .brand-mark { margin: 0 auto; }
  .auth-side .brand-logo { margin: 0 auto; display: block; }
  .auth-side p { margin: 0 auto; }
  .board { grid-template-columns: repeat(6, 78vw); }
}
@media (max-width: 600px) {
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-value { font-size: 19px; }
  .grid-2, .grid-3, .radio-cards { grid-template-columns: 1fr; }
  .filters input, .filters select, .filters input[type=search] { min-width: 0; width: 100%; }
  .hide-sm { display: none; }
  dl.details { grid-template-columns: 105px 1fr; }
  .bar-row { grid-template-columns: 90px 1fr auto; }
}
@media print {
  .sidebar, .topbar, .page-actions, .filters, .foot, .quick-act { display: none !important; }
  .main { margin: 0; }
  .card { box-shadow: none; }
}

/* =================== v1.1 additions =================== */
.brand-logo { height: 36px; max-width: 110px; object-fit: contain; background: #fff; border-radius: 8px; padding: 3px; flex: none; }
.brand-logo.big { height: 64px; max-width: 200px; padding: 6px; border-radius: 12px; }
.linkish { background: none; border: 0; color: var(--primary); font: 600 12.5px var(--font); cursor: pointer; padding: 0; }
.nowrap { white-space: nowrap; }

/* notifications bell */
.quick { display: flex; align-items: center; gap: 8px; }
.bell { position: relative; }
.bell summary { list-style: none; position: relative; color: var(--ink-2); }
.bell summary::-webkit-details-marker { display: none; }
.bell-dot { position: absolute; top: 0; right: -2px; background: var(--bad); color: #fff; font: 700 10px/16px var(--font); min-width: 16px; height: 16px; border-radius: 8px; text-align: center; padding: 0 4px; font-style: normal; }
.bell-panel { position: absolute; right: -60px; top: 42px; width: min(360px, calc(100vw - 24px)); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(16,30,54,.18); z-index: 60; overflow: hidden; }
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.bell-item { display: flex; gap: 10px; padding: 10px 14px; color: var(--ink); border-bottom: 1px solid var(--line); font-size: 13px; line-height: 1.35; }
.bell-item:hover { background: #f7f9fc; text-decoration: none; }
.bell-item.unread { background: var(--primary-soft); }
.bell-item small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.bell-ic { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #eef1f6; color: var(--ink-2); flex: none; }
.bell-ic .ic { width: 14px; height: 14px; }
.n-won { background: #fff3dc; color: #b26b00; }
.n-enquiry { background: #e3f5ec; color: var(--ok); }
.n-assign, .n-transfer { background: var(--primary-soft); color: var(--primary); }
.n-quote { background: #efe8fd; color: #5b2fc2; }
.bell-all { display: block; text-align: center; padding: 10px; font-weight: 600; font-size: 13px; }
.note-list { list-style: none; margin: 0; padding: 0; }
.note-list li { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.note-list li a { flex: 1; color: var(--ink); }
.note-list li.unread a { font-weight: 650; }
.note-list li:last-child { border-bottom: 0; }

/* files */
.file-list { list-style: none; margin: 0 0 12px; padding: 0; }
.file-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.file-ext { width: 40px; height: 40px; border-radius: 8px; background: #eef1f6; color: var(--ink-2); font: 700 10px var(--font); display: grid; place-items: center; flex: none; letter-spacing: .03em; }
.file-main { flex: 1; min-width: 0; }
.file-main a { font-weight: 600; word-break: break-word; }
.file-upload { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.file-upload input[type=file] { flex: 1; min-width: 0; font-size: 13px; }

/* quotations */
.b-q-draft { background: #eef1f6; color: #3e4c63; }
.b-q-sent { background: var(--primary-soft); color: var(--primary); }
.b-q-accepted { background: var(--ok-soft); color: var(--ok); }
.b-q-declined { background: var(--bad-soft); color: var(--bad); }
.qi-table td { padding: 8px 10px; vertical-align: top; }
.qi-table input, .qi-table select { padding: 7px 9px; }
.qi-desc { margin-top: 6px; }
.qi-line { padding-top: 15px !important; font-weight: 600; font-variant-numeric: tabular-nums; }
.quote-sum { display: flex; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.sum-box { display: grid; grid-template-columns: auto auto; gap: 6px 24px; margin: 0 0 16px auto; min-width: 260px; background: #fafbfd; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; font-variant-numeric: tabular-nums; }
.sum-box dt { color: var(--ink-2); }
.sum-box dd { margin: 0; text-align: right; font-weight: 600; }
.sum-box .grand { font-size: 17px; font-weight: 800; color: var(--ink); border-top: 1px solid var(--line); padding-top: 8px; }
.sum-box.static { margin-top: 14px; max-width: 360px; }
ol.steps { list-style: none; padding: 0; margin: 0 0 14px; }
ol.steps li { position: relative; padding: 0 0 14px 28px; color: var(--muted); font-weight: 600; }
ol.steps li::before { content: ''; position: absolute; left: 4px; top: 4px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #c9d2e0; background: #fff; }
ol.steps li::after { content: ''; position: absolute; left: 10px; top: 20px; bottom: 0; width: 2px; background: #e2e7ef; }
ol.steps li:last-child::after { display: none; }
ol.steps li.done { color: var(--ink); }
ol.steps li.done::before { background: var(--ok); border-color: var(--ok); }
ol.steps li.declined::before { background: var(--bad); border-color: var(--bad); }
ol.steps small { display: block; font-weight: 400; color: var(--muted); }

/* calendar */
.cal-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-nav h2 { margin: 0 0 0 8px; font-size: 19px; }
.cal-legend { display: flex; gap: 14px; margin: 4px 0 12px; font-size: 12px; color: var(--ink-2); }
.cal-legend .lg::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.lg.pending::before { background: var(--primary); }
.lg.overdue::before { background: var(--bad); }
.lg.done::before { background: var(--ok); }
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--line); gap: 1px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.cal-dow { background: #fafbfd; padding: 8px 10px; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.cal-day { background: #fff; min-height: 118px; padding: 6px 7px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day.weekend { background: #fcfcfe; }
.cal-day.other { background: #f6f7fa; }
.cal-day.other .cal-num { color: #aab3c2; }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--primary); }
.cal-dhead { display: flex; justify-content: space-between; align-items: center; }
.cal-num { font-weight: 700; color: var(--ink); font-size: 13px; padding: 1px 4px; border-radius: 6px; }
.cal-day.today .cal-num { background: var(--primary); color: #fff; }
.cal-wd { display: none; }
.cal-add { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; color: var(--muted); font-weight: 700; opacity: 0; }
.cal-day:hover .cal-add, .cal-add:focus { opacity: 1; background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.cal-ev { display: block; font-size: 11.5px; line-height: 1.3; padding: 3px 6px; border-radius: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink); border-left: 3px solid; }
.cal-ev:hover { text-decoration: none; filter: brightness(.97); }
.cal-ev b { font-weight: 700; font-variant-numeric: tabular-nums; }
.ev-pending { background: var(--primary-soft); border-color: var(--primary); }
.ev-overdue { background: var(--bad-soft); border-color: var(--bad); }
.ev-done { background: var(--ok-soft); border-color: var(--ok); color: #3d5a4b; }
.cal-more { font-size: 11.5px; font-weight: 600; padding-left: 6px; }
.cal-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.cal-wcol { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 280px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.cal-wcol.today { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.cal-whead { display: flex; gap: 6px; align-items: baseline; }
.cal-whead span { color: var(--muted); font-size: 12.5px; flex: 1; }
.cal-whead .cal-add { opacity: 1; }
.cal-card { display: block; border-left: 3px solid; border-radius: 6px; padding: 7px 9px; color: var(--ink); font-size: 12.5px; line-height: 1.35; }
.cal-card:hover { text-decoration: none; filter: brightness(.97); }
.cal-card b { display: block; }
.cal-card small { color: var(--ink-2); }
.cal-time { display: block; font-size: 11px; color: var(--ink-2); font-weight: 600; }

/* leaderboard */
.me-strip { display: flex; align-items: center; gap: 16px; background: var(--side); color: #dbe6f7; border-radius: var(--radius); padding: 14px 18px; margin-bottom: 18px; flex-wrap: wrap; }
.me-rank { font-size: 30px; font-weight: 800; color: #fff; font-variant-numeric: tabular-nums; }
.me-text { flex: 1; min-width: 220px; }
.me-text b { display: block; color: #fff; }
.me-text span { font-size: 13px; }
.me-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: end; max-width: 820px; margin: 0 auto 22px; }
.pod { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; }
.pod-avatar { position: relative; width: 64px; height: 64px; border-radius: 50%; background: var(--side-2); color: #fff; font-size: 26px; font-weight: 800; display: grid; place-items: center; border: 4px solid #fff; box-shadow: 0 4px 14px rgba(16,30,54,.15); }
.pod-1 .pod-avatar { width: 82px; height: 82px; font-size: 32px; background: var(--primary); }
.pod-place { position: absolute; bottom: -6px; right: -6px; width: 26px; height: 26px; border-radius: 50%; font-size: 13px; display: grid; place-items: center; color: #3a2a00; background: #e7c66b; border: 2px solid #fff; }
.pod-2 .pod-place { background: #d3d9e2; color: #2c3644; }
.pod-3 .pod-place { background: #e4b08a; color: #4a2510; }
.pod-name { font-weight: 700; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.pod-pts { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.pod-pts small { font-size: 12px; color: var(--muted); font-weight: 600; }
.pod-sub { font-size: 12px; color: var(--muted); }
.pod-badges { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; min-height: 24px; }
.pod-block { width: 100%; border-radius: 10px 10px 0 0; margin-top: 8px; background: linear-gradient(180deg, #e9edf4, #dfe5ee); }
.pod-1 .pod-block { height: 110px; background: linear-gradient(180deg, var(--primary-soft), #d7e4fa); }
.pod-2 .pod-block { height: 76px; }
.pod-3 .pod-block { height: 52px; }
.medal { --medal: #475569; display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; color: var(--medal); background: color-mix(in srgb, var(--medal) 12%, #fff); border: 1px solid color-mix(in srgb, var(--medal) 28%, #fff); padding: 2px 7px 2px 5px; border-radius: 20px; white-space: nowrap; }
.medal .ic { width: 12px; height: 12px; }
.me-strip .medal { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.2); color: #fff; }
.medal-row { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.pts-bar { display: flex; height: 8px; border-radius: 5px; overflow: hidden; background: #eef1f6; margin-bottom: 3px; }
.pts-bar i, .pts-legend span { display: block; height: 100%; }
.pb-activities { background: #7aa7ec; }
.pb-new { background: #a78bfa; }
.pb-converted { background: #2fb37a; }
.pb-deals { background: var(--primary); }
.pb-target { background: #f0b429; }
.pts-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; font-size: 12px; color: var(--ink-2); margin-top: 12px; }
.pts-legend span { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: -8px; }
tr.me-row td { background: var(--primary-soft); }
.wins { list-style: none; margin: 0; padding: 0; }
.wins li { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.wins li:last-child { border-bottom: 0; }
.win-ic { width: 30px; height: 30px; border-radius: 50%; background: #fff3dc; color: #b26b00; display: grid; place-items: center; flex: none; }
.win-ic .ic { width: 15px; height: 15px; }
.badge-legend { display: grid; gap: 8px; }
.badge-legend div { display: flex; gap: 10px; align-items: center; }
.badge-legend small { color: var(--ink-2); }
.rank-card { display: flex; align-items: center; gap: 12px; color: var(--ink); padding: 14px 16px; }
.rank-card:hover { text-decoration: none; border-color: #c9d2e0; }
.rank-card span:nth-child(2) { flex: 1; min-width: 0; }
.rank-card b { display: block; }
.rank-card small { color: var(--muted); }
.rank-ic { width: 40px; height: 40px; border-radius: 10px; background: #fff3dc; color: #b26b00; display: grid; place-items: center; flex: none; }
.rank-go { color: var(--muted); }

/* audit */
.act { font-weight: 650; font-size: 12.5px; }
.act-delete, .act-delete_file, .act-login_failed { color: var(--bad); }
.act-create, .act-convert, .act-enquiry { color: var(--ok); }
.act-export { color: #b26b00; }
tr.warn-row td { background: #fff8f8; }
.audit-sum { max-width: 560px; word-break: break-word; }

/* settings */
.settings-tabs { position: sticky; top: 61px; background: var(--bg); z-index: 20; }
.settings-tabs a { scroll-margin-top: 120px; }
section.card { scroll-margin-top: 120px; }
.brand-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 24px; }
.logo-preview { height: 90px; border: 1px dashed #c9d2e0; border-radius: 10px; display: grid; place-items: center; margin-bottom: 12px; background: #fafbfd; }
.logo-preview img { max-height: 70px; max-width: 80%; object-fit: contain; }
input[type=color] { padding: 3px; height: 42px; cursor: pointer; }
.copy-row { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 10px; }
.copy-row .field { flex: 1; margin-bottom: 0; min-width: 0; }
.copy-row > input { flex: 1; min-width: 0; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }
.save-bar { position: sticky; bottom: 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; background: rgba(255,255,255,.95); backdrop-filter: blur(6px); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 18px; box-shadow: 0 -4px 18px rgba(16,30,54,.08); z-index: 15; }

/* confetti */
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 200; }

@media (max-width: 1100px) {
  .cal-week { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .bell-panel { right: -100px; }
  .brand-grid { grid-template-columns: 1fr; }
  .settings-tabs { top: 53px; }
  .cal-month { display: block; background: none; border: 0; box-shadow: none; }
  .cal-dow, .cal-day.empty-day { display: none; }
  .cal-day { min-height: 0; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; padding: 10px; }
  .cal-day.other { display: none; }
  .cal-wd { display: inline; }
  .cal-add { opacity: 1; }
  .cal-ev { white-space: normal; font-size: 13px; padding: 6px 8px; }
  .cal-week { grid-template-columns: 1fr; }
  .cal-wcol { min-height: 0; }
  .podium { gap: 8px; }
  .pod-avatar { width: 52px; height: 52px; font-size: 21px; }
  .pod-1 .pod-avatar { width: 64px; height: 64px; }
  .pod-badges { display: none; }
}
@media (max-width: 600px) {
  .quote-sum { flex-direction: column; align-items: stretch; }
  .sum-box { margin-left: 0; min-width: 0; }
  .qi-wrap { margin: 0; }
  .qi-table thead { display: none; }
  .qi-table tr { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .qi-table td { padding: 0; border: 0; }
  .qi-table td:first-child { grid-column: 1 / -1; }
  .qi-table .qi-line { display: none; }
  .copy-row { flex-wrap: wrap; }
  .save-bar span { display: none; }
}

/* =================== v1.2 additions =================== */
.b-main { background: var(--primary-soft); color: var(--primary); }
.b-recurring { background: #e7f6f3; color: #0f766e; }
.b-r-active { background: var(--ok-soft); color: var(--ok); }
.b-r-due { background: var(--warn-soft); color: var(--warn); }
.b-r-expired { background: var(--bad-soft); color: var(--bad); }
.b-r-renewed { background: #e7f6f3; color: #0f766e; }
.b-r-lost, .b-r-cancelled { background: #f1f2f4; color: #7d8592; }
.b-t-identified { background: #eef1f6; color: #3e4c63; }
.b-t-preparing { background: var(--primary-soft); color: var(--primary); }
.b-t-submitted { background: #efe8fd; color: #5b2fc2; }
.b-t-won { background: var(--ok-soft); color: var(--ok); }
.b-t-lost { background: var(--bad-soft); color: var(--bad); }
.b-t-nobid, .b-t-cancelled { background: #f1f2f4; color: #7d8592; }
.linkish.danger { color: var(--bad); }

/* contacts */
.contact-list { list-style: none; margin: 0 0 10px; padding: 0; }
.contact-list > li { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.contact-list > li:last-child { border-bottom: 0; }
.ct-avatar { width: 32px; height: 32px; border-radius: 50%; background: #eef1f6; color: var(--ink-2); font-weight: 700; display: grid; place-items: center; flex: none; }
.ct-main { flex: 1; min-width: 0; }
.ct-note { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }
.ct-edit summary, .ct-add summary { font-size: 12.5px; }
.ct-add summary { display: inline-flex; align-items: center; gap: 4px; }
.ct-add summary .ic { width: 14px; height: 14px; }
.contact-form { margin: 10px 0 6px; background: #fafbfd; border: 1px solid var(--line); border-radius: 8px; padding: 12px; }

/* renewals & tenders */
.subcard { background: #fafbfd; border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.subcard > b { margin-bottom: 8px; }
.recurring-box { background: #f5fbfa; border: 1px solid #cfe9e4; border-radius: 10px; padding: 12px 14px 2px; margin-bottom: 14px; }
.dl { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 20px; white-space: nowrap; }
.dl .ic { width: 12px; height: 12px; }
.dl-cool { background: #eef1f6; color: var(--ink-2); }
.dl-warm { background: var(--warn-soft); color: var(--warn); }
.dl-hot { background: #ffe6d5; color: #c2410c; }
.dl-late { background: var(--bad-soft); color: var(--bad); }
.checklist { list-style: none; margin: 0 0 12px; padding: 0; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.checklist li span { flex: 1; min-width: 0; }
.checklist li.done span { color: var(--muted); text-decoration: line-through; }
.checklist li form { display: contents; }
.tick { width: 22px; height: 22px; border-radius: 6px; border: 2px solid #c9d2e0; background: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; color: #fff; flex: none; }
.tick .ic { width: 14px; height: 14px; }
.checklist li.done .tick { background: var(--ok); border-color: var(--ok); }
.checklist .icon-btn { opacity: .45; }
.checklist li:hover .icon-btn { opacity: 1; }
.ev-tender { background: #efe8fd; border-color: #7c3aed; }
.ev-renewal { background: #e7f6f3; border-color: #0f766e; }
.cal-ev .ic { width: 11px; height: 11px; vertical-align: -1px; }
.lg.tender::before { background: #7c3aed; }
.lg.renewal::before { background: #0f766e; }
.up-ic { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; margin-right: 8px; vertical-align: -5px; }
.up-ic .ic { width: 12px; height: 12px; }
.up-tender { background: #efe8fd; color: #7c3aed; }
.up-renewal { background: #e7f6f3; color: #0f766e; }
.up-sub { margin-left: 30px; }
