/* Ziyoly Maktab LMS — Base styles (Reback-derived, school-tuned) */

:root {
  --zy-primary: #1c84ee;
  --zy-primary-rgb: 28,132,238;
  --zy-primary-soft: #e6f1fd;
  --zy-primary-700: #0f5fb5;
  --zy-accent-2: #7f56da;
  --zy-success: #22c55e;
  --zy-warning: #f9b931;
  --zy-danger: #ef5f5f;
  --zy-info: #4ecac2;
  --zy-heading: #323a46;
  --zy-body: #424e5a;
  --zy-muted: #8486a7;
  --zy-bg: #f5f7fa;
  --zy-border: #e4e8ee;
  --zy-border-2: #eef2f7;
  --zy-surface: #ffffff;
  --zy-sidebar-bg: #1a2230;
  --zy-sidebar-ink: #b0b5c1;
  --zy-sidebar-active: #ffffff;
  --zy-sidebar-section: #6b778c;
  --zy-radius: 6px;
  --zy-radius-lg: 10px;
  --zy-row-h: 38px;
}

/* Playful variant overrides */
body.variant-playful {
  --zy-bg: #fbf8f3;
  --zy-sidebar-bg: #2b1f3b;
  --zy-sidebar-ink: #c2b7d6;
  --zy-radius: 14px;
  --zy-radius-lg: 22px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--zy-bg);
  font-family: 'Wix Madefor Text', system-ui, sans-serif;
  color: var(--zy-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--zy-primary); text-decoration: none; }
h1,h2,h3,h4,h5,h6 { color: var(--zy-heading); font-weight: 600; margin: 0 0 8px; line-height: 1.3; }
h1 { font-size: 24px; }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
h4 { font-size: 15px; }
h5 { font-size: 13px; }

.text-muted { color: var(--zy-muted) !important; }
.text-heading { color: var(--zy-heading) !important; }
.text-primary { color: var(--zy-primary) !important; }
.text-success { color: var(--zy-success) !important; }
.text-danger  { color: var(--zy-danger) !important; }
.text-warning { color: var(--zy-warning) !important; }
.fw-500 { font-weight: 500; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fs-sm { font-size: 12px; }
.fs-md { font-size: 13px; }
.fs-lg { font-size: 16px; }
.fs-xl { font-size: 20px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-wrap { flex-wrap: wrap; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-5 { margin-bottom: 24px; }
.mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-5 { margin-top: 24px; }
.w-100 { width: 100%; }

.app-wrapper { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ===================== SIDEBAR ===================== */
.sidebar {
  width: 256px; flex: 0 0 256px;
  background: var(--zy-sidebar-bg);
  color: var(--zy-sidebar-ink);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  transition: width .2s ease, flex-basis .2s ease;
}
.sidebar.condensed { width: 72px; flex-basis: 72px; }
.sidebar.condensed .nav-text,
.sidebar.condensed .sb-logo-full,
.sidebar.condensed .sb-section-title,
.sidebar.condensed .nav-badge,
.sidebar.condensed .sb-upsell { display: none; }
.sidebar.condensed .nav-link { justify-content: center; padding: 10px; }
.sidebar.condensed .role-switcher { padding: 8px; }
.sidebar.condensed .role-switcher .rs-body { display: none; }

.sb-logo { display: flex; align-items: center; gap: 10px; padding: 18px 20px; }
.sb-logo-mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--zy-primary), var(--zy-accent-2));
  flex: 0 0 32px;
  position: relative;
}
.sb-logo-mark::after {
  content: 'Z';
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 16px;
}
.sb-logo-full { display: flex; flex-direction: column; line-height: 1.2; }
.sb-brand { color: white; font-weight: 700; font-size: 16px; letter-spacing: 0.2px; }
.sb-tagline { color: var(--zy-sidebar-section); font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px; }

.sb-scroll { flex: 1; overflow-y: auto; padding: 0 12px 20px; }
.sb-scroll::-webkit-scrollbar { width: 4px; }
.sb-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 2px; }

.sb-section-title {
  font-size: 10px; font-weight: 600;
  color: var(--zy-sidebar-section);
  text-transform: uppercase; letter-spacing: 0.8px;
  padding: 14px 12px 6px;
}
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: var(--zy-radius);
  color: var(--zy-sidebar-ink); cursor: pointer;
  font-size: 13px; font-weight: 500;
  margin-bottom: 2px;
  transition: background .15s ease, color .15s ease;
}
.nav-link:hover { background: rgba(255,255,255,0.05); color: white; }
.nav-link.active { background: var(--zy-primary); color: white; }
.nav-link.active .nav-badge { background: rgba(255,255,255,0.22); color: white; }
.nav-icon { font-size: 16px; width: 18px; display: flex; justify-content: center; }
.nav-text { flex: 1; }
.nav-badge {
  font-size: 10px; font-weight: 600;
  padding: 2px 7px; border-radius: 10px;
  background: rgba(255,255,255,0.08);
  color: var(--zy-sidebar-ink);
}
.nav-badge.soft-warn { background: rgba(249,185,49,0.18); color: #f9b931; }
.nav-badge.soft-danger { background: rgba(239,95,95,0.2); color: #ff8787; }
.nav-badge.soft-success { background: rgba(34,197,94,0.18); color: #58d07f; }

.role-switcher {
  margin: 8px 0 16px;
  padding: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--zy-radius);
}
.role-switcher .rs-label {
  font-size: 10px; color: var(--zy-sidebar-section);
  text-transform: uppercase; letter-spacing: 0.6px;
  margin-bottom: 6px;
}
.role-switcher select {
  width: 100%;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.08);
  color: white;
  padding: 7px 10px;
  border-radius: var(--zy-radius);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}
.role-switcher .rs-who {
  display: flex; align-items: center; gap: 8px;
  margin-top: 8px; padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.role-switcher .rs-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--zy-primary), var(--zy-accent-2));
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 600; font-size: 11px;
  flex: 0 0 28px;
}
.role-switcher .rs-name { color: white; font-size: 12px; font-weight: 600; }
.role-switcher .rs-sub  { color: var(--zy-sidebar-section); font-size: 10px; }

/* ===================== TOPBAR ===================== */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 24px;
  background: var(--zy-surface);
  border-bottom: 1px solid var(--zy-border);
  position: sticky; top: 0; z-index: 10;
}
.topbar-toggle {
  background: transparent; border: none; cursor: pointer;
  width: 36px; height: 36px; border-radius: var(--zy-radius);
  color: var(--zy-muted); font-size: 20px;
  display: flex; align-items: center; justify-content: center;
}
.topbar-toggle:hover { background: var(--zy-border-2); }
.topbar-search {
  flex: 1; max-width: 440px;
  display: flex; align-items: center; gap: 8px;
  background: var(--zy-bg);
  border: 1px solid var(--zy-border);
  border-radius: var(--zy-radius);
  padding: 7px 12px;
}
.topbar-search .sicon { color: var(--zy-muted); }
.topbar-search input {
  border: none; background: transparent;
  outline: none; flex: 1;
  font-family: inherit; font-size: 13px;
  color: var(--zy-heading);
}
.topbar-search kbd {
  font-size: 10px; padding: 2px 6px;
  background: white; border: 1px solid var(--zy-border);
  border-radius: 4px; color: var(--zy-muted);
}
.topbar-term {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: var(--zy-primary-soft);
  border-radius: var(--zy-radius);
  color: var(--zy-primary-700);
  font-size: 12px; font-weight: 600;
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar-btn {
  position: relative;
  background: transparent; border: none; cursor: pointer;
  width: 36px; height: 36px; border-radius: var(--zy-radius);
  color: var(--zy-muted); font-size: 18px;
  display: flex; align-items: center; justify-content: center;
}
.topbar-btn:hover { background: var(--zy-border-2); color: var(--zy-heading); }
.topbar-btn .dot {
  position: absolute; top: 7px; right: 8px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--zy-danger); border: 2px solid white;
}
.topbar-profile {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 12px 4px 4px;
  border-radius: var(--zy-radius); cursor: pointer;
}
.topbar-profile:hover { background: var(--zy-border-2); }
.topbar-profile .avatar { width: 32px; height: 32px; border-radius: 50%; flex: 0 0 32px; }
.topbar-profile .meta { display: flex; flex-direction: column; line-height: 1.1; }
.topbar-profile .name { font-size: 13px; font-weight: 600; color: var(--zy-heading); }
.topbar-profile .role { font-size: 11px; color: var(--zy-muted); }

.page-content { padding: 24px 28px 60px; }

/* ===================== COMMON ===================== */
.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--zy-muted);
  margin-bottom: 6px;
}
.breadcrumb a { color: var(--zy-muted); }
.breadcrumb a:last-child { color: var(--zy-heading); font-weight: 500; }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  margin-bottom: 22px; flex-wrap: wrap;
}
.page-head h1 { margin-bottom: 2px; }
.page-head .subtitle { color: var(--zy-muted); font-size: 13px; }
.page-head .actions { display: flex; align-items: center; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: var(--zy-radius);
  border: 1px solid transparent;
  font-family: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; line-height: 1;
  transition: all .12s ease;
  text-decoration: none;
}
.btn-primary { background: var(--zy-primary); color: white; }
.btn-primary:hover { background: var(--zy-primary-700); color: white; }
.btn-outline { background: white; border-color: var(--zy-border); color: var(--zy-heading); }
.btn-outline:hover { background: var(--zy-border-2); }
.btn-ghost { background: transparent; color: var(--zy-muted); }
.btn-ghost:hover { background: var(--zy-border-2); color: var(--zy-heading); }
.btn-danger { background: var(--zy-danger); color: white; }
.btn-success { background: var(--zy-success); color: white; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 7px; width: 32px; height: 32px; justify-content: center; }

.card {
  background: var(--zy-surface);
  border: 1px solid var(--zy-border);
  border-radius: var(--zy-radius-lg);
  overflow: hidden;
}
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--zy-border-2);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.card-header h4 { margin: 0; }
.card-body { padding: 18px 20px; }

.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.g-5 { grid-template-columns: repeat(5, 1fr); }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: 10px;
}
.badge-primary { background: rgba(28,132,238,0.12); color: var(--zy-primary); }
.badge-success { background: rgba(34,197,94,0.12); color: #16a34a; }
.badge-warning { background: rgba(249,185,49,0.18); color: #b88300; }
.badge-danger  { background: rgba(239,95,95,0.12); color: var(--zy-danger); }
.badge-muted   { background: var(--zy-border-2); color: var(--zy-muted); }
.badge-info    { background: rgba(78,202,194,0.15); color: #16a39b; }
.badge-purple  { background: rgba(127,86,218,0.15); color: var(--zy-accent-2); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  padding: 4px 10px; border: 1px solid var(--zy-border);
  border-radius: 999px; font-size: 12px; color: var(--zy-muted);
  cursor: pointer; background: white; font-weight: 500;
  white-space: nowrap;
}
.chip.active { background: var(--zy-primary); color: white; border-color: var(--zy-primary); }
.chip:hover:not(.active) { background: var(--zy-border-2); color: var(--zy-heading); }

.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--zy-border); margin-bottom: 20px; flex-wrap: wrap; }
.tab {
  padding: 10px 2px; font-size: 13px; font-weight: 500;
  color: var(--zy-muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--zy-primary); border-bottom-color: var(--zy-primary); }
.tab:hover:not(.active) { color: var(--zy-heading); }

.progress { width: 100%; height: 6px; background: var(--zy-border-2); border-radius: 3px; overflow: hidden; }
.progress > div { height: 100%; background: var(--zy-primary); transition: width .3s ease; }
.progress.lg { height: 10px; border-radius: 5px; }

.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--zy-border-2);
  flex-shrink: 0;
}

.zy-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.zy-table th, .zy-table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--zy-border-2); vertical-align: middle; }
.zy-table th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--zy-muted); font-weight: 600; background: #fafbfc; }
.zy-table tr:hover td { background: #fafbfc; }
.zy-table tr:last-child td { border-bottom: none; }
.table-wrap { overflow-x: auto; }

input[type=text], input[type=search], input[type=email], input[type=number], select, textarea {
  font-family: inherit; font-size: 13px;
  padding: 8px 12px;
  border: 1px solid var(--zy-border);
  border-radius: var(--zy-radius);
  background: white;
  color: var(--zy-heading);
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--zy-primary); box-shadow: 0 0 0 3px rgba(28,132,238,0.1); }

/* ===================== STAT CARD ===================== */
.stat-card {
  background: var(--zy-surface);
  border: 1px solid var(--zy-border);
  border-radius: var(--zy-radius-lg);
  padding: 18px 20px;
}
.stat-card .sc-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.stat-card .sc-ico { width: 40px; height: 40px; border-radius: var(--zy-radius); display: flex; align-items: center; justify-content: center; font-size: 20px; }
.stat-card .sc-label { font-size: 12px; color: var(--zy-muted); text-transform: uppercase; letter-spacing: 0.4px; font-weight: 600; margin-bottom: 4px; }
.stat-card .sc-value { font-size: 26px; font-weight: 700; color: var(--zy-heading); line-height: 1.1; margin-bottom: 6px; }
.stat-card .sc-delta { font-size: 11px; color: var(--zy-muted); display: flex; align-items: center; gap: 4px; }
.stat-card .sc-delta.up { color: var(--zy-success); }
.stat-card .sc-delta.down { color: var(--zy-danger); }

/* ===================== JOURNAL ===================== */
.journal-wrap {
  background: var(--zy-surface);
  border: 1px solid var(--zy-border);
  border-radius: var(--zy-radius-lg);
  overflow: hidden;
}
.journal-toolbar {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-bottom: 1px solid var(--zy-border-2); flex-wrap: wrap;
}
.journal-table-wrap { overflow: auto; max-height: 640px; }
.journal {
  border-collapse: separate; border-spacing: 0;
  font-size: 12px; min-width: 900px; width: 100%;
}
.journal th, .journal td {
  border-right: 1px solid var(--zy-border-2);
  border-bottom: 1px solid var(--zy-border-2);
  padding: 0;
  text-align: center;
  background: white;
}
.journal thead th {
  position: sticky; top: 0; z-index: 3;
  background: #f7f9fc;
  font-weight: 600; color: var(--zy-heading);
  padding: 8px 6px;
  font-size: 11px;
}
.journal th.date-col { min-width: 40px; max-width: 40px; line-height: 1.1; }
.journal th.date-col .day { color: var(--zy-muted); font-size: 9px; font-weight: 500; display: block; }
.journal th.date-col.today { background: var(--zy-primary-soft); color: var(--zy-primary); }
.journal th.month-sep { background: #eef2f7; }

.journal .name-col {
  position: sticky; left: 0; z-index: 4;
  min-width: 240px; max-width: 240px;
  text-align: left;
  background: white !important;
  padding: 0;
  box-shadow: 1px 0 0 var(--zy-border);
}
.journal thead .name-col { z-index: 5; background: #f7f9fc !important; }
.journal .name-cell {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; height: var(--zy-row-h);
  font-size: 12px;
}
.journal .name-cell .num { color: var(--zy-muted); font-size: 11px; min-width: 18px; }
.journal .name-cell .avatar-sm { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-size: 10px; font-weight: 600; flex: 0 0 24px; }
.journal .name-cell .nm { flex: 1; color: var(--zy-heading); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.journal tbody tr:nth-child(even) td { background: #fafbfc; }
.journal tbody tr:nth-child(even) .name-col { background: #fafbfc !important; }
.journal tbody tr:hover td { background: var(--zy-primary-soft); }
.journal tbody tr:hover .name-col { background: var(--zy-primary-soft) !important; }

.mark-cell {
  width: 40px; height: var(--zy-row-h);
  display: flex; align-items: center; justify-content: center; gap: 2px;
  font-weight: 600; font-size: 13px;
  cursor: pointer;
}
.mark { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; }
.mark.m10, .mark.m9 { color: #16a34a; }
.mark.m8, .mark.m7 { color: #16a39b; }
.mark.m6, .mark.m5 { color: #c58a00; }
.mark.m4, .mark.m3, .mark.m2, .mark.m1 { color: var(--zy-danger); }
.mark.absent { color: var(--zy-danger); font-size: 11px; font-weight: 700; }
.mark.excused { color: var(--zy-warning); font-size: 11px; font-weight: 700; }
.mark-cell.weekend { background: #f0f0f3 !important; cursor: default; }
.mark-cell.today { background: rgba(28,132,238,0.06); }
.mark-cell.summary {
  background: var(--zy-primary-soft) !important;
  color: var(--zy-primary);
  font-weight: 700;
}
.topic-row td { background: #f7f9fc !important; font-size: 10px; color: var(--zy-muted); padding: 4px 6px; text-align: center; font-style: italic; }
.topic-row .name-col { font-style: normal; color: var(--zy-heading); font-weight: 600; }

/* ===================== TIMETABLE ===================== */
.timetable {
  display: grid;
  grid-template-columns: 70px repeat(6, 1fr);
  gap: 6px;
  background: var(--zy-surface);
  border: 1px solid var(--zy-border);
  border-radius: var(--zy-radius-lg);
  padding: 14px;
}
.tt-head {
  background: transparent;
  padding: 10px 8px;
  font-size: 12px; font-weight: 600;
  color: var(--zy-muted); text-transform: uppercase; letter-spacing: 0.5px;
  text-align: center;
}
.tt-head.today { color: var(--zy-primary); }
.tt-head .dow-num { display: block; font-size: 18px; color: var(--zy-heading); font-weight: 700; margin-top: 2px; letter-spacing: 0; text-transform: none; }
.tt-head.today .dow-num { color: var(--zy-primary); }
.tt-period {
  background: #f7f9fc;
  border-radius: var(--zy-radius);
  padding: 8px 6px; text-align: center;
  font-size: 11px; color: var(--zy-muted);
}
.tt-period .p-num { font-size: 18px; color: var(--zy-heading); font-weight: 700; }
.tt-period .p-time { display: block; font-size: 10px; }
.tt-cell {
  background: white;
  border: 1px solid var(--zy-border-2);
  border-radius: var(--zy-radius);
  padding: 8px 10px;
  font-size: 11px;
  min-height: 68px;
  position: relative;
  cursor: pointer;
  transition: all .15s;
  border-left: 3px solid var(--zy-primary);
}
.tt-cell:hover { border-color: var(--zy-primary); box-shadow: 0 2px 8px rgba(28,132,238,0.12); }
.tt-cell.empty { background: #fafbfc; border-style: dashed; border-left: 1px dashed var(--zy-border); cursor: default; }
.tt-cell.empty:hover { border-color: var(--zy-border); box-shadow: none; }
.tt-subject { font-weight: 700; color: var(--zy-heading); font-size: 12px; margin-bottom: 2px; }
.tt-meta { color: var(--zy-muted); font-size: 10px; display: flex; align-items: center; gap: 4px; }
.tt-cell .tt-room { position: absolute; top: 6px; right: 8px; font-size: 10px; color: var(--zy-muted); font-weight: 600; }

.tt-c-math { border-left-color: #1c84ee; }
.tt-c-science { border-left-color: #22c55e; }
.tt-c-lang { border-left-color: #7f56da; }
.tt-c-arts { border-left-color: #ff6c2f; }
.tt-c-sport { border-left-color: #4ecac2; }
.tt-c-history { border-left-color: #f9b931; }

/* ===================== TWEAKS ===================== */
.tweaks {
  position: fixed; bottom: 24px; right: 24px; width: 300px;
  background: white; border: 1px solid var(--zy-border);
  border-radius: var(--zy-radius-lg);
  box-shadow: 0 12px 40px rgba(0,0,0,0.14);
  padding: 16px; z-index: 100;
  font-size: 13px;
}
.tweaks h4 { display: flex; align-items: center; gap: 6px; margin: 0 0 12px; }
.tw-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.tw-label { font-size: 11px; color: var(--zy-muted); text-transform: uppercase; letter-spacing: 0.4px; font-weight: 600; }
.tw-swatches { display: flex; gap: 6px; }
.tw-swatch { width: 26px; height: 26px; border-radius: 50%; cursor: pointer; border: 2px solid transparent; box-shadow: 0 0 0 1px var(--zy-border); }
.tw-swatch.active { border-color: white; box-shadow: 0 0 0 2px var(--zy-heading); }
.tw-segs { display: flex; gap: 2px; background: var(--zy-border-2); padding: 3px; border-radius: var(--zy-radius); }
.tw-segs button {
  flex: 1; border: none; background: transparent;
  padding: 6px 8px; border-radius: 5px;
  font-family: inherit; font-size: 12px; cursor: pointer;
  color: var(--zy-muted); font-weight: 500;
}
.tw-segs button.active { background: white; color: var(--zy-heading); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,0.08); }
.tweaks-fab {
  position: fixed; bottom: 24px; right: 24px; width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--zy-heading); color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; cursor: pointer;
  box-shadow: 0 6px 18px rgba(0,0,0,0.16); z-index: 99;
}

/* KANBAN (admissions) */
.kanban { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.kanban-col { background: #f5f7fa; border-radius: var(--zy-radius-lg); padding: 12px; }
.kanban-col h5 { display: flex; align-items: center; justify-content: space-between; font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--zy-muted); margin-bottom: 10px; }
.kanban-col .count { background: white; color: var(--zy-heading); padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.kanban-card { background: white; border-radius: var(--zy-radius); padding: 12px; margin-bottom: 8px; border: 1px solid var(--zy-border); font-size: 12px; cursor: grab; }
.kanban-card .kc-name { font-weight: 600; color: var(--zy-heading); margin-bottom: 4px; }
.kanban-card .kc-meta { color: var(--zy-muted); font-size: 11px; display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.kanban-card .kc-tags { display: flex; flex-wrap: wrap; gap: 4px; }

/* Empty state */
.empty-state {
  padding: 60px 24px; text-align: center;
  background: white; border: 1px dashed var(--zy-border);
  border-radius: var(--zy-radius-lg);
}
.empty-state .e-ico { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 50%; background: var(--zy-primary-soft); color: var(--zy-primary); display: flex; align-items: center; justify-content: center; font-size: 28px; }

/* Bar chart */
.bar-chart { display: flex; align-items: stretch; gap: 12px; height: 240px; padding: 24px 0 32px; }
.bar-chart .bar { flex: 1; background: var(--zy-primary-soft); border-radius: 8px 8px 0 0; position: relative; min-height: 4px; overflow: visible; }
.bar-chart .bar .fill { position: absolute; bottom: 0; left: 0; right: 0; background: linear-gradient(180deg, var(--zy-primary), #0ea5e9); border-radius: 8px 8px 0 0; transition: height .4s ease; box-shadow: 0 -2px 8px -2px rgba(28,132,238,0.35); }
.bar-chart .bar .lbl { position: absolute; bottom: -24px; left: 0; right: 0; text-align: center; font-size: 11px; color: var(--zy-muted); font-weight: 500; }
.bar-chart .bar .val { position: absolute; top: -20px; left: 0; right: 0; text-align: center; font-size: 11px; font-weight: 700; color: var(--zy-heading); }

/* Donut */
.donut { --size: 120px; --thickness: 14px; --pct: 0.7; width: var(--size); height: var(--size); border-radius: 50%; background: conic-gradient(var(--zy-primary) calc(var(--pct) * 100%), var(--zy-border-2) 0); display: flex; align-items: center; justify-content: center; position: relative; }
.donut::before { content: ''; position: absolute; inset: var(--thickness); background: white; border-radius: 50%; }
.donut .donut-lbl { position: relative; z-index: 1; text-align: center; }
.donut .donut-lbl .v { font-size: 22px; font-weight: 700; color: var(--zy-heading); }
.donut .donut-lbl .k { font-size: 10px; color: var(--zy-muted); }

/* Heatmap */
.heatmap { display: grid; gap: 3px; }
.heatmap .hc { width: 16px; height: 16px; border-radius: 3px; background: var(--zy-border-2); }
.heatmap .hc.l1 { background: rgba(28,132,238,0.18); }
.heatmap .hc.l2 { background: rgba(28,132,238,0.36); }
.heatmap .hc.l3 { background: rgba(28,132,238,0.58); }
.heatmap .hc.l4 { background: var(--zy-primary); }

/* Variant: playful — round, warmer, more color blocks */
body.variant-playful .card { box-shadow: 0 1px 0 rgba(0,0,0,0.02); }
body.variant-playful .nav-link.active { background: linear-gradient(90deg, var(--zy-primary), var(--zy-accent-2)); }
body.variant-playful .sb-logo-mark { border-radius: 10px; }
body.variant-playful .stat-card { background: linear-gradient(180deg, white 0%, var(--zy-bg) 120%); }
body.variant-playful .btn-primary { background: linear-gradient(135deg, var(--zy-primary), var(--zy-accent-2)); }
body.variant-playful .tt-cell { border-radius: 10px; }
body.variant-playful .journal-wrap { border-radius: 18px; }

/* Focus ring for journal cells */
.mark-cell.editing { outline: 2px solid var(--zy-primary); outline-offset: -2px; background: white !important; }

/* ===================== TIMETABLE CONSTRUCTOR ===================== */
.ttc-shell { display: grid; grid-template-columns: 260px 1fr; gap: 0; background: white; border: 1px solid var(--zy-border); border-radius: 12px; overflow: hidden; min-height: calc(100vh - 220px); }
.ttc-side { background: linear-gradient(180deg, #f6f9fc 0%, #eef3f9 100%); border-right: 1px solid var(--zy-border); padding: 18px 0; }
.ttc-side h5 { padding: 0 18px; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--zy-muted); margin: 8px 0 10px; font-weight: 700; }
.ttc-step { display: flex; align-items: center; gap: 12px; padding: 10px 18px; cursor: pointer; border-left: 3px solid transparent; position: relative; transition: all .15s; }
.ttc-step:hover { background: rgba(255,255,255,0.6); }
.ttc-step.active { background: white; border-left-color: var(--zy-primary); box-shadow: 0 1px 0 rgba(0,0,0,0.03); }
.ttc-step.done .ttc-num { background: var(--zy-success); color: white; border-color: var(--zy-success); }
.ttc-step.active .ttc-num { background: var(--zy-primary); color: white; border-color: var(--zy-primary); box-shadow: 0 0 0 4px rgba(var(--zy-primary-rgb),0.18); }
.ttc-num { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--zy-border); background: white; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--zy-muted); flex: 0 0 26px; transition: all .2s; }
.ttc-step.done .ttc-num::before { content: '✓'; font-size: 14px; }
.ttc-step.done .ttc-num span { display: none; }
.ttc-step-label { font-size: 13px; color: var(--zy-heading); font-weight: 500; line-height: 1.3; }
.ttc-step.active .ttc-step-label { font-weight: 600; }
.ttc-step-sub { font-size: 11px; color: var(--zy-muted); margin-top: 2px; }
.ttc-step .badge { margin-left: auto; }
.ttc-connector { position: absolute; left: 30px; top: -10px; width: 2px; height: 10px; background: var(--zy-border-2); }

.ttc-main { padding: 24px 32px 120px; background: var(--zy-bg); overflow-y: auto; max-height: calc(100vh - 120px); }
.ttc-page-head { display: flex; align-items: flex-end; justify-content: space-between; padding-bottom: 16px; border-bottom: 1px solid var(--zy-border-2); margin-bottom: 24px; }
.ttc-page-head h2 { font-size: 22px; margin: 0 0 4px; color: var(--zy-heading); }
.ttc-page-head .sub { color: var(--zy-muted); font-size: 13px; }
.ttc-stepcount { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--zy-primary); font-weight: 700; margin-bottom: 4px; }

.ttc-bar { position: sticky; bottom: 16px; margin-top: 32px; background: white; border: 1px solid var(--zy-border); border-radius: 12px; padding: 12px 18px; display: flex; align-items: center; gap: 14px; box-shadow: 0 10px 30px rgba(26,34,48,0.08); }
.ttc-bar .progress { flex: 1; height: 6px; }
.ttc-bar .progress > div { height:100%; background: linear-gradient(90deg, var(--zy-primary), var(--zy-accent-2)); border-radius: 3px; transition: width .3s; }

/* Wizard cards */
.wzd-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.wzd-card { background: white; border: 1px solid var(--zy-border); border-radius: 12px; padding: 20px; transition: all .15s; cursor: pointer; }
.wzd-card:hover { border-color: var(--zy-primary); box-shadow: 0 4px 16px rgba(var(--zy-primary-rgb),0.08); }
.wzd-card.selected { border-color: var(--zy-primary); background: var(--zy-primary-soft); box-shadow: 0 0 0 2px var(--zy-primary) inset; }
.wzd-card .hd { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.wzd-card .ic { width: 40px; height: 40px; border-radius: 8px; background: var(--zy-primary-soft); color: var(--zy-primary); display: flex; align-items: center; justify-content: center; font-size: 20px; }

/* Subject load matrix */
.load-matrix { width: 100%; border-collapse: separate; border-spacing: 0; background: white; border: 1px solid var(--zy-border); border-radius: 10px; overflow: hidden; font-size: 12px; }
.load-matrix th, .load-matrix td { padding: 6px 8px; text-align: center; border-bottom: 1px solid var(--zy-border-2); border-right: 1px solid var(--zy-border-2); }
.load-matrix th { background: #f6f9fc; font-weight: 600; color: var(--zy-heading); font-size: 11px; }
.load-matrix th.group-h { position: sticky; left: 0; z-index: 1; }
.load-matrix td.group-c { position: sticky; left: 0; background: white; font-weight: 600; color: var(--zy-heading); text-align: left; padding-left: 12px; z-index: 1; }
.load-matrix tr:hover td { background: #fbfdff; }
.load-matrix tr:hover td.group-c { background: #fbfdff; }
.load-cell { font-weight: 600; color: var(--zy-heading); position: relative; }
.load-cell.zero { color: #d1d5db; }
.load-cell .editable { background: transparent; border: none; text-align: center; font-weight: 600; color: inherit; width: 28px; font-size: 12px; }
.load-cell .editable:focus { outline: 2px solid var(--zy-primary); background: white; border-radius: 4px; }
.load-sum { background: #f6f9fc; font-weight: 700; }

/* Availability grid */
.avail-grid { display: grid; grid-template-columns: 90px repeat(10, 1fr); gap: 2px; background: var(--zy-border-2); padding: 2px; border-radius: 8px; font-size: 11px; }
.avail-grid .h { background: #f6f9fc; padding: 6px 4px; text-align: center; font-weight: 600; color: var(--zy-heading); }
.avail-grid .r { background: white; padding: 6px 4px; text-align: center; font-weight: 500; }
.avail-cell { padding: 10px 4px; text-align: center; cursor: pointer; transition: background .1s; font-size: 10px; }
.avail-cell.on { background: rgba(34,197,94,0.16); color: #15803d; font-weight: 600; }
.avail-cell.on:hover { background: rgba(34,197,94,0.3); }
.avail-cell.off { background: rgba(239,95,95,0.12); color: #b91c1c; }
.avail-cell.off:hover { background: rgba(239,95,95,0.24); }
.avail-cell.bell { background: #fff6db; color: #8f6500; font-weight: 600; }

/* Constraint rules */
.rule-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; background: white; border: 1px solid var(--zy-border); border-radius: 10px; margin-bottom: 8px; transition: all .15s; }
.rule-row.on { border-left: 4px solid var(--zy-primary); }
.rule-row.hard { border-left-color: var(--zy-danger); }
.rule-row .wt-slider { flex: 0 0 140px; }
.rule-row .wt-val { font-weight: 700; color: var(--zy-primary); min-width: 26px; text-align: center; }

/* Switch */
.zy-switch { position: relative; width: 36px; height: 20px; background: #e5e7eb; border-radius: 12px; cursor: pointer; transition: background .15s; flex: 0 0 36px; }
.zy-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: white; transition: all .15s; box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.zy-switch.on { background: var(--zy-primary); }
.zy-switch.on::after { left: 18px; }
.zy-switch.locked { opacity: .4; cursor: not-allowed; }

/* Variant comparison cards */
.var-card { background: white; border: 2px solid var(--zy-border); border-radius: 14px; padding: 20px; cursor: pointer; transition: all .2s; position: relative; overflow: hidden; }
.var-card:hover { border-color: var(--zy-primary); transform: translateY(-2px); box-shadow: 0 12px 28px rgba(26,34,48,0.1); }
.var-card.selected { border-color: var(--zy-success); background: rgba(34,197,94,0.04); }
.var-card.selected::after { content: '✓ Tanlandi'; position: absolute; top: 14px; right: 14px; padding: 4px 10px; background: var(--zy-success); color: white; font-size: 10px; font-weight: 700; border-radius: 10px; letter-spacing: .4px; }
.var-score { font-size: 40px; font-weight: 800; line-height: 1; color: var(--zy-heading); margin: 8px 0 4px; font-variant-numeric: tabular-nums; }
.var-score .u { font-size: 14px; color: var(--zy-muted); font-weight: 500; }
.score-bar { height: 6px; background: var(--zy-border-2); border-radius: 3px; overflow: hidden; }
.score-bar > div { height:100%; background: linear-gradient(90deg, #ef5f5f 0%, #f9b931 50%, #22c55e 100%); border-radius: 3px; }

/* Grid editor */
.ed-wrap { display: grid; grid-template-columns: 240px 1fr; gap: 16px; }
.ed-palette { background: white; border: 1px solid var(--zy-border); border-radius: 12px; padding: 14px; max-height: 70vh; overflow-y: auto; }
.ed-chip { display: flex; align-items: center; gap: 8px; padding: 8px 10px; margin-bottom: 6px; border-radius: 8px; border-left: 4px solid; background: #fafbfc; cursor: grab; user-select: none; transition: all .12s; font-size: 12px; }
.ed-chip:hover { background: white; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.ed-chip:active { cursor: grabbing; }
.ed-chip .hrs { margin-left: auto; font-weight: 700; color: var(--zy-muted); font-size: 11px; }
.ed-chip.depleted { opacity: .4; cursor: not-allowed; }

.ed-grid { display: grid; grid-template-columns: 60px repeat(6, 1fr); gap: 4px; background: white; border: 1px solid var(--zy-border); border-radius: 12px; padding: 10px; }
.ed-grid .h { padding: 10px 6px; font-size: 11px; font-weight: 600; color: var(--zy-muted); text-align: center; text-transform: uppercase; letter-spacing: .4px; background: #f6f9fc; border-radius: 6px; }
.ed-grid .p { padding: 10px 4px; text-align: center; font-size: 11px; font-weight: 600; color: var(--zy-muted); }
.ed-grid .p b { display: block; font-size: 14px; color: var(--zy-heading); }
.ed-slot { position: relative; padding: 8px 8px 10px; border-radius: 6px; background: #fafbfc; border: 1px dashed var(--zy-border); min-height: 56px; font-size: 11px; cursor: pointer; transition: all .1s; border-left-width: 4px; }
.ed-slot:hover { background: white; border-style: solid; border-color: var(--zy-primary); }
.ed-slot.has { background: white; border-style: solid; border: 1px solid var(--zy-border-2); border-left: 4px solid; cursor: grab; }
.ed-slot.has:hover { box-shadow: 0 4px 10px rgba(0,0,0,0.08); }
.ed-slot.conflict { background: rgba(239,95,95,0.08); border: 1px solid var(--zy-danger); border-left: 4px solid var(--zy-danger); animation: zyShake .4s; }
.ed-slot.warn  { background: rgba(249,185,49,0.06); border: 1px dashed var(--zy-warning); }
.ed-slot.drop-target { background: rgba(var(--zy-primary-rgb), 0.1); border: 2px dashed var(--zy-primary); }
.ed-slot .s-name { font-weight: 700; color: var(--zy-heading); font-size: 11px; }
.ed-slot .s-t    { color: var(--zy-muted); font-size: 10px; margin-top: 2px; }
.ed-slot .s-r    { position: absolute; top: 6px; right: 6px; font-size: 9px; font-weight: 700; color: var(--zy-muted); background: var(--zy-bg); padding: 1px 5px; border-radius: 3px; }
.ed-slot .lock   { position: absolute; bottom: 4px; right: 6px; font-size: 10px; color: var(--zy-muted); }
@keyframes zyShake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-2px)} 75%{transform:translateX(2px)} }

/* Conflict panel */
.conflict-panel { background: white; border: 1px solid var(--zy-border); border-radius: 12px; overflow: hidden; }
.conflict-panel .hd { padding: 12px 16px; background: linear-gradient(90deg, rgba(239,95,95,0.04), transparent); border-bottom: 1px solid var(--zy-border-2); display: flex; align-items: center; gap: 10px; }
.conf-row { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--zy-border-2); align-items: flex-start; cursor: pointer; transition: background .1s; }
.conf-row:hover { background: #fafbfc; }
.conf-row:last-child { border-bottom: none; }
.conf-sev { flex: 0 0 6px; align-self: stretch; border-radius: 3px; }
.conf-sev.error { background: var(--zy-danger); }
.conf-sev.warn  { background: var(--zy-warning); }
.conf-sev.info  { background: var(--zy-primary); }
.conf-msg { flex: 1; font-size: 13px; color: var(--zy-heading); font-weight: 500; }
.conf-where { font-size: 11px; color: var(--zy-muted); margin-top: 2px; font-weight: 400; }
.conf-fix { font-size: 11px; color: var(--zy-primary); margin-top: 4px; font-weight: 600; }

/* Heatmap (teachers/rooms load) */
.tl-heatmap { display: grid; grid-template-columns: 140px repeat(10, 1fr); gap: 3px; }
.tl-heatmap .tl-l { padding: 6px 8px; font-size: 12px; color: var(--zy-heading); font-weight: 500; text-align: right; }
.tl-h-cell { height: 22px; border-radius: 4px; position: relative; cursor: pointer; font-size: 10px; color: white; display: flex; align-items: center; justify-content: center; font-weight: 600; }
.tl-h-cell.l0 { background: #f3f4f6; color: #9ca3af; }
.tl-h-cell.l1 { background: rgba(var(--zy-primary-rgb),0.25); color: var(--zy-heading); }
.tl-h-cell.l2 { background: rgba(var(--zy-primary-rgb),0.45); color: var(--zy-heading); }
.tl-h-cell.l3 { background: rgba(var(--zy-primary-rgb),0.7); color: white; }
.tl-h-cell.l4 { background: var(--zy-primary); color: white; }
.tl-h-cell.over { background: var(--zy-danger); }

/* Version history */
.vh-row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--zy-border-2); }
.vh-row:last-child { border-bottom: none; }
.vh-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--zy-primary); flex: 0 0 10px; margin-top: 4px; }
.vh-dot.pub { background: var(--zy-success); box-shadow: 0 0 0 3px rgba(34,197,94,0.2); }
.vh-dot.arc { background: var(--zy-border); }

/* Substitution cards */
.sub-card { background: white; border: 1px solid var(--zy-border); border-radius: 12px; padding: 16px; border-left: 4px solid var(--zy-warning); }
.sub-card.done { border-left-color: var(--zy-success); }
.sub-card.needs { border-left-color: var(--zy-danger); }
.sugg-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--zy-bg); border-radius: 8px; margin-top: 8px; }
.conf-bar { width: 80px; height: 6px; background: #e5e7eb; border-radius: 3px; overflow: hidden; }
.conf-bar > div { height: 100%; background: var(--zy-success); }

/* Export cards */
.exp-card { background: white; border: 1px solid var(--zy-border); border-radius: 12px; padding: 22px; text-align: center; cursor: pointer; transition: all .15s; }
.exp-card:hover { border-color: var(--zy-primary); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(var(--zy-primary-rgb),0.1); }
.exp-card .ic-lg { width: 56px; height: 56px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 26px; margin: 0 auto 12px; color: white; }

/* Utility */
.ttc-tabs { display: inline-flex; background: white; border: 1px solid var(--zy-border); border-radius: 8px; padding: 3px; gap: 2px; }
.ttc-tabs button { border: none; background: transparent; padding: 6px 14px; border-radius: 6px; font-size: 12px; font-weight: 600; color: var(--zy-muted); cursor: pointer; transition: all .15s; font-family: inherit; }
.ttc-tabs button.active { background: var(--zy-primary); color: white; }
