:root {
  --bg: #f6f3ee;
  --card: #fff;
  --ink: #25211c;
  --muted: #82786f;
  --line: #e3ddd3;
  --brand: #111827;
  --green: #16a34a;
  --amber: #d97706;
  --blue: #2563eb;
  --red: #dc2626;
  --shadow: 0 10px 30px rgba(35, 28, 18, 0.05);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 12px/1.38 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.wrap { width: min(1780px, calc(100vw - 28px)); margin: 0 auto; padding: 14px 0; }
.top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin-bottom: 10px; }
.top > div:first-child { grid-column: 2; text-align: center; }
.header-actions { grid-column: 3; justify-self: end; display: flex; align-items: center; gap: 10px; }
.logo { font-size: 18px; font-weight: 780; letter-spacing: -0.04em; }
.sub, .meta { color: var(--muted); }
.meta { font-size: 11px; margin-top: 2px; }
.kicker { color: var(--muted); font-size: 10px; font-weight: 780; letter-spacing: .06em; text-transform: uppercase; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
button, .btn, input, select, textarea { font: inherit; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 5px 8px; }
textarea { min-width: 0; }
button, .btn { cursor: pointer; font-weight: 680; white-space: nowrap; }
button.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
button.blue { background: var(--blue); color: #fff; border-color: var(--blue); }
button.green { background: var(--green); color: #fff; border-color: var(--green); }
button.danger { background: var(--red); color: #fff; border-color: var(--red); }
button.ghost { background: transparent; }
button:disabled { opacity: .62; cursor: wait; }
.version-badge { display: inline-flex; align-items: center; justify-content: center; min-height: 28px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.58); color: var(--muted); font-size: 11px; font-weight: 750; white-space: nowrap; }
.login { max-width: 420px; margin: 12vh auto; padding: 28px; }
.login h1 { margin: 0 0 8px; }
.login input { width: 100%; margin: 16px 0; }

.dash-toolbar { display: grid; grid-template-columns: auto minmax(240px, 1fr) auto; align-items: center; gap: 8px; padding: 8px; margin-bottom: 10px; }
.segmented { display: flex; gap: 4px; padding: 3px; background: #f1eee8; border-radius: 11px; }
.segmented button { border: 0; background: transparent; color: var(--muted); padding: 5px 8px; }
.segmented button.active { background: var(--brand); color: #fff; box-shadow: 0 8px 20px rgba(17,24,39,.12); }
#globalSearch { width: 100%; }
.toolbuttons { display: flex; gap: 7px; align-items: center; justify-content: flex-start; flex-wrap: wrap; }

.calendar-layout { display: grid; grid-template-columns: 290px 440px minmax(640px, 1fr); gap: 10px; align-items: start; }
.calendar-card, .agenda-card, .inspector-card { padding: 12px; min-width: 0; }
.month-head { display: grid; grid-template-columns: 30px 1fr 30px; align-items: center; gap: 7px; margin-bottom: 8px; text-align: center; }
.month-head strong { font-size: 15px; }
.month-head button { font-size: 16px; padding: 3px 0; }
.weekday-row { display: grid; grid-template-columns: repeat(7, 1fr); color: var(--muted); font-size: 11px; font-weight: 750; text-align: center; margin-bottom: 6px; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.day-cell { aspect-ratio: 1 / 1; min-height: 0; padding: 5px; text-align: left; display: block; border-radius: 9px; background: #fffdf9; overflow: hidden; position: relative; }
.day-cell:hover { border-color: #cfc6b8; transform: translateY(-1px); }
.day-cell.selected { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.day-cell.today .day-num { background: var(--brand); color: #fff; }
.day-cell.muted-month { opacity: .45; }
.day-num { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: 18px; height: 18px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 780; z-index: 2; }
.day-dots { position: absolute; top: 27px; left: 50%; transform: translateX(-50%); min-height: 6px; display: flex; gap: 4px; align-items: center; justify-content: center; color: var(--muted); font-size: 8px; z-index: 1; pointer-events: none; white-space: nowrap; }
.dot { width: 5px; height: 5px; flex: 0 0 5px; display: inline-block; border-radius: 999px; box-shadow: 0 0 0 1px #fffdf9; }
.dot.content { background: var(--blue); }
.dot.news { background: var(--green); }
.more-dot { font-size: 8px; line-height: 1; color: var(--muted); margin-left: 0; font-weight: 750; }

.agenda-head, .inspector-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.agenda-head h2, .inspector-head h2 { margin: 2px 0 0; letter-spacing: -.03em; line-height: 1.1; }
.agenda-head h2 { font-size: 18px; }
.inspector-head h2 { font-size: 17px; }
.agenda-item { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 7px; cursor: pointer; background: #fffdf9; }
.agenda-item:hover, .agenda-item.active { background: #faf8f5; border-color: #cfc6b8; }
.agenda-item.active { box-shadow: inset 4px 0 0 var(--brand); }
.agenda-item h3 { margin: 4px 0 0; font-size: 14px; letter-spacing: -.02em; }
.kind-badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 2px 7px; font-size: 10px; font-weight: 760; }
.kind-badge.content { background: #eff6ff; color: #1d4ed8; }
.kind-badge.news { background: #ecfdf5; color: #15803d; }

.pill { font-size: 11px; border-radius: 999px; padding: 3px 8px; background: #f1eee8; color: var(--muted); white-space: nowrap; font-weight: 760; }
.pill.draft, .pill.planned, .pill.needs_review { color: var(--amber); background: #fff7ed; }
.pill.approved, .pill.draft_ready { color: var(--blue); background: #eff6ff; }
.pill.posted, .pill.published { color: var(--green); background: #ecfdf5; }
.pill.skipped, .pill.archived { color: #64748b; background: #f1f5f9; }

.actions { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; margin: 10px 0 12px; }
.sticky-actions { position: sticky; top: 0; z-index: 5; padding: 8px 0; background: linear-gradient(#fff 75%, rgba(255,255,255,0)); flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }
.edit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 10px 0; }
.edit-grid label, .full-label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 750; }
.edit-grid input, .edit-grid select, .full-label textarea { width: 100%; color: var(--ink); font-weight: 400; }
.full-label { margin: 8px 0; }
.full-label textarea { resize: vertical; line-height: 1.52; }
#editDraft { font-size: 14px; line-height: 1.55; }
.hebrew, .preview-box { direction: rtl; text-align: right; white-space: pre-wrap; font-size: 13px; line-height: 1.52; border: 1px solid var(--line); background: #fffdf9; padding: 12px; border-radius: 11px; max-height: 58vh; overflow: auto; }
.approval { margin-top: 10px; color: var(--muted); font-size: 12px; }
.published { margin: 0 0 10px; padding: 8px 10px; border: 1px solid #bbf7d0; border-radius: 11px; background: #f0fdf4; color: #166534; font-size: 12px; overflow-wrap: anywhere; }
.published a { color: #166534; }
.sources { margin-top: 14px; }
.sources a { display: block; color: #374151; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin: 5px 0; }
.events { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.events summary { cursor: pointer; color: var(--muted); font-weight: 700; }
.image-preview { display: grid; gap: 6px; margin: 8px 0 10px; }
.image-preview img { width: 100%; max-height: 180px; object-fit: cover; border: 1px solid var(--line); border-radius: 12px; background: #fffdf9; }
.image-preview a { color: var(--blue); text-decoration: none; font-weight: 700; }
.publish-targets { display: grid; gap: 10px; margin: 18px 0 4px; }
.publish-targets label { display: flex; align-items: center; gap: 9px; font-weight: 700; }
.publish-targets input { width: auto; }
.empty { padding: 50px; text-align: center; color: var(--muted); }
.empty.compact { padding: 28px; border: 1px dashed var(--line); border-radius: 14px; }

.toast-stack { position: fixed; right: 24px; bottom: 24px; z-index: 2000; display: grid; gap: 10px; width: min(360px, calc(100vw - 32px)); }
.toast { display: flex; align-items: center; gap: 10px; background: rgba(17,24,39,.96); color: #fff; padding: 13px 15px; border-radius: 14px; box-shadow: 0 18px 45px rgba(17,24,39,.22); transform: translateY(10px); opacity: 0; transition: transform .18s ease, opacity .18s ease; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: #166534; }
.toast.error { background: #991b1b; }
.toast-dot { width: 9px; height: 9px; border-radius: 999px; background: rgba(255,255,255,.78); flex: 0 0 auto; }
.modal-backdrop { position: fixed; inset: 0; z-index: 1800; display: grid; place-items: center; padding: 20px; background: rgba(17,24,39,.42); backdrop-filter: blur(3px); opacity: 0; transition: opacity .18s ease; }
.modal-backdrop.show { opacity: 1; }
.modal-card { width: min(500px, 100%); background: #fff; border: 1px solid rgba(227,221,211,.9); border-radius: 22px; padding: 24px; box-shadow: 0 24px 70px rgba(17,24,39,.25); transform: translateY(8px) scale(.98); transition: transform .18s ease; }
.modal-backdrop.show .modal-card { transform: translateY(0) scale(1); }
.modal-kicker { color: var(--muted); font-size: 13px; font-weight: 750; letter-spacing: .02em; text-transform: uppercase; }
.modal-card h3 { margin: 8px 0 8px; font-size: 24px; letter-spacing: -.03em; }
.modal-card p { margin: 0; color: #4b5563; font-size: 16px; line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.modal-actions button { min-width: 116px; }

@media (max-width: 1420px) { .wrap { width: min(100% - 24px, 1400px); } .calendar-layout { grid-template-columns: 280px 390px minmax(500px, 1fr); } }
@media (max-width: 1220px) { .calendar-layout { grid-template-columns: 320px minmax(360px, 1fr); } .inspector-card { grid-column: 1 / -1; } }
@media (max-width: 850px) { .wrap { width: min(100% - 24px, 1480px); padding: 14px 0; } .top, .dash-toolbar, .calendar-layout { grid-template-columns: 1fr; } .top > div:first-child, .header-actions { grid-column: 1; justify-self: center; text-align:center; } .toolbuttons { justify-content: center; } .calendar-card, .agenda-card, .inspector-card { padding: 12px; } .day-cell { min-height: 78px; } }
@media (max-width: 520px) { .edit-grid { grid-template-columns: 1fr; } .segmented, .toolbuttons { width: 100%; } .segmented button, .toolbuttons button { flex: 1; } }
