/* Shipster CRM. One loud thing: the urgency stripe on deals and tasks. Everything else stays quiet. */

:root {
  --ink: #14213d;
  --ink-2: #2b3a5c;
  --text: #1c2536;
  --muted: #5d6b82;
  --faint: #8d99ae;
  --line: #d6dce5;
  --surface: #ffffff;
  --board: #e8ecf1;
  --column: #f3f5f8;
  --marker: #ffc93c;
  --marker-deep: #e8a900;
  --overdue: #d7263d;
  --overdue-bg: #fdecee;
  --today: #e07a1f;
  --today-bg: #fff3e6;
  --ok: #1f8a7a;
  --ok-bg: #e5f4f1;
  --quiet: #a3adbd;
  --link: #24479b;
  --focus: #2f6fed;
  --radius: 6px;
  --font: "Archivo", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--board);
  font-variant-numeric: tabular-nums;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-stretch: 112%; letter-spacing: -0.01em; color: var(--ink); }
h1 { font-size: 26px; font-weight: 750; line-height: 1.15; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 14px; font-weight: 700; }
p { margin: 0 0 12px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex; align-items: center; gap: 24px;
  height: 56px; padding: 0 20px;
  background: var(--ink); color: #fff;
  position: sticky; top: 0; z-index: 20;
}
.brand { font-weight: 850; font-stretch: 75%; font-size: 21px; color: #fff; letter-spacing: 0.01em; }
.brand:hover { text-decoration: none; }
.brand span { color: var(--marker); }
.nav { display: flex; gap: 4px; flex: 1; min-width: 0; }
/* Phone only: the nav folds into a menu under this button. */
.nav-toggle {
  display: none; position: relative; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0; border: 0; border-radius: var(--radius);
  background: transparent; color: #fff; cursor: pointer;
}
.nav-toggle:hover, .nav-toggle[aria-expanded="true"] { background: var(--ink-2); }
.nav-toggle .count { position: absolute; top: -2px; right: -6px; min-width: 18px; line-height: 18px; font-size: 11px; padding: 0 4px; }
.nav a {
  color: #c5cde0; padding: 6px 10px; border-radius: var(--radius); font-weight: 550; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.nav a:hover { color: #fff; background: var(--ink-2); text-decoration: none; }
.nav a[aria-current="page"] { color: #fff; background: var(--ink-2); }
.count {
  display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px;
  background: var(--overdue); color: #fff; font-size: 12px; font-weight: 700; text-align: center; line-height: 20px;
}
.who { display: flex; align-items: center; gap: 10px; }
.avatar {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: #dfe5ef; color: var(--ink); font-size: 11px; font-weight: 750; flex: none;
}
.topbar .avatar { background: var(--ink-2); color: #fff; }
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-items {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 180px; z-index: 30;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(20, 33, 61, 0.16); padding: 4px;
}
.menu-items a, .menu-items button {
  display: block; width: 100%; text-align: left; padding: 7px 10px; border: 0; background: none;
  font: inherit; color: var(--text); border-radius: 4px; cursor: pointer;
}
.menu-items a:hover, .menu-items button:hover { background: var(--column); text-decoration: none; }
.menu-items .sep { border-top: 1px solid var(--line); margin: 4px 0; }

/* ---------- Buttons & form controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 0 14px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--faint); text-decoration: none; }
.btn-create { background: var(--marker); border-color: var(--marker); color: var(--ink); font-weight: 750; }
.btn-create:hover { background: var(--marker-deep); border-color: var(--marker-deep); }
.btn-ink { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn-ink:hover { background: var(--ink-2); border-color: var(--ink-2); }
.btn-danger { color: var(--overdue); }
.btn-danger:hover { border-color: var(--overdue); }
.btn-sm { min-height: 28px; padding: 0 10px; font-size: 13px; }
.btn-icon { width: 28px; min-height: 28px; padding: 0; border-color: transparent; background: transparent; color: var(--muted); }
.btn-icon:hover { background: var(--column); color: var(--text); border-color: transparent; }
.btn-link { border: 0; background: none; padding: 0; color: var(--link); font: inherit; cursor: pointer; }
.btn-link:hover { text-decoration: underline; }
kbd {
  font: inherit; font-size: 11px; font-weight: 700; padding: 0 5px; border-radius: 3px;
  border: 1px solid rgba(20, 33, 61, 0.3); line-height: 16px;
}

label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number],
input[type=date], input[type=search], input[type=url], input:not([type]), select, textarea {
  width: 100%; min-height: 36px; padding: 6px 10px;
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.18); }
textarea { min-height: 70px; resize: vertical; }
.field { margin-bottom: 14px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; color: var(--text); }
.check input { width: 16px; height: 16px; }
fieldset { border: 0; margin: 0 0 14px; padding: 0; min-width: 0; }
legend { padding: 0; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
fieldset .check { margin-bottom: 6px; }
.pre-wrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.error { color: var(--overdue); font-size: 13px; margin-top: 4px; }
.notice { padding: 10px 14px; border-radius: var(--radius); background: var(--today-bg); color: #7a3e06; margin-bottom: 16px; }
.notice.ok { background: var(--ok-bg); color: #0f5148; }

/* Chips: quick-pick buttons (task due date) */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  min-height: 28px; padding: 0 10px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; font-size: 13px; font-weight: 550; cursor: pointer;
}
.chip:hover { border-color: var(--faint); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---------- Page frames ---------- */
.page { max-width: 1240px; margin: 0 auto; padding: 24px 20px 60px; }
.page-narrow { max-width: 560px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.empty { color: var(--muted); padding: 10px 0; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.grid-2.grid-work { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); }
.grid-2 > .panel + .panel { margin-top: 0; }

table.list { width: 100%; border-collapse: collapse; }
.list th { text-align: left; font-size: 13px; font-weight: 600; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.list td { padding: 10px; border-bottom: 1px solid #edf0f4; vertical-align: top; }
.list tr:last-child td { border-bottom: 0; }
.list .num { text-align: right; width: 96px; }

/* Label / value pairs (admin status panels) */
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; font-size: 14px; }
.facts dt { color: var(--muted); font-weight: 600; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.list-middle td { vertical-align: middle; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; white-space: nowrap; }
.row-actions form { display: flex; gap: 4px; }
select.stage-kind { width: auto; min-width: 92px; }
.btn-square { width: 30px; padding: 0; }

/* ---------- Urgency ---------- */
/* .u-overdue / .u-today / .u-ok / .u-quiet set --u, which the stripe and due labels use. */
.u-overdue { --u: var(--overdue); --u-bg: var(--overdue-bg); }
.u-today { --u: var(--today); --u-bg: var(--today-bg); }
.u-ok { --u: var(--ok); --u-bg: var(--ok-bg); }
.u-quiet { --u: var(--quiet); --u-bg: var(--column); }
.due { font-size: 13px; font-weight: 650; color: var(--u, var(--muted)); white-space: nowrap; }

.tag {
  display: inline-block; padding: 1px 7px; border-radius: 4px; font-size: 12px; font-weight: 650; white-space: nowrap;
  background: #e9edf5; color: var(--ink-2);
}
.tag-contact { background: #e4ecfb; color: #24479b; }
.tag-them { background: #f1e8fb; color: #5b2d91; }
.tag-us { background: #fff0d6; color: #85500a; }
.tag-remind { background: #e5f4f1; color: #0f5148; }

/* ---------- Board ---------- */
.board-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); height: calc(100vh - 56px); }
.rail { background: var(--surface); border-right: 1px solid var(--line); padding: 18px 16px 40px; overflow-y: auto; }
.rail h2 { margin-bottom: 10px; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.rail h2 .muted { font-weight: 550; }
.rail section + section { margin-top: 26px; }
.rail-group { font-size: 13px; font-weight: 650; color: var(--muted); margin: 12px 0 4px; }

/* The board fills the window below the top bar; columns run its full height so any part of one is a drop target. */
.board-main { padding: 16px 20px 16px; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.board-tools { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.board-tools input[type=search] { width: 220px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg a { padding: 6px 12px; color: var(--text); font-weight: 550; font-size: 14px; }
.seg a + a { border-left: 1px solid var(--line); }
.seg a:hover { background: var(--column); text-decoration: none; }
.seg a[aria-current="true"] { background: var(--ink); color: #fff; }

.board { display: flex; gap: 10px; overflow-x: auto; flex: 1; min-height: 0; padding-bottom: 4px; }
.column {
  flex: 1 1 0; min-width: 190px; background: var(--column); border-radius: var(--radius);
  display: flex; flex-direction: column; min-height: 0;
}
.column-closed { flex: 0 0 150px; min-width: 0; background: transparent; border: 1px dashed #c3cad6; }
.column-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 12px 12px 8px; }
.column-head h2 { font-size: 15px; }
.column-head .muted { font-size: 13px; }
.cards { list-style: none; margin: 0; padding: 0 8px 10px; overflow-y: auto; min-height: 60px; flex: 1; }
.cards.drop-target { background: rgba(47, 111, 237, 0.06); border-radius: 0 0 var(--radius) var(--radius); }
.column-empty { color: var(--faint); font-size: 13px; padding: 6px 4px 12px; }

.card {
  position: relative; background: var(--surface); border-radius: var(--radius);
  padding: 10px 10px 10px 16px; margin-bottom: 8px; cursor: grab;
  border: 1px solid #dfe4ea; box-shadow: 0 1px 0 rgba(20, 33, 61, 0.06);
}
.card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px;
  border-radius: var(--radius) 0 0 var(--radius); background: var(--u, var(--line));
}
.card:hover { border-color: #c3cad6; }
.card.dragging { opacity: 0.45; }
.card.drop-before { box-shadow: 0 -3px 0 var(--focus); }
.card.u-quiet { background: #fafbfc; }
.card.u-quiet .card-title { color: var(--muted); }
.card.is-new { animation: arrive 1.6s ease-out; }
@keyframes arrive { 0% { box-shadow: 0 0 0 4px var(--marker); } 100% { box-shadow: 0 1px 0 rgba(20, 33, 61, 0.06); } }
.card-top { display: flex; justify-content: space-between; gap: 8px; }
.card-title { font-weight: 700; color: var(--ink); line-height: 1.25; }
.card-title:hover { text-decoration: underline; }
.card-value { font-size: 13px; font-weight: 650; color: var(--muted); white-space: nowrap; }
.card-company { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.card-next { font-size: 13px; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.card-next .t {
  color: var(--text); max-width: 100%; overflow: hidden;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.card-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.card-foot .avatar { width: 22px; height: 22px; font-size: 10px; margin-left: auto; }
.meta-icon { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.meta-icon svg { width: 13px; height: 13px; flex: none; }
.flag-late { color: var(--overdue); font-weight: 650; }
.flag-soon { color: var(--today); font-weight: 650; }
.card-closed { cursor: grab; padding: 8px 10px 8px 16px; }
.card-closed .card-top { flex-direction: column; gap: 0; }
.card-closed .card-company { margin: 0; }

/* ---------- Task rows (rail, my work, deal page) ---------- */
.tasks { list-style: none; margin: 0; padding: 0; }
.task {
  display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 8px; align-items: start;
  padding: 8px 0; border-bottom: 1px solid #edf0f4;
}
.task:last-child { border-bottom: 0; }
.task-check {
  width: 22px; height: 22px; margin-top: 1px; border-radius: 50%; border: 2px solid var(--u, var(--faint));
  background: var(--surface); cursor: pointer; display: grid; place-items: center; padding: 0; color: transparent;
}
.task-check:hover { background: var(--u-bg, var(--column)); color: var(--u, var(--muted)); }
.task-check svg { width: 12px; height: 12px; }
.task-title { font-weight: 600; color: var(--text); overflow-wrap: anywhere; }
.task-sub { font-size: 13px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: baseline; }
.task-sub a { color: var(--muted); }
.task-side { display: flex; align-items: center; gap: 4px; }
.task.done .task-title { text-decoration: line-through; color: var(--faint); }
.task.leaving { opacity: 0.35; transition: opacity .25s; }

/* ---------- Meetings ---------- */
.meetings { list-style: none; margin: 0; padding: 0; }
.meeting { padding: 8px 0; border-bottom: 1px solid #edf0f4; }
.meeting:last-child { border-bottom: 0; }
.meeting-single { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; }
.meeting-deals { list-style: none; margin: 2px 0 0; padding: 0; }
.meeting-deals li { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 13px; }
.meeting-deals .btn-icon { width: 24px; min-height: 24px; }
.meeting-when { font-size: 13px; font-weight: 650; color: var(--ink-2); }
.meeting-subject { font-weight: 600; overflow-wrap: anywhere; }
.meeting-sub { font-size: 13px; color: var(--muted); }
.meeting.past .meeting-when { color: var(--faint); }
.dismiss { color: var(--faint); }
.dismiss:hover { color: var(--overdue); }

/* ---------- Deal page ---------- */
.crumb { font-size: 14px; margin-bottom: 8px; display: inline-block; }
.deal-head { margin-bottom: 18px; }
.deal-head h1 { margin-bottom: 4px; }
.deal-facts { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: 14px; }
.deal-facts strong { color: var(--text); font-weight: 650; }

.pipeline { display: flex; gap: 4px; margin: 14px 0 22px; flex-wrap: wrap; }
.pipeline form { display: contents; }
.pipeline button {
  flex: 1 1 0; min-width: 96px; min-height: 34px; padding: 0 10px; border: 0; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 650; color: var(--muted); background: #dde2ea;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%);
}
.pipeline button:first-of-type { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); }
.pipeline button.passed { background: #c8d1df; color: var(--ink-2); }
.pipeline button.current { background: var(--ink); color: #fff; }
.pipeline button.won { flex: 0 1 90px; clip-path: none; border-radius: var(--radius); margin-left: 8px; }
.pipeline button.lost { flex: 0 1 90px; clip-path: none; border-radius: var(--radius); }
.pipeline button.won.current { background: var(--ok); }
.pipeline button.lost.current { background: var(--overdue); }
.pipeline button:hover:not(.current) { color: var(--ink); background: #ccd4e1; }

.stage-select { display: none; align-items: center; gap: 8px; margin: 14px 0 20px; }
.stage-select label { margin: 0; }
.stage-select select { flex: 1; }

.quick-task { display: flex; gap: 8px; }
.quick-task input { flex: 1; font-size: 16px; min-height: 42px; }
.quick-task .btn { min-height: 42px; }
.task-options { display: flex; flex-wrap: wrap; gap: 0 20px; margin-top: 12px; }
.field-inline { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; margin-bottom: 8px; }
.field-inline > label, .field-inline > .label { margin: 0; min-width: 58px; font-size: 13px; font-weight: 600; color: var(--muted); }
.field-inline select { width: auto; min-height: 32px; padding: 4px 8px; }
.field-inline .chips { flex: 1; min-width: 0; }
.field-chips { align-items: flex-start; }
.field-chips > .label { padding-top: 5px; }
.parse-preview { font-size: 13px; color: var(--muted); min-height: 20px; margin: 2px 0 6px; }
.parse-preview strong { color: var(--ink); }

.form-actions { display: flex; gap: 8px; }
.delete-form { margin-top: 16px; padding-top: 14px; border-top: 1px solid #edf0f4; }

.timeline { list-style: none; margin: 14px 0 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; padding: 8px 0; }
.timeline .avatar { width: 26px; height: 26px; font-size: 10px; }
.timeline .sys { background: var(--column); color: var(--faint); }
.timeline .what { overflow-wrap: anywhere; }
.timeline .note .what { background: #fffbea; border: 1px solid #f3e3a4; border-radius: var(--radius); padding: 8px 10px; white-space: pre-wrap; }
.timeline .when { font-size: 12px; color: var(--faint); }

.people { list-style: none; margin: 0 0 10px; padding: 0; }
.person { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px; padding: 8px 0; border-bottom: 1px solid #edf0f4; }
.person-name { font-weight: 650; }
.person-sub { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.person-sub a { color: var(--muted); }

details.more > summary { cursor: pointer; color: var(--muted); font-size: 13px; margin-top: 10px; }

/* ---------- Autocomplete ---------- */
.ac { position: relative; }
.ac-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 50; margin: 0; padding: 4px; list-style: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 10px 28px rgba(20, 33, 61, 0.18); max-height: 300px; overflow-y: auto;
}
.ac-item { padding: 7px 10px; border-radius: 4px; cursor: pointer; }
.ac-item[aria-selected="true"] { background: #e9effc; }
.ac-main { font-weight: 600; }
.ac-sub { font-size: 12px; color: var(--muted); }
.ac-new { color: var(--link); font-weight: 600; }

/* ---------- Dialog (quick add) ---------- */
dialog.sheet {
  width: min(520px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 10px;
  box-shadow: 0 24px 60px rgba(20, 33, 61, 0.35); color: var(--text);
}
dialog.sheet::backdrop { background: rgba(20, 33, 61, 0.45); }
.sheet-body { padding: 22px 24px 20px; }
.sheet-body h2 { font-size: 20px; margin-bottom: 16px; }
.sheet-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; align-items: center; }
.sheet-actions .spacer { flex: 1; }
.sheet-close { position: absolute; top: 12px; right: 12px; }
.optional { border-top: 1px solid #edf0f4; padding-top: 14px; margin-top: 4px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 14px; padding: 10px 14px 10px 16px;
  background: var(--ink); color: #fff; border-radius: var(--radius); box-shadow: 0 10px 30px rgba(20, 33, 61, 0.3); font-size: 14px;
}
.toast button, .toast a { background: none; border: 0; color: var(--marker); font: inherit; font-weight: 700; cursor: pointer; padding: 0; }

/* ---------- Login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--ink); }
.login-card { width: min(380px, 100%); background: var(--surface); border-radius: 10px; padding: 28px; }
.login-card .brand { color: var(--ink); font-size: 28px; display: block; margin-bottom: 4px; }
.login-card .brand span { color: var(--marker-deep); }

/* ---------- Module menu (under the top bar) ---------- */
.subnav {
  display: flex; align-items: center; gap: 2px; height: 42px; padding: 0 20px; overflow-x: auto;
  background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 56px; z-index: 19;
}
.subnav a {
  color: var(--muted); padding: 0 10px; height: 100%; font-weight: 600; font-size: 14px; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px; border-bottom: 2px solid transparent;
}
.subnav a:hover { color: var(--ink); text-decoration: none; }
.subnav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--marker-deep); }
body.has-subnav .board-layout { height: calc(100vh - 98px); }

/* ---------- Home ---------- */
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.home-grid > .panel + .panel { margin-top: 0; }
.home-list { list-style: none; margin: 10px 0 0; padding: 0; }
.home-list li { padding: 7px 0; border-top: 1px solid #edf0f4; }
.home-sub { font-size: 14px; margin: 18px 0 2px; }
.flag-overdue { color: var(--overdue); font-weight: 700; }
.show-sm { display: none; }

/* ---------- Holidays ---------- */
.page-wide { max-width: none; }
.page-narrow-wide { max-width: 760px; }
.year-switch { display: flex; align-items: center; gap: 10px; }
.allowance { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.allowance div { display: flex; flex-direction: column; gap: 2px; }
.allowance .big { font-size: 26px; font-weight: 800; font-stretch: 85%; color: var(--ink); line-height: 1.1; }
.allowance div:first-child .big { color: var(--ok); }
.allowance .muted { font-size: 12px; }
.tag-pending { background: var(--today-bg); color: #85500a; }
.tag-approved { background: var(--ok-bg); color: #0f5148; }
.tag-declined { background: var(--overdue-bg); color: #9b1427; }
.input-days { width: 90px; }
.cal-groups { margin-bottom: 14px; flex-wrap: wrap; }
.approval .facts { margin-bottom: 14px; }

/* Calendar: one row per person, one column per day. A bar shows leave; half a bar is a half day. */
.cal-scroll { overflow-x: auto; }
table.leave-cal { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.leave-cal th, .leave-cal td { border-bottom: 1px solid #edf0f4; }
.leave-cal thead th {
  font-weight: 600; color: var(--muted); padding: 4px 0; min-width: 28px; width: 28px;
  text-align: center; font-size: 12px; line-height: 1.2;
}
.leave-cal thead th span { display: block; font-size: 10px; font-weight: 500; }
.leave-cal th.cal-name {
  text-align: left; padding: 6px 14px 6px 0; white-space: nowrap; min-width: 150px; width: auto;
  position: sticky; left: 0; z-index: 1; background: var(--surface); color: var(--text); font-size: 13px;
}
.leave-cal td { height: 30px; padding: 0; }
.leave-cal .we { background-color: #f3f5f8; }
.leave-cal .bh, .key.bh { background-image: repeating-linear-gradient(135deg, #eef1f6 0 4px, #dfe5ee 4px 8px); }
.leave-cal thead th.today { color: var(--ink); box-shadow: inset 0 -2px 0 var(--marker-deep); }
.off { --leave: var(--ok); background-repeat: no-repeat; }
.off.pending { --leave: var(--marker-deep); }
.off.full { background-image: linear-gradient(var(--leave), var(--leave)); background-size: 100% 18px; background-position: center; }
.off.am { background-image: linear-gradient(var(--leave), var(--leave)); background-size: 50% 18px; background-position: left center; }
.off.pm { background-image: linear-gradient(var(--leave), var(--leave)); background-size: 50% 18px; background-position: right center; }
.cal-key { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.cal-key span { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 26px; height: 18px; border: 1px solid var(--line); border-radius: 3px; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
  .grid-2, .grid-2.grid-work { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  /* Stacked: tasks and meetings first, then the board scrolling sideways. */
  .board-layout { grid-template-columns: minmax(0, 1fr); height: auto; }
  .rail { border-right: 0; border-bottom: 1px solid var(--line); }
  .board { align-items: flex-start; }
  .column { flex: 0 0 260px; }
  .column-closed { flex-basis: 180px; }
  .cards { min-height: 120px; }
  .who .name { display: none; }
}
@media (max-width: 640px) {
  .topbar { gap: 8px; padding: 0 12px; }
  .brand { font-size: 17px; margin-right: auto; }
  .nav-toggle { display: inline-flex; order: 3; }
  .nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 2px; padding: 8px 12px 12px;
    background: var(--ink); box-shadow: 0 12px 24px rgba(20, 33, 61, 0.3);
  }
  .nav.open { display: flex; }
  .nav a { padding: 10px 12px; font-size: 16px; }
  .topbar .btn-create { order: 2; }
  .topbar .who { order: 4; }
  .btn-create .label { display: none; }
  .page { padding: 16px 16px 48px; }
  .board-main { padding: 12px 16px; }
  .pipeline { display: none; }
  .stage-select { display: flex; }
  .field-inline > label, .field-inline > .label { min-width: 0; }
  .field-chips > .label { width: 100%; padding-top: 0; }
  .row { flex-direction: column; gap: 0; }
  .list .hide-sm { display: none; }
  .subnav { padding: 0 12px; }
  .list .show-sm { display: block; }
  .list .num { width: auto; }
  .list td { padding: 10px 6px; }
  .list .tag { white-space: normal; }
  .allowance { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  .card.is-new { animation: none; }
  .task.leaving { transition: none; }
}

/* ---------- Directory ---------- */
.directory-search { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0 12px; }
.directory-search .field { flex: 1 1 200px; }
.directory-search .form-actions { margin-bottom: 14px; }

/* ---------- Print ---------- */
@media print {
  .topbar, .subnav, .no-print, .toasts { display: none !important; }
  body { background: #fff; }
  .panel { border: 0; box-shadow: none; padding: 0; }
  .emergency-list { font-size: 11px; }
  .emergency-list a { color: inherit; text-decoration: none; }
}
