/* K-CRM: an outreach ledger.
   One world: a dark bottle-green rail on the start side, a pale celadon ledger beside it.
   Display face: Sentient (self-hosted) for Latin, Markazi Text (self-hosted, Arabic glyphs only) for Arabic.
   UI face: the system sans. Layout uses logical properties so Arabic mirrors it without a second stylesheet.
   The one bespoke silhouette is the board's "K-CRM slip": a ledger ticket with a perforated stub. */

@font-face { font-family: "Sentient"; src: url("/fonts/Sentient-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Sentient"; src: url("/fonts/Sentient-Italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Sentient"; src: url("/fonts/Sentient-Medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Sentient"; src: url("/fonts/Sentient-Bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
/* Markazi draws small for its size; size-adjust brings its Arabic up to Sentient's visual height. */
@font-face {
  font-family: "Markazi Text"; src: url("/fonts/MarkaziText-Arabic.woff2") format("woff2");
  font-weight: 400 700; font-style: normal; font-display: swap; size-adjust: 118%;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFC;
}

:root {
  --display: "Sentient", "Markazi Text", Georgia, "Times New Roman", serif;
  --ui: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --ink: #16231d;
  --ink-2: #35443c;
  --ink-3: #5c6b62;
  --paper: #e8ebe3;
  --paper-2: #f2f4ee;
  --paper-3: #dde2d6;
  --paper-4: #cfd6c9;
  --line: rgba(22, 35, 29, 0.14);

  --rail: #16261f;
  --rail-2: #223629;
  --rail-3: #2c4536;
  --rail-text: #dbe3d8;
  --rail-muted: #8fa094;

  --s-todo: #7f8b84;
  --s-contacted: #a37f2d;
  --s-talking: #3d8078;
  --s-proposal: #7f5079;
  --s-won: #4e8046;
  --s-lost: #7d5b50;
  --late: #a8503a;
  --late-ink: #8d3f2b;

  --radius: 6px;
  --rail-w: 272px;
  --drawer-w: 500px;
  --main-pad: 56px;
  --stub: 58px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1;
}
::selection { background: var(--ink); color: var(--paper); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; text-align: inherit; }
a { color: inherit; text-decoration: none; }
.entry .txt a { text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.rail :focus-visible { outline-color: var(--rail-text); }
[hidden] { display: none !important; }
/* Free text keeps its own reading direction but stays aligned with the column it sits in. */
[dir="rtl"] [dir="auto"]:not(input):not(textarea) { text-align: right; }
[dir="ltr"] [dir="auto"]:not(input):not(textarea) { text-align: left; }
/* Arabic letters join; tracking would pull them apart. */
[dir="rtl"] h1, [dir="rtl"] .brand { letter-spacing: 0; }
[dir="rtl"] .arrow { transform: scaleX(-1); }
.muted { color: var(--ink-3); }
.muted-n { color: var(--ink-3); font-size: 14px; }
.late-n { color: var(--late-ink); }
.hint { color: var(--ink-3); font-size: 13px; }

.app { display: grid; grid-template-columns: var(--rail-w) 1fr; min-height: 100vh; }

/* ---------- rail ---------- */
.rail {
  background: var(--rail);
  color: var(--rail-text);
  padding: 28px 18px 24px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.brand-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 2px 10px 22px; }
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--display); font-weight: 500; font-size: 24px; letter-spacing: 0.01em;
  color: #eef2ea;
}
.brand .mark { width: 18px; height: 18px; display: block; color: #b9cdbd; }
.who-top { display: none; }
.rail-list { display: flex; flex-direction: column; gap: 4px; }
.rail-item {
  display: grid; grid-template-columns: 1fr auto; column-gap: 12px; align-items: center;
  width: 100%; text-align: start;
  padding: 9px 10px; border-radius: var(--radius);
  color: var(--rail-text);
  transition: background-color 120ms ease;
}
.rail-item:hover { background: var(--rail-2); }
.rail-item.active { background: var(--rail-3); }
.rail-item .name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-item .count { color: var(--rail-muted); font-size: 13px; }
.rail-item .count.late { color: #e3a28f; }
.rail-item .meter { grid-column: 1 / -1; height: 3px; border-radius: 2px; background: rgba(255,255,255,0.12); margin-top: 7px; overflow: hidden; }
.rail-item .meter i { display: block; height: 100%; width: 0; border-radius: 2px; background: #9fb7a6; transition: width 600ms cubic-bezier(.2,.7,.2,1); }
.rail-item.m-only { display: none; }
.rail-head {
  margin: 20px 10px 4px; font-size: 12px; color: var(--rail-muted);
  display: flex; justify-content: space-between; align-items: baseline;
}
.rail-head button { color: var(--rail-text); font-size: 13px; padding: 2px 4px; border-radius: 4px; }
.rail-head button:hover { color: #fff; background: var(--rail-2); }
.rail-add { padding: 4px 4px 2px; }
.rail-add input {
  width: 100%; padding: 8px 10px; border-radius: var(--radius);
  border: 1px solid var(--rail-3); background: var(--rail-2); color: #fff;
}
.rail-add input::placeholder { color: var(--rail-muted); }
.rail-add .hint { font-size: 12px; color: var(--rail-muted); padding: 6px 6px 0; }
.rail-empty { font-size: 13px; color: var(--rail-muted); padding: 4px 10px; }
.rail-foot { margin-top: auto; padding-top: 18px; display: flex; flex-direction: column; gap: 4px; }
.rail-foot .rail-item .name { font-weight: 400; }

/* Language switch on the sign-in sheet: a quiet word in the other language. */
.lang { color: var(--ink-3); font-size: 14px; padding: 4px 8px; border-radius: var(--radius); transition: color 120ms ease, background-color 120ms ease; }
.lang:hover { color: var(--ink); background: var(--paper-3); }

/* ---------- main ---------- */
.main { padding: 44px var(--main-pad) 80px; min-width: 0; }
.page { max-width: 1120px; }

.title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px; flex-wrap: wrap; }
h1 {
  font-family: var(--display); font-weight: 500; font-size: 42px; line-height: 1.1;
  margin: 0; letter-spacing: -0.005em;
}
.sub { color: var(--ink-3); margin: 8px 0 0; }
.actions { display: flex; gap: 18px; align-items: center; padding-bottom: 6px; flex-wrap: wrap; }
.textbtn { color: var(--ink-3); transition: color 120ms ease; border-radius: 4px; }
.textbtn:hover { color: var(--ink); }
.textbtn.danger:hover { color: var(--late-ink); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--radius);
  background: var(--ink); color: var(--paper-2); font-weight: 500; line-height: 1.3;
  transition: background-color 120ms ease;
}
.btn:hover { background: #26382f; }
.btn svg { width: 14px; height: 14px; flex: 0 0 auto; }
.btn.quiet { background: var(--paper-3); color: var(--ink); }
.btn.quiet:hover { background: var(--paper-4); }

/* The view switch: two words, the current one in ink. */
.switch { display: inline-flex; gap: 14px; }
.switch .textbtn.on { color: var(--ink); font-weight: 500; }

/* the progress meter: one rounded track, segments clipped inside */
.meter-wrap { margin: 26px 0 22px; }
.meter-big { height: 10px; border-radius: 5px; background: var(--paper-3); overflow: hidden; display: flex; }
.meter-big i { display: block; height: 100%; width: 0; transition: width 700ms cubic-bezier(.2,.7,.2,1); }
.meter-big .won { background: var(--s-won); }
.meter-big .lost { background: var(--s-lost); }
.meter-big .live { background: #a7b7aa; }

/* filter line: search, then picks that read like a sentence */
.toolbar { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; margin-bottom: 14px; }
.search { position: relative; flex: 1 1 220px; max-width: 320px; }
.search input {
  width: 100%; padding: 8px 12px; padding-inline-start: 34px; border-radius: var(--radius);
  border: 1px solid var(--paper-4); background: var(--paper-2);
}
.search svg { position: absolute; inset-inline-start: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--ink-3); pointer-events: none; }
.picks { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }
.picks .dot, .drawer-top .dot { color: var(--ink-3); padding: 0 2px; }
.pick { position: relative; display: inline-flex; align-items: center; }
.pick select {
  appearance: none; -webkit-appearance: none; field-sizing: content;
  border: 0; background: none; color: var(--ink-2); cursor: pointer;
  padding: 4px 6px; padding-inline-end: 22px; border-radius: var(--radius);
  transition: background-color 120ms ease;
}
.pick select:hover { background: var(--paper-3); }
.pick select:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.pick .caret { position: absolute; inset-inline-end: 4px; top: 50%; width: 14px; height: 14px; margin-top: -7px; color: var(--ink-3); pointer-events: none; }
.pick.on select { color: var(--ink); font-weight: 500; }
.pick.late select { color: var(--late-ink); }

/* status glyph: a ring that fills clockwise as the deal moves */
.glyph { width: 14px; height: 14px; flex: 0 0 auto; display: inline-block; vertical-align: -2px; color: var(--c, var(--ink)); transition: color 120ms ease; }
.glyph .pie { transition: stroke-dasharray 120ms ease; }
.glyph .strike { transition: opacity 120ms ease; }
.glyph.todo { --c: var(--s-todo); }
.glyph.contacted { --c: var(--s-contacted); }
.glyph.talking { --c: var(--s-talking); }
.glyph.proposal { --c: var(--s-proposal); }
.glyph.won { --c: var(--s-won); }
.glyph.lost { --c: var(--s-lost); }

/* inline forms */
.addform {
  background: var(--paper-2); border-radius: 10px; padding: 20px 22px 18px; margin: 4px 0 22px;
  border: 1px solid var(--paper-3);
}
.addform.rename { margin-top: 18px; }
.addform.narrow { max-width: 460px; }
.addform h3 { margin: 0 0 14px; font-family: var(--display); font-weight: 500; font-size: 22px; }
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 12px 14px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label, .field .lbl { font-size: 12.5px; color: var(--ink-3); }
.field input, .field textarea, .field select {
  width: 100%; padding: 8px 11px; border-radius: var(--radius);
  border: 1px solid var(--paper-4); background: #fff; color: var(--ink);
}
.field textarea { resize: vertical; min-height: 76px; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--ink); outline-offset: 0; border-color: transparent; }
/* An input that reads as text until it is focused. */
.field input.soft { background: var(--paper); border-color: transparent; }
.c2 { grid-column: span 2; } .c3 { grid-column: span 3; } .c4 { grid-column: span 4; } .c6 { grid-column: span 6; } .c8 { grid-column: span 8; } .c12 { grid-column: span 12; }
.form-actions { display: flex; align-items: center; gap: 18px; margin-top: 16px; flex-wrap: wrap; }
.form-error { color: var(--late-ink); font-size: 14px; }
.form-error:empty { display: none; }

/* service ticks */
.ticks { border: 0; padding: 0; margin: 0; min-width: 0; }
.ticks legend { font-size: 12.5px; color: var(--ink-3); padding: 0; margin-bottom: 4px; }
.tick { display: flex; align-items: center; gap: 10px; min-height: 36px; cursor: pointer; }
.tick input { width: 16px; height: 16px; margin: 0; accent-color: var(--ink); flex: 0 0 auto; }

/* ---------- lists ---------- */
.list { border-top: 1px solid var(--line); }
.row {
  display: grid; align-items: center; column-gap: 16px;
  grid-template-columns: 20px minmax(180px, 1.3fr) minmax(200px, 1.6fr) minmax(120px, .8fr) 112px;
  padding: 13px 10px; margin: 0 -10px;
  border-bottom: 1px solid var(--line);
  width: calc(100% + 20px); text-align: start;
  transition: background-color 120ms ease;
}
button.row, .row[role="button"] { cursor: pointer; }
.row:hover { background: var(--paper-2); }
.row.head { color: var(--ink-3); font-size: 12.5px; padding: 8px 10px; cursor: default; }
.row.head:hover { background: none; }
.row .ring { display: flex; align-items: center; height: 20px; }
.row .co { font-family: var(--display); font-weight: 500; font-size: 17px; line-height: 1.2; min-width: 0; }
.row .co .nm { display: block; overflow: hidden; text-overflow: ellipsis; }
.row .co small, .row .nxt-cell small, .row .own small {
  display: block; font-family: var(--ui); font-weight: 400; font-size: 13px; color: var(--ink-3); margin-top: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row .nxt-cell, .row .own { min-width: 0; }
.row .nxt { color: var(--ink-2); font-size: 14px; line-height: 1.35; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.row .own { font-size: 14px; color: var(--ink-2); }
.row .when { font-size: 14px; color: var(--ink-2); }
.row .when.late { color: var(--late-ink); font-weight: 500; }
.row .when.today { color: var(--ink); font-weight: 500; }
.row .when.muted { color: var(--ink-3); }
.row.closed .co { color: var(--ink-3); }
.closed-toggle { padding: 12px 0; border-bottom: 1px solid var(--line); }
.empty { padding: 34px 0; color: var(--ink-3); max-width: 52ch; line-height: 1.5; }
.empty b { color: var(--ink); font-weight: 500; }
.empty p { margin: 0 0 14px; }
.empty .textbtn { margin-inline-start: 8px; color: var(--ink-2); }

/* My day groups */
.group { margin-top: 36px; }
.group h2 { font-family: var(--display); font-weight: 500; font-size: 24px; margin: 0 0 6px; display: flex; align-items: baseline; gap: 12px; }
.group h2 .n { font-size: 15px; color: var(--ink-3); font-family: var(--ui); font-weight: 400; }
.group h2.late { color: var(--late-ink); }
.row.agenda { grid-template-columns: 20px minmax(180px, 1.2fr) minmax(200px, 1.6fr) 120px; }
.row.agenda .reason { color: var(--late-ink); }
.row.agenda.decide .when .btn { padding: 6px 12px; font-size: 14px; }
.row.person-line { grid-template-columns: minmax(160px, 1fr) 130px 150px; }
.row.person-line .nm { font-weight: 500; }
.row.person-line small { color: var(--ink-3); font-weight: 400; font-size: 13px; }
.day-empty { padding-top: 44px; }

.welcome { max-width: 54ch; margin-top: 40px; font-size: 17px; line-height: 1.55; color: var(--ink-2); }
.welcome p { margin: 0 0 18px; }

.inline-confirm { display: inline-flex; align-items: center; gap: 14px; color: var(--ink-2); font-size: 14px; flex-wrap: wrap; }
.inline-confirm .btn { padding: 6px 12px; background: var(--late-ink); }
.inline-confirm .btn:hover { background: var(--late); }

/* ---------- board ---------- */
/* The board leaves the page width and scrolls sideways across the whole main column. */
.board {
  display: flex; gap: 16px; align-items: stretch;
  overflow-x: auto; min-height: 62vh;
  margin: 8px calc(-1 * var(--main-pad)) 0; padding: 4px var(--main-pad) 28px;
  user-select: none; -webkit-user-select: none;
}
/* Lanes share the width so all six fit on a laptop; below that the board scrolls sideways. */
.lane { flex: 1 1 0; min-width: 182px; display: flex; flex-direction: column; }
.lane.narrow { flex-grow: 0.8; min-width: 156px; }
.lane-head {
  display: flex; align-items: center; gap: 8px; margin: 0 0 4px; padding: 6px 0;
  font-family: var(--ui); font-size: 14px; font-weight: 500; line-height: 1.3;
}
.lane-head .n { color: var(--ink-3); font-weight: 400; }
.lane-cards {
  flex: 1; display: flex; flex-direction: column; gap: 8px;
  padding: 6px; margin: 0 -6px; border-radius: 8px;
  transition: background-color 120ms ease;
}
.lane.over .lane-cards { background: var(--paper-3); }
.lane-empty { margin: 0; font-size: 13px; color: var(--ink-3); }
.status-index { display: none; }

/* The K-CRM slip: a ledger ticket. A tear-off stub at the inline end, a perforation of round dots,
   and two half-round notches cut into the edge at the perforation. Content is padded well clear of the notches. */
.slip {
  --perf: calc(100% - var(--stub));
  position: relative; display: flex; min-height: 82px;
  background: var(--paper-2); border-radius: var(--radius);
  box-shadow: inset 0 0 0 1px rgba(22, 35, 29, 0.06);
  cursor: pointer; touch-action: manipulation;
  -webkit-touch-callout: none;
  transition: background-color 120ms ease;
  -webkit-mask-image: radial-gradient(circle at var(--perf) 0, transparent 5px, #000 5.5px), radial-gradient(circle at var(--perf) 100%, transparent 5px, #000 5.5px);
  -webkit-mask-composite: source-in;
  mask-image: radial-gradient(circle at var(--perf) 0, transparent 5px, #000 5.5px), radial-gradient(circle at var(--perf) 100%, transparent 5px, #000 5.5px);
  mask-composite: intersect;
}
[dir="rtl"] .slip { --perf: var(--stub); }
@media (hover: hover) { .slip:hover { background: #f6f8f3; } }
.slip:focus-visible { outline-offset: 1px; }
.slip-body { flex: 1 1 auto; min-width: 0; padding: 11px 12px; display: flex; flex-direction: column; gap: 3px; }
.slip-name {
  font-family: var(--display); font-size: 16px; font-weight: 500; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.slip-step {
  font-size: 13.5px; line-height: 1.35; color: var(--ink-2);
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.slip-meta { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.slip-stub {
  position: relative; flex: 0 0 var(--stub); width: var(--stub);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  padding: 11px 4px; text-align: center;
}
/* The perforation: 2px round dots, 5px apart, stopping 9px short of each notch-cut edge. */
.slip-stub::before {
  content: ""; position: absolute; inset-inline-start: -1px; top: 9px; bottom: 9px; width: 2px;
  background: radial-gradient(circle, var(--paper-4) 0.9px, transparent 1.2px) center top / 2px 5px repeat-y;
}
.slip-ring { display: flex; }
.slip-ring .glyph { width: 16px; height: 16px; }
.slip-day { font-family: var(--display); font-size: 20px; font-weight: 500; line-height: 1; }
.slip-word { font-size: 11.5px; line-height: 1.2; color: var(--ink-3); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slip-day.late, .slip-word.late { color: var(--late-ink); }
.slip-day.muted { color: var(--ink-3); }
.slip.dragging {
  position: fixed; z-index: 60; margin: 0; pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(22, 35, 29, 0.22);
  background: var(--paper-2);
}
.slip-hole { border: 1px dashed var(--paper-4); border-radius: var(--radius); flex: 0 0 auto; }

/* The move tray, phones only: rises on a long press. */
.tray {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 55;
  background: var(--paper-2); border-top: 1px solid var(--paper-3);
  padding: 14px 16px calc(18px + env(safe-area-inset-bottom));
}
.tray-head { font-size: 13px; color: var(--ink-3); margin: 0 4px 8px; }
.tray-taps { grid-template-columns: repeat(3, 1fr); margin: 0; }
.tray-taps button { font-size: 14px; }
.tray-taps button:disabled { opacity: .45; cursor: default; }
.tray-taps button:disabled:hover { background: none; }

/* ---------- drawer ---------- */
.drawer-scrim { position: fixed; inset: 0; background: rgba(22, 35, 29, 0.28); z-index: 20; }
.drawer {
  position: fixed; top: 0; inset-inline-end: 0; bottom: 0; width: min(var(--drawer-w), 100vw);
  background: var(--paper-2); z-index: 21;
  overflow-y: auto; padding: 28px 32px 48px;
  border-inline-start: 1px solid var(--paper-3);
  transform: translateX(16px);
  transition: transform 220ms cubic-bezier(.2,.7,.2,1);
}
[dir="rtl"] .drawer { transform: translateX(-16px); }
.drawer.in { transform: none; }
.drawer-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.drawer-top .head { flex: 1 1 auto; min-width: 0; }
.drawer-top .sec { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 4px; color: var(--ink-3); font-size: 13px; margin-bottom: 6px; }
.drawer-top .owner { display: inline-flex; align-items: center; gap: 2px; }
.drawer-top .pick select { font-size: 13px; padding-block: 2px; }
.drawer h2 { font-family: var(--display); font-weight: 500; font-size: 30px; line-height: 1.12; margin: 0; overflow-wrap: anywhere; }
.close { width: 36px; height: 36px; border-radius: var(--radius); display: grid; place-items: center; color: var(--ink-3); flex: 0 0 auto; }
.close:hover { background: var(--paper-3); color: var(--ink); }
.close svg { width: 16px; height: 16px; display: block; }
.reach { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 18px; margin-top: 10px; }
.reach .num { color: var(--ink-2); }
.reach .textbtn { color: var(--ink-2); font-weight: 500; }
.reach .textbtn:hover { color: var(--ink); }

/* Where it stands */
.next-now {
  position: relative; margin: 22px 0 0; padding: 14px 16px; border-radius: 8px; background: var(--paper);
  display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; align-items: baseline;
}
.next-now .st { grid-column: 1 / -1; display: flex; align-items: center; gap: 9px; font-weight: 500; margin-bottom: 4px; padding-inline-end: 72px; }
.next-now .st .glyph { width: 18px; height: 18px; }
.next-now .chg-btn { position: absolute; top: 13px; inset-inline-end: 16px; font-size: 14px; }
.next-now .k { color: var(--ink-3); font-size: 13px; }
.next-now .v { font-weight: 500; }
.next-now .v.late { color: var(--late-ink); }
.next-now .v.today { color: var(--ink); }
.next-now .v.none { color: var(--ink-3); font-weight: 400; }
.next-now.editing { display: flex; flex-direction: column; align-items: stretch; gap: 14px; }
.next-now.editing .st { margin: 0; }
.next-now.editing .field input.soft { background: var(--paper-2); }
.next-now.editing .taps button { background: var(--paper-2); }
.next-now.editing .taps button:hover { background: #fff; }
.next-now.editing .taps button.active { background: #fff; border-color: var(--ink); }
.next-now.stale { display: block; }
.next-now.stale .reason { margin: 0; color: var(--late-ink); font-weight: 500; }
.next-now.stale .stale-q { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.next-now.stale .stale-q .btn { background: var(--paper-2); }
.next-now.stale .stale-q .btn:hover { background: var(--paper-3); }
.next-now.stale .or { margin: 10px 0 0; color: var(--ink-3); font-size: 13.5px; }

.block { margin-top: 30px; }
.block h3 { font-family: var(--display); font-weight: 500; font-size: 21px; margin: 0 0 12px; }
.block h3 small { font-family: var(--ui); font-weight: 400; font-size: 13px; color: var(--ink-3); margin-inline-start: 10px; }
.hint-line { margin: 0 0 6px; color: var(--ink-3); font-size: 14px; }
.won-done { margin: 0; color: var(--ink-2); }
.happened .add-note { margin-top: 12px; }
.note-only { margin-top: 14px; }

/* The tap tile: every "pick one" in the app */
.taps { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; }
/* A tile you can see is tappable at rest: its own surface, a self-coloured edge, the ring it leads to at the end. */
.taps button {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 44px; padding: 6px 12px;
  border-radius: var(--radius); color: var(--ink); text-align: start;
  background: var(--paper); border: 1px solid var(--paper-3);
  transition: background-color 120ms ease, border-color 120ms ease;
}
.taps button:hover { background: var(--paper-3); border-color: var(--paper-4); }
.taps button.active { background: #fff; border-color: var(--ink); font-weight: 500; }
.taps .to { display: flex; }
.tray-taps button { justify-content: flex-start; }
.quick-dates { grid-template-columns: repeat(4, 1fr); }
.quick-dates button { flex-direction: column; align-items: flex-start; justify-content: center; gap: 1px; line-height: 1.25; }
.quick-dates .qd-top { font-weight: 500; }
.quick-dates .qd-sub { font-size: 12.5px; color: var(--ink-3); font-weight: 400; }
.qd-input { margin-top: 8px; align-self: flex-start; padding: 7px 10px; border: 1px solid var(--paper-4); border-radius: var(--radius); background: #fff; }

/* The confirm panel, under the outcome tiles */
.confirm { margin-top: 14px; display: flex; flex-direction: column; gap: 14px; align-items: stretch; }
.confirm > .textbtn { align-self: flex-start; }
.confirm .chg, .entry .chg { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 14px; }
.chg svg.arrow { width: 14px; height: 14px; color: var(--ink-3); }
.confirm .preview { margin: 0; color: var(--ink-2); font-size: 14px; }
.save-bar { display: flex; flex-direction: column; gap: 8px; }
.save-bar .btn { width: 100%; padding-block: 11px; }

/* History */
.hist { margin-top: 6px; }
.entry { display: grid; grid-template-columns: 96px 1fr; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line); align-items: start; }
.entry:first-child { border-top: 0; }
.entry .at { color: var(--ink-3); font-size: 13px; line-height: 1.5; padding-top: 1px; }
.entry .at b { display: block; font-weight: 500; color: var(--ink-2); }
.entry .by { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry .oc { font-weight: 500; margin-bottom: 2px; }
.entry .chg { margin-bottom: 4px; }
.entry .txt { white-space: pre-wrap; line-height: 1.5; overflow-wrap: anywhere; }
.entry .rm { color: var(--ink-3); font-size: 12.5px; margin-top: 4px; opacity: 0; transition: opacity 120ms ease; }
.entry:hover .rm, .entry .rm:focus-visible { opacity: 1; }
.entry .rm:hover { color: var(--late-ink); }
.entry.sys .txt { color: var(--ink-3); }
.hist + .textbtn { margin-top: 8px; }

/* Details, folded */
.details { border-top: 1px solid var(--line); padding-top: 6px; }
.fold {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  font-family: var(--display); font-weight: 500; font-size: 21px; padding: 8px 0; border-radius: 4px;
}
.fold svg { width: 18px; height: 18px; color: var(--ink-3); transition: transform 160ms ease; }
.fold[aria-expanded="true"] svg { transform: rotate(180deg); }
#detailform { margin-top: 10px; }
.danger-zone { margin-top: 32px; padding-top: 18px; border-top: 1px solid var(--line); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--ink); color: var(--paper-2); padding: 10px 16px; border-radius: 8px;
  font-size: 14px; z-index: 70; max-width: min(90vw, 520px);
}
.toast.err { background: var(--late-ink); }

/* ---------- team and account ---------- */
/* The heading row shares the person grid, so every heading sits over its own column. */
.row.person, .list.team .row.head { grid-template-columns: minmax(180px, 1.4fr) 100px 110px 120px 270px; cursor: default; }
/* Usernames are Latin (dir=ltr) but sit under an Arabic name: keep them on the name side. */
[dir="rtl"] .row.person .co small { text-align: right; }
.row.person.off .nm { color: var(--ink-3); }
.row.person .self { font-family: var(--ui); font-weight: 400; font-size: 13px; color: var(--ink-3); display: inline; }
.row.person .role { font-size: 14px; color: var(--ink-2); }
.person-actions { display: flex; gap: 16px; justify-content: flex-end; flex-wrap: wrap; font-size: 14px; }
.reset-box { grid-column: 1 / -1; display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding-top: 12px; }
.reset-box .field { width: 240px; }
.team-add { margin-top: 36px; }
.team-add .hint { margin: 10px 0 0; }
.backup { margin-top: 44px; max-width: 62ch; }
.backup h2 { font-family: var(--display); font-weight: 500; font-size: 24px; margin: 0 0 6px; }
.backup p { color: var(--ink-2); margin: 0 0 14px; }
.account-lang { display: flex; align-items: center; gap: 14px; margin: 28px 0 22px; }
.account-lang .lbl { color: var(--ink-3); font-size: 14px; }
.account .signout { margin-top: 4px; font-size: 14.5px; }

/* ---------- sign in ---------- */
.signin { min-height: 100vh; display: grid; grid-template-columns: minmax(300px, 40%) 1fr; }
.signin-brand {
  background: var(--rail); color: var(--rail-text);
  display: flex; flex-direction: column; justify-content: flex-end; gap: 14px;
  padding: 56px;
}
.signin-brand .mark { color: #b9cdbd; display: flex; }
.signin-brand .glyph { width: 64px; height: 64px; }
.signin-brand .word { font-family: var(--display); font-weight: 500; font-size: 64px; line-height: 1; color: #eef2ea; letter-spacing: 0.01em; }
.signin-brand p { margin: 0; color: var(--rail-muted); font-size: 17px; }
.signin-sheet { position: relative; display: grid; place-items: center; padding: 72px 24px; }
.signin-sheet .lang { position: absolute; top: 24px; inset-inline-end: 28px; }
.signin-form { width: min(340px, 100%); display: flex; flex-direction: column; gap: 14px; }
.signin-form h1 { font-size: 36px; margin-bottom: 8px; }
.signin-form .form-actions { flex-direction: column; align-items: stretch; gap: 10px; margin-top: 6px; }
.signin-form .btn { padding-block: 11px; }

/* ---------- phones and small tablets ---------- */
@media (max-width: 960px) {
  :root { --main-pad: 20px; }
  .app { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; padding: 16px 16px 10px; }
  .brand-row { padding: 0 4px 12px; }
  .who-top { display: block; color: var(--rail-muted); font-size: 14px; padding: 4px 6px; border-radius: var(--radius); max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .who-top.active, .who-top:hover { color: #fff; background: var(--rail-2); }
  .rail-list { flex-direction: row; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
  .rail-list::-webkit-scrollbar { display: none; }
  .rail-item { width: auto; flex: 0 0 auto; grid-template-columns: auto auto; min-height: 40px; }
  .rail-item.m-only { display: grid; }
  .rail-item .meter, .rail-head, .rail-add, .rail-empty, .rail-foot { display: none; }
  .main { padding: 28px var(--main-pad) 60px; }
  h1 { font-size: 34px; }
  .actions { padding-bottom: 0; }
  /* narrow rows stack: name on top, next step beneath, date at the end */
  .row, .row.agenda { grid-template-columns: 20px 1fr auto; row-gap: 6px; min-height: 48px; }
  .row.head, .row .own, .row .co small, .row .nxt-cell small { display: none; }
  .row .nxt-cell, .row.agenda .nxt { grid-column: 2 / -1; }
  .row .when { grid-column: 3; grid-row: 1; text-align: end; }
  .row .co { font-size: 16px; }
  .row.person-line { grid-template-columns: 1fr auto; }
  .row.person-line .muted-n:not(:last-child) { display: none; }
  .row.person { grid-template-columns: 1fr auto; row-gap: 8px; }
  .list.team .row.head { display: none; }
  .row.person > .muted-n { display: none; }
  .person-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .c2, .c3, .c4, .c6, .c8 { grid-column: span 12; }
  .search { max-width: none; flex-basis: 100%; }

  /* Board: one lane per screen, the next one peeking at the edge. */
  .board { scroll-snap-type: x mandatory; scroll-padding-inline: var(--main-pad); min-height: 55vh; }
  .lane, .lane.narrow { flex-basis: calc(100vw - 56px); scroll-snap-align: start; }
  .status-index { display: flex; justify-content: space-between; gap: 4px; margin: 6px 0 4px; }
  .si { flex: 1 1 0; min-width: 0; min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 4px 2px; border-radius: var(--radius); }
  .si .glyph { width: 16px; height: 16px; }
  .si.on .glyph { width: 18px; height: 18px; }
  .si-label { display: none; font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .si.on .si-label { display: block; }
  .si-n { font-size: 12.5px; color: var(--ink-3); line-height: 1; }

  .drawer { padding: 22px 20px 0; }
  .taps button { min-height: 48px; }
  .quick-dates { grid-template-columns: repeat(2, 1fr); }
  /* Save stays in reach while the rep checks the date. */
  .confirm .save-bar, .next-now.editing .save-bar {
    position: sticky; bottom: 0; z-index: 2;
    margin: 0 -20px; padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
    background: var(--paper-2); border-top: 1px solid var(--paper-3);
  }
  .next-now.editing .save-bar { margin: 0 -16px -14px; padding-inline: 16px; }
  .drawer > :last-child { margin-bottom: 40px; }

  .signin { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .signin-brand { flex-direction: row; align-items: center; flex-wrap: wrap; padding: 28px 24px; gap: 12px 14px; }
  .signin-brand .glyph { width: 40px; height: 40px; }
  .signin-brand .word { font-size: 36px; }
  .signin-brand p { flex-basis: 100%; font-size: 15px; }
  .signin-sheet { place-items: start center; padding: 56px 24px; }
  .signin-sheet .lang { top: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
