/* Maxify HQ. Plain CSS, no build step.
   Colours are the Maxify Tickets brand tokens; geometry is square throughout. */

/* Helvetica Now Display, the Maxify Tickets typeface (same files as frontend-admin/public/fonts). */
@font-face { font-family: "Helvetica Now Display"; src: url("../fonts/HelveticaNowDisplay-Regular.01db325a7f89.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Helvetica Now Display"; src: url("../fonts/HelveticaNowDisplay-Medium.87caf42962ee.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Helvetica Now Display"; src: url("../fonts/HelveticaNowDisplay-Bold.7192af0d2ced.woff2") format("woff2"); font-weight: 600 700; font-style: normal; font-display: swap; }

:root {
  /* Maxify Tickets brand */
  --brand: #107bef;
  --brand-hover: #0d6ad6;
  --brand-subtle: #f1f8ff;
  --brand-ring: #cfe6ff;

  --ink: #171717;
  --ink-muted: #545454;
  --ink-subtle: #737373;

  --canvas: #fafafa;
  --surface: #ffffff;
  --hairline: #eaeaea;
  --control: #d0d5dd;

  /* Functional states */
  --success: #16a34a;
  --success-subtle: #f0fdf4;
  --warning: #b45309;
  --warning-subtle: #fffbeb;
  --danger: #dc2626;
  --danger-subtle: #fef2f2;

  --font: "Helvetica Now Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --sidebar-w: 240px;
  --topbar-h: 56px;
  --control-h: 36px;
}

/* Base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; border-radius: 0; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-hover); text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { color: var(--ink); margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 20px; line-height: 28px; }
h2 { font-size: 15px; line-height: 22px; }
h3 { font-size: 13px; line-height: 20px; }
p { margin: 0 0 8px; }
code { font-family: var(--mono); font-size: 12px; color: var(--ink-muted); }
small, .muted { color: var(--ink-muted); }
.faint { color: var(--ink-subtle); }
[x-cloak] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand-ring); outline-offset: 1px; }

ion-icon { font-size: 18px; width: 18px; height: 18px; flex-shrink: 0; }
.icon-sm { font-size: 16px; width: 16px; height: 16px; }

/* App shell ------------------------------------------------------------ */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--hairline);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column;
}
.brand {
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
  height: var(--topbar-h); padding: 0 20px;
  border-bottom: 1px solid var(--hairline);
  font-weight: 600; font-size: 15px; color: var(--ink);
}
.brand-mark {
  width: 28px; height: 28px; background: var(--brand); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
}
.nav { padding: 12px 0 24px; flex-shrink: 0; }
.nav-section {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-subtle); padding: 16px 20px 6px;
}
.nav a {
  display: flex; align-items: center; gap: 12px;
  height: 36px; padding: 0 20px 0 18px;
  border-left: 2px solid transparent;
  color: var(--ink-muted); font-weight: 500;
}
.nav a ion-icon { color: var(--ink-subtle); }
.nav a:hover { background: var(--canvas); color: var(--ink); text-decoration: none; }
.nav a.active { background: var(--brand-subtle); border-left-color: var(--brand); color: var(--brand); }
.nav a.active ion-icon { color: var(--brand); }
.nav a .count { margin-left: auto; min-width: 20px; height: 20px; line-height: 20px; padding: 0 6px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 600; text-align: center; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 12px;
  height: var(--topbar-h); padding: 0 32px;
  background: var(--surface); border-bottom: 1px solid var(--hairline);
  position: sticky; top: 0; z-index: 20;
}
.topbar .spacer { flex: 1; }
.content { padding: 28px 32px 48px; max-width: 1320px; width: 100%; }
.topbar .menu-toggle { display: none; }

.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head .eyebrow { font-size: 12px; color: var(--ink-subtle); margin-bottom: 2px; }
.page-head .sub { display: block; font-size: 13px; color: var(--ink-muted); margin-top: 2px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Surfaces ------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--hairline); padding: 20px; }
.card + .card { margin-top: 16px; }
.grid > .card + .card, .split > .card + .card { margin-top: 0; }
.card.flush { padding: 0; }
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; min-height: 28px; }
.card-head .right { margin-left: auto; }
.card > h2, .card > h3 { margin-bottom: 14px; }
.card.flush > .card-head { padding: 16px 20px 0; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.section { margin-bottom: 16px; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.empty { color: var(--ink-subtle); padding: 20px 0; text-align: center; font-size: 13px; }

/* Stats */
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat .label {
  font-size: 12px; font-weight: 500; color: var(--ink-subtle);
}
.stat .value { font-size: 28px; line-height: 34px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 15px; font-weight: 500; color: var(--ink-subtle); letter-spacing: 0; }
.stat .foot { font-size: 12px; color: var(--ink-muted); }

/* Buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: var(--control-h); padding: 0 14px;
  border: 1px solid var(--control); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 13px; font-weight: 500; line-height: 1;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background-color 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover { background: var(--canvas); border-color: #b9bec7; color: var(--ink); text-decoration: none; }
.btn ion-icon { font-size: 16px; width: 16px; height: 16px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: #fff; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-subtle); border-color: var(--danger); color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--ink-muted); }
.btn-ghost:hover { background: var(--canvas); border-color: transparent; color: var(--ink); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn-icon { width: var(--control-h); padding: 0; }
.btn-icon.btn-sm { width: 30px; }
.btn[disabled], .btn[disabled]:hover { opacity: 0.45; cursor: not-allowed; background: var(--surface); }
.btn-primary[disabled], .btn-primary[disabled]:hover { background: var(--brand); }
.btn-group { display: inline-flex; }
.btn-group .btn + .btn { margin-left: -1px; }
.btn-group .btn.active { background: var(--brand-subtle); border-color: var(--brand); color: var(--brand); position: relative; z-index: 1; }
.htmx-request.btn, .htmx-request .btn[type=submit] { opacity: 0.6; pointer-events: none; }

/* Forms ---------------------------------------------------------------- */
.field { margin-bottom: 16px; }
.field > label { display: block; font-size: 13px; font-weight: 500; color: var(--ink); margin-bottom: 6px; }
.field .optional { color: var(--ink-subtle); font-weight: 400; }
.field .help { color: var(--ink-subtle); font-size: 12px; margin-top: 4px; }
.field .errors { color: var(--danger); font-size: 12px; margin-top: 4px; }
.form-errors { background: var(--danger-subtle); border: 1px solid #fecaca; color: var(--danger); padding: 10px 12px; margin-bottom: 16px; font-size: 13px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time],
input[type=datetime-local], input[type=search], input[type=file], select, textarea {
  width: 100%; height: var(--control-h); padding: 0 10px;
  font: inherit; font-size: 14px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--control);
  -webkit-appearance: none; appearance: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}
input[type=file] { padding: 6px 10px; height: auto; font-size: 13px; }
select {
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%23737373' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
select[multiple] { height: auto; padding: 4px; background-image: none; }
textarea { height: auto; min-height: 88px; padding: 8px 10px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--ink-subtle); }
input:hover, select:hover, textarea:hover { border-color: #b9bec7; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; margin: 0; accent-color: var(--brand); }
.field ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; }
.field ul label { font-weight: 400; display: inline-flex; gap: 8px; align-items: center; font-size: 13px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-muted); cursor: pointer; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; align-items: center; margin-top: 4px; }

.filters {
  display: flex; gap: 8px; flex-wrap: wrap; align-items: center;
  padding: 12px; margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--hairline);
}
.filters select, .filters input[type=search] { width: auto; min-width: 150px; height: 32px; font-size: 13px; }
.filters input[type=search] { min-width: 220px; }
.filters .check { margin-left: 4px; }

/* Tables --------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-size: 12px; font-weight: 500; color: var(--ink-subtle);
  background: var(--canvas); border-bottom: 1px solid var(--hairline);
  padding: 10px 12px; white-space: nowrap;
}
.table td { border-bottom: 1px solid var(--hairline); padding: 12px; vertical-align: middle; color: var(--ink); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--canvas); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions-cell { text-align: right; white-space: nowrap; }
.card.flush .table th:first-child, .card.flush .table td:first-child { padding-left: 20px; }
.card.flush .table th:last-child, .card.flush .table td:last-child { padding-right: 20px; }

/* Badges --------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 8px;
  font-size: 12px; font-weight: 500; white-space: nowrap;
  background: var(--canvas); color: var(--ink-muted); border: 1px solid var(--hairline);
}
.badge.backlog { background: var(--canvas); color: var(--ink-muted); border-color: var(--hairline); }
.badge.in_progress { background: var(--brand-subtle); color: var(--brand); border-color: var(--brand-ring); }
.badge.in_review { background: var(--surface); color: var(--brand); border-color: var(--brand); }
.badge.completed { background: var(--success-subtle); color: var(--success); border-color: #bbf7d0; }
.badge.deployed_staging { background: var(--surface); color: var(--success); border-color: var(--success); }
.badge.deployed_main { background: var(--success); color: #fff; border-color: var(--success); }
.badge.good { background: var(--success-subtle); color: var(--success); border-color: #bbf7d0; }
.badge.warn, .badge.high { background: var(--warning-subtle); color: var(--warning); border-color: #fde68a; }
.badge.bad, .badge.urgent { background: var(--danger-subtle); color: var(--danger); border-color: #fecaca; }
.badge.brand { background: var(--brand-subtle); color: var(--brand); border-color: var(--brand-ring); }

.status-mark { width: 8px; height: 8px; display: inline-block; background: var(--control); flex-shrink: 0; }
.status-mark.working { background: var(--success); }
.status-mark.meeting { background: var(--ink-muted); }
.status-mark.focusing { background: var(--brand); }
.status-mark.on_leave { background: var(--warning); }
.status-mark.offline { background: var(--control); }

/* Scores and meters */
.score { font-weight: 600; font-variant-numeric: tabular-nums; }
.score.high { color: var(--success); }
.score.mid { color: var(--warning); }
.score.low { color: var(--danger); }
.meter { height: 4px; background: var(--hairline); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--brand); }
.meter.good > span { background: var(--success); }
.meter.warn > span { background: var(--warning); }
.meter.bad > span { background: var(--danger); }

/* Tasks ---------------------------------------------------------------- */
.task-title { font-weight: 500; color: var(--ink); }
.task-title:hover { color: var(--brand); }
.task-meta { color: var(--ink-subtle); font-size: 12px; }
.overdue { color: var(--danger); }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.column { background: var(--canvas); border: 1px solid var(--hairline); padding: 10px; min-height: 280px; }
.column.drag-over { background: var(--brand-subtle); border-color: var(--brand); }
.column-head { display: flex; align-items: center; gap: 8px; padding: 2px 2px 10px; }
.column-head .n { color: var(--ink-subtle); font-size: 12px; margin-left: auto; font-variant-numeric: tabular-nums; }
.task-card { background: var(--surface); border: 1px solid var(--hairline); padding: 10px 12px; margin-bottom: 8px; cursor: grab; }
.task-card:hover { border-color: var(--control); }
.task-card.blocked { border-left: 2px solid var(--danger); }
.task-card .task-meta { margin-top: 2px; }
.task-card .row { margin-top: 8px; gap: 4px; }

.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--hairline); border-right: 0; border-bottom: 0; background: var(--surface); }
.calendar .dow { font-size: 12px; font-weight: 500; color: var(--ink-subtle); padding: 8px 10px; background: var(--canvas); border-right: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.calendar .day { min-height: 112px; padding: 8px; border-right: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); font-size: 12px; }
.calendar .day.other { background: var(--canvas); color: var(--ink-subtle); }
.calendar .day .num { display: inline-block; min-width: 22px; height: 22px; line-height: 22px; text-align: center; font-weight: 500; }
.calendar .day.today .num { background: var(--brand); color: #fff; }
.calendar .chip { display: block; background: var(--brand-subtle); color: var(--brand); border-left: 2px solid var(--brand); padding: 2px 6px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calendar .chip:hover { text-decoration: none; background: var(--brand-ring); }
.calendar .chip.done { background: var(--success-subtle); color: var(--success); border-left-color: var(--success); }
.calendar .chip.late { background: var(--danger-subtle); color: var(--danger); border-left-color: var(--danger); }

.list { list-style: none; padding: 0; margin: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--hairline); font-size: 13px; }
.list li:first-child { padding-top: 0; }
.list li:last-child { border-bottom: 0; padding-bottom: 0; }
.list .meta { color: var(--ink-subtle); font-size: 12px; margin-top: 2px; }
.comment { padding: 14px 0; border-bottom: 1px solid var(--hairline); }
.comment:first-child { padding-top: 0; }
.comment:last-child { border-bottom: 0; }
.comment .who { font-weight: 600; font-size: 13px; }
.comment .when { color: var(--ink-subtle); font-size: 12px; }
.comment .body { white-space: pre-wrap; margin-top: 6px; color: var(--ink); }
.attachment { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: 10px; align-items: center; padding: 6px 0; font-size: 13px; }
.checklist li.done span { text-decoration: line-through; color: var(--ink-subtle); }
.kv { display: grid; grid-template-columns: 112px 1fr; gap: 10px 12px; font-size: 13px; margin: 0; }
.kv dt { color: var(--ink-subtle); }
.kv dd { margin: 0; color: var(--ink); }
.alert { display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin-bottom: 16px; font-size: 13px; border: 1px solid; }
.alert-bad { background: var(--danger-subtle); color: var(--danger); border-color: #fecaca; }
.alert-warn { background: var(--warning-subtle); color: var(--warning); border-color: #fde68a; }
.alert-info { background: var(--brand-subtle); color: var(--brand); border-color: var(--brand-ring); }
.alert .right { margin-left: auto; }
.note { font-size: 12px; color: var(--ink-subtle); margin-top: 12px; }

/* Top bar controls ------------------------------------------------------ */
.clock { display: flex; align-items: center; gap: 10px; padding-right: 12px; margin-right: 4px; border-right: 1px solid var(--hairline); }
.clock .timer { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; color: var(--ink); }
.clock .state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--success); font-weight: 500; }
.menu-anchor { position: relative; }
.bell-count {
  position: absolute; top: 4px; right: 3px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--brand); color: #fff; font-size: 10px; font-weight: 600; line-height: 16px; text-align: center;
}
.dropdown {
  position: absolute; right: 0; top: calc(100% + 8px);
  width: 360px; max-height: 480px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--hairline);
  box-shadow: 0 12px 32px -12px rgba(23, 23, 23, 0.18); z-index: 50;
}
.dropdown-head { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--hairline); font-weight: 600; font-size: 13px; }
.dropdown-head .btn { margin-left: auto; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 10px 16px; border: 0; background: none; text-align: left;
  font: inherit; font-size: 13px; color: var(--ink); cursor: pointer;
}
.menu-item:hover { background: var(--canvas); color: var(--ink); text-decoration: none; }
.menu-item ion-icon { color: var(--ink-subtle); }
.menu-divider { border-top: 1px solid var(--hairline); }
.menu-profile { padding: 12px 16px; border-bottom: 1px solid var(--hairline); }
.menu-profile .name { font-weight: 600; font-size: 13px; }
.menu-profile .meta { font-size: 12px; color: var(--ink-subtle); }
.notif {
  display: block; width: 100%; padding: 12px 16px;
  border: 0; border-bottom: 1px solid var(--hairline); background: var(--surface);
  text-align: left; font: inherit; color: var(--ink); cursor: pointer;
}
.notif:hover { background: var(--canvas); }
.notif.unread { box-shadow: inset 2px 0 0 var(--brand); background: var(--brand-subtle); }
.notif .t { font-weight: 500; font-size: 13px; }
.notif .b { color: var(--ink-muted); font-size: 12px; white-space: pre-line; max-height: 3.2em; overflow: hidden; margin-top: 2px; }
.notif .w { color: var(--ink-subtle); font-size: 11px; margin-top: 4px; }
.notif-list .notif:last-child { border-bottom: 0; }
.notif-list .notif .b { max-height: none; }
.avatar {
  width: 28px; height: 28px; background: var(--brand-subtle); color: var(--brand);
  display: inline-grid; place-items: center; font-weight: 600; font-size: 11px; flex-shrink: 0;
}

/* Modal ---------------------------------------------------------------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(23, 23, 23, 0.4); display: grid; place-items: start center; padding: 8vh 16px; z-index: 100; overflow-y: auto; }
.modal { background: var(--surface); width: min(680px, 100%); border: 1px solid var(--hairline); box-shadow: 0 24px 48px -16px rgba(23, 23, 23, 0.25); }
.modal-head { display: flex; align-items: center; height: 56px; padding: 0 20px; border-bottom: 1px solid var(--hairline); }
.modal-head .close { margin-left: auto; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--hairline); background: var(--canvas); }

/* Toasts --------------------------------------------------------------- */
.toasts { position: fixed; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast {
  display: flex; align-items: center; gap: 10px;
  background: var(--ink); color: #fff; padding: 12px 16px; min-width: 260px; max-width: 380px;
  font-size: 13px; border-left: 3px solid var(--brand);
}
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }
.toast.success { border-left-color: var(--success); }

/* Charts --------------------------------------------------------------- */
.bars { display: grid; grid-template-columns: repeat(7, 1fr); gap: 12px; align-items: end; height: 160px; }
.bars .bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; font-size: 12px; color: var(--ink-subtle); font-variant-numeric: tabular-nums; }
.bars .bar .fill { width: 100%; max-width: 44px; background: var(--brand); min-height: 1px; }
.bars .bar .value { color: var(--ink-muted); }
.trend { display: flex; gap: 6px; align-items: end; height: 132px; }
.trend .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; font-size: 11px; color: var(--ink-subtle); font-variant-numeric: tabular-nums; }
.trend .col .fill { width: 100%; background: var(--brand-ring); min-height: 1px; }
.trend .col.current .fill { background: var(--brand); }
.trend .col.none .fill { background: var(--hairline); }

/* Auth ----------------------------------------------------------------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--canvas); }
.auth-panel { width: min(400px, 100%); background: var(--surface); border: 1px solid var(--hairline); border-top: 3px solid var(--brand); padding: 32px; }
.auth-panel .brand { height: auto; padding: 0 0 24px; border: 0; }
.auth-panel h1 { margin-bottom: 6px; }
.auth-panel .lead { color: var(--ink-muted); font-size: 13px; margin-bottom: 20px; }
.btn-block { width: 100%; }

/* Responsive ----------------------------------------------------------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: var(--sidebar-w); z-index: 60; transform: translateX(-100%); transition: transform 0.2s; }
  .sidebar.open { transform: none; border-right-color: var(--control); }
  .topbar .menu-toggle { display: inline-flex; }
  .grid-2, .grid-3, .split, .form-grid { grid-template-columns: 1fr; }
  .content { padding: 20px 16px 40px; }
  .topbar { padding: 0 16px; }
  .clock { border-right: 0; padding-right: 0; }
  .dropdown { width: min(360px, calc(100vw - 32px)); }
}
@media (max-width: 560px) {
  .grid-4 { grid-template-columns: 1fr; }
}

/* Compact task tables (overview): title, status, due only. */
.table.compact td:nth-child(3), .table.compact td:nth-child(5), .table.compact td:nth-child(6) { display: none; }

/* Image pins */
.pin-image { margin-top: 10px; }
.pin-frame { position: relative; display: inline-block; max-width: 100%; border: 1px solid var(--hairline); line-height: 0; }
.pin-frame img { max-width: 100%; max-height: 520px; display: block; }
.pin-frame.placing { cursor: crosshair; outline: 2px solid var(--brand); outline-offset: -2px; }
.pin {
  position: absolute; transform: translate(-50%, -50%);
  min-width: 22px; height: 22px; padding: 0 4px; line-height: 22px; text-align: center;
  background: var(--brand); color: #fff; font-size: 11px; font-weight: 600; border: 2px solid #fff;
}
.pin:hover { background: var(--brand-hover); color: #fff; text-decoration: none; }
.pin-new { background: var(--ink); }

/* Approvals */
.approval-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 420px); gap: 20px; padding: 16px 20px; border-top: 1px solid var(--hairline); align-items: start; }
.approval-progress { display: flex; gap: 4px; margin: 8px 0; }
.approval-progress span { flex: 1; height: 4px; background: var(--hairline); }
.approval-progress span.done { background: var(--success); }
@media (max-width: 960px) { .approval-row { grid-template-columns: 1fr; } }

/* Chat */
.chat-shell { display: grid; grid-template-columns: 280px minmax(0, 1fr); height: calc(100vh - var(--topbar-h) - 76px); min-height: 480px; background: var(--surface); border: 1px solid var(--hairline); }
.chat-groups { border-right: 1px solid var(--hairline); overflow-y: auto; }
.chat-groups-head { display: flex; align-items: center; height: 56px; padding: 0 12px 0 16px; border-bottom: 1px solid var(--hairline); }
.chat-groups-head .btn { margin-left: auto; }
.chat-group { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-left: 2px solid transparent; color: var(--ink); border-bottom: 1px solid var(--hairline); }
.chat-group:hover { background: var(--canvas); text-decoration: none; color: var(--ink); }
.chat-group.active { background: var(--brand-subtle); border-left-color: var(--brand); }
.chat-group ion-icon { color: var(--ink-subtle); }
.chat-group.active ion-icon { color: var(--brand); }
.chat-group .name { display: flex; flex-direction: column; min-width: 0; font-weight: 500; font-size: 13px; }
.chat-group .name small { color: var(--ink-subtle); font-weight: 400; font-size: 12px; }
.chat-group .count { margin-left: auto; min-width: 20px; height: 20px; line-height: 20px; padding: 0 6px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 600; text-align: center; }
.chat-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-empty { align-items: center; justify-content: center; }
.chat-head { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 20px; border-bottom: 1px solid var(--hairline); }
.chat-scroll { flex: 1; overflow-y: auto; padding: 8px 0; }
.earlier { text-align: center; padding: 8px; }
.msg { position: relative; display: flex; gap: 12px; padding: 8px 20px; }
.msg:hover { background: var(--canvas); }
.msg-main { min-width: 0; flex: 1; }
.msg-head { display: flex; align-items: baseline; gap: 8px; }
.msg-head .who { font-weight: 600; font-size: 13px; }
.msg-head .when { color: var(--ink-subtle); font-size: 11px; }
.msg-body { white-space: pre-wrap; word-wrap: break-word; font-size: 14px; }
.msg-quote { display: block; border-left: 2px solid var(--control); padding: 2px 8px; margin: 4px 0; color: var(--ink-muted); font-size: 12px; background: var(--canvas); }
.msg-quote:hover { text-decoration: none; border-left-color: var(--brand); color: var(--ink); }
.msg-actions { position: absolute; right: 16px; top: 4px; display: none; background: var(--surface); border: 1px solid var(--hairline); }
.msg:hover .msg-actions { display: flex; }
.mention { color: var(--brand); font-weight: 500; background: var(--brand-subtle); padding: 0 2px; }
.typing { height: 20px; padding: 0 20px; font-size: 12px; color: var(--ink-subtle); }
.chat-composer { border-top: 1px solid var(--hairline); padding: 12px 20px; }
.chat-composer textarea { min-height: 36px; height: 36px; max-height: 160px; padding-top: 7px; resize: vertical; }
.reply-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; margin-bottom: 8px; background: var(--brand-subtle); border-left: 2px solid var(--brand); font-size: 12px; color: var(--ink-muted); }
.reply-bar .btn { margin-left: auto; }
@media (max-width: 960px) {
  .chat-shell { grid-template-columns: 1fr; height: auto; }
  .chat-groups { border-right: 0; border-bottom: 1px solid var(--hairline); max-height: 220px; }
  .chat-pane { height: 70vh; }
}

@media (max-width: 640px) {
  .hide-sm { display: none; }
  .topbar { gap: 4px; }
  .topbar .btn-primary { width: var(--control-h); padding: 0; }
  .clock { gap: 6px; }
  .page-head .actions { margin-left: 0; }
}

/* Assets */
.asset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.asset-card { display: block; background: var(--surface); border: 1px solid var(--hairline); color: var(--ink); }
.asset-card:hover { border-color: var(--brand); text-decoration: none; color: var(--ink); }
.asset-thumb { position: relative; height: 150px; background: var(--canvas); display: grid; place-items: center; overflow: hidden; border-bottom: 1px solid var(--hairline); }
.asset-thumb img { width: 100%; height: 100%; object-fit: cover; }
.asset-thumb ion-icon { font-size: 40px; width: 40px; height: 40px; color: var(--ink-subtle); }
.asset-flag { position: absolute; top: 8px; left: 8px; }
.asset-info { padding: 10px 12px; }
.asset-preview { background: var(--canvas); border: 1px solid var(--hairline); display: grid; place-items: center; min-height: 220px; }
.asset-preview img, .asset-preview video { max-width: 100%; max-height: 520px; display: block; }

/* Sales */
.badge.stage-new { background: var(--canvas); color: var(--ink-muted); }
.badge.stage-contacted { background: var(--brand-subtle); color: var(--brand); border-color: var(--brand-ring); }
.badge.stage-qualified { background: var(--surface); color: var(--brand); border-color: var(--brand); }
.badge.stage-proposal { background: var(--brand); color: #fff; border-color: var(--brand); }
.badge.stage-won { background: var(--success-subtle); color: var(--success); border-color: #bbf7d0; }
.badge.stage-lost { background: var(--danger-subtle); color: var(--danger); border-color: #fecaca; }
.funnel-row { display: grid; grid-template-columns: 110px 1fr 60px 56px; gap: 12px; align-items: center; padding: 6px 0; }
.funnel-label { font-size: 13px; font-weight: 500; }
.funnel-bar { height: 22px; background: var(--canvas); border: 1px solid var(--hairline); }
.funnel-bar span { display: block; height: 100%; background: var(--brand); }
.funnel-count { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.funnel-rate { text-align: right; font-size: 12px; color: var(--ink-subtle); font-variant-numeric: tabular-nums; }

.money { font-variant-numeric: proportional-nums; letter-spacing: 0; white-space: nowrap; }

/* Meetings */
.join-when { padding: 4px 0 20px; }
.join-date { font-size: 18px; font-weight: 600; }
.join-time { font-size: 15px; margin-top: 2px; }
.countdown { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--hairline); margin-bottom: 16px; }
.countdown div { padding: 16px 8px; text-align: center; border-right: 1px solid var(--hairline); background: var(--canvas); }
.countdown div:last-child { border-right: 0; }
.countdown span { display: block; font-size: 32px; line-height: 40px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); }
.countdown small { font-size: 12px; color: var(--ink-subtle); }
.btn-join { height: 48px; padding: 0 28px; font-size: 15px; }
.meeting-row { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--hairline); }
.meeting-date { text-align: center; border: 1px solid var(--hairline); padding: 6px 0; }
.meeting-date .d { font-size: 22px; font-weight: 600; line-height: 26px; }
.meeting-date .m { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-subtle); }
.badge.att-attended { background: var(--success-subtle); color: var(--success); border-color: #bbf7d0; }
.badge.att-late { background: var(--warning-subtle); color: var(--warning); border-color: #fde68a; }
.badge.att-absent { background: var(--danger-subtle); color: var(--danger); border-color: #fecaca; }
.badge.att-excused { background: var(--canvas); color: var(--ink-muted); }
.badge.att-invited { background: var(--brand-subtle); color: var(--brand); border-color: var(--brand-ring); }
.people-pick { max-height: 320px; overflow-y: auto; border: 1px solid var(--control); }
.people-pick .team-head { position: sticky; top: 0; display: flex; align-items: center; gap: 8px; padding: 6px 12px; background: var(--canvas); border-bottom: 1px solid var(--hairline); font-size: 12px; font-weight: 600; color: var(--ink-muted); }
.people-pick label { display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-bottom: 1px solid var(--hairline); font-size: 13px; cursor: pointer; }
.people-pick label:hover { background: var(--canvas); }
@media (max-width: 640px) { .countdown span { font-size: 24px; } .meeting-row { grid-template-columns: 72px minmax(0, 1fr); } }

/* Checkbox and radio groups (Django renders each option in its own div) */
.field > div[id]:has(input[type=checkbox], input[type=radio]) { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.field > div[id] > div > label { display: inline-flex; align-items: center; gap: 8px; font-weight: 400; font-size: 13px; cursor: pointer; }
