/* Calm, neutral working palette. Not an official brand palette. */
:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --text: #1d2733;
  --muted: #5d6877;
  --border: #dce1e7;
  --accent: #2c6a70;
  --accent-soft: #e4f0f0;
  --accent-text: #ffffff;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --warn: #8a5a00;
  --warn-soft: #fff3d6;
  --info: #1d5b8f;
  --info-soft: #e7f0f9;
  --ok: #1f7047;
  --ok-soft: #e5f4ec;
  --focus: #1d5b8f;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --font: "Segoe UI", "Noto Sans Hebrew", "Rubik", Arial, "Liberation Sans", sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.5; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 1.6rem; font-weight: 650; }
h2 { font-size: 1.1rem; font-weight: 650; }
h3 { font-size: .98rem; font-weight: 600; margin-block: 1rem .4rem; }
a { color: var(--accent); }
p { margin-block: .4rem; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; inset-inline-start: 8px; top: -40px; background: var(--surface); padding: 8px 12px; z-index: 100; border-radius: 6px; }
.skip:focus { top: 8px; }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.strong { font-weight: 600; }
.num { font-variant-numeric: tabular-nums; unicode-bidi: isolate; }
.nodata { color: var(--muted); font-style: italic; }
.neutral { color: var(--muted); }
.danger-text { color: var(--danger); }
.warn-text { color: var(--warn); }
.url { word-break: break-all; unicode-bidi: isolate; }
[hidden] { display: none !important; }

/* ---------------- layout */
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; flex-direction: column; }
.brand-title { font-weight: 700; font-size: 1.05rem; }
.brand-sub { font-size: .8rem; color: var(--muted); }
.menu-btn { display: none; }
.ws-banner { background: var(--warn-soft); color: #5c3d00; border-bottom: 1px solid #f0d58a; padding: 8px 20px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 58px); }
.sidenav { background: var(--surface); border-inline-end: 1px solid var(--border); padding: 14px 10px; }
.sidenav ul { list-style: none; margin: 0; padding: 0; position: sticky; top: 72px; }
.sidenav a { display: block; padding: 9px 12px; border-radius: 8px; color: var(--text); text-decoration: none; margin-bottom: 2px; }
.sidenav a:hover { background: var(--surface-2); }
.sidenav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 650; }
.main { padding: 22px 26px 60px; min-width: 0; }
.main:focus { outline: none; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1:focus { outline: none; }
.page-head .sub { color: var(--muted); margin: 4px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------------- controls */
.btn { font: inherit; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 7px 14px; border-radius: 8px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { filter: brightness(.95); }
.btn.danger { background: var(--surface); border-color: var(--danger); color: var(--danger); }
.btn.small { padding: 4px 10px; min-height: 30px; font-size: .88rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.icon-btn { font: inherit; background: transparent; border: 1px solid transparent; border-radius: 8px; min-width: 34px; min-height: 34px; cursor: pointer; color: var(--text); }
.icon-btn:hover { background: var(--surface-2); }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-align: start; }
.linklike:hover { text-decoration: underline; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid #c7ced7; border-radius: 8px; padding: 7px 10px; min-height: 36px; max-width: 100%; }
textarea { width: 100%; resize: vertical; }
input[type="checkbox"] { min-height: auto; width: 18px; height: 18px; accent-color: var(--accent); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); background: #fffafa; }
.segmented { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: var(--surface); flex-wrap: wrap; }
.segmented button { font: inherit; border: 0; background: transparent; padding: 7px 14px; cursor: pointer; color: var(--text); }
.segmented button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.segmented button + button { border-inline-start: 1px solid var(--border); }
.filters { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; display: grid; gap: 10px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-row input[type="search"] { flex: 1 1 240px; }
.date-filter { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.check-inline { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.month-picker { display: inline-flex; align-items: center; gap: 4px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-block: 8px; }
.quick-row { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.result-count { color: var(--muted); margin: 4px 2px 8px; }
.notice { background: var(--info-soft); color: #123c5e; border-radius: 8px; padding: 9px 12px; margin-bottom: 10px; }

/* ---------------- cards & stats */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 14px; min-width: 0; }
a.card { display: block; color: inherit; text-decoration: none; }
a.card:hover { border-color: var(--accent); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.card-link { font-size: .88rem; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; align-items: start; }
.grid-cards > .card { margin-bottom: 0; }
.grid-cards.two { grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); margin-bottom: 14px; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow); border-inline-start: 4px solid var(--border); }
.stat:hover { border-color: var(--accent); }
.stat-value { font-size: 1.8rem; font-weight: 700; }
.stat-label { font-weight: 600; }
.stat-explain { font-size: .8rem; color: var(--muted); }
.stat.danger:not(.zero) { border-inline-start-color: var(--danger); }
.stat.danger:not(.zero) .stat-value { color: var(--danger); }
.stat.warn:not(.zero) { border-inline-start-color: #d4a017; }
.stat.warn:not(.zero) .stat-value { color: var(--warn); }
.stat.info:not(.zero) { border-inline-start-color: var(--info); }
.onboarding ol li { margin-bottom: 6px; }
.big-ratio { font-size: 1.05rem; margin-bottom: 8px; }
.big-ratio .num { font-size: 1.5rem; font-weight: 700; }
.progress, .bar { display: block; background: var(--surface-2); border-radius: 99px; height: 10px; overflow: hidden; }
.progress { margin: 8px 0; }
.progress > span, .bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.bar-row { display: grid; grid-template-columns: 140px 1fr auto; gap: 8px; align-items: center; margin-bottom: 6px; font-size: .9rem; }
.bar-val { color: var(--muted); font-size: .85rem; }
ul.plain { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: 4px 0; }
.agenda { list-style: none; margin: 0; padding: 0; }
.agenda li { display: flex; gap: 8px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--surface-2); flex-wrap: wrap; }
.agenda-date { min-width: 44px; color: var(--muted); font-size: .88rem; }
.agenda-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); flex: none; }
.agenda .ag-due .agenda-dot { background: transparent; border: 2px solid var(--warn); }
.agenda .ag-task .agenda-dot { background: var(--muted); border-radius: 2px; }
.kpi-mini { list-style: none; margin: 0; padding: 0; }
.kpi-mini li { display: flex; justify-content: space-between; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--surface-2); }
.kpi-mini .num { font-weight: 700; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }

/* ---------------- badges & pills */
.badge { display: inline-block; font-size: .76rem; padding: 1px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); margin-inline-end: 4px; white-space: nowrap; }
.badge.danger { background: var(--danger); color: #fff; }
.badge.danger-soft { background: var(--danger-soft); color: var(--danger); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badges { margin-top: 3px; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: .84rem; background: var(--surface-2); white-space: nowrap; }
.cat-idea.pill { background: #eef0f3; color: #4b5563; }
.cat-active.pill { background: var(--info-soft); color: var(--info); }
.cat-approval.pill { background: var(--warn-soft); color: var(--warn); }
.cat-ready.pill { background: #e9ecfb; color: #3b4a9e; }
.cat-done.pill { background: var(--ok-soft); color: var(--ok); }
.cat-paused.pill { background: #f2efe9; color: #6b5b3e; }
.cat-cancelled.pill { background: #f1f1f1; color: #777; text-decoration: line-through; }

/* ---------------- tables */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-block: 6px; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { text-align: start; padding: 9px 10px; border-bottom: 1px solid var(--surface-2); vertical-align: top; }
.table thead th { background: var(--surface-2); font-weight: 600; white-space: nowrap; position: sticky; top: 0; }
.table tbody tr:hover { background: #fafbfc; }
.table.compact th, .table.compact td { padding: 6px 8px; }
.table tr.archived, .table tr.done { color: var(--muted); }
.table tr.row-error { background: var(--danger-soft); }
.table tfoot th, .table tfoot td { background: var(--surface-2); font-weight: 600; }
.sort-btn { background: none; border: 0; font: inherit; font-weight: 600; cursor: pointer; padding: 0; color: inherit; }
.name-cell { min-width: 220px; }
.row-actions { white-space: nowrap; }
.row-actions .btn { margin-inline-end: 4px; }
.table.kpi td, .table.kpi th { min-width: 90px; }
.res-met { color: var(--ok); font-weight: 700; }
.res-missed { color: var(--danger); font-weight: 700; }
.res-neutral { font-weight: 700; }
.rules { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 12px; }
.rules summary { cursor: pointer; font-weight: 600; }

/* ---------------- forms */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field.full, .form-section { grid-column: 1 / -1; }
.field.check { flex-direction: row; align-items: center; gap: 8px; }
.field label { font-weight: 600; font-size: .9rem; }
.field .req { color: var(--danger); }
.help { color: var(--muted); font-size: .84rem; }
.field-error { color: var(--danger); font-size: .84rem; min-height: 0; }
.field-error:empty { display: none; }
.form-section { margin-top: 6px; padding-bottom: 4px; border-bottom: 1px solid var(--surface-2); color: var(--accent); }
.form-summary { background: var(--danger-soft); color: var(--danger); border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; }
.form-summary ul { margin: 4px 0 0; padding-inline-start: 18px; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--surface-2); }
fieldset.days { border: 1px solid var(--border); border-radius: 8px; display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }

/* ---------------- modal */
.modal { border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); box-shadow: 0 20px 50px rgba(0, 0, 0, .25); color: var(--text); }
.modal.wide { width: min(900px, calc(100vw - 24px)); }
.modal::backdrop { background: rgba(20, 28, 38, .45); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-body { padding: 16px 18px; }
.modal-actions { display: flex; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); position: sticky; bottom: 0; background: var(--surface); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 14px; overflow-x: auto; }
.tab { font: inherit; background: none; border: 0; padding: 9px 14px; cursor: pointer; color: var(--muted); border-bottom: 3px solid transparent; text-decoration: none; white-space: nowrap; }
.tab[aria-selected="true"], .tab[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.asset-meta { margin-bottom: 12px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.subpanel { display: grid; gap: 10px; }
.task-list { list-style: none; padding: 0; margin: 0; }
.task-list li { padding: 6px 0; border-bottom: 1px solid var(--surface-2); }
.task-list li.done label { text-decoration: line-through; color: var(--muted); }
.history { padding-inline-start: 18px; font-size: .9rem; }
.history li { margin-bottom: 4px; }

/* ---------------- states */
.state { padding: 28px; text-align: center; background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.state.error { border-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.state.loading { flex-direction: row; justify-content: center; color: var(--muted); }
.spinner { width: 18px; height: 18px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.toasts { position: fixed; bottom: 16px; inset-inline-start: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 1000; }
.toast { background: #1d2733; color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow); max-width: 420px; }
.toast.error { background: var(--danger); }

/* ---------------- kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 10px; overflow-x: auto; padding-bottom: 10px; }
.kanban-col { background: var(--surface-2); border-radius: var(--radius); padding: 10px; min-height: 200px; border-top: 4px solid var(--border); }
.kanban-col.cat-approval { border-top-color: #d4a017; }
.kanban-col.cat-done { border-top-color: var(--ok); }
.kanban-col.cat-cancelled, .kanban-col.cat-paused { opacity: .85; }
.kanban-col.drop { outline: 3px dashed var(--accent); }
.kanban-col h2 { font-size: .95rem; margin-bottom: 8px; display: flex; justify-content: space-between; }
.kanban-col .count { color: var(--muted); font-weight: 500; }
.kanban-cards { display: grid; gap: 8px; }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px; display: grid; gap: 4px; cursor: grab; }
.kcard.dragging { opacity: .5; }
.move-select { font-size: .85rem; min-height: 30px; padding: 3px 6px; margin-top: 4px; }

/* ---------------- calendar */
.cal-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.cal-nav h2 { min-width: 180px; text-align: center; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0 0 10px; }
.legend .ev { cursor: default; }
.cal-grid { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.cal-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-head { padding: 8px; font-weight: 600; background: var(--surface-2); text-align: center; font-size: .88rem; }
.cal-head .short { display: none; }
.cal-head.off, .cal-cell.off { background: #f8f9fa; color: var(--muted); }
.cal-cell { min-height: 110px; border-top: 1px solid var(--surface-2); border-inline-start: 1px solid var(--surface-2); padding: 6px; min-width: 0; }
.cal-grid.week .cal-cell { min-height: 300px; }
.cal-cell.outside { background: #fbfbfc; }
.cal-cell.outside .cal-date { opacity: .5; }
.cal-cell.today { box-shadow: inset 0 0 0 2px var(--accent); }
.cal-date { font-size: .8rem; color: var(--muted); margin-bottom: 4px; }
.cal-events { display: grid; gap: 3px; }
.ev { font: inherit; font-size: .8rem; display: block; width: 100%; text-align: start; border-radius: 6px; padding: 2px 6px; border: 1px solid transparent; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); text-decoration: none; }
.legend .ev { width: auto; }
.ev-publication { background: var(--accent); color: #fff; }
.ev-planned_publish { background: var(--accent-soft); border: 1px dashed var(--accent); color: var(--accent); }
.ev-due { background: var(--surface); border: 1px solid var(--warn); color: var(--warn); }
.ev-task { background: var(--surface-2); border: 1px solid var(--border); }
.ev-overdue { border: 2px solid var(--danger) !important; }
.legend .ev-overdue { background: var(--surface); color: var(--danger); }
.ev-done { opacity: .7; }
.ev-sub { opacity: .85; }
.cal-agenda { display: none; }
.cal-agenda section { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin-bottom: 8px; }
.cal-agenda h3 { margin: 0 0 6px; font-size: .92rem; }
.cal-agenda .ev { white-space: normal; }

/* ---------------- new site */
.milestones { display: grid; gap: 8px; }
.milestone { display: grid; grid-template-columns: 170px 50px 1fr 70px; gap: 10px; align-items: center; text-decoration: none; color: var(--text); padding: 6px; border-radius: 8px; }
.milestone:hover { background: var(--surface-2); }
.m-count { font-weight: 700; }
.stage-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.stage { display: flex; flex-direction: column; align-items: center; padding: 10px 14px; border-radius: 8px; background: var(--surface-2); text-decoration: none; color: var(--text); min-width: 110px; border-top: 3px solid var(--border); }
.stage.cat-approval { border-top-color: #d4a017; }
.stage.cat-done { border-top-color: var(--ok); }
.stage.cat-ready { border-top-color: #3b4a9e; }
.stage strong { font-size: 1.3rem; }
.campaign-card .progress { margin: 10px 0 6px; }
.archived { opacity: .75; }
.demo-card { border-color: #f0d58a; }

/* ---------------- responsive */
@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .menu-btn { display: inline-block; font-size: 1.3rem; }
  .sidenav { position: fixed; inset-block: 58px 0; inset-inline-start: 0; width: 260px; z-index: 30; transform: translateX(100%); transition: transform .2s; box-shadow: 0 10px 30px rgba(0,0,0,.2); visibility: hidden; }
  body.nav-open .sidenav { transform: none; visibility: visible; }
  .main { padding: 16px; }
  .grid-cards.two { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  html { font-size: 15px; }
  h1 { font-size: 1.35rem; }
  .form-grid { grid-template-columns: 1fr; }
  .grid-cards { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cal-grid { display: none; }
  .cal-agenda { display: block; }
  .bar-row { grid-template-columns: 110px 1fr auto; }
  .milestone { grid-template-columns: 1fr 40px; }
  .milestone .bar, .milestone > .num, .milestone > .nodata { grid-column: 1 / -1; }
  .page-head { flex-direction: column; }
  .filter-row > select, .filter-row > input { flex: 1 1 140px; min-width: 0; }
  .topbar { padding: 8px 12px; }
  .modal-body { padding: 12px; }
  .toasts { inset-inline: 12px; }
}

@media print {
  .topbar, .sidenav, .no-print, .ws-banner, .filters, .page-actions, .toasts { display: none !important; }
  .layout { display: block; }
  .main { padding: 0; }
  .card { box-shadow: none; break-inside: avoid; }
  body { background: #fff; }
  .rules { display: none; }
}

/* ---------------- login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-box { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 28px 24px; width: min(380px, 100%); display: grid; gap: 6px; }
.login-box .sub { color: var(--muted); margin: 0 0 12px; }
.login-box .form { display: grid; gap: 14px; }
.login-box .btn { justify-content: center; min-height: 44px; }
.login-box input { min-height: 44px; font-size: 16px; }
.topbar .spacer { flex: 1; }
