/* The team's pages (لوحة فريق عزيمتك): the apps' brand, right to left, one clear job per page.
   Layout: a side menu on the right, a top bar, then the page: header, summary, then the details. */

@font-face {
  font-family: "Noto Sans Arabic";
  src: url("/fonts/NotoSansArabic.ttf") format("truetype");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --cream: #FFFCF8; --white: #FFFFFF; --sand: #F6EFE5; --sand-2: #FBF7F1; --border: #EADFD1; --line: #F1E9DE;
  --canvas: #F6F1EA;
  --brown: #4B2E1E; --brown-2: #6E4A2F; --brown-3: #3A2317; --saffron: #C78E32; --gold: #8B5E21; --gold-tint: #FCF1DF;
  --green: #277241; --green-tint: #EAF4E9; --clay: #C2410C; --clay-tint: #FFEEE8;
  --amber: #8A5A00; --amber-tint: #FFF1D8; --blue: #2F5D8A; --blue-tint: #EAF1F8;
  --muted: #766C64; --body: #57483D; --ink: #2B211A; --neutral: #F1EEE9;
  --radius: 16px; --radius-sm: 12px; --radius-xs: 8px;
  --shadow: 0 1px 2px rgba(43, 33, 26, 0.04), 0 6px 20px rgba(43, 33, 26, 0.05);
  --shadow-lg: 0 18px 50px rgba(43, 33, 26, 0.18);
  --font: "Noto Sans Arabic", "SF Arabic", "Segoe UI", Tahoma, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --side: 268px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--font); font-size: 14px; line-height: 1.65; color: var(--ink); background: var(--canvas);
  -webkit-font-smoothing: antialiased; }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.4; color: var(--ink); }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: 12.5px; direction: ltr; unicode-bidi: isolate; }
img { max-width: 100%; }
[hidden] { display: none !important; }

/* Icons from /img/admin-icons.svg: they take the text colour. */
svg.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
svg.i.sm { width: 15px; height: 15px; }
svg.i.lg { width: 22px; height: 22px; }

/* ===== Shell ===== */
.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--brown); color: #F3E8DA;
  display: flex; flex-direction: column; padding: 18px 14px 14px; scrollbar-width: thin; }
.sidebar .brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; color: var(--cream);
  text-decoration: none; border-bottom: 1px solid rgba(255, 252, 248, 0.1); }
.sidebar .brand:hover { text-decoration: none; }
.brand-mark { width: 40px; height: 40px; border-radius: 12px; background: var(--saffron); color: var(--brown-3);
  display: grid; place-items: center; font-weight: 800; font-size: 20px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text strong { font-size: 18px; }
.brand-text small { font-size: 12px; color: rgba(243, 232, 218, 0.72); }
.nav { display: flex; flex-direction: column; gap: 2px; padding-top: 8px; }
.nav-title { font-size: 11.5px; font-weight: 700; color: rgba(243, 232, 218, 0.5); margin: 16px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 11px; color: #EADCCB;
  font-weight: 500; text-decoration: none; transition: background 0.12s ease; }
.nav a:hover { background: rgba(255, 252, 248, 0.07); color: var(--cream); text-decoration: none; }
.nav a.active { background: var(--cream); color: var(--brown); font-weight: 700; }
.nav a.active svg.i { color: var(--saffron); }
.nav .count { margin-inline-start: auto; min-width: 22px; text-align: center; border-radius: 999px; padding: 0 7px;
  font-size: 11.5px; font-weight: 700; line-height: 20px; background: rgba(255, 252, 248, 0.16); color: var(--cream); }
.nav .count.urgent { background: var(--clay); color: var(--white); }
.nav a.active .count { background: var(--brown); color: var(--cream); }
.nav a.active .count.urgent { background: var(--clay); }
.me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 14px 8px 4px;
  border-top: 1px solid rgba(255, 252, 248, 0.1); }
.me .avatar { background: var(--brown-2); color: var(--cream); }
.me-name { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.me-name strong { font-size: 13.5px; color: var(--cream); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-name small { font-size: 11.5px; color: rgba(243, 232, 218, 0.65); }
.me form { margin: 0 auto 0 0; }
.me button { background: transparent; border: 1px solid rgba(255, 252, 248, 0.22); color: #EADCCB; border-radius: 10px;
  min-height: 34px; padding: 0 10px; display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 12.5px;
  font-weight: 600; cursor: pointer; }
.me button:hover { background: rgba(255, 252, 248, 0.08); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; min-height: 58px;
  padding: 10px 32px; background: rgba(246, 241, 234, 0.9); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line); }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 13px; color: var(--muted); min-width: 0; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--brown); }
.crumbs .sep { opacity: 0.55; }
.crumbs strong { color: var(--ink); font-weight: 600; }
.topbar .menu-btn { display: none; }
.topbar .spacer { flex: 1; }
.topbar .today { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.content { width: 100%; max-width: 1360px; margin: 0 auto; padding: 26px 32px 64px; display: flex; flex-direction: column;
  gap: 20px; }

/* ===== Page header ===== */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.page-head .titles { display: flex; flex-direction: column; gap: 4px; min-width: 0; max-width: 820px; }
.page-head h1 { font-size: 26px; font-weight: 800; color: var(--brown); letter-spacing: -0.2px; }
.page-head .lead { color: var(--muted); font-size: 14px; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.actions.end { justify-content: flex-end; }

/* ===== Buttons ===== */
.btn, button { font: inherit; font-weight: 700; font-size: 13.5px; display: inline-flex; align-items: center;
  justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 12px; cursor: pointer;
  text-decoration: none; white-space: nowrap; border: 1px solid transparent; background: var(--brown); color: var(--white);
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease; }
.btn:hover, button:hover { background: var(--brown-2); text-decoration: none; }
.btn.primary { background: var(--brown); color: var(--white); }
.btn.secondary, button.secondary { background: var(--white); color: var(--brown); border-color: var(--border); }
.btn.secondary:hover, button.secondary:hover { border-color: var(--saffron); background: var(--white); }
.btn.ghost, button.ghost { background: transparent; color: var(--brown); border-color: transparent; }
.btn.ghost:hover, button.ghost:hover { background: rgba(75, 46, 30, 0.06); }
.btn.danger, button.danger { background: var(--clay); color: var(--white); }
.btn.danger:hover, button.danger:hover { background: #A63508; }
.btn.danger-outline, button.danger-outline { background: var(--white); color: var(--clay); border-color: #F2C8B6; }
.btn.danger-outline:hover, button.danger-outline:hover { background: var(--clay-tint); }
.btn.ok, button.ok { background: var(--green); color: var(--white); }
.btn.ok:hover, button.ok:hover { background: #1E5C34; }
.btn.sm, button.sm { min-height: 32px; padding: 0 12px; font-size: 12.5px; border-radius: 10px; }
.btn.icon, button.icon { width: 38px; min-height: 38px; padding: 0; border-radius: 11px; }
.btn.block, button.block { width: 100%; }
button:disabled, .btn.disabled { opacity: 0.45; cursor: not-allowed; }
.link-btn, button.link-btn { background: none; border: 0; color: var(--gold); padding: 0; min-height: 0; font-weight: 600; }
.link-btn:hover, button.link-btn:hover { background: none; text-decoration: underline; }

/* ===== Cards and panels ===== */
.panel { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 16px 20px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 16.5px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.panel-head .sub { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.panel-body { padding: 18px 20px; }
.panel-body.tight { padding: 0; }
.panel-body.section-divider { border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.panel.flat { box-shadow: none; }
.section-title { font-size: 16px; font-weight: 700; color: var(--ink); }
.tabs { scroll-margin-top: 70px; }
.panel-foot { padding: 12px 20px; border-top: 1px solid var(--line); background: var(--sand-2);
  border-radius: 0 0 var(--radius) var(--radius); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.stack.sm { gap: 12px; }
.stack.xs { gap: 6px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
/* Side-by-side cards are as tall as each other, their actions on one line at the bottom. */
.grid-2 > .panel, .grid-3 > .panel { display: flex; flex-direction: column; }
.grid-2 > .panel > form, .grid-3 > .panel > form { display: flex; flex-direction: column; flex: 1; }
.grid-2 > .panel .panel-body, .grid-3 > .panel .panel-body { flex: 1; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
.split > .aside { position: sticky; top: 78px; display: flex; flex-direction: column; gap: 20px; }
.split.single { grid-template-columns: minmax(0, 1fr); }
.list-note { display: block; width: 100%; margin-top: 8px; }
.thumb { border-radius: 12px; object-fit: cover; border: 1px solid var(--border); }

/* ===== Summary numbers ===== */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.kpi { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 16px 18px; background: var(--white);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--ink);
  text-decoration: none; overflow: hidden; }
a.kpi:hover { border-color: var(--saffron); text-decoration: none; }
.kpi .kpi-label { font-size: 13px; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 7px; }
.kpi .kpi-value { font-size: 28px; font-weight: 800; color: var(--brown); line-height: 1.25; font-variant-numeric: tabular-nums; }
.kpi .kpi-value small { font-size: 15px; font-weight: 700; color: var(--muted); }
.kpi .kpi-hint { font-size: 12px; color: var(--muted); }
.kpi::before { content: ""; position: absolute; inset-block: 14px; inset-inline-start: 0; width: 4px;
  border-radius: 4px 0 0 4px; background: transparent; }
.kpi.ok::before { background: var(--green); }
.kpi.warn::before { background: var(--saffron); }
.kpi.problem::before { background: var(--clay); }
.kpi.info::before { background: var(--blue); }
.kpi.problem .kpi-value { color: var(--clay); }
.kpi.active { border-color: var(--brown); box-shadow: 0 0 0 1px var(--brown) inset, var(--shadow); }

/* ===== Status chips: colour, a dot and words ===== */
.chip { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 2px 10px; font-size: 12px;
  font-weight: 700; line-height: 20px; white-space: nowrap; background: var(--blue-tint); color: var(--blue); }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.chip.ok { background: var(--green-tint); color: var(--green); }
.chip.warn { background: var(--amber-tint); color: var(--amber); }
.chip.progress { background: var(--gold-tint); color: var(--gold); }
.chip.off { background: var(--neutral); color: var(--muted); }
.chip.problem { background: var(--clay-tint); color: var(--clay); }
.chip.hold { background: var(--sand); color: var(--brown); }
.chip.plain::before { display: none; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.count-pill { display: inline-flex; align-items: center; justify-content: center; min-width: 24px; padding: 0 8px;
  border-radius: 999px; background: var(--sand); color: var(--brown); font-size: 12px; font-weight: 700; line-height: 22px; }
.ref { font-family: var(--mono); font-size: 12.5px; direction: ltr; unicode-bidi: isolate; background: var(--sand);
  color: var(--brown); border-radius: 7px; padding: 1px 7px; white-space: nowrap; }

/* ===== Tables ===== */
.table-wrap { width: 100%; overflow-x: auto; }
table.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th { text-align: start; font-size: 12.5px; font-weight: 700; color: var(--muted); background: var(--sand-2);
  padding: 11px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #FFFBF4; }
.table tr[data-href] { cursor: pointer; }
.table .num { text-align: end; font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: plaintext; white-space: nowrap; }
.table .end { text-align: end; white-space: nowrap; }
.table .muted { color: var(--muted); }
.table .strong { font-weight: 700; }
.table td.nowrap { white-space: nowrap; }
.cell-main { display: flex; align-items: center; gap: 12px; min-width: 0; }
.cell-main .lines { display: flex; flex-direction: column; min-width: 0; line-height: 1.45; }
.cell-main .lines strong { font-weight: 700; color: var(--ink); }
.cell-main .lines small { color: var(--muted); font-size: 12px; }
a.row-link { color: var(--ink); font-weight: 700; }
a.row-link:hover { color: var(--brown); }
.go { color: var(--muted); display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 13px; }
tr:hover .go { color: var(--brown); }

/* ===== Toolbars, filters, search ===== */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.search { position: relative; display: flex; align-items: center; min-width: 260px; }
.search svg.i { position: absolute; inset-inline-start: 12px; color: var(--muted); pointer-events: none; }
.search input { padding-inline-start: 38px; width: 100%; }
.segmented { display: inline-flex; background: var(--sand); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented a, .segmented button { min-height: 32px; padding: 0 12px; border-radius: 9px; font-size: 13px; font-weight: 600;
  color: var(--body); background: transparent; border: 0; display: inline-flex; align-items: center; gap: 6px; }
.segmented a:hover, .segmented button:hover { background: rgba(255, 255, 255, 0.6); text-decoration: none; }
.segmented .on, .segmented .on:hover { background: var(--white); color: var(--brown); box-shadow: 0 1px 3px rgba(43, 33, 26, 0.12); }
.segmented .n { font-size: 11.5px; color: var(--muted); font-weight: 700; }

/* ===== Tabs ===== */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 14px 11px; color: var(--muted); font-weight: 600; white-space: nowrap; border-bottom: 2.5px solid transparent;
  margin-bottom: -1px; display: inline-flex; align-items: center; gap: 7px; text-decoration: none; }
.tabs a:hover { color: var(--brown); text-decoration: none; }
.tabs a.on { color: var(--brown); border-bottom-color: var(--brown); }
.tabs .count-pill { line-height: 19px; min-width: 20px; font-size: 11px; }
.js .tab-panel:not(.on) { display: none; }

/* ===== Forms ===== */
input, select, textarea { font: inherit; font-size: 14px; color: var(--ink); background: var(--white); border: 1px solid var(--border);
  border-radius: 11px; padding: 0 12px; min-height: 42px; max-width: 100%; transition: border-color 0.12s ease, box-shadow 0.12s ease; }
textarea { padding: 10px 12px; min-height: 84px; line-height: 1.6; resize: vertical; width: 100%; }
select { padding-inline-end: 30px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--saffron); box-shadow: 0 0 0 3px rgba(199, 142, 50, 0.18); }
input[type=checkbox], input[type=radio] { accent-color: var(--brown); width: 17px; height: 17px; min-height: 0; margin: 0; flex: none; }
input[type=date], input[type=time], input[type=number], input[dir=ltr] { direction: ltr; text-align: right; }
input::placeholder, textarea::placeholder { color: #A89C92; }
form { margin: 0; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; }
.field > span, .field > .label { font-size: 13px; font-weight: 600; color: var(--body); }
.field .req { color: var(--clay); }
.field input, .field select, .field textarea { width: 100%; }
.field input[type=checkbox], .field input[type=radio] { width: 17px; }
.field small, .hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.field.full { grid-column: 1 / -1; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.one { grid-template-columns: minmax(0, 1fr); }
.form-section { display: flex; flex-direction: column; gap: 14px; }
.form-section + .form-section { border-top: 1px solid var(--line); padding-top: 18px; }
.form-section h3 { font-size: 14.5px; font-weight: 700; color: var(--brown); }
.form-section > p { color: var(--muted); font-size: 12.5px; margin-top: -8px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.checks { display: flex; gap: 10px 18px; flex-wrap: wrap; }
.choice-list { display: flex; flex-direction: column; gap: 8px; }
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 11px 13px; border: 1px solid var(--border);
  border-radius: 12px; cursor: pointer; background: var(--white); }
.choice:has(input:checked) { border-color: var(--brown); background: var(--sand-2); }
.choice input { margin-top: 3px; }
.choice > span { flex: 1; min-width: 0; }
.choice strong { display: block; font-size: 13.5px; }
.choice small { display: block; color: var(--muted); white-space: normal; overflow-wrap: anywhere; }
.choice-list.roles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input { min-width: 160px; }
fieldset { border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px 14px; margin: 0; }
legend { padding: 0 6px; color: var(--muted); font-size: 13px; font-weight: 600; }

/* ===== A period of days to page through ===== */
.period-bar { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; border-bottom: 1px solid var(--line);
  padding-block: 12px; }
.pager { display: inline-flex; align-items: center; gap: 10px; }
.pager strong { min-width: 190px; text-align: center; font-variant-numeric: tabular-nums; }
.period-bar .inline-form input { min-width: 0; width: 160px; min-height: 34px; }

/* ===== Reviewing a submission: one line per field, a note only where one is needed ===== */
.review-body { display: flex; flex-direction: column; padding-block: 6px; }
.review-field { display: flex; flex-direction: column; gap: 8px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.review-field:last-child { border-bottom: 0; }
.review-line { display: grid; grid-template-columns: 210px minmax(0, 1fr) auto; gap: 16px; align-items: baseline; }
.review-line .k { color: var(--muted); font-size: 13px; }
.review-line .v { font-weight: 600; overflow-wrap: anywhere; }
.note-input { width: 100%; }

/* ===== Messages ===== */
.toasts { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column;
  gap: 8px; width: min(560px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 14px;
  background: var(--white); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-weight: 600;
  animation: toast-in 0.25s ease; }
.toast.ok { border-color: #BFDDC6; }
.toast.ok > svg.i { color: var(--green); }
.toast.problem { border-color: #F2C8B6; }
.toast.problem > svg.i { color: var(--clay); }
.toast p { flex: 1; }
.toast button { background: transparent; color: var(--muted); min-height: 0; padding: 0; border: 0; }
.toast button:hover { background: transparent; color: var(--ink); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--blue-tint);
  color: var(--blue); font-size: 13px; }
.note > svg.i { margin-top: 2px; }
.note.warn { background: var(--amber-tint); color: var(--amber); }
.note.problem { background: var(--clay-tint); color: var(--clay); }
.note.ok { background: var(--green-tint); color: var(--green); }
.note.plain { background: var(--sand-2); color: var(--body); border: 1px solid var(--line); }
.note strong { font-weight: 700; }
.note.flat-note { border-radius: 0; border-width: 0 0 1px; }
.inline-error { color: var(--clay); font-size: 12.5px; font-weight: 600; }

/* ===== Empty states ===== */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 36px 20px;
  color: var(--muted); }
.empty .empty-icon { width: 52px; height: 52px; border-radius: 16px; background: var(--sand); color: var(--brown);
  display: grid; place-items: center; }
.empty strong { color: var(--ink); font-size: 15px; }
.empty.ok .empty-icon { background: var(--green-tint); color: var(--green); }
.empty.compact { padding: 20px; }

/* ===== Key facts ===== */
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 18px; margin: 0; }
.facts dt { color: var(--muted); font-size: 13px; }
.facts dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.facts.cards { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.facts.cards > div { background: var(--sand-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.facts.cards dt { font-size: 12px; }
.facts.cards dd { font-size: 14px; }
.facts.cards.one { grid-template-columns: minmax(0, 1fr); }
.facts.cards > .full-row { grid-column: 1 / -1; }
.figure { display: flex; flex-direction: column; gap: 2px; }
.figure strong { font-size: 24px; font-weight: 800; color: var(--brown); font-variant-numeric: tabular-nums; }

/* ===== Avatars ===== */
.avatar { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 15px;
  background: var(--sand); color: var(--brown); flex: none; overflow: hidden; }
.avatar.lg { width: 64px; height: 64px; border-radius: 18px; font-size: 26px; }
.avatar.round { border-radius: 50%; }
.avatar.t1 { background: #F4E4CC; color: #7A4E14; }
.avatar.t2 { background: #E3EEE0; color: #2B6340; }
.avatar.t3 { background: #E5ECF4; color: #2F5D8A; }
.avatar.t4 { background: #F6E1D9; color: #A3410F; }
.avatar.t5 { background: #EDE6F3; color: #5B3F80; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ===== Profile header ===== */
.profile { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; padding: 20px 22px; }
.profile .who { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: 8px; }
.profile h1 { font-size: 25px; font-weight: 800; color: var(--brown); }
.profile .meta { display: flex; gap: 6px 16px; flex-wrap: wrap; color: var(--muted); font-size: 13px; align-items: center; }
.profile .meta span { display: inline-flex; align-items: center; gap: 6px; }

/* ===== Lists ===== */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; gap: 12px; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 700; }
.list .sub { color: var(--muted); font-size: 12.5px; }
.list .grow > .title, .list .grow > .sub { display: block; }
.list.parties > li { padding: 10px 0; align-items: flex-start; }
.attention { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.attention a { display: flex; flex-direction: column; gap: 4px; padding: 16px 18px; background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; }
.attention .top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.attention a:hover { border-color: var(--saffron); text-decoration: none; }
.attention .ic { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; flex: none;
  background: var(--sand); color: var(--brown); }
.attention .problem .ic { background: var(--clay-tint); color: var(--clay); }
.attention .warn .ic { background: var(--amber-tint); color: var(--amber); }
.attention .ok .ic { background: var(--green-tint); color: var(--green); }
.attention .n { font-size: 30px; font-weight: 800; color: var(--brown); line-height: 1.1; font-variant-numeric: tabular-nums; }
.attention .problem .n { color: var(--clay); }
.attention .ok .n { color: var(--green); }
.attention .t { font-weight: 700; }
.attention .s { color: var(--muted); font-size: 12.5px; }
.sections { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.sections a { display: flex; gap: 12px; padding: 16px; background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.sections a:hover { border-color: var(--saffron); text-decoration: none; }
.sections .ic { width: 40px; height: 40px; border-radius: 12px; background: var(--sand); color: var(--brown); display: grid;
  place-items: center; flex: none; }
.sections strong { display: block; font-weight: 700; }
.sections small { color: var(--muted); font-size: 12.5px; }

/* ===== Timeline ===== */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; padding: 0 24px 16px 0; }
.timeline li::before { content: ""; position: absolute; right: 4px; top: 7px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--saffron); box-shadow: 0 0 0 3px var(--gold-tint); }
.timeline li::after { content: ""; position: absolute; right: 8px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li:last-child { padding-bottom: 0; }
.timeline .when { font-size: 12px; color: var(--muted); }
.timeline .what { font-weight: 600; }
.timeline .detail { color: var(--body); font-size: 13px; }

/* ===== Conversations ===== */
.thread { display: flex; flex-direction: column; gap: 10px; }
.bubble { background: var(--neutral); border-radius: 14px; padding: 9px 13px; max-width: 92%; align-self: flex-start; }
.bubble.team { background: var(--gold-tint); align-self: flex-end; }
.bubble small { display: block; color: var(--muted); font-size: 11.5px; margin-bottom: 2px; }
.bubble p { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ===== Dialogs ===== */
dialog.modal { border: 0; padding: 0; border-radius: 20px; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  box-shadow: var(--shadow-lg); color: var(--ink); background: var(--white); }
dialog.modal.wide { width: min(820px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(43, 33, 26, 0.42); backdrop-filter: blur(2px); }
dialog.modal[open] { display: flex; flex-direction: column; animation: modal-in 0.18s ease; }
dialog.modal > form, dialog.modal > .modal-inner { display: flex; flex-direction: column; min-height: 0; max-height: calc(100vh - 48px); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 22px 14px;
  border-bottom: 1px solid var(--line); }
.modal-head h3 { font-size: 17px; font-weight: 800; color: var(--brown); }
.modal-head p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.modal-head button { background: transparent; color: var(--muted); min-height: 32px; width: 32px; padding: 0; border-radius: 9px; flex: none; }
.modal-head button:hover { background: var(--sand); color: var(--ink); }
.modal-body { padding: 18px 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-start; padding: 14px 22px; border-top: 1px solid var(--line);
  background: var(--sand-2); border-radius: 0 0 20px 20px; flex-wrap: wrap; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

/* ===== Maps (OpenStreetMap through Leaflet) ===== */
.map { height: 380px; border-radius: 14px; border: 1px solid var(--border); overflow: hidden; z-index: 0; }
.map.small { height: 240px; }
.map.tall { height: 460px; }
details.map-panel > summary { list-style: none; cursor: pointer; border-bottom-color: transparent; }
details.map-panel > summary::-webkit-details-marker { display: none; }
details.map-panel > summary::after { content: ""; width: 9px; height: 9px; border: solid var(--muted); border-width: 0 2px 2px 0;
  transform: rotate(45deg); margin-inline-start: auto; transition: transform 0.15s ease; }
details.map-panel[open] > summary { border-bottom-color: var(--line); }
details.map-panel[open] > summary::after { transform: rotate(-135deg); }
details.pick { margin: 0; }
details.pick summary { cursor: pointer; color: var(--gold); font-weight: 600; display: inline-flex; gap: 6px; align-items: center; }
details.pick[open] summary { margin-bottom: 8px; }

/* ===== Misc ===== */
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.strong { font-weight: 700; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.divider { height: 1px; background: var(--line); margin: 4px 0; }
/* The thin bar only: a gold «progress» chip keeps its own height and text. */
.progress:not(.chip) { height: 8px; background: var(--sand); border-radius: 999px; overflow: hidden; }
.progress:not(.chip) > span { display: block; height: 100%; background: var(--saffron); border-radius: 999px; }
.steps { display: flex; flex-direction: column; }
.step { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.step:last-child { border-bottom: 0; }
.step .ic { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--neutral); color: var(--muted); }
.step.done .ic { background: var(--green-tint); color: var(--green); }
.step.todo .ic { background: var(--amber-tint); color: var(--amber); }
.step.problem .ic { background: var(--clay-tint); color: var(--clay); }
.step .grow { flex: 1; min-width: 0; }
.step small { display: block; color: var(--muted); font-size: 12px; }
.kanban { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.skip { position: absolute; inset-inline-start: 8px; top: -60px; background: var(--brown); color: var(--white); padding: 8px 12px;
  border-radius: 10px; z-index: 100; }
.skip:focus { top: 8px; }
:focus-visible { outline: 2px solid var(--saffron); outline-offset: 2px; }
.scrim { display: none; }

/* ===== Sign-in ===== */
.signin { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: var(--canvas); }
.signin-art { background: var(--brown); color: var(--cream); padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden; }
.signin-art::after { content: ""; position: absolute; width: 420px; height: 420px; border-radius: 50%; left: -120px; bottom: -160px;
  background: radial-gradient(circle, rgba(199, 142, 50, 0.35), transparent 65%); }
.signin-art h2 { color: var(--cream); font-size: 32px; font-weight: 800; line-height: 1.35; max-width: 440px; }
.signin-art p { color: rgba(243, 232, 218, 0.78); max-width: 440px; margin-top: 12px; }
.signin-art ul { list-style: none; padding: 0; margin: 28px 0 0; display: flex; flex-direction: column; gap: 12px; color: #EADCCB; }
.signin-art li { display: flex; gap: 10px; align-items: center; }
.signin-art li svg.i { color: var(--saffron); }
.signin-form { display: grid; place-items: center; padding: 32px 20px; }
.signin-card { width: min(420px, 100%); background: var(--white); border: 1px solid var(--border); border-radius: 22px; padding: 30px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 16px; }
.signin-card h1 { font-size: 24px; font-weight: 800; color: var(--brown); }
.signin-brand strong { font-size: 20px; }
.signin-foot { color: rgba(243, 232, 218, 0.6); position: relative; z-index: 1; }
.signin-mark { width: 48px; height: 48px; font-size: 24px; border-radius: 14px; }

/* ===== Small screens ===== */
@media (max-width: 1180px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .split > .aside { position: static; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1020px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset-block: 0; right: 0; width: min(300px, 86vw); z-index: 50; transform: translateX(105%);
    transition: transform 0.2s ease; box-shadow: var(--shadow-lg); }
  .nav-open .sidebar { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(43, 33, 26, 0.4); z-index: 40; }
  .nav-open .scrim { display: block; }
  .topbar .menu-btn { display: inline-flex; }
  .topbar { padding: 10px 18px; }
  .content { padding: 20px 18px 56px; }
}
@media (max-width: 720px) {
  .page-head h1 { font-size: 22px; }
  .page-head { align-items: stretch; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn, .page-head .actions button { flex: 1; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .attention { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .attention a { padding: 13px 14px; }
  .attention .ic { width: 36px; height: 36px; border-radius: 11px; }
  .attention .n { font-size: 24px; }
  .attention .t { font-size: 13.5px; }
  .kpi { padding: 13px 14px; }
  .kpi .kpi-value { font-size: 23px; }
  .grid-2, .grid-3, .form-grid, .form-grid.three, .choice-list.roles { grid-template-columns: minmax(0, 1fr); }
  .facts { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .facts dd { margin-bottom: 10px; }
  .panel-head, .panel-body { padding-inline: 16px; }
  .profile { padding: 16px; }
  .profile .who { min-width: 0; flex-basis: 100%; }
  .profile h1 { font-size: 21px; }
  .table th, .table td { padding: 11px 12px; }
  .review-line { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
  .review-line .k { grid-column: 1 / -1; }
  .table.stack-sm thead { display: none; }
  .table.stack-sm, .table.stack-sm tbody { display: block; width: 100%; }
  /* A row becomes a card: its main cell on top, the labelled facts flowing after it, its actions last. */
  .table.stack-sm tr { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 12px 14px;
    border-bottom: 1px solid var(--line); }
  .table.stack-sm td { display: block; border: 0; padding: 0; font-size: 13px; }
  .table.stack-sm td:first-child { flex: 1 1 auto; min-width: 58%; order: 0; }
  .table.stack-sm td.end { order: 1; }
  .table.stack-sm td:not(:first-child):not(.end) { order: 2; }
  .table.stack-sm td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: 12px; font-weight: 400; }
  .table.stack-sm .num, .table.stack-sm .end { text-align: start; }
  .table.stack-sm .actions.end { justify-content: flex-start; }
  .table.stack-sm tbody tr:hover td { background: transparent; }
  .search { min-width: 0; width: 100%; }
  .topbar .today { display: none; }
  .signin { grid-template-columns: minmax(0, 1fr); }
  .signin-art { display: none; }
  dialog.modal { width: 100vw; max-width: 100vw; max-height: 92vh; margin: auto 0 0; border-radius: 20px 20px 0 0; }
  .modal-foot { border-radius: 0; }
}

/* Restaurant menus: dish cards on an offering's page, and the dishes a customer ordered. */
.dish-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.dish, .card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px;
  display: flex; flex-direction: column; gap: 10px; }
.dish.off { background: var(--sand-2); }
.dish.off .dish-photo { filter: grayscale(0.6); }
.dish-photo { width: 100%; aspect-ratio: 4 / 3; border-radius: var(--radius-sm); object-fit: cover; background: var(--sand);
  display: grid; place-items: center; color: var(--muted); }
.dish h3 { font-size: 15px; }
.dish-specs { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; font-size: 12.5px; color: var(--body); }
.dish-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.dish-actions form { display: contents; }
.spec-row { border: 1px dashed var(--border); border-radius: var(--radius-sm); padding: 10px 12px; display: grid; gap: 8px; }
.photo-strip { display: flex; flex-wrap: wrap; gap: 10px; }
.photo-strip figure { margin: 0; display: grid; gap: 4px; justify-items: center; }
.table.compact th, .table.compact td { padding: 6px 10px; font-size: 13px; }
.table caption { text-align: start; padding: 0 0 6px; }

/* Language is a presentation choice; identifiers, account numbers and money remain isolated LTR. */
.language-picker { display: flex; align-items: center; gap: 8px; margin-block: 10px; font-size: 13px; }
.language-picker label { white-space: nowrap; }
.language-picker select { min-width: 0; width: auto; flex: 1; }
.sidebar .language-picker { color: #F7EEE6; }
.signin-form { display: flex; flex-direction: column; justify-content: center; }
.signin-form > .language-picker { width: min(420px, 100%); }
html[dir=ltr] .directional { transform: scaleX(-1); }
html[dir=ltr] input[type=date], html[dir=ltr] input[type=time], html[dir=ltr] input[type=number], html[dir=ltr] input[dir=ltr] { text-align: left; }
html[dir=ltr] .timeline li::before { right: auto; left: 4px; }
html[dir=ltr] .timeline li::after { right: auto; left: 8px; }
@media (max-width: 1020px) {
  html[dir=ltr] .sidebar { right: auto; left: 0; transform: translateX(-105%); }
  html[dir=ltr] body.nav-open .sidebar { transform: translateX(0); }
}
