@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/fonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}


:root {
  /* ── Paper base ── */
  --paper: #F5F3EF;
  --paper-elevated: #FBFAF8;
  --bg: var(--paper);

  /* ── Text ── */
  --ink: #201C1C;
  --ink-muted: #6B6560;
  --text-main: var(--ink);
  --text-muted: var(--ink-muted);

  /* ── Accents ── */
  --wine: #7A2140;
  --wine-hover: #8F2A4E;
  --wine-light: rgba(122, 33, 64, 0.08);
  --sage: #5B7561;
  --sage-light: #E4EAE5;
  --gold: #B98D3E;
  --gold-light: rgba(185, 141, 62, 0.14);
  --pending: #6B7A8F;
  --pending-light: #E8ECEF;
  --danger: #A23B2E;
  --danger-light: rgba(162, 59, 46, 0.12);

  /* Back-compat aliases — existing markup/inline styles reference --primary */
  --primary: var(--wine);
  --primary-hover: var(--wine-hover);
  --primary-light: var(--wine-light);

  /* ── Surfaces ── */
  --sidebar-bg: var(--paper-elevated);
  --card-bg: var(--paper-elevated);
  --border: var(--line);
  --line: #DDD6CC;
  --glass-border: var(--line);

  /* ── Geometry ── */
  --radius: 8px;
  --radius-btn: 6px;
  --radius-lg: 8px;
  --radius-md: 8px;
  --radius-sm: 6px;

  /* ── Shadows — subtle 1px ambient only, never heavier ── */
  --shadow-ambient: 0 1px 2px rgba(32, 28, 28, 0.08);
  --shadow-card: var(--shadow-ambient);
  --shadow-sm: var(--shadow-ambient);

  /* ── Signature motif: measure-line (thin repeating tick pattern) ── */
  --measure-line: repeating-linear-gradient(
    90deg,
    var(--line) 0,
    var(--line) 1px,
    transparent 1px,
    transparent 8px
  );

  /* ── Standard easing — calmer, no overshoot ── */
  --ease-standard: cubic-bezier(0.22, 0.61, 0.36, 1);

  /* ── Type scale (Vazirmatn only) ── */
  --fs-xs: 11px;
  --fs-sm: 12px;
  --fs-base: 14px;
  --fs-md: 16px;
  --fs-lg: 18px;
  --fs-xl: 22px;
}

* { box-sizing: border-box; font-family: Vazirmatn, sans-serif; }

body {
  margin: 0;
  background: var(--paper);
  min-height: 100vh;
  direction: rtl;
  color: var(--ink);
}

/* ── Numeric data: tabular figures with monospace fallback ── */
.tabular-nums,
bdo[dir="ltr"] {
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace;
}

/* ── Signature motif utility — tab underlines, dividers, progress tracks ── */
.measure-line {
  background-image: var(--measure-line);
  background-repeat: repeat-x;
  background-position: bottom;
}

.sidebar {
  position: fixed;
  right: 0;
  top: 0;
  height: 100vh;
  width: 260px;
  background: var(--sidebar-bg);
  border-left: 1px solid var(--line);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.main-content {
  margin-right: 260px;
  padding: 32px;
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

.card {
  position: relative;
  background: var(--paper-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-ambient);
  padding: 24px;
  overflow: hidden;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.card-header h2,
.card-header h3 {
  margin: 0;
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.btn-primary {
  background: var(--wine);
  color: #FBFAF8;
  border: none;
  border-radius: var(--radius-btn);
  padding: 10px 20px;
  cursor: pointer;
  font-size: var(--fs-base);
  font-family: Vazirmatn, sans-serif;
  font-weight: 700;
  transition: background 0.2s var(--ease-standard);
}

.btn-primary:hover { background: var(--wine-hover); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius-btn);
  padding: 10px 20px;
  cursor: pointer;
  font-size: var(--fs-base);
  font-family: Vazirmatn, sans-serif;
  color: var(--ink-muted);
  transition: background 0.2s var(--ease-standard);
}

.btn-ghost:hover { background: var(--wine-light); }

.btn-reject {
  background: transparent;
  border: 1px solid rgba(162, 59, 46, 0.4);
  border-radius: var(--radius-btn);
  padding: 6px 14px;
  cursor: pointer;
  font-size: 13px;
  font-family: Vazirmatn, sans-serif;
  color: var(--danger);
  transition: background 0.2s var(--ease-standard);
}

.btn-reject:hover { background: var(--danger-light); }

.nav-item {
  position: relative;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--ink-muted);
  font-size: var(--fs-base);
  font-weight: 500;
  transition: background 0.2s var(--ease-standard), color 0.2s var(--ease-standard);
  user-select: none;
}

.nav-item.active {
  background: var(--wine-light);
  color: var(--wine);
  font-weight: 600;
}

/* Active-nav indicator — a single solid wine tick, not a repeating pattern
   (a repeating-gradient here rendered as 3-4 tiny squares at this size,
   reading as a stray "⋮" rather than a tick — kept it one solid mark). */
.nav-item.active::before {
  content: '';
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 14px;
  background: var(--wine);
  border-radius: 2px;
}

.nav-item:hover {
  background: rgba(32, 28, 28, 0.04);
  color: var(--ink);
}

.nav-section-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--ink-muted);
  padding: 8px 16px;
  letter-spacing: 0.08em;
  cursor: default;
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 99px;
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.01em;
}

.badge-pending  { background: var(--pending-light); color: var(--pending); }
.badge-approved { background: var(--sage-light);  color: var(--sage); }
.badge-rejected { background: var(--danger-light); color: var(--danger); }

.input-field {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-btn);
  font-size: var(--fs-base);
  font-family: Vazirmatn, sans-serif;
  outline: none;
  transition: border-color 0.2s var(--ease-standard), background 0.2s var(--ease-standard);
  background: var(--paper-elevated);
  color: var(--ink);
}

.input-field::placeholder { color: rgba(32, 28, 28, 0.32); }

.input-field:focus {
  border-color: var(--wine);
  background: #FFFFFF;
  outline: none;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field-label {
  font-size: var(--fs-sm);
  color: var(--ink-muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 10px 12px;
  text-align: right;
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-base);
}

th {
  font-size: var(--fs-sm);
  color: var(--ink-muted);
  font-weight: 600;
  letter-spacing: 0.03em;
}

.table-wrap { overflow-x: auto; }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(32, 28, 28, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-overlay.open { display: flex; }

.modal-box {
  position: relative;
  background: var(--paper-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  width: 520px;
  max-width: 95vw;
  box-shadow: var(--shadow-ambient);
  overflow: hidden;
}

.modal-box h3 {
  margin: 0 0 16px;
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.section-gap { margin-bottom: 24px; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: var(--radius-btn);
  font-size: var(--fs-base);
  font-family: Vazirmatn, sans-serif;
  font-weight: 600;
  z-index: 9999;
  animation: toastIn 0.2s var(--ease-standard);
  pointer-events: none;
}

.toast-success { background: var(--sage);   color: #FBFAF8; }
.toast-error   { background: var(--danger); color: #FBFAF8; }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ── Solid surfaces (formerly glassmorphism utilities — blur retired) ─── */

.glass-card {
  position: relative;
  background: var(--paper-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-ambient);
  overflow: hidden;
}

.glass-card-strong {
  position: relative;
  background: var(--paper-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-ambient);
  overflow: hidden;
}

.glass-input {
  background: var(--paper-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-btn);
  padding: 10px 14px;
  width: 100%;
  box-sizing: border-box;
  font-family: Vazirmatn, sans-serif;
  font-size: var(--fs-base);
  color: var(--ink);
  transition: border-color 0.2s var(--ease-standard), background 0.2s var(--ease-standard);
}

.glass-input::placeholder { color: rgba(32, 28, 28, 0.32); }

.glass-input:focus {
  outline: none;
  background: #FFFFFF;
  border-color: var(--wine);
  box-shadow: none;
}

.glass-btn-primary {
  background: var(--wine);
  color: #FBFAF8;
  border: none;
  border-radius: var(--radius-btn);
  padding: 10px 24px;
  font-family: Vazirmatn, sans-serif;
  font-size: var(--fs-base);
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s var(--ease-standard);
}

.glass-btn-primary:hover { background: var(--wine-hover); }

.glass-btn-secondary {
  background: var(--paper-elevated);
  color: var(--wine);
  border: 1px solid rgba(122, 33, 64, 0.3);
  border-radius: var(--radius-btn);
  padding: 10px 24px;
  font-family: Vazirmatn, sans-serif;
  font-size: var(--fs-base);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s var(--ease-standard);
}

.glass-btn-secondary:hover {
  background: var(--wine-light);
}

/* ===== SMOOTH INTERACTIONS — calm standard ease, no overshoot/scale-pop ===== */
*, *::before, *::after {
  transition-timing-function: var(--ease-standard);
}

.glass-card, .card {
  transition: box-shadow 0.2s var(--ease-standard), border-color 0.2s var(--ease-standard);
}
.glass-card:hover, .card:hover {
  border-color: rgba(122, 33, 64, 0.25);
}

.glass-btn-primary,
.glass-btn-secondary,
.btn-primary,
.btn-ghost {
  transition: background 0.2s var(--ease-standard), border-color 0.2s var(--ease-standard);
}
.glass-btn-primary:active,
.btn-primary:active {
  background: var(--wine-hover);
}

.nav-sub-item, .nav-item {
  transition: background 0.2s var(--ease-standard), color 0.2s var(--ease-standard);
}

/* Input focus */
.glass-input {
  transition: background 0.2s var(--ease-standard), border-color 0.2s var(--ease-standard);
}

/* Page section entrance — subtle fade, no slide/bounce */
@keyframes sectionFadeUp {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.section.active {
  animation: sectionFadeUp 0.2s var(--ease-standard) both;
}

/* ===== UTILITY ===== */
.hidden { display: none !important; }

/* ── Styled checkbox — replaces browser default ── */
.styled-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin: 0;
  border: 1.5px solid var(--line);
  border-radius: 4px;
  background: var(--paper-elevated);
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: background 0.15s var(--ease-standard), border-color 0.15s var(--ease-standard);
}
.styled-checkbox:hover:not(:disabled) {
  border-color: var(--sage);
}
.styled-checkbox:checked {
  background: var(--wine);
  border-color: var(--wine);
}
.styled-checkbox:checked::after {
  content: '';
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #FBFAF8;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.styled-checkbox:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ── Empty state — shared component (see window.renderEmptyState in app.js) ── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
}
.empty-state-icon { margin-bottom: 10px; }
.empty-state-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
}
.empty-state-subtitle {
  font-size: 12px;
  color: var(--ink-muted);
  opacity: 0.75;
  margin-top: 4px;
}

/* ===== ATS KANBAN ===== */

.ats-kanban-grid {
  display: grid;
  grid-auto-columns: 280px;
  grid-auto-flow: column;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
  min-height: 480px;
}

.ats-kanban-col {
  min-height: 420px;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--paper-elevated);
  border: 1px solid var(--line);
}

.ats-col-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.ats-col-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 8px;
  border-radius: 99px;
  font-size: var(--fs-sm);
  font-weight: 700;
}

.ats-col-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

.ats-col-dropzone {
  flex: 1;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
  font-size: var(--fs-sm);
  color: var(--ink-muted);
  background: var(--paper);
  border: 2px dashed var(--line);
  border-radius: var(--radius-sm);
}
.ats-col-dropzone .empty-state {
  padding: 12px 8px;
}
.ats-col-dropzone .empty-state-icon {
  width: 36px;
  height: 36px;
  margin-bottom: 6px;
}
.ats-col-dropzone .empty-state-title {
  font-size: 11px;
}
.ats-col-dropzone .empty-state-subtitle {
  font-size: 10px;
}

.ats-candidate-card {
  padding: 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--paper);
  border: 1px solid var(--line);
  transition: border-color 0.2s var(--ease-standard), box-shadow 0.2s var(--ease-standard);
}

.ats-candidate-card:hover {
  border-color: rgba(122, 33, 64, 0.3);
  box-shadow: var(--shadow-ambient);
}

/* ── Candidate Drawer ── */
.ats-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(32, 28, 28, 0.35);
  z-index: 190;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease-standard);
}

.ats-drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.ats-drawer {
  position: fixed;
  top: 0;
  right: -480px;
  width: 420px;
  max-width: 95vw;
  height: 100vh;
  z-index: 200;
  padding: 28px 24px;
  border-radius: var(--radius) 0 0 var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: none;
  transition: right 0.25s var(--ease-standard);
}
.ats-drawer.open {
  right: 0;
}

.ats-section-tab-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
  padding: 5px 5px 8px;
  background-color: var(--paper);
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}
.ats-section-tab-bar.measure-line {
  background-size: auto 6px;
}

.tab-btn {
  flex: 1;
  padding: 10px 16px;
  border-radius: var(--radius-btn);
  cursor: pointer;
  font-family: Vazirmatn, sans-serif;
  font-size: var(--fs-base);
  font-weight: 600;
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink-muted);
  transition: background 0.2s var(--ease-standard), color 0.2s var(--ease-standard);
}

.tab-btn.active {
  background: var(--wine);
  color: #FBFAF8;
  border-color: transparent;
}

.ats-drawer-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.ats-tab-btn {
  flex: 1;
  min-width: 44%;
  padding: 8px 12px;
  font-size: 13px;
  border-radius: var(--radius-btn);
}

/* ── Timeline ── */
.ats-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-top: 4px;
}

.ats-timeline-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  position: relative;
  padding-bottom: 16px;
}

.ats-timeline-item:not(:last-child)::before {
  content: '';
  position: absolute;
  right: 5px;
  top: 20px;
  bottom: -4px;
  width: 2px;
  background: var(--line);
}

.ats-timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px var(--paper);
}

.ats-timeline-content {
  flex: 1;
  min-width: 0;
}

/* ── Stat tile colors ── */
#ats-stat-total  { color: var(--ink) !important; }
#ats-stat-draft  { color: var(--ink-muted) !important; }
#ats-stat-open   { color: var(--wine) !important; }
#ats-stat-filled { color: var(--sage) !important; }

/* ── Custom Select ── */
.custom-select-wrapper { position: relative; width: 100%; }
.custom-select-trigger {
  width: 100%; padding: 10px 14px;
  background: var(--paper-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-btn); color: var(--ink); font-size: 13px;
  cursor: pointer; display: flex; align-items: center;
  justify-content: space-between; user-select: none;
  font-family: inherit; direction: rtl;
}
.custom-select-trigger:hover { background: var(--paper); }
.custom-select-trigger.open { border-color: var(--wine); }
.custom-select-trigger .placeholder { color: rgba(32, 28, 28, 0.32); }
.custom-select-trigger span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.custom-select-trigger .arrow {
  width: 14px; height: 14px; opacity: 0.5;
  transition: transform 0.2s var(--ease-standard);
  flex-shrink: 0; margin-right: 8px;
}
.custom-select-trigger.open .arrow { transform: rotate(180deg); }
.custom-select-dropdown {
  background: var(--paper-elevated); border: 1px solid var(--line);
  border-radius: var(--radius-btn); overflow: hidden;
  box-shadow: var(--shadow-ambient);
}
.custom-select-dropdown.open { display: block; }
.custom-select-option {
  padding: 10px 14px; color: var(--ink); font-size: 13px;
  cursor: pointer; direction: rtl; transition: background 0.15s var(--ease-standard);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.custom-select-option:hover { background: var(--paper); }
.custom-select-option.selected {
  background: var(--wine-light); color: var(--wine);
}
.custom-select-option.placeholder-opt { color: rgba(32, 28, 28, 0.32); }

/* ── NEO-60 report narrative (markdown-rendered) ── */
.neo-narrative {
  font-size: var(--fs-base);
  line-height: 1.9;
  color: var(--ink);
}

.neo-narrative h1,
.neo-narrative h2,
.neo-narrative h3 {
  color: var(--wine);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 12px;
}

.neo-narrative h1 { font-size: var(--fs-lg); }
.neo-narrative h2 {
  font-size: var(--fs-md);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.neo-narrative h3 { font-size: var(--fs-base); }

.neo-narrative h1:not(:first-child),
.neo-narrative h2:not(:first-child),
.neo-narrative h3:not(:first-child) {
  margin-top: 20px;
}

.neo-narrative p {
  margin: 0 0 12px;
  text-align: justify;
  text-align-last: right;
}

.neo-narrative strong {
  color: var(--ink);
  font-weight: 700;
}

.neo-narrative ul,
.neo-narrative ol {
  margin: 0 0 12px;
  padding-right: 20px;
  padding-left: 0;
}

.neo-narrative li {
  margin-bottom: 6px;
  text-align: justify;
  text-align-last: right;
}

.neo-narrative li::marker {
  color: var(--wine);
}

/* Signature measure-line divider — semantic <hr> inside report narrative */
.neo-narrative hr {
  border: none;
  height: 6px;
  background-image: var(--measure-line);
  background-position: center;
  margin: 20px 0;
}

.neo-narrative > *:last-child {
  margin-bottom: 0;
}

/* ── NEO-60 report: at-a-glance summary card ── */
.neo-summary-card {
  padding: 16px 20px;
  background: var(--gold-light);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(185, 141, 62, 0.25);
}

.neo-summary-label {
  font-size: var(--fs-xs);
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.neo-summary-text {
  font-size: var(--fs-base);
  line-height: 1.8;
  color: var(--ink);
  text-align: justify;
  text-align-last: right;
}

/* ── NEO-60 report: narrative accordion ── */
.neo-accordion {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.neo-accordion-item {
  padding: 0;
  overflow: hidden;
}

.neo-accordion-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: Vazirmatn, sans-serif;
  text-align: right;
  direction: rtl;
}

.neo-accordion-heading {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.neo-accordion-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.neo-accordion-preview {
  font-size: var(--fs-xs);
  color: var(--ink-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.neo-accordion-item.open .neo-accordion-preview {
  display: none;
}

.neo-accordion-arrow {
  flex-shrink: 0;
  color: var(--ink-muted);
  transition: transform 0.2s var(--ease-standard);
}

.neo-accordion-item.open .neo-accordion-arrow {
  transform: rotate(180deg);
}

.neo-accordion-body {
  max-height: 0;
  overflow: hidden;
  padding: 0 18px;
  transition: max-height 0.3s var(--ease-standard), padding 0.2s var(--ease-standard);
}

.neo-accordion-item.open .neo-accordion-body {
  max-height: 2000px;
  padding: 0 18px 18px;
}

/* ══════════════════════════════════════════════════════════════════════════
   PHASE 2 — Interface shell: role-aware home, PWA chrome, responsive layout.
   Appended rather than woven in so the diff stays reviewable; every rule
   below is additive and none overrides an existing selector's base state.
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Home screen ─────────────────────────────────────────────────────── */

.home-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.home-greeting {
  font-size: 22px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.5;
}

.home-persona {
  font-size: var(--fs-sm);
  color: var(--ink-muted);
  margin-top: 4px;
}

.home-bell {
  position: relative;
  flex-shrink: 0;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--paper-elevated);
  color: var(--ink-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s var(--ease-standard), color 0.2s var(--ease-standard);
}
.home-bell:hover { background: var(--wine-light); color: var(--wine); }

.home-bell-dot {
  position: absolute;
  top: 8px;
  inset-inline-end: 9px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--wine);
  border: 2px solid var(--paper-elevated);
}

/* The "why you can't install this" notice. Deliberately informational, not
   an error state — nothing is broken from the user's point of view. */
.home-notice {
  background: var(--pending-light);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: var(--fs-sm);
  color: var(--ink-muted);
  line-height: 1.9;
  margin-bottom: 20px;
}

.home-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
}
.home-actions:empty { display: none; }

.home-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.home-card {
  position: relative;
  text-align: start;
  font-family: inherit;
  background: var(--paper-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 20px;
  cursor: pointer;
  transition: border-color 0.2s var(--ease-standard), transform 0.2s var(--ease-standard);
}
.home-card:hover { border-color: var(--wine); transform: translateY(-2px); }
.home-card:focus-visible { outline: 2px solid var(--wine); outline-offset: 2px; }

/* Tone is a 3px inline-start rule, matching the active-nav tick language
   rather than introducing a new accent shape. */
.home-card::before {
  content: '';
  position: absolute;
  inset-inline-start: 0;
  top: 16px;
  bottom: 16px;
  width: 3px;
  border-radius: 2px;
  background: transparent;
}
.home-card.tone-gold::before { background: var(--gold); }
.home-card.tone-wine::before { background: var(--wine); }
.home-card.tone-sage::before { background: var(--sage); }

.home-card-title { font-size: var(--fs-sm); color: var(--ink-muted); font-weight: 500; }
.home-card-value {
  font-size: 28px;
  font-weight: 600;
  color: var(--ink);
  margin: 8px 0 6px;
  font-variant-numeric: tabular-nums;
}
.home-card-hint { font-size: var(--fs-sm); color: var(--ink-muted); line-height: 1.8; }
.home-card-cta { margin-top: 12px; font-size: var(--fs-sm); font-weight: 600; color: var(--wine); }

.home-card-skeleton {
  height: 132px;
  cursor: default;
  background: linear-gradient(90deg, var(--paper-elevated) 0%, rgba(0,0,0,0.035) 50%, var(--paper-elevated) 100%);
  background-size: 200% 100%;
  animation: homeShimmer 1.2s linear infinite;
}
.home-card-skeleton:hover { transform: none; border-color: var(--line); }
@keyframes homeShimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ── iOS install instruction card ────────────────────────────────────── */

.home-ios-card {
  background: var(--paper-elevated);
  border: 1px solid var(--gold);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  margin-bottom: 20px;
}
.home-ios-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: var(--fs-base);
  color: var(--ink);
}
.home-ios-x {
  background: none;
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-muted);
  padding: 0 4px;
}
.home-ios-steps {
  margin: 0;
  padding-inline-start: 20px;
  font-size: var(--fs-sm);
  color: var(--ink-muted);
  line-height: 2.1;
}
.home-ios-steps strong { color: var(--ink); font-weight: 600; }
.home-ios-note {
  margin: 12px 0 0;
  font-size: var(--fs-xs);
  color: var(--ink-muted);
  line-height: 1.9;
}

/* ── Notification tray ───────────────────────────────────────────────── */

.home-tray-panel {
  width: 440px;
  max-width: 95vw;
  max-height: 80vh;
  padding: 24px;
  display: flex;
  flex-direction: column;
}
.home-tray-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.home-tray-head h3 { margin: 0; font-size: 16px; font-weight: 600; color: var(--ink); }
.home-tray-list { overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }

.home-tray-item {
  text-align: start;
  font-family: inherit;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color 0.2s var(--ease-standard);
}
.home-tray-item:hover { border-color: var(--wine); }
.home-tray-item.unread { border-inline-start: 3px solid var(--wine); }
.home-tray-title { font-size: var(--fs-base); font-weight: 500; color: var(--ink); }
.home-tray-body { font-size: var(--fs-sm); color: var(--ink-muted); margin-top: 4px; line-height: 1.8; }

/* ── Manager home: task-first sections ───────────────────────────────────
   Uses the existing v2 token set only — no new colours, no new fonts. Tone
   accents reuse the same wine/gold/sage roles the home cards already use. */

.home-sections { display: flex; flex-direction: column; gap: 28px; margin-bottom: 28px; }
.home-sections:empty { display: none; }

.home-section-head { margin-bottom: 12px; }
.home-section-title {
  margin: 0;
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--ink);
}
.home-section-sub {
  margin: 4px 0 0;
  font-size: var(--fs-sm);
  color: var(--ink-muted);
  line-height: 1.8;
}
.home-section-empty {
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

/* Pending actions — the lead section. Each row is one tappable task. */
.home-action-list { display: flex; flex-direction: column; gap: 10px; }

.home-action {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  text-align: start;
  font: inherit;
  padding: 16px 20px 16px 18px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.18s var(--ease-standard), transform 0.18s var(--ease-standard);
}
.home-action:hover { border-color: var(--wine); transform: translateY(-1px); }
.home-action:focus-visible { outline: 2px solid var(--wine); outline-offset: 2px; }

/* Inline-start accent stripe, matching the home cards' tone treatment. */
.home-action::before {
  content: '';
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 3px;
  background: var(--line);
}
.home-action.tone-wine::before { background: var(--wine); }
.home-action.tone-gold::before { background: var(--gold); }
.home-action.tone-sage::before { background: var(--sage); }

.home-action-main { min-width: 0; }
.home-action-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.home-action-title {
  font-size: var(--fs-base);
  font-weight: 600;
  color: var(--ink);
}
.home-action-badge {
  font-size: var(--fs-xs);
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--gold-light);
  color: var(--gold);
  white-space: nowrap;
}
.home-action.tone-wine .home-action-badge { background: var(--wine-light); color: var(--wine); }
.home-action-sub {
  margin-top: 5px;
  font-size: var(--fs-sm);
  color: var(--ink-muted);
  line-height: 1.8;
}
.home-action-cta {
  flex-shrink: 0;
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--wine);
  white-space: nowrap;
}

/* My team */
.home-team {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.home-team-member {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 0;
}
.home-team-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--sage-light);
  color: var(--sage);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-base);
  font-weight: 600;
}
.home-team-info { min-width: 0; }
.home-team-name {
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home-team-meta {
  font-size: var(--fs-sm);
  color: var(--ink-muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Quick-log evidence — placeholder entry point, not yet wired. */
.home-quicklog {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 18px 20px;
  background: var(--card-bg);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.home-soon-badge {
  font-size: var(--fs-xs);
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--pending-light);
  color: var(--pending);
}

/* Built-in help */
.home-help {
  margin-top: 28px;
  background: var(--card-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 18px;
}
.home-help[hidden] { display: none; }
.home-help > summary {
  cursor: pointer;
  padding: 14px 0;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--ink-muted);
  list-style: none;
}
.home-help > summary::-webkit-details-marker { display: none; }
.home-help > summary::before {
  content: '؟';
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-inline-end: 8px;
  border-radius: 50%;
  background: var(--gold-light);
  color: var(--gold);
  font-size: var(--fs-xs);
  font-weight: 600;
  vertical-align: -3px;
}
.home-help[open] > summary { color: var(--ink); border-bottom: 1px solid var(--line); }
.home-help-body { padding: 4px 0 16px; }
.home-help-body p {
  margin: 12px 0 0;
  font-size: var(--fs-sm);
  color: var(--ink-muted);
  line-height: 2;
}
.home-help-body strong { color: var(--ink); font-weight: 600; }

/* ── "View as" banner ────────────────────────────────────────────────────
   Fixed to the viewport, above every other layer including the mobile top bar
   and the sidebar drawer (z-index 1000). Being impossible to scroll away from
   or cover is the point: an admin must never lose track of whose account they
   are looking at. Wine, because this is a state the product wants noticed. */

.imp-banner {
  position: fixed;
  top: 0;
  inset-inline: 0;
  z-index: 1100;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--wine);
  color: #FBFAF8;
  font-size: var(--fs-sm);
  line-height: 1.7;
  box-shadow: 0 2px 8px rgba(32, 28, 28, 0.25);
}
.imp-banner[hidden] { display: none; }

.imp-banner-dot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gold);
  animation: impPulse 2s var(--ease-standard) infinite;
}
@keyframes impPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.imp-banner-text { flex: 1; min-width: 0; }
.imp-banner-text strong { font-weight: 600; }

.imp-banner-timer {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
  opacity: 0.85;
  font-size: var(--fs-xs);
  white-space: nowrap;
}

.imp-banner-exit {
  flex-shrink: 0;
  font: inherit;
  font-weight: 600;
  color: var(--wine);
  background: #FBFAF8;
  border: none;
  border-radius: var(--radius-btn);
  padding: 7px 14px;
  cursor: pointer;
  white-space: nowrap;
}
.imp-banner-exit:hover { background: #fff; }
.imp-banner-exit:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* Push the whole app down so the banner never covers content or the sidebar's
   own top. Applied to body, so it holds on every view without each one knowing. */
body.imp-active .main-content { padding-top: 76px; }
body.imp-active .sidebar { padding-top: 76px; }

/* View-as screen */
.imp-help {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
}
.imp-help p {
  margin: 0 0 10px;
  font-size: var(--fs-sm);
  color: var(--ink-muted);
  line-height: 2;
}
.imp-help p:last-child { margin-bottom: 0; }
.imp-help strong { color: var(--ink); font-weight: 600; }
.imp-help-note {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 12px !important;
}

.imp-start[hidden] { display: none; }
.imp-start-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.imp-error {
  margin-top: 10px;
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid rgba(162, 59, 46, 0.3);
  border-radius: var(--radius-sm);
  padding: 9px 13px;
  font-size: var(--fs-sm);
}
.imp-error[hidden] { display: none; }

/* ── View-as: mandatory reason + tenant notify setting ───────────────────
   Existing v2 tokens only — no new colours, no new fonts. */

.imp-start-hint {
  margin: 10px 0 0;
  font-size: var(--fs-xs);
  color: var(--ink-muted);
  line-height: 1.9;
}

/* Settings: the notify toggle */
.set-toggle-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: var(--fs-base);
  color: var(--ink);
  line-height: 1.9;
  margin-bottom: 14px;
}
.set-toggle-row input { margin-top: 3px; flex-shrink: 0; }

.set-help {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.set-help p {
  margin: 0 0 9px;
  font-size: var(--fs-sm);
  color: var(--ink-muted);
  line-height: 2;
}
.set-help p:last-child { margin-bottom: 0; }
.set-help strong { color: var(--ink); font-weight: 600; }
.set-help-note {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 12px !important;
}

/* ── Mobile chrome ───────────────────────────────────────────────────── */

.mobile-topbar {
  display: none;
  position: fixed;
  top: 0;
  inset-inline: 0;
  height: calc(56px + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  background: var(--wine);
  color: #FBFAF8;
  align-items: center;
  gap: 12px;
  padding-inline: 12px;
  z-index: 900;
}
.mobile-menu-btn {
  background: none;
  border: none;
  color: inherit;
  padding: 8px;
  cursor: pointer;
  display: flex;
  border-radius: var(--radius-sm);
}
.mobile-topbar-title { font-size: var(--fs-base); font-weight: 600; }

.sidebar-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(32, 28, 28, 0.45);
  z-index: 950;
}

/* ── Responsive ──────────────────────────────────────────────────────────
   Full parity, not a cut-down "mobile lite": every screen, action, and nav
   item available on desktop is reachable here. The sidebar becomes a drawer
   and wide content scrolls inside its own container — nothing is removed.  */

@media (max-width: 900px) {
  .mobile-topbar { display: flex; }
  .sidebar-scrim[hidden] { display: none; }
  .sidebar-scrim { display: block; }

  .sidebar {
    transform: translateX(100%);          /* RTL: off-canvas to the right */
    transition: transform 0.25s var(--ease-standard);
    z-index: 1000;
    width: 82vw;
    max-width: 300px;
    padding-top: calc(24px + env(safe-area-inset-top));
  }
  .sidebar.open { transform: translateX(0); }

  .main-content {
    margin-right: 0;
    padding: 20px 16px calc(24px + env(safe-area-inset-bottom));
    padding-top: calc(56px + env(safe-area-inset-top) + 20px);
  }

  /* Comfortable tap targets on touch. */
  .nav-item { padding: 14px 16px; }

  .home-head { flex-direction: row; align-items: center; }
  .home-greeting { font-size: 19px; }
  .home-cards { grid-template-columns: 1fr; gap: 12px; }

  /* Same sections, same actions — only the layout reflows. */
  .home-sections { gap: 22px; }
  .home-team { grid-template-columns: 1fr; }

  /* The banner wraps onto two rows rather than shrinking the exit button
     away. Exit stays a comfortable tap target — the one control that must
     never be hard to hit. */
  .imp-banner { flex-wrap: wrap; gap: 8px 10px; padding-inline: 12px; }
  .imp-banner-dot { order: 0; }
  .imp-banner-text { flex: 1 1 100%; order: 1; }
  .imp-banner-timer { order: 2; }
  .imp-banner-exit { order: 3; margin-inline-start: auto; }

  /* Clear the taller wrapped banner, and keep the mobile top bar below it. */
  body.imp-active .mobile-topbar { top: 82px; }
  body.imp-active .main-content { padding-top: calc(56px + env(safe-area-inset-top) + 20px + 82px); }
  body.imp-active .sidebar { padding-top: calc(24px + env(safe-area-inset-top) + 82px); }

  /* Wide content scrolls inside its own box — the page body never scrolls
     sideways. */
  .table-wrap, .kanban-board { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  .glass-card-strong { width: 95vw !important; max-width: 95vw; padding: 20px !important; }
  .home-tray-panel { width: 95vw; max-height: 85vh; }

  .toast { left: 16px; right: 16px; transform: none; bottom: calc(16px + env(safe-area-inset-bottom)); }
  @keyframes toastIn { from { opacity: 0; } to { opacity: 1; } }
}

@media (max-width: 480px) {
  .home-greeting { font-size: 17px; }
  .home-card-value { font-size: 24px; }
  .home-actions { flex-direction: column; }
  .home-actions > button { width: 100%; }

  /* An action row stacks rather than squeezing its CTA off the edge, so the
     whole row stays one comfortable tap target at phone width. */
  .home-action {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px 14px 14px;
  }
  .home-action-cta { align-self: flex-end; }
  .imp-banner-exit { flex: 1 1 100%; margin-inline-start: 0; padding: 10px 14px; }
  .imp-start-row > * { width: 100%; max-width: none !important; }
  .home-quicklog { flex-direction: column; align-items: stretch; }
  .home-quicklog-btn { width: 100%; }
  .home-soon-badge { align-self: flex-start; }
}

/* Installed (standalone) mode: no browser chrome, so the app paints into the
   notch area itself. */
@media (display-mode: standalone) {
  body { overscroll-behavior-y: none; }
}
