/* Pippa Employee Portal — RTL base styles.
 * THEME: "London Atelier v2.1" — visual twin of the Pippa careers site
 *   (pippa-careers-ats / pippa-child). Mulberry accent, powder canvas,
 *   white cards + hairline, pill buttons, editorial Persian type (lh 2).
 *   Retheme is CSS-only: templates + leave/CSRF/HTMX logic are untouched.
 *
 * RULES (PLAN §6.1): CSS LOGICAL PROPERTIES ONLY — never physical left/right
 * or margin-left/right. Use margin-inline / padding-inline / inset-inline /
 * border-inline / text-align:start|end. Self-hosted Vazirmatn (no Google Fonts).
 */

/* ── Self-hosted Vazirmatn (woff2 in /static/fonts) ──────────────────────
 * Weights: 300 (Light, display headings) · 400 (Regular, body) ·
 *          600 (SemiBold, labels/buttons/titles) · 700 (Bold).
 * All four carry full Persian coverage (811 glyphs), so no glyph falls back.
 */
@font-face {
  font-family: "Vazirmatn";
  src: url("/static/fonts/Vazirmatn-Light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("/static/fonts/Vazirmatn-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("/static/fonts/Vazirmatn-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Vazirmatn";
  src: url("/static/fonts/Vazirmatn-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ── Self-hosted Bodoni Moda — the editorial Latin wordmark ("Pippa") ─────
 * Ported from the careers site (pippa-careers-ats). Italic 400 + Normal 500.
 * unicode-range pins these faces to Latin ONLY (ASCII + Latin-1 + Extended
 * A/B), so Persian glyphs NEVER fall back to a serif — Vazirmatn keeps all
 * Arabic-script coverage. Zero CDN (PLAN §6.1).
 */
@font-face {
  font-family: "Bodoni Moda";
  src: url("/static/fonts/BodoniModa-Italic-400.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
  unicode-range: U+0020-007E, U+00A0-024F;
}
@font-face {
  font-family: "Bodoni Moda";
  src: url("/static/fonts/BodoniModa-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0020-007E, U+00A0-024F;
}

:root {
  /* ── Palette (London Atelier v2.1, AA-checked) ── */
  --bg: #F3EAE4;              /* powder — page canvas */
  --surface: #FBF8F6;        /* warm off-white surface */
  --card: #FFFFFF;           /* card fill */
  --band: #EDE4DF;           /* quiet band */
  --ink: #211A1E;            /* primary text */
  --ink-deep: #171215;       /* deepest ink */
  --muted: #6B5A60;          /* taupe — secondary text */
  --secondary: #211A1E;      /* labels resolve to ink */
  --primary: #6D2E46;        /* mulberry accent */
  --primary-deep: #5A2439;   /* mulberry hover */
  --primary-ink: #FFFFFF;
  --ghost: rgba(109, 46, 70, 0.10);   /* mulberry 10% wash */
  --on-ink: #F6EFEA;
  --on-ink-soft: #C9BFC2;
  --numeral: #A0828A;        /* large decorative numerals */
  --border: #E7DCD5;         /* hairline */
  --border-strong: #D8C9C1;  /* hairline strong */
  --chip-grad: linear-gradient(180deg, #7A3550, #6D2E46);
  --danger-bg: #F7ECEE;
  --danger-ink: #A03038;
  --warn-bg: #F4E9DA;        /* warm sand notice (no Teams blue anywhere) */
  --warn-ink: #6E4A16;
  --ok-bg: #E8F0E8;          /* muted sage confirmation, AA on --ok-ink */
  --ok-ink: #2F5D3A;

  /* ── Radius ── */
  --radius: 12px;            /* card / box */
  --radius-field: 8px;       /* input / select / alert */
  --radius-pill: 999px;      /* buttons, chips */

  /* ── Spacing — 8px base scale (mirrors careers London Atelier tokens) ── */
  --card-pad: 32px;          /* card inner padding */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px; --sp-9: 96px;

  /* ── Shadow + focus ── */
  --shadow-rest: 0 1px 2px rgba(33, 26, 30, 0.05);
  --shadow-hover: 0 1px 2px rgba(33, 26, 30, 0.05), 0 8px 24px rgba(33, 26, 30, 0.07);

  /* ── Type scale — 1.25 ratio, base 17px ── */
  --fs-display: 2.625rem;    /* 42 */
  --fs-h2: 2.0625rem;        /* 33 */
  --fs-h2-sm: 1.6875rem;     /* 27 */
  --fs-h3: 1.3125rem;        /* 21 */
  --fs-body: 1.0625rem;      /* 17 */
  --fs-small: 0.85rem;       /* 13.6 */

  /* Vazirmatn first, then platform fallbacks (correct even before woff2 loads). */
  --font: "Vazirmatn", "Segoe UI", Tahoma, Arial, system-ui, "Noto Sans Arabic", sans-serif;
}

* { box-sizing: border-box; }

/* Tabular figures for the whole document keep Jalali dates + counts aligned. */
html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 2;                 /* editorial Persian rhythm */
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

h1, h2, h3, h4, h5, h6 { letter-spacing: 0; color: var(--ink); }
p { letter-spacing: 0; }

a { color: var(--primary); text-decoration: none; transition: color 160ms ease-out; }
a:hover, a:focus { color: var(--primary-deep); text-decoration: underline; text-decoration-thickness: 1px; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ── Top bar / header ────────────────────────────────────────────────────
 * Powder ground + hairline-strong bottom rule, echoing the careers lockup.
 * A gradient pigment chip precedes the wordmark.
 */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.85rem;
  padding-inline: 1.25rem;
  background: var(--bg);
  border-block-end: 1px solid var(--border-strong);
}
.brand {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  padding-inline-start: 0.85rem;   /* room for the pigment chip */
  line-height: 1.15;
  color: var(--ink);
}
.brand::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  inset-block-start: 50%;
  translate: 0 -50%;
  inline-size: 6px;
  block-size: 30px;
  border-radius: 2px;
  background: var(--chip-grad);
}
/* Latin wordmark in Bodoni Moda italic — mirrors the careers header lockup. */
.brand-latin {
  font-family: "Bodoni Moda", Didot, "Vazirmatn", serif;
  font-style: italic;
  font-weight: 400;
  font-size: 1.55rem;
  line-height: 1.15;
  letter-spacing: 0;
  color: var(--ink);
}
/* Persian sits below as a taupe subtitle — stays Vazirmatn. */
.brand-fa {
  font-family: var(--font);
  font-weight: 600;
  font-size: var(--fs-small);
  line-height: 1.4;
  color: var(--muted);
}
.topnav { display: flex; align-items: center; gap: 0.75rem; }
.user { color: var(--muted); font-size: var(--fs-small); font-weight: 600; }
.logout-form { margin: 0; }

.container {
  max-inline-size: 900px;
  margin-inline: auto;
  padding-inline: 1rem;
  padding-block: 2rem;
}

/* Dark footer — ink-deep ground with on-ink text (careers family). */
.footer {
  text-align: center;
  background: var(--ink-deep);
  color: var(--on-ink);
  padding-block: 1.75rem;
  margin-block-start: 2rem;
  font-size: var(--fs-small);
  border-block-start: 1px solid rgba(246, 239, 234, 0.14);
}

/* ── Cards — signature: white fill, hairline, rest shadow, pigment edge chip */
.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding-block: var(--card-pad);
  padding-inline: var(--card-pad);
  margin-block-end: 1.25rem;
  box-shadow: var(--shadow-rest);
  overflow: clip;               /* keep the chip inside the rounded corner */
  transition: box-shadow 160ms ease-out;
}
/* Signature pigment chip — 8×40, grows in WIDTH on hover (careers parity). */
.card::before {
  content: "";
  position: absolute;
  inset-inline-start: -1px;
  inset-block-start: 50%;
  translate: 0 -50%;
  inline-size: 8px;
  block-size: 40px;
  background: var(--chip-grad);
  border-start-end-radius: 4px;
  border-end-end-radius: 4px;
  transition: inline-size 160ms ease-out;
}
.card:hover { box-shadow: var(--shadow-hover); }
.card:hover::before { inline-size: 12px; }
.card:focus-within { box-shadow: var(--shadow-hover); }
.card:focus-within::before { inline-size: 12px; }

.login-card { max-inline-size: 440px; margin-inline: auto; }
/* Editorial page/card title — light 300 weight (careers hero-title feel). */
.card-title {
  margin-block: 0 0.5rem;
  font-size: var(--fs-h2);
  font-weight: 300;
  line-height: 1.4;
  color: var(--ink);
}
.section-title {
  font-size: var(--fs-h3);
  font-weight: 600;
  line-height: 1.5;
  margin-block: 1.75rem 0.75rem;
  color: var(--ink);
}

/* ── Forms (RTL, logical props) ──────────────────────────────────────────*/
.form { display: flex; flex-direction: column; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: 0.35rem; }
.field-label { font-size: var(--fs-small); font-weight: 600; color: var(--ink); line-height: 1.6; }
.input, select.input, textarea.input {
  inline-size: 100%;
  padding-block: 0.7rem;
  padding-inline: 1rem;
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-field);
  background: var(--card);
  text-align: start;
  min-block-size: 48px;         /* ≥48px tap target (§6.1) */
  font-feature-settings: "tnum";
  transition: border-color 160ms ease-out, box-shadow 160ms ease-out;
}
textarea.input { min-block-size: 96px; line-height: 1.8; }
.input::placeholder { color: var(--muted); opacity: 1; }
.input:focus { outline: 2px solid var(--primary); outline-offset: 2px; border-color: var(--primary); }
.amount { font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; }

/* ── Grouped form sections (leave request: 3 fieldsets + responsive grid) ──
 * Each <fieldset class="form-section"> carries a legend and a 2-col responsive
 * grid; hairline rule separates sections. `[hidden]` is set by the reveal script
 * (progressive enhancement, hide-and-clear) — the explicit `.field[hidden]` rule
 * is REQUIRED because `.field{display:flex}` would otherwise beat the UA
 * `[hidden]{display:none}`. */
.form-section {
  min-inline-size: 0;
  margin: 0;
  padding-block: var(--sp-4);
  padding-inline: 0;
  border: 0;
  border-block-start: 1px solid var(--border);
}
.form-section:first-of-type { border-block-start: 0; padding-block-start: 0; }
.form-section__legend {
  padding-inline: 0;
  margin-block-end: var(--sp-3);
  color: var(--primary);
  font-size: var(--fs-small);
  font-weight: 700;
  line-height: 1.6;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--sp-4);
  align-items: start;
}
.field--span-2 { grid-column: 1 / -1; }
.field-help { color: var(--muted); font-size: var(--fs-small); line-height: 1.7; }
.form-section[hidden], .field[hidden] { display: none; }
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .field--span-2 { grid-column: auto; }
}

/* ── Buttons — pill (999px), 600, mulberry primary ───────────────────────*/
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding-block: 0.6rem;
  padding-inline: 1.4rem;
  min-block-size: 48px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font: inherit;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 160ms ease-out, color 160ms ease-out,
              border-color 160ms ease-out, opacity 160ms ease-out;
}
.btn:hover { text-decoration: none; }
.btn:active { filter: brightness(0.96); }
.btn:disabled, .btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.btn-block { inline-size: 100%; }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-deep); color: var(--primary-ink); }
.btn-secondary { background: var(--card); color: var(--ink); border-color: var(--border-strong); box-shadow: var(--shadow-rest); }
.btn-secondary:hover { background: var(--surface); color: var(--ink); border-color: var(--muted); box-shadow: var(--shadow-hover); }
.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--ink); }
.btn-ghost:hover { background: var(--surface); color: var(--ink); }

/* ── Alerts ──────────────────────────────────────────────────────────────*/
.alert {
  padding-block: 0.75rem;
  padding-inline: 1rem;
  border-radius: var(--radius-field);
  margin-block-end: 1rem;
  border-inline-start: 3px solid transparent;
  font-size: var(--fs-body);
}
.alert-error { background: var(--danger-bg); color: var(--danger-ink); border-inline-start-color: var(--danger-ink); }
.alert-warn { background: var(--warn-bg); color: var(--warn-ink); border-inline-start-color: var(--warn-ink); }
/* A success must NOT borrow the warning colour: an accepted daily report shown
   in amber reads as a failure and invites a second submit. */
.alert-success { background: var(--ok-bg); color: var(--ok-ink); border-inline-start-color: var(--ok-ink); }

/* Screen-reader-only / layout-only. Used for the form's hidden default submit
   button, which is what makes Enter submit the report instead of clicking
   «افزودن ردیف» (the first submit in tree order otherwise). */
.visually-hidden {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  padding: 0;
  margin: -1px;
  border: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-small);
  margin-block: 1.25rem;
}
.divider::before, .divider::after { content: ""; flex: 1; border-block-start: 1px solid var(--border); }
.divider span { padding-inline: 0.75rem; }

.hint { color: var(--muted); font-size: var(--fs-small); line-height: 1.7; }

/* ── Lists / key-value ───────────────────────────────────────────────────*/
.module-list { list-style: none; padding-inline: 0; }
.module-item {
  padding-block: 0.6rem;
  padding-inline: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-field);
  margin-block-end: 0.5rem;
}
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1.5rem; }
.kv dt { color: var(--muted); }
.kv dd { margin-inline-start: 0; font-weight: 600; }

/* ── Home module tiles (role-aware navigation) ───────────────────────────
 * The section title ("مرخصی") sits above a responsive grid of equal-size
 * tiles — one per permitted destination. Replaces the old cramped flex-wrap
 * pill row (5-in-a-row + 1 orphan) the COO flagged as under-scaled. Tiles are
 * uniform regardless of label length (auto-fill keeps aligned columns), read
 * as first-class "big cards", and carry the careers pigment-chip family cue.
 */
.module-card .card-title { margin-block-end: 1rem; }
.module-title { font-size: var(--fs-h2-sm); }

.module-tiles {
  /* Centered flex-wrap (was grid auto-fill). Broken flex-basis per breakpoint
   * makes a short last row CENTER instead of left-aligning, so the layout reads
   * symmetric: desktop 3+2 centered, tablet 2+2+1 centered, mobile 1-per-row.
   * All tiles stay equal height (see .module-tile__label 2-line reserve). */
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-2);
}

/* Each tile echoes the card signature (white fill, hairline, rest shadow,
 * inline-start pigment chip) but at compact nav scale: a per-section glyph at
 * the start (right in RTL) is the primary identifier, then the label. */
.module-tile {
  position: relative;
  flex: 0 1 100%;                        /* mobile: 1 tile per row (basis broken per breakpoint below) */
  min-inline-size: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: var(--sp-2);
  min-block-size: 64px;                  /* compact; whole tile is the tap target (≥44px) */
  padding-block: var(--sp-3);
  padding-inline: var(--sp-4) var(--sp-3);   /* start room clears the chip */
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-rest);
  color: var(--ink);
  text-decoration: none;
  overflow: clip;                        /* keep the chip inside the radius */
  transition: box-shadow 160ms ease-out, border-color 160ms ease-out,
              transform 160ms ease-out;
}
/* Broken flex-basis => centered symmetric rows (justify-content:center on the
 * flex parent). Tablet 2-up, desktop 3-up; the gap is subtracted so N tiles +
 * (N-1) gaps fit one row exactly. */
@media (min-width: 560px) { .module-tile { flex-basis: calc((100% - var(--sp-2)) / 2); } }
@media (min-width: 860px) { .module-tile { flex-basis: calc((100% - (2 * var(--sp-2))) / 3); } }
/* Pigment edge chip — grows in width on hover (careers parity with .card). */
.module-tile::before {
  content: "";
  position: absolute;
  inset-inline-start: -1px;
  inset-block-start: 50%;
  translate: 0 -50%;
  inline-size: 5px;
  block-size: 20px;
  background: var(--chip-grad);
  border-start-end-radius: 4px;
  border-end-end-radius: 4px;
  transition: inline-size 160ms ease-out;
}
.module-tile:hover,
.module-tile:focus-visible {
  color: var(--ink);
  text-decoration: none;
  border-color: var(--border-strong);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);           /* lift */
}
.module-tile:hover::before,
.module-tile:focus-visible::before { inline-size: 10px; }
.module-tile:active { transform: translateY(0); }

.module-tile__label {
  flex: 1 1 auto;
  min-inline-size: 0;                    /* allow long labels to wrap, not push */
  min-block-size: calc(2 * 1.35em);      /* reserve 2 lines so every tile is equal height */
  display: flex;
  align-items: center;
  font-weight: 600;
  font-size: 0.9375rem;                  /* 15px — a touch smaller than body */
  line-height: 1.35;
  color: var(--ink);
  text-align: start;
  text-wrap: balance;
  overflow-wrap: anywhere;
}
/* Per-section glyph (leading, mulberry). This is the tile's main identifier now,
 * so it sits fully opaque; the generic chevron is gone. */
.module-tile__icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  color: var(--primary);
  opacity: 0.9;
  transition: opacity 160ms ease-out;
}
.module-tile__icon .tile-glyph { display: block; }
.module-tile:hover .module-tile__icon,
.module-tile:focus-visible .module-tile__icon { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .module-tile:hover, .module-tile:focus-visible { transform: none; }
}

/* ── Leave module (tables, balance box, tags, inline fields) ─────────────*/
.row { display: flex; gap: 1rem; flex-wrap: wrap; }
.row > .field { flex: 1; min-inline-size: 9rem; }
.field-inline { display: flex; align-items: center; gap: 0.5rem; color: var(--ink); min-block-size: 48px; }
.field-inline input[type="checkbox"] { flex: 0 0 auto; inline-size: 20px; block-size: 20px; accent-color: var(--primary); }

/* Balance callout — warm surface + mulberry edge, tnum figures (no blue). */
.balance-box {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-inline-start: 3px solid var(--primary);
  border-radius: var(--radius-field);
  padding-block: 0.8rem;
  padding-inline: 1rem;
  margin-block-end: 1.25rem;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}
.balance-box strong { font-weight: 600; color: var(--primary); }

.tbl { inline-size: 100%; border-collapse: collapse; font-feature-settings: "tnum"; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td {
  text-align: start;             /* logical — never left/right */
  padding-block: 0.6rem;
  padding-inline: 0.7rem;
  border-block-end: 1px solid var(--border);
  font-size: var(--fs-small);
  line-height: 1.7;
}
.tbl th { color: var(--muted); font-weight: 600; }
.tbl tbody tr:hover { background: var(--surface); }
.actions { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.reject-form { display: flex; gap: 0.3rem; align-items: center; }
.btn-sm { min-block-size: 36px; padding-block: 0.3rem; padding-inline: 0.9rem; font-size: var(--fs-small); }
.input-sm { min-block-size: 36px; padding-block: 0.3rem; padding-inline: 0.6rem; inline-size: 8rem; }

/* Social-security chip — pigment wash, pill (retonalised from amber). */
.tag {
  display: inline-block;
  background: var(--ghost);
  color: var(--primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding-block: 0.08rem;
  padding-inline: 0.55rem;
  font-size: var(--fs-small);
  font-weight: 600;
  line-height: 1.5;
}

/* ── Responsive — narrow-screen table rescue ─────────────────────────────
 * The 7–8 column queue tables would be clipped by the card's `overflow:clip`
 * on a phone (action buttons vanishing). Turn the table into its own
 * horizontal scroll container so every column + action stays reachable.
 */
@media (max-width: 640px) {
  .tbl {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }
}

/* ── Reduced motion — freeze transitions; chip stays at rest size ─────────*/
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation: none !important; }
  .card:hover::before, .card:focus-within::before { inline-size: 8px; }
}

/* ── Daily report — task rows, static question, mood scale ───────────────
 * Logical properties only (the whole portal is RTL). No inline styles anywhere
 * in the module: the live CSP is `style-src 'self'`, which blocks a style=""
 * attribute exactly as surely as script-src blocks an inline <script>.
 *
 * .task-row__num is a pure CSS counter, so adding a row (htmx append) and
 * removing one (hx-swap="delete") both renumber correctly with ZERO JavaScript.
 */
.task-rows { counter-reset: taskrow; display: flex; flex-direction: column; gap: 0.6rem; }

/* GRID, not flex-wrap. The old row was a wrapping flex line, so as soon as the
   text box hit its 18rem basis the duration box wrapped onto a line of its own
   and the row stopped reading as one thing. A grid keeps description and
   duration side by side, and on a narrow phone it re-flows to a DELIBERATE
   two-line shape instead of whatever wrapping happened to produce. */
/* Description and duration stay SIDE BY SIDE at every width. The previous
   version dropped to a deliberate two-line shape below 560px, which is exactly
   the "duration is under the description" the COO rejected: he was looking at
   a phone. Losing the separate number column (the counter now lives inside the
   label) buys back the room that makes one line fit. */
.task-row {
  counter-increment: taskrow;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 7.5rem auto;
  grid-template-areas: "text hours remove";
  gap: 0.4rem 0.6rem;
  align-items: end;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2, #fbfaf9);
}
.task-row:focus-within { border-color: var(--primary); }
.task-row__text   { grid-area: text; }
.task-row__hours  { grid-area: hours; }
.task-row__remove { grid-area: remove; align-self: end; }

/* «۱. شرح کار» - the counter is part of the label, next to what it numbers. */
.task-row__num::before {
  content: counter(taskrow) ". ";
  color: var(--primary);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
/* Both labels must occupy the same height or the two inputs stop aligning:
   «مدت زمان انجام کار» wraps to two lines in a 7.5rem track and «شرح کار»
   never does. A fixed min height on the label row settles it without a
   media query. */
.task-row .field-label { min-block-size: 2.4em; display: flex; align-items: flex-end; }
.task-row__hours .input { inline-size: 100%; }

@media (max-width: 560px) {
  /* Only shrink, never stack. */
  .task-row { grid-template-columns: minmax(0, 1fr) 5.5rem auto; padding-inline: 0.5rem; gap: 0.35rem 0.4rem; }
  .task-row .field-label { font-size: 0.78rem; min-block-size: 3.2em; }
  .task-row__remove { padding-inline: 0.5rem; }
}

/* Instruction that has to be READ, not skimmed past. Used above the task list
   because the same sentence sitting underneath was being read after the
   mistake it prevents. */
.callout {
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  margin-block-end: 0.8rem;
  line-height: 1.9;
  border-inline-start: 4px solid var(--primary);
  background: var(--surface-2, #fbfaf9);
  color: var(--ink);
}
.callout strong { color: var(--primary); }

/* Row-cap affordance with ZERO JavaScript (the live CSP is script-src 'self'
   and this module ships no JS at all). Once the 20th .task-row exists, swap
   «افزودن ردیف» for the cap note, so the employee learns the limit BEFORE
   typing five more rows they then have to merge by hand on a phone. Browsers
   without :has() fall back to the previous behaviour; MAX_TASK_ROWS on the
   server is the actual enforcement either way. */
.task-rows-cap { display: none; }
.form-section:has(#task-rows .task-row:nth-child(20)) .task-rows-add { display: none; }
.form-section:has(#task-rows .task-row:nth-child(20)) .task-rows-cap { display: block; }

/* The spotlight question is STATIC TEXT, never an editable control (req 4). */
.static-question {
  font-weight: 600;
  color: var(--ink);
  line-height: 1.9;
  border-inline-start: 3px solid var(--primary);
  padding-inline-start: 0.75rem;
  margin-block-end: 0.75rem;
}

.mood-scale { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.mood-opt {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-block-size: 48px;
  padding-inline: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--ink);
}
.mood-opt input { flex: 0 0 auto; inline-size: 20px; block-size: 20px; accent-color: var(--primary); }
.mood-opt:focus-within { border-color: var(--primary); }

/* The old flex-era mobile block lived here and set
   `.task-row__hours { flex: 1 1 100% }`. Dead once the row became a grid, and
   deleting it removes a rule that would fight any future flex fallback. */
