/* Rhythmos UI for Rhythmos Rotation. Tokens from the Rhythmos design kit (RHYTHMOS_HANDOVER.md, §3 and §10). */
@font-face { font-family: 'Heebo'; font-weight: 400; src: url(assets/fonts/heebo-hebrew-400-normal.woff2) format('woff2'); unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'Heebo'; font-weight: 400; src: url(assets/fonts/heebo-latin-400-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: 'Heebo'; font-weight: 500; src: url(assets/fonts/heebo-hebrew-500-normal.woff2) format('woff2'); unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'Heebo'; font-weight: 500; src: url(assets/fonts/heebo-latin-500-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: 'Heebo'; font-weight: 700; src: url(assets/fonts/heebo-hebrew-700-normal.woff2) format('woff2'); unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'Heebo'; font-weight: 700; src: url(assets/fonts/heebo-latin-700-normal.woff2) format('woff2'); unicode-range: U+0000-00FF, U+2000-206F; }
@font-face { font-family: 'Inter'; font-weight: 400; src: url(assets/fonts/inter-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; src: url(assets/fonts/inter-latin-600-normal.woff2) format('woff2'); }

:root {
  --rh-primary: #880A0A; --rh-primary-hover: #690808; --rh-primary-pressed: #4a0505;
  --rh-primary-soft: rgba(136, 10, 10, 0.12); --rh-primary-softer: rgba(136, 10, 10, 0.06); --rh-primary-ring: rgba(136, 10, 10, 0.20);
  --rh-canvas: #f1f1f1; --rh-surface: #ffffff; --rh-surface-alt: #f4f5f8; --rh-input-bg: #f4f5f8; --rh-thead-bg: #f0f0f0;
  --rh-row-hover: #fafafa; --rh-row-selected: rgba(136, 10, 10, 0.07);
  --rh-border-grid-strong: #888888; --rh-border: #d9d9d9; --rh-border-subtle: #e0e0e0; --rh-border-control: #585858;
  --rh-text-strong: #111111; --rh-text: #222428; --rh-text-body: #333333; --rh-text-secondary: #555555; --rh-text-muted: #6b6b6b;
  --rh-icon: #555555; --rh-dark-btn: #333333;
  --rh-draft-bg: #fef3c7; --rh-draft-fg: #92400e; --rh-progress-bg: #e0e7ff; --rh-progress-fg: #3730a3;
  --rh-info-bg: #e0f2fe; --rh-info-fg: #0369a1; --rh-done-bg: #dcfce7; --rh-done-fg: #166534;
  --rh-danger-bg: #fee2e2; --rh-danger-fg: #b42318; --rh-warning-bg: #fff3cd; --rh-warning-fg: #7a4d00;
  --rh-neutral-bg: #eef0f2; --rh-neutral-fg: #4a5058; --rh-sev-yellow: #e6c000; --rh-sev-red: #d0021b;
  --rh-radius-pill: 999px; --rh-radius-md: 12px; --rh-radius-sm: 8px; --rh-radius-xs: 6px; --rh-radius-2xs: 4px;
  --rh-shadow-sm: 0 2px 8px rgba(0,0,0,.10); --rh-shadow-dropdown: 0 4px 12px rgba(0,0,0,.15); --rh-shadow-modal: 0 16px 40px rgba(0,0,0,.25);
  --rh-shadow-toast: 0 4px 12px rgba(0,0,0,.30); --rh-backdrop: rgba(0,0,0,.45);
  --rh-font: 'Heebo', Arial, sans-serif; --rh-font-num: 'Inter', 'Heebo', Arial, sans-serif;
  --fs: 15px; --fs-sm: 13.5px; --fs-lg: 18px;
}
body.hc { --rh-border: #9a9a9a; --rh-border-subtle: #a8a8a8; --rh-text-secondary: #333; --rh-text-muted: #444; --rh-thead-bg: #e2e2e2; --fs: 16.5px; --fs-sm: 15px; --fs-lg: 20px; }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { font-family: var(--rh-font); font-size: var(--fs); color: var(--rh-text); background: var(--rh-surface); direction: rtl; overflow: hidden; }
.num { font-family: var(--rh-font-num); font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; display: inline-block; }
svg.ic { width: 20px; height: 20px; flex: none; }
button { font-family: inherit; font-size: inherit; }
.hidden { display: none !important; }

/* ---------- app frame ---------- */
.app { display: grid; grid-template-rows: 84px 1fr; height: 100vh; direction: rtl; }
.topbar { position: relative; display: flex; align-items: center; justify-content: space-between; padding: 0 28px;
  background: #fff url(assets/grapes_pattern_white_bg.png) repeat-x center / auto 140%; box-shadow: 0 3px 8px rgba(0,0,0,.12); z-index: 500; }
.topbar::before { content: ''; position: absolute; inset: 0; background: rgba(255,255,255,.72); pointer-events: none; }
.topbar > * { position: relative; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand img { height: 40px; }
.brand .tag { font-size: 15px; font-weight: 700; color: var(--rh-primary); border: 1.5px solid var(--rh-primary); border-radius: var(--rh-radius-pill); padding: 1px 10px; }
.farm-title { font-size: 28px; font-weight: 500; color: var(--rh-text-strong); }
.top-icons { display: flex; gap: 18px; align-items: center; }
.icon-btn { background: none; border: 0; padding: 6px; border-radius: var(--rh-radius-xs); cursor: pointer; color: #333; display: inline-flex; align-items: center; gap: 6px; }
.icon-btn:hover { background: var(--rh-row-hover); }
.icon-btn svg.ic { width: 28px; height: 28px; stroke-width: 1.5; }
.role { font-size: var(--fs-sm); color: var(--rh-text-secondary); }

.tabs { display: flex; align-items: flex-end; gap: 4px; padding: 0 24px; background: #fff; border-bottom: 1px solid var(--rh-border); }
.tab { border: 0; background: none; padding: 12px 18px 11px; font-size: 16px; color: var(--rh-text-secondary); cursor: pointer; border-bottom: 3px solid transparent; display: flex; gap: 8px; align-items: center; }
.tab:hover { color: var(--rh-text-strong); }
.tab.active { color: var(--rh-primary); font-weight: 700; border-bottom-color: var(--rh-primary); }
.tab .badge { background: var(--rh-danger-bg); color: var(--rh-danger-fg); border-radius: var(--rh-radius-pill); font-size: 12px; padding: 0 7px; font-weight: 700; }
.sample-note { margin-inline-start: auto; align-self: center; font-size: 13px; color: var(--rh-warning-fg); background: var(--rh-warning-bg); border-radius: var(--rh-radius-pill); padding: 3px 12px; }
main { overflow: hidden; background: #fff; }
.view { height: 100%; overflow: auto; padding: 18px 24px; }
.view.plan-view { padding: 0; overflow: hidden; display: grid; grid-template-rows: auto 1fr; }

/* ---------- buttons ---------- */
.btn { height: 40px; padding: 0 18px; border-radius: var(--rh-radius-sm); border: 1.5px solid var(--rh-primary); background: #fff; color: var(--rh-primary);
  font-weight: 500; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; white-space: nowrap; transition: background .2s; }
.btn:hover { background: var(--rh-primary-softer); }
.btn.primary { background: var(--rh-primary); color: #fff; }
.btn.primary:hover { background: var(--rh-primary-hover); }
.btn.dark { background: var(--rh-dark-btn); border-color: var(--rh-dark-btn); color: #fff; }
.btn.small { height: 32px; padding: 0 12px; font-size: var(--fs-sm); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg.ic { width: 18px; height: 18px; }
.seg { display: inline-flex; background: #ececec; border-radius: var(--rh-radius-pill); padding: 4px; gap: 2px; box-shadow: inset 0 1px 2px rgba(0,0,0,.06); }
.seg button { border: 0; background: none; border-radius: var(--rh-radius-pill); padding: 5px 12px; cursor: pointer; color: #333; display: flex; gap: 6px; align-items: center; }
.seg button.on { background: #fff; box-shadow: var(--rh-shadow-sm); }

/* ---------- plan status bar ---------- */
.statusbar { display: flex; align-items: center; gap: 22px; padding: 12px 24px; border-bottom: 1px solid var(--rh-border); direction: rtl; }
.statusbar .title { font-size: 20px; font-weight: 700; }
.steps { display: flex; align-items: center; gap: 6px; }
.step { display: flex; align-items: center; gap: 7px; color: var(--rh-text-muted); font-size: var(--fs-sm); }
.step.on { color: var(--rh-text-strong); font-weight: 700; }
.step.done { color: var(--rh-text-body); }
.step-sep { width: 24px; height: 2px; background: var(--rh-border); }
.dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #333; display: inline-block; background: #fff; }
.dot.q { background: conic-gradient(#333 0 25%, #fff 0); } .dot.h { background: conic-gradient(#333 0 50%, #fff 0); }
.dot.t { background: conic-gradient(#333 0 75%, #fff 0); } .dot.f { background: #333; }
.statusbar .actions { margin-inline-start: auto; display: flex; gap: 10px; align-items: center; }
.approved-banner { background: var(--rh-done-bg); color: var(--rh-done-fg); padding: 6px 14px; border-radius: var(--rh-radius-sm); font-weight: 500; }

/* ---------- plan workspace: three panes ---------- */
.panes { display: grid; grid-template-columns: minmax(640px, 50%) 1fr 330px; direction: rtl; min-height: 0; }
.panes.issues-closed { grid-template-columns: minmax(640px, 50%) 1fr 44px; }
.pane { min-height: 0; display: flex; flex-direction: column; border-inline-start: 1px solid var(--rh-border); }
.pane:first-child { border-inline-start: 0; }
.pane-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; min-height: 58px; }
.pane-head h3 { margin: 0; font-size: 17px; }
.pane-head .tools { margin-inline-start: auto; display: flex; gap: 4px; align-items: center; }
.tool { background: none; border: 0; padding: 7px; border-radius: var(--rh-radius-xs); color: var(--rh-icon); cursor: pointer; display: inline-flex; }
.tool:hover { background: var(--rh-row-hover); color: #111; }
.pane-body { flex: 1; min-height: 0; overflow: auto; position: relative; }

/* ---------- tables ---------- */
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-sm); }
table.grid th { position: sticky; top: 0; z-index: 4; background: var(--rh-thead-bg); text-align: start; font-weight: 700; color: var(--rh-text-strong);
  padding: 9px 10px; border-bottom: 1px solid var(--rh-border-grid-strong); white-space: nowrap; }
table.grid th .th { display: flex; align-items: center; gap: 6px; }
table.grid th .flt { background: none; border: 0; padding: 2px; color: #555; cursor: pointer; display: inline-flex; border-radius: 4px; }
table.grid th .flt.on { color: var(--rh-primary); background: var(--rh-primary-soft); }
table.grid th .flt svg.ic { width: 15px; height: 15px; }
table.grid td { padding: 8px 10px; border-bottom: 1px solid var(--rh-border); color: var(--rh-text-body); vertical-align: middle; }
table.grid tbody tr { cursor: default; }
table.grid tbody tr.click { cursor: pointer; }
table.grid tbody tr:hover td { background: var(--rh-row-hover); }
table.grid tbody tr.sel td { background: var(--rh-row-selected); }
table.grid tbody tr.changed td:first-child { box-shadow: inset -4px 0 0 var(--rh-primary); }
table.grid.boxed { border: 1px solid var(--rh-border-grid-strong); border-radius: 4px; }
table.grid.boxed td, table.grid.boxed th { border-inline-start: 1px solid var(--rh-border); }
table.grid.boxed td:first-child, table.grid.boxed th:first-child { border-inline-start: 0; }
td.n, th.n { text-align: center; }
table.grid th.n .th { justify-content: center; }
.crop { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.crop i { width: 13px; height: 13px; border-radius: 3px; display: inline-block; border: 1px solid rgba(0,0,0,.25); flex: none; }
.muted { color: var(--rh-text-muted); }
.chk { display: inline-flex; gap: 4px; align-items: center; }
.chk svg.ic { width: 18px; height: 18px; }
.ok { color: #1f7a3a; } .warn { color: #a66a00; } .bad { color: var(--rh-danger-fg); } .exc { color: #6b21a8; }

/* ---------- filter dropdown ---------- */
.dropdown { position: fixed; z-index: 1000; background: #fff; border: 1px solid var(--rh-border); border-radius: var(--rh-radius-xs); box-shadow: var(--rh-shadow-dropdown); width: 240px; direction: rtl; }
.dropdown .search { display: flex; align-items: center; gap: 6px; margin: 10px; padding: 6px 10px; border: 1px solid var(--rh-border); border-radius: var(--rh-radius-2xs); }
.dropdown .search input { border: 0; outline: 0; flex: 1; font: inherit; }
.dropdown .opts { max-height: 260px; overflow: auto; border-top: 1px solid var(--rh-border-subtle); border-bottom: 1px solid var(--rh-border-subtle); }
.dropdown label { display: flex; align-items: center; gap: 10px; padding: 8px 14px; cursor: pointer; }
.dropdown label:hover { background: #f6f7f8; }
.dropdown label.all { font-weight: 700; }
.dropdown .foot { display: flex; justify-content: space-between; padding: 10px 14px; }
.dropdown .foot button { background: none; border: 0; cursor: pointer; font-weight: 700; }
.dropdown .foot .clear { color: var(--rh-danger-fg); font-weight: 400; }
.dropdown .foot .apply { color: #1a56db; }
input[type=checkbox] { accent-color: var(--rh-primary); width: 17px; height: 17px; }
.menu { position: fixed; z-index: 1000; background: #fff; border: 1px solid var(--rh-border); border-radius: var(--rh-radius-xs); box-shadow: var(--rh-shadow-dropdown); min-width: 230px; padding: 6px 0; }
.menu button { display: flex; gap: 10px; align-items: center; width: 100%; background: none; border: 0; padding: 10px 16px; cursor: pointer; text-align: start; }
.menu button:hover { background: #f6f7f8; }

/* ---------- issues pane (tickets) ---------- */
.issue { border-bottom: 1px solid var(--rh-border); padding: 12px 14px; cursor: pointer; display: grid; grid-template-columns: 26px 1fr; gap: 4px 10px; direction: rtl; }
.issue:hover { background: var(--rh-row-hover); }
.issue.sel { background: var(--rh-row-selected); }
.issue .sev { display: flex; gap: 1px; padding-top: 4px; }
.issue .sev i { width: 4px; height: 14px; background: #ddd; display: inline-block; }
.issue .sev.red i { background: var(--rh-sev-red); } .issue .sev.yellow i:nth-child(-n+3) { background: var(--rh-sev-yellow); }
.issue .t { font-weight: 700; color: var(--rh-text-strong); font-size: var(--fs-sm); }
.issue .d { grid-column: 2; font-size: 13px; color: var(--rh-text-secondary); }
.issue .meta { grid-column: 2; display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--rh-text-muted); margin-top: 2px; }
.issue .meta .btn { margin-inline-start: auto; }
.issues-collapsed { writing-mode: vertical-rl; transform: rotate(180deg); padding: 14px 10px; color: var(--rh-text-secondary); font-weight: 700; }
.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: var(--rh-radius-2xs); padding: 2px 8px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.pill.draft { background: var(--rh-draft-bg); color: var(--rh-draft-fg); } .pill.done { background: var(--rh-done-bg); color: var(--rh-done-fg); }
.pill.danger { background: var(--rh-danger-bg); color: var(--rh-danger-fg); } .pill.info { background: var(--rh-info-bg); color: var(--rh-info-fg); }
.pill.prog { background: var(--rh-progress-bg); color: var(--rh-progress-fg); } .pill.neutral { background: var(--rh-neutral-bg); color: var(--rh-neutral-fg); }
.pill.warn { background: var(--rh-warning-bg); color: var(--rh-warning-fg); } .pill.sample { background: var(--rh-warning-bg); color: var(--rh-warning-fg); }
.pill.excp { background: #f3e8ff; color: #6b21a8; }

/* ---------- map ---------- */
#map { position: absolute; inset: 0; background: #e9ece6; }
.leaflet-container { font-family: var(--rh-font); }
.plot-label { background: transparent; border: 0; box-shadow: none; font-weight: 700; font-size: 11.5px; color: #111; text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 2px #fff; padding: 0; }
.plot-label::before { display: none; }
.map-legend { position: absolute; bottom: 12px; right: 12px; z-index: 600; background: rgba(255,255,255,.95); border-radius: var(--rh-radius-sm); box-shadow: var(--rh-shadow-sm); padding: 8px 12px; font-size: 12.5px; display: grid; grid-template-columns: repeat(2, auto); gap: 4px 14px; direction: rtl; max-width: 330px; }
.map-ctl { position: absolute; top: 12px; left: 12px; z-index: 600; display: flex; gap: 8px; }
.map-ctl .seg { background: #fff; box-shadow: var(--rh-shadow-sm); }

/* ---------- plot card (drawer over the map) ---------- */
.drawer { position: absolute; inset: 0; background: #fff; z-index: 1100; display: flex; flex-direction: column; direction: rtl; }
.drawer-head { padding: 14px 18px; border-bottom: 1px solid var(--rh-border); display: flex; align-items: center; gap: 12px; }
.drawer-head h2 { margin: 0; font-size: 22px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--rh-surface-alt); border: 1px solid var(--rh-border); border-radius: var(--rh-radius-pill); padding: 2px 10px; font-size: 13px; color: var(--rh-text-body); }
.subtabs { display: flex; gap: 2px; padding: 0 14px; border-bottom: 1px solid var(--rh-border); }
.subtabs button { border: 0; background: none; padding: 10px 14px; cursor: pointer; border-bottom: 3px solid transparent; color: var(--rh-text-secondary); font-size: 15px; }
.subtabs button.on { color: var(--rh-primary); border-bottom-color: var(--rh-primary); font-weight: 700; }
.drawer-body { flex: 1; overflow: auto; padding: 16px 18px; }
.drawer-foot { border-top: 1px solid var(--rh-border); padding: 12px 18px; display: flex; gap: 10px; flex-wrap: wrap; }
.why { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.why li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; line-height: 1.45; }
.why li svg.ic { width: 18px; height: 18px; margin-top: 2px; color: var(--rh-primary); }
.why li.w svg.ic { color: #a66a00; } .why li.m svg.ic { color: #6b21a8; }
.sec-title { font-size: 14px; font-weight: 700; color: var(--rh-text-secondary); margin: 18px 0 8px; }
.timeline td.yr { font-weight: 700; }
.cell-crop { display: inline-flex; gap: 6px; align-items: center; }

/* ---------- cards, report, charts ---------- */
.card { background: #fff; border: 1px solid var(--rh-border); border-radius: var(--rh-radius-sm); }
.card-head { padding: 12px 16px; border-bottom: 1px solid var(--rh-border); background: var(--rh-thead-bg); font-weight: 700; display: flex; align-items: center; gap: 10px; border-radius: var(--rh-radius-sm) var(--rh-radius-sm) 0 0; }
.card-body { padding: 14px 16px; }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; direction: rtl; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--rh-text-secondary); }
select, .inp { height: 38px; border: 1px solid var(--rh-border); border-radius: var(--rh-radius-sm); background: var(--rh-input-bg); padding: 0 10px; font: inherit; font-size: var(--fs-sm); color: var(--rh-text); min-width: 140px; }
textarea.inp { height: 70px; padding: 8px 10px; resize: vertical; width: 100%; }
.inp.qty { width: 110px; min-width: 0; text-align: center; font-family: var(--rh-font-num); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; direction: rtl; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; direction: rtl; }
.chart { width: 100%; display: block; }
.chart text { font-family: var(--rh-font); font-size: 12.5px; fill: #333; }
.chart .axis { stroke: #888; stroke-width: 1; } .chart .gridl { stroke: #e3e3e3; stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; margin-top: 8px; direction: rtl; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 10px; display: inline-block; border-radius: 2px; }
.kpis { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; direction: rtl; }
.kpi { border: 1px solid var(--rh-border); border-radius: var(--rh-radius-sm); padding: 10px 16px; min-width: 170px; }
.kpi .v { font-size: 24px; font-weight: 600; font-family: var(--rh-font-num); }
.kpi .l { font-size: 13px; color: var(--rh-text-secondary); }
.empty { padding: 50px 20px; text-align: center; color: var(--rh-text-secondary); }
.empty .big { font-size: 18px; color: var(--rh-text-strong); margin-bottom: 10px; }

/* rule cards */
.rules { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; direction: rtl; }
.rule-card { border: 1px solid var(--rh-border); border-radius: var(--rh-radius-sm); overflow: hidden; }
.rule-card .rh { display: flex; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--rh-border); background: var(--rh-thead-bg); }
.rule-card .rh h3 { margin: 0; font-size: 18px; }
.rule-card .rb { padding: 6px 16px 14px; display: grid; grid-template-columns: 110px 1fr; gap: 8px 14px; }
.rule-card .rb dt { color: var(--rh-text-secondary); font-size: 14px; padding-top: 2px; }
.rule-card .rb dd { margin: 0; }
.rule-card .rb ol { margin: 0; padding-inline-start: 20px; }
.rule-card.featured { border-color: var(--rh-primary); box-shadow: 0 0 0 1px var(--rh-primary-soft); }
.rules-compact td:first-child { font-weight: 500; }

/* ---------- dialogs ---------- */
.backdrop { position: fixed; inset: 0; background: var(--rh-backdrop); z-index: 9000; display: flex; align-items: center; justify-content: center; }
.dialog { background: #fff; border-radius: var(--rh-radius-md); box-shadow: var(--rh-shadow-modal); width: 720px; max-width: 94vw; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; direction: rtl; }
.dialog.narrow { width: 480px; }
.dialog-head { position: relative; padding: 18px 22px; text-align: center; font-size: 20px; font-weight: 700; background: #fff url(assets/grapes_pattern_white_bg.png) repeat-x center / auto 160%; box-shadow: 0 2px 6px rgba(0,0,0,.1); }
.dialog-head::before { content: ''; position: absolute; inset: 0; background: rgba(255,255,255,.75); }
.dialog-head span { position: relative; }
.dialog-head .x { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); }
.dialog-body { padding: 18px 22px; overflow: auto; }
.dialog-body p { margin: 0 0 12px; line-height: 1.5; }
.dialog-foot { border-top: 1px solid #e9e9e9; padding: 14px 22px; display: flex; justify-content: space-between; gap: 10px; }
.dialog-foot .btn { min-width: 140px; justify-content: center; height: 46px; }
.lbl { font-size: 14px; color: var(--rh-text-body); margin: 14px 0 6px; display: block; }
.lbl .req { color: #f00; }
.opt-list { display: flex; flex-direction: column; gap: 8px; }
.opt { border: 1.5px solid var(--rh-border); border-radius: var(--rh-radius-sm); padding: 10px 14px; display: grid; grid-template-columns: 24px 1fr auto; gap: 4px 10px; cursor: pointer; align-items: start; }
.opt:hover { border-color: #aaa; }
.opt.on { border-color: var(--rh-primary); background: var(--rh-primary-softer); }
.opt .ot { font-weight: 700; }
.opt .od { grid-column: 2 / 4; font-size: 13.5px; color: var(--rh-text-secondary); }
.effect { margin-top: 14px; background: var(--rh-surface-alt); border-radius: var(--rh-radius-sm); padding: 10px 14px; display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 14px; }
.effect b { font-family: var(--rh-font-num); }

/* ---------- toast and loading ---------- */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); background: #2b2b2b; color: #fff; border-radius: var(--rh-radius-sm);
  padding: 12px 20px; display: flex; gap: 10px; align-items: center; box-shadow: var(--rh-shadow-toast); z-index: 11000; font-size: 15px; direction: rtl; }
.loading { position: absolute; inset: 0; background: rgba(255,255,255,.85); z-index: 800; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--rh-text-secondary); }
.dots { display: flex; gap: 6px; } .dots i { width: 8px; height: 8px; border-radius: 50%; background: #3b82f6; animation: bl 1s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes bl { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }

@media (max-width: 1500px) {
  .panes { grid-template-columns: minmax(560px, 50%) 1fr 300px; }
  :root { --fs: 14px; --fs-sm: 13px; }
  .farm-title { font-size: 24px; }
}

/* plan table: one line per row */
table.grid.plan-table td { white-space: nowrap; padding: 8px 7px; }
table.grid.plan-table th { padding-inline: 7px; }
svg.chart { direction: ltr; }
svg.chart text { unicode-bidi: plaintext; }
table.grid tr.subtotal td { background: var(--rh-thead-bg); }
table.grid td.ok { color: #1f7a3a; } table.grid td.warn { color: #a66a00; } table.grid td.bad { color: var(--rh-danger-fg); font-weight: 700; }
.drawer-head h2 { white-space: nowrap; }
table.grid.orders tr.group td { background: var(--rh-thead-bg); border-top: 2px solid var(--rh-border-grid-strong); }
table.grid.orders tr.vrow td.vname { padding-inline-start: 34px; color: var(--rh-text-body); }

/* ================= v2: Rhythmos shell, Resources frame, planning app ================= */
.brand { background: none; border: 0; padding: 0; cursor: pointer; }
.top-icons { gap: 14px; }
.icon-btn { position: relative; }
.icon-btn.deco { cursor: default; }
.icon-btn.deco:hover { background: none; }
.icon-btn.on { color: var(--rh-primary); }
.icon-btn.on::after { content: ''; position: absolute; left: 8px; right: 8px; bottom: -6px; height: 3px; border-radius: 2px; background: var(--rh-primary); }
.menu-head { padding: 8px 16px 10px; font-size: 13px; color: var(--rh-text-muted); border-bottom: 1px solid var(--rh-border-subtle); margin-bottom: 4px; }

/* Resources frame (also used by planning settings) */
.res-page { height: 100%; display: grid; grid-template-rows: auto 1fr; padding: 16px 18px 18px; gap: 14px; background: #fff; }
.res-head { display: flex; align-items: center; gap: 22px; direction: rtl; }
.res-head h1 { margin: 0; font-size: 26px; font-weight: 700; color: var(--rh-text-strong); }
.res-grid { display: grid; grid-template-columns: 326px 1fr; gap: 20px; min-height: 0; direction: rtl; }
.res-menu { border: 1px solid var(--rh-border); border-radius: var(--rh-radius-sm); align-self: start; overflow: hidden; background: #fafafa; }
.res-menu button { width: 100%; height: 80px; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; border: 0; border-bottom: 1px solid var(--rh-border-subtle); background: #fafafa; font-size: 17px; color: var(--rh-text-strong); cursor: pointer; }
.res-menu button:last-child { border-bottom: 0; }
.res-menu button svg.ic { width: 24px; height: 24px; stroke-width: 1.6; color: #333; }
.res-menu button:hover { background: #f0f0f0; }
.res-menu button.on { background: #e6e6e6; font-weight: 700; }
.res-menu button.inert { cursor: default; }
.res-menu button.inert:hover { background: #fafafa; }
.res-content { border: 1px solid var(--rh-border); border-radius: var(--rh-radius-sm); min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
.res-content > .view { flex: 1; min-height: 0; padding: 18px 20px; }

/* plan status strip */
.statusbar { gap: 18px; padding: 10px 20px; min-height: 64px; }
.statusbar .title { font-size: 19px; font-weight: 500; white-space: nowrap; }
.statusbar .title b { font-family: var(--rh-font-num); }
.tool[disabled] { opacity: .32; cursor: default; }
.tool[disabled]:hover { background: none; }
.tool.big { gap: 7px; align-items: center; padding: 8px 10px; color: #333; font-size: var(--fs-sm); }
.tool.big svg.ic { width: 22px; height: 22px; }
.tool .cnt { font-size: 11px; font-weight: 700; background: var(--rh-primary); color: #fff; border-radius: 9px; padding: 0 5px; margin-inline-start: -6px; align-self: flex-start; }
.tool.deco { cursor: default; color: #9a9a9a; }
.tool.deco:hover { background: none; color: #9a9a9a; }
.vsep { width: 1px; height: 28px; background: var(--rh-border); margin: 0 4px; }
.sp { flex: 1; }

/* pane toolbars, Rhythmos style */
.pane-tools { display: flex; align-items: center; gap: 6px; padding: 12px 14px; min-height: 66px; direction: rtl; }
.pane-label { font-size: 16px; font-weight: 700; white-space: nowrap; }
.boxed-body { margin: 0 14px 14px; border: 1px solid var(--rh-border); border-radius: 6px; }
.pill-seg { display: inline-flex; background: #ececec; border-radius: var(--rh-radius-pill); padding: 4px; gap: 2px; box-shadow: inset 0 1px 2px rgba(0,0,0,.08); }
.pill-seg button { border: 0; background: none; border-radius: var(--rh-radius-pill); width: 46px; height: 38px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: #333; }
.pill-seg button.on { background: #fff; box-shadow: var(--rh-shadow-sm); }
.pill-seg button.deco { cursor: default; }
.seg.small button { padding: 4px 11px; font-size: var(--fs-sm); }
th.cb, td.cb { width: 38px; text-align: center; padding-inline: 6px !important; }
table.grid tbody tr.checked td { background: #f6f6f6; }
.fake-select { color: #555; font-size: var(--fs-sm); padding: 0 10px; }
.fake-select::after { content: ' \25BE'; color: #888; }

/* tickets */
table.grid.tickets td { padding: 8px 6px; }
table.grid.tickets th { padding: 9px 6px; }
th.sv, td.sv { width: 36px; }
td.by { white-space: nowrap; color: var(--rh-text-secondary); font-size: 12.5px; }
td.un { white-space: nowrap; color: var(--rh-text-secondary); }
th.st, td.st { width: 26px; text-align: center; }
table.grid.tickets tr.closed td { opacity: .55; }
.sev { display: inline-flex; gap: 1px; vertical-align: middle; }
.sev i { width: 4px; height: 14px; background: #ddd; display: inline-block; }
.sev.red i { background: var(--rh-sev-red); } .sev.yellow i:nth-child(-n+3) { background: var(--rh-sev-yellow); }
.rsn { display: inline-flex; gap: 6px; align-items: flex-start; line-height: 1.35; }
.rsn svg.ic { width: 18px; height: 18px; color: #444; margin-top: 1px; }
.rsn svg.ic.bad { color: var(--rh-sev-red); }
.sdot { width: 15px; height: 15px; border-radius: 50%; border: 1.6px solid #333; display: inline-block; vertical-align: middle; background: #fff; }
.sdot.h { background: conic-gradient(#333 0 50%, #fff 0); } .sdot.f { background: #333; }
.form-head { position: relative; padding: 16px 48px; text-align: center; font-size: 19px; font-weight: 700; background: #fff url(assets/grapes_pattern_white_bg.png) repeat-x center / auto 160%; box-shadow: 0 2px 6px rgba(0,0,0,.1); z-index: 2; }
.form-head::before { content: ''; position: absolute; inset: 0; background: rgba(255,255,255,.75); }
.form-head span { position: relative; }
.form-head .x { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); }
.form-head .x svg.ic { width: 22px; height: 22px; }
.form-head.small { font-size: 17px; padding: 12px 44px; }
.tform { display: flex; flex-direction: column; height: 100%; }
.tform-body { flex: 1; overflow: auto; padding: 14px 16px; }
.tform-title { margin-bottom: 12px; font-size: 15px; }
.tform-foot { border-top: 1px solid var(--rh-border); padding: 12px 16px; display: flex; gap: 8px; flex-wrap: wrap; }
dl.kv { display: grid; grid-template-columns: 92px 1fr; gap: 9px 12px; margin: 0; font-size: var(--fs-sm); }
dl.kv dt { color: var(--rh-text-muted); }
dl.kv dd { margin: 0; line-height: 1.45; }
.drawer .drawer-head { padding: 10px 18px; }

/* center pane: season sequence */
.seasons { display: none; position: absolute; inset: 0; flex-direction: column; }
.show-seasons .seasons { display: flex; }
.show-seasons #map, .show-seasons .map-legend, .show-seasons .map-ctl { display: none; }
.seasons-scroll { flex: 1; overflow: auto; margin: 0 14px; border: 1px solid var(--rh-border); border-radius: 6px; }
table.seq { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12.5px; direction: rtl; }
table.seq th { position: sticky; top: 0; z-index: 3; background: var(--rh-thead-bg); font-weight: 700; padding: 7px 2px; border-bottom: 1px solid var(--rh-border-grid-strong); font-size: 11.5px; }
table.seq th.plan { background: #e7e1e1; color: var(--rh-primary); }
table.seq td { padding: 2px; border-bottom: 1px solid #eee; height: 24px; }
table.seq .code { position: sticky; right: 0; background: #fff; z-index: 2; padding: 2px 10px; text-align: start; white-space: nowrap; min-width: 64px; }
table.seq th.code { z-index: 4; background: var(--rh-thead-bg); }
table.seq td.sq i { display: block; height: 18px; border-radius: 2px; }
table.seq td.sq.unk { background: repeating-linear-gradient(45deg, #f3f3f3 0 3px, #fff 3px 6px); }
table.seq td.plan { border-inline-start: 2px solid var(--rh-primary); background: #fcf7f7; position: relative; }
table.seq td.plan.w::after, table.seq td.plan.f::after, table.seq td.plan.x::after { content: ''; position: absolute; top: 3px; left: 3px; width: 7px; height: 7px; border-radius: 50%; background: #e6a700; border: 1px solid #fff; }
table.seq td.plan.f::after { background: var(--rh-sev-red); } table.seq td.plan.x::after { background: #6b21a8; }
table.seq tr.click { cursor: pointer; }
table.seq tr:hover td { background-color: #fafafa; }
table.seq tr.sel td { background-color: var(--rh-row-selected); }
table.seq tr.sel td.code { box-shadow: inset -4px 0 0 var(--rh-primary); }
.seq-legend { display: flex; flex-wrap: wrap; gap: 5px 14px; padding: 10px 16px 12px; font-size: 12.5px; direction: rtl; }
.seq-legend i.unk { background: repeating-linear-gradient(45deg, #ddd 0 3px, #fff 3px 6px); }

/* Rhythmos main screen */
.home { height: 100%; display: grid; grid-template-columns: minmax(560px, 33%) 1fr 520px; direction: rtl; min-height: 0; }
.home.tk-closed { grid-template-columns: minmax(560px, 33%) 1fr 60px; }
.hpane { display: flex; flex-direction: column; min-height: 0; border-inline-start: 1px solid var(--rh-border); }
.hpane:first-child { border-inline-start: 0; }
table.grid.ops td { white-space: nowrap; }
table.grid.ops td.wrap { white-space: normal; min-width: 150px; font-size: 12.5px; color: var(--rh-text-secondary); }
table.grid tr.new td { animation: flash 1.6s ease-out; }
@keyframes flash { 0% { background: #fde68a; } 100% { background: transparent; } }
.cal { padding: 0 18px 14px; direction: ltr; display: flex; flex-direction: column; height: 100%; }
.cal-title { text-align: center; font-size: 24px; margin: 4px 0 12px; font-family: 'Roboto', var(--rh-font); }
.cal-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.cal-btns, .cal-views { display: flex; }
.cal-btns button, .cal-views button { height: 34px; min-width: 52px; border: 1px solid var(--rh-primary); background: #fff; color: var(--rh-primary); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 16px; }
.cal-btns button + button, .cal-views button + button { border-left: 0; }
.cal-btns button:first-child, .cal-views button:first-child { border-radius: 4px 0 0 4px; }
.cal-btns button:last-child, .cal-views button:last-child { border-radius: 0 4px 4px 0; }
.cal-btns .today-btn { margin-right: 8px; border-radius: 4px !important; border: 1px solid var(--rh-primary) !important; }
.cal-btns button svg.ic { width: 18px; height: 18px; }
.cal-views button { color: var(--rh-primary); }
.cal-views button.on { background: var(--rh-primary-softer); font-weight: 700; }
.cal-grid { flex: 1; display: flex; flex-direction: column; border-top: 1px solid #ccc; min-height: 0; }
.dow { display: grid; grid-template-columns: repeat(7, 1fr); border-bottom: 1px solid #ccc; }
.dow span { text-align: center; font-size: 19px; padding: 8px 0; color: #222; }
.days { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: 1fr; min-height: 0; }
.day { border-right: 1px solid #ddd; border-bottom: 1px solid #ddd; padding: 4px; overflow: hidden; display: flex; flex-direction: column; gap: 3px; background: #f7f7f7; min-height: 0; }
.day:nth-child(7n+1) { border-left: 1px solid #ddd; }
.day .dn { align-self: flex-end; font-size: 19px; color: #333; padding: 2px 6px; }
.day.out { background: #fff; } .day.out .dn { color: #bbb; }
.day.today { background: #fdf3d4; }
.ev { display: flex; align-items: center; gap: 4px; direction: rtl; background: #fff; border: 1px solid #bbb; border-radius: 6px; padding: 2px 6px; font-size: 12.5px; cursor: pointer; white-space: nowrap; overflow: hidden; text-align: start; font-family: inherit; color: #222; }
.ev span { overflow: hidden; text-overflow: ellipsis; }
.ev svg.ic { width: 14px; height: 14px; flex: none; }
.ev.new { animation: flash 1.6s ease-out; }
.more { font-size: 12px; color: var(--rh-text-muted); text-align: right; padding: 0 6px; }
.dialog.wide { width: 1280px; }
.dialog.wide .dialog-body table { font-size: 13px; }

.panes { grid-template-columns: minmax(640px, 50%) 1fr 400px; }
.panes.issues-closed { grid-template-columns: minmax(640px, 50%) 1fr 60px; }
.tool .cnt { margin-inline-start: -4px; margin-top: -6px; }
.tool { position: relative; align-items: center; }
table.seq { table-layout: fixed; }
table.seq th.code, table.seq td.code { width: 58px; min-width: 0; padding: 2px 8px; }
table.seq th { font-size: 10.5px; padding: 7px 0; }
table.seq td.sq { padding: 2px 1.5px; }
.home { grid-template-columns: minmax(600px, 34%) 1fr 440px; }
.home.tk-closed { grid-template-columns: minmax(600px, 34%) 1fr 60px; }
table.grid.ops td.ttl { white-space: normal; min-width: 170px; }
table.grid.ops td.wrap { min-width: 110px; }
.ev { white-space: normal; align-items: flex-start; line-height: 1.25; padding: 3px 6px; }
.ev span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ev svg.ic { margin-top: 1px; }
table.grid.plan-table td { padding: 8px 5px; }
table.grid.plan-table th { padding-inline: 5px; }
/* notes round 1 */
.hist-top { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; direction: rtl; }
.hist-tools { margin-bottom: 14px; align-items: flex-end; }
.hist-tools select { min-width: 112px; }
.res-grid { grid-template-rows: minmax(0, 1fr); }
.res-menu { max-height: 100%; overflow-y: auto; }
@media (max-width: 1500px) {
  .res-grid { grid-template-columns: 230px 1fr; gap: 14px; }
  .res-menu button { height: 56px; font-size: 15px; padding: 0 16px; }
  .res-head h1 { font-size: 22px; }
  .hist-top, .res-content .grid2 { grid-template-columns: 1fr !important; }
}
table.grid.rules-list td { padding: 11px 10px; }
table.grid.rules-list td.rs { color: var(--rh-text-secondary); }
.side-panel { position: fixed; left: 0; top: 84px; bottom: 0; width: 600px; max-width: 92vw; background: #fff; z-index: 1200; box-shadow: 4px 0 24px rgba(0,0,0,.18); display: flex; flex-direction: column; direction: rtl; animation: slidein .2s ease-out; }
@keyframes slidein { from { transform: translateX(-30px); opacity: .4; } to { transform: none; opacity: 1; } }
.side-body { flex: 1; overflow: auto; padding: 18px 22px; }
dl.kv.wide { grid-template-columns: 100px 1fr; gap: 12px 16px; font-size: var(--fs); }
dl.kv ol { margin: 0; padding-inline-start: 20px; }
/* plot information (risk survey) */
.ninfo { display: inline-flex; margin-inline-start: 4px; color: #2563a8; vertical-align: middle; }
.ninfo svg.ic { width: 14px; height: 14px; }
ul.why li.i svg.ic { color: #2563a8; }
.info-card .card-head { background: #eef4fb; }
.info-card .card-head svg.ic { color: #2563a8; }
.pill .ic, span.bad .ic { width: 12px; height: 12px; vertical-align: -1px; }
