:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #6d778a;
  --line: #dde3ee;
  --accent: #2459d3;
  --accent-dark: #1948b7;
  --accent-soft: #edf3ff;
  --danger: #b42318;
  --success: #16794a;
  --warning: #9a6700;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(28, 42, 72, .08);
}
* { box-sizing: border-box; }
html { font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--text); background: var(--bg); }
body { margin: 0; min-width: 320px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { margin: 0 0 4px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 15%, #eef4ff, transparent 32%), var(--bg); }
.login-card { width: min(440px, 100%); padding: 36px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.brand-mark { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; margin-bottom: 24px; background: var(--accent); color: #fff; font-weight: 900; letter-spacing: -.05em; }
.brand-mark.small { width: 40px; height: 40px; margin: 0; border-radius: 12px; font-size: 13px; }
h1, h2, h3 { margin: 0; letter-spacing: -.025em; }
h1 { font-size: 28px; margin-bottom: 8px; }
h2 { font-size: 24px; }
h3 { font-size: 19px; }
.stack { display: grid; gap: 16px; margin-top: 24px; }
label { display: grid; gap: 7px; font-size: 14px; font-weight: 700; }
input, select { width: 100%; min-height: 44px; padding: 10px 12px; color: var(--text); background: #fff; border: 1px solid #cbd4e2; border-radius: 9px; outline: none; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(36, 89, 211, .12); }
.button { min-height: 42px; padding: 9px 15px; border-radius: 9px; border: 1px solid transparent; font-weight: 800; }
.button.primary { background: var(--accent); color: #fff; }
.button.primary:hover { background: var(--accent-dark); }
.button.secondary { background: #fff; color: var(--text); border-color: var(--line); }
.button.ghost { width: 100%; background: transparent; color: #cbd5e6; border-color: #47546a; }
.button.danger { background: #fff2f0; border-color: #ffd5cf; color: var(--danger); }
.button:disabled { opacity: .55; cursor: not-allowed; }
.form-error { min-height: 20px; margin: 0; color: var(--danger); font-size: 13px; }
.admin-page { min-height: 100vh; display: grid; grid-template-columns: 252px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 20px 16px; background: #111a2a; color: #fff; }
.sidebar-brand { display: flex; gap: 12px; align-items: center; padding: 4px 8px 22px; }
.sidebar-brand strong, .sidebar-brand span { display: block; }
.sidebar-brand span { margin-top: 2px; color: #95a2b8; font-size: 12px; }
.nav-menu { display: grid; gap: 5px; }
.nav-button { width: 100%; min-height: 44px; padding: 10px 12px; border: 0; border-radius: 9px; text-align: left; background: transparent; color: #bdc7d8; font-weight: 700; }
.nav-button:hover, .nav-button.active { background: #1e2c43; color: #fff; }
.sidebar-footer { margin-top: auto; padding: 16px 8px 4px; border-top: 1px solid #2a374c; }
.current-user { margin-bottom: 12px; font-size: 13px; line-height: 1.5; color: #b8c3d5; overflow-wrap: anywhere; }
.workspace { min-width: 0; }
.topbar { min-height: 88px; display: flex; align-items: center; gap: 16px; padding: 18px 30px; background: rgba(255,255,255,.9); border-bottom: 1px solid var(--line); }
.station-context { margin-left: auto; min-width: 180px; }
.content { padding: 28px 30px 56px; }
.grid { display: grid; gap: 18px; }
.grid.cards { grid-template-columns: repeat(3, minmax(0,1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 3px 14px rgba(28, 42, 72, .035); }
.card.pad { padding: 20px; }
.metric { font-size: 30px; font-weight: 900; margin-top: 8px; }
.section-header { display: flex; gap: 16px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-header p { margin: 5px 0 0; }
.table-card { overflow: hidden; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: 13px 15px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
th { background: #f8faff; color: #4e5b70; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.status.active { background: #eaf8f1; color: var(--success); }
.status.inactive { background: #f2f3f5; color: #727b89; }
.role { display: inline-flex; padding: 4px 8px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-dark); font-size: 12px; font-weight: 800; }
.actions { display: flex; gap: 7px; flex-wrap: wrap; }
.mini-button { min-height: 34px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); font-size: 12px; font-weight: 800; }
.empty { padding: 42px 20px; text-align: center; color: var(--muted); }
.callout { padding: 16px 18px; border: 1px solid #d6e2fb; background: #f3f7ff; border-radius: 12px; color: #304463; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.check-list { display: grid; gap: 10px; }
.program-row { display: grid; grid-template-columns: minmax(150px,1fr) repeat(4, 92px); gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.program-row:last-child { border-bottom: 0; }
.check { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; }
.check input { width: 18px; min-height: 18px; }
.modal { width: min(620px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 16px; box-shadow: 0 20px 70px rgba(11, 21, 40, .28); }
.modal::backdrop { background: rgba(10, 18, 31, .48); }
.modal-card { padding: 22px; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.icon-button { min-width: 42px; min-height: 42px; border: 1px solid var(--line); border-radius: 9px; background: #fff; font-size: 20px; }
.mobile-only { display: none; }
@media (max-width: 900px) {
  .grid.cards { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
  .admin-page { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 30; width: 260px; left: -280px; transition: left .2s ease; box-shadow: var(--shadow); }
  .sidebar.open { left: 0; }
  .mobile-only { display: inline-grid; place-items: center; }
  .topbar { padding: 14px 18px; }
  .content { padding: 20px 18px 44px; }
  .station-context { min-width: 130px; }
}
@media (max-width: 560px) {
  .login-card { padding: 26px 20px; }
  .topbar { align-items: flex-start; flex-wrap: wrap; }
  .station-context { width: 100%; margin-left: 58px; }
  .section-header { align-items: flex-start; flex-direction: column; }
  .section-header .button { width: 100%; }
  .program-row { grid-template-columns: 1fr 1fr; }
  .program-row .program-name { grid-column: 1 / -1; }
}
.mt18 { margin-top: 18px; }
textarea { width: 100%; padding: 10px 12px; color: var(--text); background: #fff; border: 1px solid #cbd4e2; border-radius: 9px; outline: none; resize: vertical; font: inherit; }
textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(36, 89, 211, .12); }
.toolbar-row { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin: -4px 0 12px; }
.mini-button.danger { color: var(--danger); border-color: #ffd5cf; background: #fff7f6; }
.permission-list { display: grid; gap: 8px; }
.permission-row { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.permission-row input { width: 18px; min-height: 18px; margin-top: 2px; }
.permission-row span { display: grid; gap: 3px; }
.permission-row small { color: var(--muted); font-weight: 500; }
.geo-rule-row { display: grid; grid-template-columns: 120px minmax(220px,1fr) 120px auto; align-items: end; }
.geo-rule-row label { display: grid; gap: 6px; font-size: 12px; font-weight: 700; color: #4e5b70; }
.geo-rule-row input { width: 100%; min-height: 40px; margin: 0; padding: 8px 10px; border: 1px solid #cbd4e2; border-radius: 9px; color: var(--text); background: #fff; font: inherit; }
.geo-rule-row .mini-button { min-height: 40px; }
@media (max-width: 760px) {
  .geo-rule-row { grid-template-columns: 1fr 1fr; }
  .geo-rule-row .remove-geo-rule { width: 100%; }
}
@media (max-width: 520px) {
  .geo-rule-row { grid-template-columns: 1fr; }
}

.media-upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.upload-panel {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border, #d9dee7);
  border-radius: 12px;
  background: #fff;
}
.upload-panel small { color: #667085; }
.upload-panel input[type="file"] { width: 100%; min-width: 0; }
@media (max-width: 720px) {
  .media-upload-grid { grid-template-columns: 1fr; }
}

.status.warning { background: #fff6d8; color: var(--warning); }
.schedule-toolbar { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; }
.schedule-toolbar label { min-width: 180px; }
.schedule-toolbar .mini-button { min-height: 44px; }
.schedule-table { min-width: 1040px; }
.schedule-assessment { display: grid; gap: 5px; min-width: 220px; }
.schedule-detail { color: var(--muted); line-height: 1.35; }
@media (max-width: 620px) {
  .schedule-toolbar { align-items: stretch; }
  .schedule-toolbar > * { width: 100%; }
}

.shuffle-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 10px; font-weight: 700; white-space: nowrap; }
.shuffle-toggle input { width: 18px; height: 18px; margin: 0; }
.shuffle-help { margin: -6px 0 14px; }
