:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #172033;
  --muted: #667085;
  --border: #dde3ec;
  --primary: #2457d6;
  --primary-2: #173f9f;
  --primary-soft: #eaf0ff;
  --success: #16794b;
  --success-soft: #e9f8f0;
  --warning: #9a6700;
  --warning-soft: #fff7df;
  --danger: #b42318;
  --danger-soft: #fff0ee;
  --shadow: 0 10px 30px rgba(26, 39, 74, .08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--bg); color: var(--text); }
body { margin: 0; min-width: 320px; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(36, 87, 214, .25); outline-offset: 2px; }
button:disabled { opacity: .48; cursor: not-allowed; }

.landing-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top, #eef3ff, var(--bg) 52%); }
.landing-shell { width: min(720px, 100%); }
.landing-card { background: var(--surface); border: 1px solid var(--border); border-radius: 24px; padding: clamp(28px, 6vw, 54px); box-shadow: var(--shadow); }
.brand-mark { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; background: var(--primary); color: white; font-weight: 800; letter-spacing: -.03em; }
.brand-mark.small { width: 42px; height: 42px; border-radius: 13px; flex: 0 0 auto; }
.eyebrow { margin: 18px 0 6px; color: var(--primary); font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.landing-card h1 { margin: 0; font-size: clamp(2rem, 6vw, 3.5rem); letter-spacing: -.04em; }
.lead { color: var(--muted); font-size: 1.08rem; line-height: 1.65; }
.notice { margin: 28px 0; padding: 18px; border: 1px solid var(--border); background: var(--surface-2); border-radius: 16px; }
.notice p { margin: 7px 0 0; color: var(--muted); line-height: 1.55; }

.btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 11px; border: 1px solid transparent; font-weight: 750; text-decoration: none; cursor: pointer; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-2); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: #ffd2cd; }
.btn-small { min-height: 38px; padding: 7px 11px; font-size: .9rem; }

.admin-body { background: var(--bg); }
.admin-layout { min-height: 100vh; display: grid; grid-template-columns: 245px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 18px 14px; background: #12213f; color: #eaf0ff; display: flex; flex-direction: column; }
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 4px 6px 18px; }
.sidebar-brand strong { display: block; }
.sidebar-brand span { display: block; color: #9fb2d5; font-size: .78rem; margin-top: 2px; }
.nav-list { display: grid; gap: 5px; }
.nav-item { min-height: 44px; border: 0; border-radius: 10px; padding: 9px 11px; color: #c8d6ef; background: transparent; text-align: left; cursor: pointer; }
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,.1); color: #fff; }
.sidebar-foot { margin-top: auto; padding: 14px 8px 4px; border-top: 1px solid rgba(255,255,255,.12); overflow-wrap: anywhere; }
.sidebar-foot span { display: block; font-size: .8rem; }
.sidebar-foot small { color: #8fa3ca; display: block; margin-top: 4px; }

.admin-main { min-width: 0; padding: 24px clamp(18px, 4vw, 44px) 50px; }
.topbar { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 20px; }
.topbar .eyebrow { margin: 0 0 4px; }
.topbar h1 { margin: 0; font-size: clamp(1.65rem, 3vw, 2.2rem); letter-spacing: -.03em; }
.status-dot { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; background: var(--success-soft); color: var(--success); border-radius: 999px; font-size: .82rem; font-weight: 700; }
.status-dot i { width: 8px; height: 8px; background: var(--success); border-radius: 50%; }

.content { min-width: 0; }
.loading-card, .card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px; box-shadow: 0 3px 12px rgba(26,39,74,.03); }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.metric { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 17px; }
.metric-label { color: var(--muted); font-size: .84rem; }
.metric-value { margin-top: 5px; font-size: 1.8rem; font-weight: 800; letter-spacing: -.04em; }
.metric-note { margin-top: 5px; color: var(--muted); font-size: .82rem; }
.section { margin-top: 16px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.section-head h2 { margin: 0; font-size: 1.08rem; }
.section-head p { margin: 3px 0 0; color: var(--muted); font-size: .86rem; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 13px; }
.toolbar .field { min-width: 180px; }
.field { display: grid; gap: 5px; min-width: 0; }
.field label, .field-label { font-size: .82rem; font-weight: 700; color: #344054; }
.input, .select, .textarea { width: 100%; min-height: 44px; border: 1px solid var(--border); background: #fff; border-radius: 10px; padding: 9px 11px; color: var(--text); font-size: 16px; }
.textarea { min-height: 88px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 13px; }
.form-grid .wide { grid-column: 1 / -1; }
.help-text { color: var(--muted); font-size: .78rem; line-height: 1.45; }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: 12px 13px; border-bottom: 1px solid var(--border); text-align: left; font-size: .9rem; vertical-align: middle; }
th { background: var(--surface-2); color: #475467; font-size: .76rem; letter-spacing: .03em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; min-height: 28px; padding: 4px 9px; border-radius: 999px; font-size: .76rem; font-weight: 750; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-muted { background: #eef1f5; color: #596579; }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }

.flash { margin-bottom: 14px; padding: 12px 14px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface); }
.flash.success { background: var(--success-soft); color: var(--success); border-color: #ccebdc; }
.flash.error { background: var(--danger-soft); color: var(--danger); border-color: #ffd2cd; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

.modal { width: min(680px, calc(100% - 24px)); max-height: calc(100% - 30px); border: 0; border-radius: 18px; padding: 0; box-shadow: 0 24px 80px rgba(14,25,48,.28); }
.modal::backdrop { background: rgba(12, 20, 36, .55); }
.modal-shell { background: var(--surface); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 17px 18px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 1.1rem; }
.modal-body { padding: 18px; overflow: auto; max-height: calc(100vh - 140px); }
.icon-btn { width: 42px; height: 42px; border-radius: 10px; border: 1px solid var(--border); background: #fff; font-size: 1.3rem; cursor: pointer; }
.modal-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

.location-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
.location-card { background: var(--surface); border: 1px solid var(--border); border-radius: 15px; padding: 15px; }
.location-card h3 { margin: 0 0 6px; }
.location-card p { margin: 0; color: var(--muted); font-size: .84rem; }
.location-card .actions { margin-top: 13px; }

.calendar-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 10px; }
.calendar-days { display: grid; grid-template-columns: repeat(7, minmax(110px, 1fr)); gap: 6px; min-width: 820px; }
.calendar-wrap { overflow-x: auto; }
.calendar-weekday { padding: 8px; text-align: center; color: var(--muted); font-size: .76rem; font-weight: 700; }
.calendar-day { min-height: 112px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); padding: 9px; cursor: pointer; text-align: left; }
.calendar-day:hover { border-color: #b5c5eb; }
.calendar-day.blank { visibility: hidden; }
.calendar-date { font-weight: 800; margin-bottom: 7px; }
.calendar-slot { display: block; font-size: .73rem; margin: 4px 0; color: #344054; }
.calendar-origin { margin-top: 7px; font-size: .68rem; color: var(--muted); }
.calendar-day.exception { background: #fffaf0; }
.calendar-day.closed { background: #f7f7f8; color: var(--muted); }

.rule-list { display: grid; gap: 9px; }
.rule-card { border: 1px solid var(--border); border-radius: 12px; padding: 13px; background: var(--surface); }
.rule-card strong { display: block; }
.rule-meta { margin-top: 4px; font-size: .8rem; color: var(--muted); }
.rule-slots { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 5px; }
.slot-chip { padding: 5px 8px; border-radius: 999px; background: var(--primary-soft); color: #244ba6; font-size: .75rem; font-weight: 700; }
.week-grid { display: grid; gap: 10px; }
.week-day { border: 1px solid var(--border); border-radius: 13px; padding: 13px; background: var(--surface); }
.week-day h3 { margin: 0 0 10px; }
.week-place { padding: 9px 0; border-top: 1px dashed var(--border); }
.week-place:first-of-type { border-top: 0; }

.public-body { background: var(--bg); padding: 18px; }
.public-shell { width: min(900px, 100%); margin: 0 auto; }
.public-header { display: flex; justify-content: space-between; align-items: end; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 20px; }
.public-header .eyebrow { margin: 0 0 4px; }
.public-header h1 { margin: 0; }
.public-header p { margin: 5px 0 0; color: var(--muted); }
.access-pill { padding: 7px 10px; border-radius: 999px; background: var(--success-soft); color: var(--success); font-size: .78rem; font-weight: 750; }
.program-summary { margin: 12px 0; display: flex; justify-content: space-between; gap: 10px; padding: 13px 15px; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); }
.program-summary span { color: var(--muted); }
.program-day { margin-top: 13px; background: var(--surface); border: 1px solid var(--border); border-radius: 17px; padding: 17px; }
.program-day h2 { margin: 0 0 13px; font-size: 1.08rem; text-transform: capitalize; }
.program-place { border-top: 1px solid var(--border); padding: 13px 0 4px; }
.program-place h3 { margin: 0 0 8px; font-size: .95rem; }
.program-slot { display: grid; grid-template-columns: 120px 1fr; gap: 12px; padding: 8px 0; }
.slot-time { font-weight: 800; }
.slot-people { color: #344054; }
.slot-people span { color: #98a2b3; margin: 0 5px; }
.public-footer { padding: 22px 6px; color: var(--muted); font-size: .76rem; text-align: center; }
.empty-state { margin-top: 12px; padding: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: 17px; text-align: center; }
.empty-state h2 { margin-top: 0; }
.empty-state p { color: var(--muted); }

@media (max-width: 1000px) {
  .cards { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .location-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .admin-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; padding: 10px; }
  .sidebar-brand { padding-bottom: 10px; }
  .nav-list { display: flex; overflow-x: auto; padding-bottom: 4px; }
  .nav-item { flex: 0 0 auto; min-width: max-content; }
  .sidebar-foot { display: none; }
  .admin-main { padding: 18px 12px 40px; }
  .topbar { align-items: center; }
  .cards { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .public-header { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 480px) {
  .cards { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .program-slot { grid-template-columns: 1fr; gap: 3px; }
  .program-summary { flex-direction: column; }
  .modal-actions .btn { width: 100%; }
}

.rule-days { margin-top: 8px; }

.availability-choice {display:block;padding:10px;border-bottom:1px solid #ddd} .table-wrap{overflow-x:auto} button:disabled{opacity:.45;cursor:not-allowed}
