/* Phase 3 screens: Today, Alerts, Hatchery, Houbara, Pivot, Stock, Store Issue, Organisation, Administration. Logical
   properties only (RTL-safe). Builds on tokens.css, app.css and reports.css. */

.tile-fact { margin-top: 2px; font-size: 12.5px; color: rgba(255,255,255,.72); min-height: 1.2em; }

/* ── Generic bits ── */
.stack { display: grid; gap: 20px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.banner { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border-radius: 14px; font-size: 14px;
  background: color-mix(in oklab, var(--tone, var(--info)) 12%, transparent); color: var(--tone-text, var(--label)); }
.banner .lucide { flex-shrink: 0; margin-top: 2px; color: var(--tone, var(--info)); }
.banner-warning { --tone: var(--warning); }
.banner-info { --tone: var(--info); }
.banner-critical { --tone: var(--critical); }
.list-card { list-style: none; margin: 0; padding: 0; overflow: hidden; }
.list-card > li { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.list-card > li + li { border-top: 0.5px solid var(--separator); }
.list-card > li:nth-child(even) { background: var(--zebra, transparent); }
.sev-badge { display: grid; place-items: center; flex-shrink: 0; width: 36px; height: 36px; border-radius: 10px;
  background: color-mix(in oklab, var(--tone) 15%, transparent); color: var(--tone-text, var(--tone)); }
.sev-heading { display: flex; align-items: center; gap: 8px; margin: 0 4px 8px; font-size: 13px; font-weight: 600; color: var(--tone-text); }
.sev-heading .muted { font-weight: 400; color: var(--label-secondary); }
.unread-dot { width: 8px; height: 8px; border-radius: 999px; flex-shrink: 0; background: transparent; }
.unread-dot.is-on { background: var(--info); }
.alert-main { flex: 1; min-width: 0; text-align: start; background: none; border: 0; padding: 0; color: inherit; cursor: pointer; font: inherit; }
.alert-title { display: block; font-size: 14.5px; line-height: 1.35; }
.alert-title.is-unread { font-weight: 600; }
.alert-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 2px; font-size: 12.5px; color: var(--label-secondary); }
.alert-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.snoozed-toggle { display: inline-flex; align-items: center; gap: 6px; margin: 24px 4px 8px; background: none; border: 0; padding: 0;
  font-size: 13px; font-weight: 600; color: var(--label-secondary); cursor: pointer; }
.snoozed-toggle:hover { color: var(--label); }
.sev-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* Notifications popover rows */
.notif-row { display: flex; width: 100%; align-items: flex-start; gap: 12px; padding: 10px; border-radius: 12px; border: 0; background: none;
  text-align: start; color: inherit; font: inherit; cursor: pointer; }
.notif-row:hover { background: var(--fill); }
.notif-icon { display: grid; place-items: center; flex-shrink: 0; width: 32px; height: 32px; margin-top: 2px; border-radius: 999px;
  background: color-mix(in oklab, var(--tone) 15%, transparent); color: var(--tone); }
.notif-text { flex: 1; min-width: 0; }
.notif-title { display: block; font-size: 13.5px; line-height: 1.35; }
.notif-title.is-unread { font-weight: 600; }
.notif-mark { background: none; border: 0; padding: 0; font-size: 13px; font-weight: 500; color: var(--accent); cursor: pointer; }
.notif-mark:hover { text-decoration: underline; }

/* ── Today ── */
.today-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.att-list > li { gap: 12px; }
.att-text { flex: 1; min-width: 0; font-size: 14.5px; }
.metric-pair { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.metric { display: grid; gap: 2px; }
.metric-value { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; }
.metric-label { font-size: 12.5px; color: var(--label-secondary); }
.mini-list { display: grid; gap: 6px; margin-top: 12px; font-size: 13.5px; }
.mini-list > div { display: flex; justify-content: space-between; gap: 12px; }
.bar-track { position: relative; height: 8px; border-radius: 999px; background: var(--fill); overflow: hidden; margin-top: 12px; }
.bar-fill { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 999px; background: var(--tone, var(--accent)); }

/* ── Houbara awaiting data ── */
.awaiting-hero { display: grid; justify-items: center; gap: 12px; padding: 48px 24px; text-align: center; }
.awaiting-hero .awaiting-icon { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 22px;
  background: color-mix(in oklab, var(--gold) 16%, transparent); color: var(--gold-text, var(--gold)); }
.awaiting-hero h2 { margin: 0; }
.awaiting-hero p { max-width: 520px; margin: 0; }
.awaiting-list { display: grid; gap: 8px; margin: 8px 0 0; padding: 0; list-style: none; text-align: start; }
.awaiting-list li { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--label-secondary); }

/* ── Pivot / stock / store / org ── */
.cover-bar { display: inline-block; width: 64px; height: 6px; border-radius: 999px; background: var(--fill); overflow: hidden; vertical-align: middle; margin-inline-end: 8px; }
.cover-bar > span { display: block; height: 100%; background: var(--tone, var(--positive)); }
.issue-lines { margin: 4px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--label-secondary); }
.dept-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.dept-card h3 { margin: 0; }
.dept-split { display: flex; height: 8px; border-radius: 999px; overflow: hidden; margin-top: 10px; background: var(--fill); }
.dept-split > span:first-child { background: var(--positive); }
.dept-split > span:last-child { background: var(--warning); }

/* ── Administration ── */
.form-grid { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 500; color: var(--label-secondary); }
.input, .select { width: 100%; min-height: 40px; padding: 8px 12px; border-radius: 10px; border: 0.5px solid var(--separator);
  background: var(--bg-elevated, var(--fill)); color: var(--label); font: inherit; }
.input:focus-visible, .select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.perm-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.perm-table th, .perm-table td { padding: 8px 10px; text-align: start; border-bottom: 0.5px solid var(--separator); }
.perm-table td.c, .perm-table th.c { text-align: center; }
.palette-row { display: flex; flex-wrap: wrap; gap: 8px; }
.palette-swatch { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; background: var(--fill); font-size: 13px; }
.palette-swatch i { width: 14px; height: 14px; border-radius: 999px; display: inline-block; }
.issue-line-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr) minmax(90px, 1fr) minmax(60px, .6fr) auto; gap: 8px; align-items: start; }
@media (max-width: 640px) { .issue-line-row { grid-template-columns: 1fr 1fr; } }

/* Hatchery */
.funnel-value { display: block; margin-top: 4px; line-height: 1; }
.hatchery-funnel .metric { gap: 6px; }
.loss-stat { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: color-mix(in oklab, var(--critical) 7%, transparent); }
.loss-text { color: var(--critical-text); }
.class-table tr.is-selected td { background: color-mix(in oklab, var(--accent) 10%, transparent); }
.avatar-stack { display: inline-flex; }
.avatar-stack > * + * { margin-inline-start: -6px; }
@media (max-width: 640px) { .hide-phone { display: none; } }

/* Pivot */
.variance-row { display: grid; gap: 4px; margin-top: 4px; padding-inline-start: 44px; }
.variance-cell { display: grid; place-items: center; padding: 6px 2px; border-radius: 8px; font-size: 11px; font-weight: 600; background: var(--fill); }
.variance-cell.is-neg { background: color-mix(in oklab, var(--critical) 16%, transparent); color: var(--critical-text); }
.variance-cell.is-pos { background: color-mix(in oklab, var(--positive) 16%, transparent); color: var(--positive-text); }
.select-pill { min-height: 32px; width: auto; max-width: 320px; padding: 4px 12px; border-radius: 999px; font-size: 13.5px; }

/* Stock */
.pos-text { color: var(--positive-text); }
.cell-two { display: grid; min-width: 0; line-height: 1.25; }
.is-active-ring { box-shadow: 0 0 0 2px var(--warning); }
.chip.is-warning.is-selected { background: var(--warning); color: #fff; }

/* Two-pane admin layouts */
.view-gap-sm { margin-bottom: 12px; }
.two-pane { display: grid; gap: 16px; align-items: start; }
@media (min-width: 768px) { .two-pane { grid-template-columns: 280px minmax(0, 1fr); } .list-pane { position: sticky; top: 64px; } }
.list-pane { overflow: hidden; }
.pane-search { padding: 10px; border-bottom: 0.5px solid var(--separator); }
.pane-list { display: grid; padding: 6px; max-height: calc(100dvh - 260px); overflow-y: auto; }
.pane-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 12px; background: none;
  color: inherit; font: inherit; text-align: start; cursor: pointer; }
.pane-row:hover { background: var(--fill); }
.pane-row.is-selected { background: color-mix(in oklab, var(--accent) 12%, transparent); }
.role-grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.role-option { display: grid; gap: 2px; min-height: 56px; padding: 10px 12px; border: 0; border-radius: 12px; background: var(--fill);
  color: inherit; font: inherit; text-align: start; cursor: pointer; }
.role-option.is-selected { background: color-mix(in oklab, var(--accent) 14%, transparent); box-shadow: inset 0 0 0 1px var(--accent); }
.role-option:disabled { cursor: default; opacity: .85; }
.mini-list > div > .toggle { flex-shrink: 0; }

/* Chinese Projects */
/* Chinese Projects: a small window over the video counting down to the redirect. */
.chinese-redirect { position: relative; z-index: 1; display: grid; place-items: center; min-height: 100dvh; padding: 24px 16px; }
.chinese-redirect-card { display: grid; justify-items: center; gap: 8px; width: 100%; max-width: 380px; padding: 28px 24px 20px; border-radius: 24px; text-align: center; color: var(--label); }
.chinese-redirect-card h1, .chinese-redirect-card p { margin: 0; }
.chinese-redirect-icon { display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 4px; border-radius: 18px; background: var(--accent); color: #fff; }
.chinese-countdown { font-size: 64px; font-weight: 700; line-height: 1; letter-spacing: -0.03em; }
.chinese-redirect-actions { justify-content: center; margin-top: 12px; }
.palette-list > li { padding: 8px 4px; }

/* ── Farm Map (prototype pages/map): base-art tokens, canvas, farm shapes, legend, side list, inspector bars ── */
.estate { --sand: #EBDDBF; --sand-2: #E0CCA4; --grain: rgba(130,100,50,.16); --road: #F8F2E4; --road-edge: rgba(120,95,55,.30);
  --parcel: rgba(255,251,242,.55); --parcel-edge: rgba(120,95,55,.30); --roof: #F3F0E8; --roof-edge: rgba(90,80,60,.35);
  --water: #9FCBD6; --water-2: #79B5C6; --water-edge: rgba(40,110,130,.35); --tree: #7F9A5B; --tree-2: #5F7D43;
  --pivot: #B6C786; --pivot-2: #9DB16B; --shed: #E9E3D6; --lbl: #5A4A2E; --halo: rgba(250,245,232,.92); --melon: #A8BE7A; }
[data-theme="dark"] .estate { --sand: #2A251D; --sand-2: #231E17; --grain: rgba(255,225,170,.05); --road: #3B352B; --road-edge: rgba(255,240,210,.10);
  --parcel: rgba(255,255,255,.035); --parcel-edge: rgba(255,240,210,.16); --roof: #34322D; --roof-edge: rgba(255,255,255,.16);
  --water: #2B5664; --water-2: #234856; --water-edge: rgba(120,200,220,.25); --tree: #566F3E; --tree-2: #425A2F;
  --pivot: #3E4C2C; --pivot-2: #4A5A33; --shed: #3A3731; --lbl: #D9CCB0; --halo: rgba(22,20,16,.88); --melon: #4B5C33; }
.estate .lbl { fill: var(--lbl); paint-order: stroke; stroke: var(--halo); stroke-width: 5px; stroke-linejoin: round; font-family: var(--font-latin); }
html[lang="ar"] .estate .lbl { font-family: var(--font-arabic); }
.map-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
@media (min-width: 1024px) { .map-layout { grid-template-columns: minmax(0, 1fr) 300px; } }
.map-canvas-card { position: relative; overflow: hidden; padding: 0; height: min(68vh, 720px); min-height: 360px; }
.map-skeleton { position: absolute; inset: 0; height: 100%; border-radius: 0; }
.map-canvas { position: absolute; inset: 0; touch-action: none; user-select: none; cursor: grab; outline: none; }
.map-canvas.is-panning { cursor: grabbing; }
.map-canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.map-canvas svg { display: block; width: 100%; height: 100%; }
.farm-shape { cursor: pointer; outline: none; transition: opacity .25s; }
.farm-shape .farm-fill { stroke: rgba(255,255,255,.75); stroke-width: 3; stroke-linejoin: round; transition: filter .15s; }
.farm-shape:hover .farm-fill { filter: brightness(1.07) saturate(1.05); }
.farm-shape.is-dim { opacity: .22; }
.farm-shape.is-hit .farm-fill { stroke: var(--gold); stroke-width: 6; }
.farm-shape.is-selected .farm-fill, .farm-shape:focus-visible .farm-fill { stroke: var(--accent); stroke-width: 7; }
.farm-label { pointer-events: none; }
.map-zoom { position: absolute; top: 12px; inset-inline-end: 12px; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.map-glass-stack { display: flex; flex-direction: column; gap: 2px; }
.map-legend { position: absolute; bottom: 12px; inset-inline-start: 12px; z-index: 2; width: min(320px, calc(100% - 72px)); border-radius: 16px; }
.map-legend-head { display: flex; width: 100%; align-items: center; gap: 8px; padding: 10px 14px; text-align: start; }
.map-legend-titles { display: grid; flex: 1; min-width: 0; }
.map-summary { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-legend-chevron { flex-shrink: 0; color: var(--label-secondary); transition: transform .2s; }
.map-legend-chevron.is-open { transform: rotate(180deg); }
.map-legend-body { padding: 10px 14px 12px; border-top: 0.5px solid var(--separator); }
.map-ramp { height: 10px; border-radius: 999px; }
.map-ramp-ends { display: flex; justify-content: space-between; margin-top: 4px; }
.map-legend-none { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.map-swatch { width: 12px; height: 12px; flex-shrink: 0; border-radius: 4px; box-shadow: inset 0 0 0 0.5px rgba(0,0,0,.18); }
.map-block-note { display: flex; align-items: flex-start; gap: 6px; margin-top: 10px; }
.map-block-note .lucide { flex-shrink: 0; margin-top: 2px; }
.map-side { display: flex; flex-direction: column; min-height: 0; max-height: min(68vh, 720px); padding: 0; overflow: hidden; }
.map-side-title { display: flex; align-items: baseline; gap: 8px; padding: 14px 16px 8px; }
.map-farm-list { list-style: none; margin: 0; padding: 0 0 8px; overflow-y: auto; }
.map-farm-row { display: flex; width: 100%; align-items: center; gap: 10px; padding: 10px 16px; text-align: start; }
.map-farm-row:hover { background: var(--fill); }
.map-farm-row.is-selected { background: color-mix(in oklab, var(--accent) 10%, transparent); }
.map-farm-text { display: grid; flex: 1; min-width: 0; }
.map-farm-qty { font-size: 13px; font-weight: 600; white-space: nowrap; }
.map-tip { position: fixed; z-index: 60; display: grid; gap: 2px; width: 240px; padding: 10px 12px; border-radius: 14px; pointer-events: none; }
.map-filters { flex: 1; min-width: 0; }
.map-match-badge { padding: 2px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; }
.harvest-bars { padding: 12px 14px 10px; }
.harvest-bars-plot { display: flex; align-items: flex-end; gap: 10px; height: 112px; }
.harvest-bar-col { display: flex; flex: 1; flex-direction: column; align-items: center; justify-content: flex-end; gap: 4px; height: 100%; }
.harvest-bar { width: 100%; max-width: 36px; border-radius: 6px 6px 2px 2px; background: var(--c2); }
.harvest-bars-axis { display: flex; gap: 10px; margin-top: 6px; padding-top: 6px; border-top: 0.5px solid var(--separator); }
.harvest-bars-axis span { flex: 1; text-align: center; font-size: 10.5px; color: var(--label-secondary); }
.map-top-items { list-style: none; margin: 0; padding: 0; }
.map-top-items li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; }
.map-top-text { display: grid; flex: 1; min-width: 0; }
.map-top-items .link-btn { margin-top: 0; white-space: nowrap; }
@media (max-width: 767px) { .map-canvas-card { height: 60vh; } .map-tip { display: none; } }

/* ── Log production sheet ── */
.log-item-card { display: flex; align-items: center; gap: 12px; padding: 12px; }
.log-item-text { flex: 1; min-width: 0; }
.log-search { display: grid; gap: 8px; }
.log-search .search-field { max-width: none; }
.log-results { list-style: none; margin: 0; padding: 0; max-height: 224px; overflow-y: auto; }
.log-result { display: flex; width: 100%; align-items: center; gap: 12px; padding: 8px 12px; text-align: start; }
.log-result:hover { background: var(--fill); }
.log-result-text { display: grid; flex: 1; min-width: 0; }
.log-results-empty { padding: 16px 12px; text-align: center; }
.log-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 12px 14px; }
.log-row-label { flex: 1; }
.log-quick { display: flex; gap: 6px; }
.log-quick-btn { height: 28px; padding: 0 10px; border-radius: 999px; background: var(--fill); font-size: 12.5px; font-weight: 600; }
.log-quick-btn:hover { background: var(--fill-strong); }
.log-grade { padding: 12px 14px; }
.log-grade-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; margin-bottom: 10px; }
.log-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 8px; margin: 8px 0; border-radius: 999px;
  background: linear-gradient(to right, var(--c1) var(--pct), var(--c2) var(--pct)); outline: none; }
[dir="rtl"] .log-slider { background: linear-gradient(to left, var(--c1) var(--pct), var(--c2) var(--pct)); }
.log-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 24px; height: 24px; border-radius: 999px; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.25), 0 0 0 .5px rgba(0,0,0,.08); }
.log-slider::-moz-range-thumb { width: 24px; height: 24px; border: 0; border-radius: 999px; background: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.log-slider:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.log-grade-legend { display: flex; justify-content: space-between; font-size: 11.5px; font-weight: 500; }
.log-grade-legend i { display: inline-block; width: 8px; height: 8px; margin-inline-end: 4px; border-radius: 999px; }
.log-reasons { display: grid; gap: 6px; padding: 12px 14px; }
.log-error { margin: 0; padding-inline: 4px; }

/* ── Stepper ── */
.stepper { display: inline-flex; align-items: center; gap: 4px; padding: 3px; border-radius: 999px; background: var(--fill); }
.stepper-btn { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 999px; background: var(--bg-elevated); box-shadow: 0 0 0 0.5px var(--separator); }
.stepper-btn:disabled { opacity: .4; }
.stepper-input { width: 64px; border: 0; background: transparent; text-align: center; font-weight: 600; -moz-appearance: textfield; appearance: textfield; }
.stepper-input::-webkit-inner-spin-button, .stepper-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper-input[aria-invalid="true"] { color: var(--critical-text); }
.stepper-unit { padding-inline-end: 4px; font-size: 12.5px; color: var(--label-secondary); }

/* ── Export menu and print (PDF / Print use the browser's print dialog) ── */
.export-menu.is-compact { padding-inline: 10px; }
@media print {
  .export-menu, .toolbar-actions, .page-accessory, .page-toolbar-phone, .inspector-panel, .overlay-scrim, .sheet, .toast-host,
  .map-zoom, .tab-bar, .no-print { display: none !important; }
  .card { box-shadow: none !important; break-inside: avoid; }
  .dt-scroll { max-height: none !important; overflow: visible !important; }
  body, .app-root, .main-scroll { background: #fff !important; }
}

/* EAG Project Log (CR-017) */
.project-log { margin-top: 24px; border-radius: 20px; padding: 18px 20px; display: grid; gap: 12px; color: var(--label); }
.project-log-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.project-log-sub { color: var(--label-secondary); }
.project-log-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.project-log-row { width: 100%; display: grid; grid-template-columns: minmax(90px, 140px) minmax(0, 1fr) 56px auto; grid-template-areas: "name bar pct chip" "note note note note";
  align-items: center; gap: 6px 12px; padding: 12px 14px; border-radius: 14px; border: 0; background: var(--fill-quaternary, rgba(127,127,127,.08)); color: inherit; text-align: start; cursor: pointer; font: inherit; }
.project-log-row:hover, .project-log-row:focus-visible { background: var(--fill-tertiary, rgba(127,127,127,.14)); outline: none; }
.project-log-row:focus-visible { box-shadow: 0 0 0 2px var(--accent); }
.project-log-name { grid-area: name; font-weight: 700; }
.project-log-bar { grid-area: bar; height: 10px; border-radius: 99px; background: var(--fill-secondary, rgba(127,127,127,.2)); overflow: hidden; }
.project-log-bar > span { display: block; height: 100%; border-radius: inherit; background: var(--tone); }
.project-log-pct { grid-area: pct; font-weight: 700; text-align: end; }
.project-log-row .status-chip { grid-area: chip; }
.project-log-note { grid-area: note; color: var(--label-secondary); }
.project-log-none { grid-column: 2 / -1; color: var(--label-secondary); }
.project-log-history { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.project-log-history > li { padding: 10px 12px; border-radius: 12px; background: var(--fill-quaternary, rgba(127,127,127,.08)); display: grid; gap: 4px; }
.project-log-history-note { margin: 0; white-space: pre-line; }
@media (max-width: 560px) { .project-log-row { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name chip" "bar pct" "note note"; } }
