/* kursyo.net ERP — clean product UI */
:root {
  --ink: #0f172a;
  --ink-2: #1e293b;
  --ink-3: #334155;
  --teal: #0f766e;
  --teal-bright: #14b8a6;
  --teal-soft: #ccfbf1;
  --sand: #f1f5f9;
  --paper: #f8fafc;
  --line: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --warn: #d97706;
  --warn-bg: #fffbeb;
  --ok: #059669;
  --ok-bg: #ecfdf5;
  --info: #0284c7;
  --info-bg: #f0f9ff;
  --amber: #d97706;
  --amber-bg: #fffbeb;
  --radius: 12px;
  --shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
  --sidebar-w: 256px;
  --font-display: "IBM Plex Sans", system-ui, sans-serif;
  --font-body: "IBM Plex Sans", system-ui, sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--text);
  background: #fff;
}
body.app-body {
  background: #eef2f6;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--ink-2); text-decoration: underline; }

/* Shell */
.app-shell { display: flex; min-height: 100vh; background: #eef2f6; }
.app-shell--solo .topbar__menu-btn { display: none !important; }
.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: #eef2f6;
  transition: all 0.22s ease;
}
html.dark body.app-body,
html.dark .app-shell,
html.dark .app-main,
html.dark .content {
  background: #0b1120 !important;
  color: #e2e8f0;
}
.content {
  padding: 1.5rem 1.75rem 2.75rem;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: #0f172a;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  border-right: 1px solid #1e293b;
  z-index: 40;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE / Edge */
  transition: margin-left 0.22s ease, transform 0.22s ease;
}
@media (min-width: 961px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
  }
  .app-main {
    margin-left: var(--sidebar-w);
  }
  body.sidebar-collapsed .sidebar {
    margin-left: calc(-1 * var(--sidebar-w));
    visibility: hidden;
    pointer-events: none;
  }
  body.sidebar-collapsed .app-main {
    margin-left: 0;
  }
  html[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
  }
  html[dir="rtl"] .app-main {
    margin-left: 0;
    margin-right: var(--sidebar-w);
  }
  html[dir="rtl"] body.sidebar-collapsed .app-main {
    margin-right: 0;
  }
}
.sidebar::-webkit-scrollbar,
.sidebar *::-webkit-scrollbar {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

.sidebar__brand { padding: 1.35rem 1.25rem 1rem; }
.sidebar__logo {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-body);
  font-size: 1.35rem;
  font-weight: 700;
  color: #f8fafc;
  text-decoration: none;
  letter-spacing: -0.02em;
}
.sidebar__logo:hover,
.sidebar__logo:focus-visible {
  color: #ffffff;
  text-decoration: none;
  text-shadow: none;
}
.sidebar__logo-mark {
  width: 30px;
  height: 30px;
  margin-right: 0.55rem;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(14, 165, 233, 0.28));
  transition: transform 0.15s ease;
}
.sidebar__logo:hover .sidebar__logo-mark,
.sidebar__logo:focus-visible .sidebar__logo-mark { transform: scale(1.06); }
.sidebar__logo span {
  color: #2dd4bf;
  font-style: normal;
  font-family: inherit;
  font-weight: 700;
  font-size: 1em;
}
.sidebar__logo:hover span,
.sidebar__logo:focus-visible span {
  color: #5eead4;
}
.sidebar__tag {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  text-transform: none;
  color: #94a3b8;
  font-weight: 600;
  line-height: 1.3;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar__nav { padding: 0.15rem 0.65rem 1.5rem; }
.sidebar__list { list-style: none; margin: 0; padding: 0.15rem 0 0.45rem; }

.nav-group {
  margin: 0 0 0.35rem;
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid transparent;
}
.nav-group[open] {
  border-color: rgba(20, 184, 166, 0.12);
  background: rgba(255,255,255,0.04);
}
.nav-group__summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.7rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7fa0b2;
  user-select: none;
}
.nav-group__summary::-webkit-details-marker { display: none; }
.nav-group__summary .nav-ico {
  width: 14px;
  height: 14px;
  opacity: 0.7;
  transition: transform 0.18s ease;
}
.nav-group[open] > .nav-group__summary .nav-ico { transform: rotate(180deg); color: var(--teal-bright); }
.nav-group__summary:hover { color: #d7e8ef; }

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.7rem;
  margin: 0 0.15rem 0.1rem;
  border-radius: 8px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: background 0.12s ease, color 0.12s ease;
}
.sidebar__link:hover {
  background: #1e293b;
  color: #f1f5f9;
  transform: none;
}
.sidebar__link.is-active {
  background: rgba(20, 184, 166, 0.18);
  color: #f8fafc;
  box-shadow: inset 3px 0 0 var(--teal-bright);
}
.nav-ico {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.9;
}
.sidebar__link.is-active .nav-ico { color: var(--teal-bright); }

.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(6, 20, 31, 0.45);
  z-index: 35;
}

/* Collapsible form sections */
.form-section {
  margin: 0 0 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}
.form-section > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.75rem 1rem;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--ink-2);
  background: linear-gradient(180deg, #f8fcfb, #f2f8f6);
  border-bottom: 1px solid transparent;
  user-select: none;
}
.form-section > summary::-webkit-details-marker { display: none; }
.form-section > summary::after {
  content: "▾";
  float: right;
  color: var(--muted);
  transition: transform 0.15s ease;
}
.form-section:not([open]) > summary::after { transform: rotate(-90deg); }
.form-section[open] > summary { border-bottom-color: var(--line); }
.form-section .form-grid { padding: 0.95rem 1rem 1rem; }

.perm-grid { display: grid; gap: 0.65rem; }
.perm-module {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fcfb;
}
.perm-module > summary {
  list-style: none;
  cursor: pointer;
  padding: 0.55rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.perm-module > summary::-webkit-details-marker { display: none; }
.perm-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.35rem 0.75rem;
  padding: 0 0.75rem 0.75rem;
}
.check-inline {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.84rem;
  color: var(--text);
}

.field-hint {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.72rem;
  color: var(--muted);
}

.material-picker {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.85rem 1rem 1rem;
  max-height: 280px;
  overflow: auto;
}
.material-picker[hidden],
.material-picker__row[hidden],
.material-picker__row.is-hidden {
  display: none !important;
}
.material-picker__head {
  display: grid;
  grid-template-columns: auto 1fr 96px 110px 72px;
  gap: 0.65rem;
  align-items: center;
  padding: 0 0.65rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.material-picker__row {
  display: grid;
  grid-template-columns: auto 1fr 72px;
  gap: 0.65rem;
  align-items: center;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}
.material-picker--stock .material-picker__row {
  grid-template-columns: auto 1fr 96px 110px 72px;
}
.material-picker__row:has(.material-check:checked) {
  border-color: color-mix(in srgb, var(--teal) 45%, transparent);
  background: rgba(20, 184, 166, 0.06);
}
.material-picker__row.is-out {
  opacity: 0.55;
  cursor: not-allowed;
}
.material-picker__name {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-size: 0.88rem;
  font-weight: 500;
  min-width: 0;
}
.material-picker__name small {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.72rem;
}
.material-picker .material-qty,
.material-picker .material-ro {
  width: 100%;
  padding: 0.35rem 0.4rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  font: inherit;
  font-size: 0.85rem;
}
.material-picker .material-ro {
  background: #f1f5f9;
  color: var(--ink);
  cursor: default;
  text-align: right;
}
.material-picker .material-qty {
  text-align: center;
}

.stat-card.inst--paid {
  background: color-mix(in srgb, var(--ok-bg) 85%, #fff);
}
.stat-card.inst--partial {
  background: color-mix(in srgb, #fef3c7 80%, #fff);
}
.stat-card.inst--unpaid {
  background: color-mix(in srgb, var(--danger-bg) 85%, #fff);
}
html.dark .stat-card.inst--paid {
  background: rgba(16, 185, 129, 0.16);
  color: #d1fae5;
}
html.dark .stat-card.inst--partial {
  background: rgba(245, 158, 11, 0.16);
  color: #fde68a;
}
html.dark .stat-card.inst--unpaid {
  background: rgba(244, 63, 94, 0.18);
  color: #fecdd3;
}
tr.inst--cancelled { opacity: 0.65; }
.pay-model {
  display: inline-block;
  white-space: nowrap;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: #f1f5f9;
  color: #334155;
}
html.dark .pay-model {
  background: #1e293b;
  color: #e2e8f0;
  border: 1px solid #334155;
}

.badge-inst {
  border: 0;
  font-weight: 600;
}
.badge-inst.inst--paid { background: #dcfce7; color: #166534; }
.badge-inst.inst--partial { background: #fef3c7; color: #92400e; }
.badge-inst.inst--unpaid { background: #fee2e2; color: #991b1b; }
.badge-inst.inst--cancelled { background: #e2e8f0; color: #475569; }

.kanban {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.75rem;
  overflow-x: auto;
  margin-top: 0.5rem;
}
.kanban__col {
  background: rgba(255,255,255,0.72);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.55rem;
  min-height: 280px;
}
.kanban__head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0.4rem 0.65rem;
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.kanban__card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem;
  margin-bottom: 0.45rem;
  box-shadow: 0 4px 14px rgba(6,20,31,0.04);
}
.kanban__card strong { display: block; font-size: 0.88rem; }
.kanban__card p { margin: 0.25rem 0 0.5rem; font-size: 0.78rem; color: var(--muted); }
.kanban__move select {
  width: 100%;
  font: inherit;
  font-size: 0.75rem;
  padding: 0.3rem 0.4rem;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.5rem;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 80;
  overflow: visible;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}
.topbar__main-row { display: contents; }
.topbar__left {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  order: 1;
  flex-shrink: 0;
}
.topbar__center {
  display: flex;
  align-items: center;
  justify-content: center;
  order: 2;
  flex: 1;
  max-width: 420px;
  margin: 0 auto;
}
.topbar__sub-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  order: 3;
  margin-left: auto;
}
.topbar__primary-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  order: 4;
}
.topbar__primary-actions::before {
  content: "";
  display: block;
  width: 1px;
  height: 20px;
  background: var(--line, #e2e8f0);
  margin-right: 4px;
}
html.dark .topbar__primary-actions::before {
  background: #334155;
}
.topbar__sub-left, .topbar__sub-right { display: flex; align-items: center; gap: 0.5rem; }
.topbar__right { display: flex; align-items: center; gap: 0.75rem; }
.topbar__company { display: flex; flex-direction: column; line-height: 1.2; }
.topbar__company-name { font-weight: 600; font-size: 0.95rem; }
.topbar__user { font-size: 0.75rem; color: var(--muted); }
.topbar__menu-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: 8px;
  cursor: pointer;
  background: transparent;
  color: var(--ink-2, #334155);
  border: 1px solid transparent;
  transition: all 0.15s ease;
}
.topbar__menu-btn:hover {
  background: #f1f5f9;
  color: var(--teal, #0d9488);
  border-color: #cbd5e1;
}
.topbar__menu-btn:active {
  background: #e2e8f0;
}

.impersonation-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1.5rem;
  background: linear-gradient(90deg, #fef3c7, #ffedd5);
  color: #92400e;
  border-bottom: 1px solid #fcd34d;
  font-size: 0.88rem;
}

.topbar__center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.monitor-mode-box {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 9999px;
  padding: 4px 12px 4px 6px;
  box-shadow: 0 1px 4px rgba(217, 119, 6, 0.15);
  animation: fadeIn 0.2s ease-in-out;
}
.monitor-mode-box__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: #f59e0b;
  border-radius: 50%;
  font-size: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}
.monitor-mode-box__text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: #92400e;
}
.monitor-mode-box__tag {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  color: #b45309;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 4px;
}
.monitor-mode-box__title {
  color: #78350f;
  font-size: 0.82rem;
}
.monitor-mode-box__form {
  margin: 0;
  display: inline-flex;
}
.monitor-mode-box__exit-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #d97706;
  color: #fff;
  border: none;
  padding: 4px 11px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}
.monitor-mode-box__exit-btn:hover {
  background: #b45309;
  transform: translateY(-1px);
}

/* Page chrome */
.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.35rem;
  padding: 1.25rem 1.4rem;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-left: 4px solid var(--teal);
}
.page-head h1 {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1.65rem;
  font-weight: 700;
  font-style: normal;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.page-head p { margin: 0.35rem 0 0; color: var(--muted); max-width: 48rem; font-size: 0.95rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: 0.55rem; }

/* Panels */
.panel,
.glass-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 1.35rem 1.45rem;
  margin-bottom: 1.25rem;
  position: relative;
  overflow: hidden;
  min-height: 8rem;
}
.panel::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: var(--teal);
  opacity: 1;
}
.panel--accent-green { background: linear-gradient(180deg, #f0fdf4 0%, #fff 42%); }
.panel--accent-green::before { background: #16a34a; }
.panel--accent-teal { background: linear-gradient(180deg, #f0fdfa 0%, #fff 42%); }
.panel--accent-teal::before { background: #0d9488; }
.panel--accent-blue { background: linear-gradient(180deg, #eff6ff 0%, #fff 42%); }
.panel--accent-blue::before { background: #2563eb; }
.panel--accent-amber { background: linear-gradient(180deg, #fffbeb 0%, #fff 42%); }
.panel--accent-amber::before { background: #d97706; }
.panel--accent-rose { background: linear-gradient(180deg, #fff1f2 0%, #fff 42%); }
.panel--accent-rose::before { background: #e11d48; }
.panel__title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}
.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.panel__link {
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--teal);
}
.panel__link:hover { color: var(--ink-2); }

.table-wrap {
  overflow-x: auto;
  margin-bottom: 1.25rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 0.35rem 0.5rem;
}
.table-wrap.staff-fit {
  overflow-x: hidden;
}
.staff-fit-table {
  min-width: 0 !important;
  table-layout: fixed;
  width: 100%;
}
.staff-fit-table th,
.staff-fit-table td {
  white-space: normal !important;
  padding: 0.4rem 0.28rem !important;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-size: 0.74rem;
  vertical-align: middle;
}
.staff-fit-table .staff-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 3px;
  max-width: 100%;
}
.staff-fit-table .staff-actions .btn,
.staff-fit-table .staff-actions a.btn {
  padding: 3px 6px;
  font-size: 0.72rem;
  border-radius: 6px;
  line-height: 1.2;
}
.staff-fit-table .staff-actions .btn-open-leave {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fcd34d;
  font-weight: 700;
}
.staff-fit-table .staff-actions .btn-open-pay {
  background: #059669;
  color: #fff;
  font-weight: 700;
}
.staff-fit-table .staff-actions .btn:disabled {
  background: #e2e8f0;
  color: #64748b;
  border: 1px solid #cbd5e1;
  cursor: not-allowed;
}
.staff-fit-table .staff-actions form {
  margin: 0;
  display: inline-flex;
}
.staff-fit-table .staff-del {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fecaca;
  font-weight: 700;
}
table.data {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
  font-size: 0.92rem;
}
table.data th,
table.data td {
  text-align: left;
  padding: 0.95rem 0.85rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
table.data th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
  background: #f8fafc;
}
table.data tbody tr:hover { background: rgba(15, 118, 110, 0.04); }
table.data tbody tr:last-child td { border-bottom: 0; }

.empty-state {
  padding: 1.5rem;
  color: var(--muted);
  border: 1px dashed color-mix(in srgb, var(--teal) 35%, transparent);
  border-radius: var(--radius);
  background: #f8fafc;
}

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.85rem 1rem;
}
.form-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem 1rem;
  width: 100%;
}
.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field--full { grid-column: 1 / -1; }
.field label { font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.field input,
.field select,
.field textarea,
.select {
  font: inherit;
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--ink-3) 22%, transparent);
  background: #fff;
  color: var(--text);
}
.field input:focus,
.field select:focus,
.field textarea:focus,
.select:focus {
  outline: 2px solid color-mix(in srgb, var(--teal-bright) 55%, transparent);
  border-color: var(--teal);
}
.select--sm { padding: 0.4rem 0.55rem; font-size: 0.85rem; }
.checkbox-row {
  display: flex; flex-wrap: wrap; gap: 0.65rem 1rem;
  padding-top: 0.35rem;
}
.checkbox-row label { display: flex; align-items: center; gap: 0.35rem; font-size: 0.88rem; }
.form-actions {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}
.hint { font-size: 0.78rem; color: var(--muted); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  font: inherit; font-weight: 600; font-size: 0.9rem;
  padding: 0.65rem 1.15rem;
  border-radius: 9px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  background: var(--teal);
  color: #fff;
  box-shadow: none;
  transition: background 0.12s ease;
  position: static;
  overflow: visible;
}
.btn::after { display: none; }
.btn:hover {
  background: #0d9488;
  color: #fff;
  transform: none;
  filter: none;
  box-shadow: none;
  text-decoration: none;
}
.btn:active { background: #0f766e; }
.btn--secondary {
  background: #fff;
  color: var(--ink-2);
  border-color: var(--line);
}
.btn--secondary:hover { background: var(--sand); color: var(--ink); }
.btn--ghost {
  background: transparent;
  color: var(--ink-2);
  border-color: transparent;
}
.btn--danger,
.btn[style*="background: #fee2e2" i],
.btn[style*="background:#fee2e2" i],
.btn[style*="background: #fef2f2" i],
.btn[style*="background:#fef2f2" i],
.btn[style*="background: #fecaca" i],
.btn[style*="background:#fecaca" i],
button[style*="background: #fee2e2" i],
button[style*="background:#fee2e2" i],
button[style*="background: #fef2f2" i],
button[style*="background:#fef2f2" i] {
  background: #dc2626 !important;
  color: #fff !important;
  border-color: #991b1b !important;
}
.btn--danger:hover,
.btn[style*="background: #fee2e2" i]:hover,
.btn[style*="background:#fee2e2" i]:hover,
.btn[style*="background: #fef2f2" i]:hover,
.btn[style*="background:#fef2f2" i]:hover,
.btn[style*="background: #fecaca" i]:hover,
.btn[style*="background:#fecaca" i]:hover {
  background: #b91c1c !important;
  color: #fff !important;
}
.btn--sm { padding: 0.35rem 0.65rem; font-size: 0.8rem; }
.btn--icon { width: 2.25rem; height: 2.25rem; padding: 0; }
.inline-form { display: inline; margin: 0; }

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: var(--sand);
  color: var(--ink-3);
}
.badge--alert { background: #fecaca; color: #7f1d1d; border: 1px solid #f87171; }
.badge--warn { background: var(--warn-bg); color: var(--warn); }
.badge--ok { background: var(--ok-bg); color: var(--ok); }
.badge--info { background: var(--info-bg); color: var(--info); }

/* Flash */
.flash-stack { display: grid; gap: 0.5rem; margin-bottom: 1rem; }
.kursco-field-alert {
  position: fixed;
  z-index: 240;
  max-width: min(280px, calc(100vw - 24px));
  padding: 0.55rem 0.75rem;
  border-radius: 12px;
  background: #0F4C3A;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 650;
  line-height: 1.35;
  box-shadow: 0 12px 28px rgba(15, 76, 58, 0.35);
  pointer-events: none;
}
.kursco-field-alert::before {
  content: "";
  position: absolute;
  left: 14px;
  border: 7px solid transparent;
}
.kursco-field-alert.is-below::before {
  top: -7px;
  border-top: 0;
  border-bottom-color: #0F4C3A;
}
.kursco-field-alert.is-above::before {
  bottom: -7px;
  border-bottom: 0;
  border-top-color: #0F4C3A;
}
input.kursco-field-alert-target,
select.kursco-field-alert-target,
textarea.kursco-field-alert-target {
  border-color: #0F4C3A !important;
  box-shadow: 0 0 0 3px rgba(15, 76, 58, 0.22) !important;
}
.flash {
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-size: 0.9rem;
  border: 1px solid transparent;
}
.flash--success { background: var(--ok-bg); color: var(--ok); border-color: #abefc6; }
.flash--error { background: var(--danger-bg); color: var(--danger); border-color: #fecdca; }
.flash--warning { background: var(--warn-bg); color: var(--warn); border-color: #fedf89; }
.flash--info { background: var(--info-bg); color: var(--info); border-color: #b2e0f5; }

/* Metrics */
.metric-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}
.metric {
  padding: 1rem 1.1rem;
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(255,255,255,0.9), rgba(204,251,241,0.45));
  border: 1px solid var(--line);
}
.metric__label { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.metric__value {
  font-family: var(--font-display);
  font-size: 1.55rem;
  margin-top: 0.25rem;
  color: var(--ink);
}

/* Modal (JS only — no :target / no-js fallback) */
html.kursco-scroll-lock,
html.kursco-scroll-lock body {
  overflow: hidden !important;
  overscroll-behavior: none;
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal.is-open,
.modal[open] {
  display: flex;
}
.modal[hidden] { display: none !important; }
.modal.is-open[hidden] { display: flex !important; }
.modal__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
  background: rgba(6, 20, 31, 0.55);
}
.modal__panel {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: min(90vh, 900px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.28);
  border: 1px solid var(--line);
  animation: modalIn 0.22s ease;
}
.modal--lg .modal__panel { width: min(760px, 100%); }
.modal--xl .modal__panel { width: min(960px, 100%); }
.modal__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem 1.15rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0; background: #fff; z-index: 1;
}
.modal__title { margin: 0; font-size: 1.15rem; font-family: var(--font-display); color: var(--ink); }
.modal__close {
  font-size: 1.45rem; line-height: 1;
  text-decoration: none; color: var(--muted);
  width: 2.1rem; height: 2.1rem; display: grid; place-items: center;
  border-radius: 10px; border: 0; background: transparent; cursor: pointer;
  flex-shrink: 0;
}
.modal__close:hover { background: #f1f5f9; color: var(--ink); }
.modal__body {
  padding: 1.15rem;
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.modal__footer,
.modal .form-actions,
.modal footer {
  flex-shrink: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  margin-top: 1.5rem;
  padding: 0.5rem 0 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  justify-content: flex-end;
}
.modal .panel::before { display: none; }
.modal form.panel,
.modal .panel {
  box-shadow: none;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.btn-ico {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.lang-switch { margin: 0; position: relative; z-index: 50; }
.lang-switch__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  cursor: pointer;
  font: inherit;
}
.lang-switch__code { font-weight: 700; font-size: 0.82rem; }
.lang-switch__chev {
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.55;
  margin-inline-start: 0.1rem;
}
.lang-switch__menu {
  position: fixed;
  z-index: 100000;
  min-width: 11rem;
  padding: 0.3rem;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.16);
}
.lang-switch__menu[hidden] { display: none !important; }
.lang-switch__item-form { margin: 0; }
.lang-switch__item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  text-align: start;
}
.lang-switch__item:hover { background: rgba(20, 184, 166, 0.12); }
.lang-switch__item.is-active {
  background: var(--teal);
  color: #ecfffb;
}
.lang-switch__name {
  font-size: 0.78rem;
  opacity: 0.85;
  margin-inline-start: auto;
}

html[dir="rtl"] .sidebar { border-right: 0; border-left: 1px solid rgba(20, 184, 166, 0.15); }
html[dir="rtl"] .panel::before { left: auto; right: 0; }
html[dir="rtl"] .sidebar__link.is-active {
  box-shadow: inset -3px 0 0 var(--teal-bright);
}

/* Availability grid */
.week-grid {
  display: grid;
  grid-template-columns: 72px repeat(7, minmax(0, 1fr));
  gap: 2px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 1.25rem;
}
.week-grid__cell {
  background: #fff;
  min-height: 52px;
  padding: 0.35rem;
  font-size: 0.75rem;
}
.week-grid__head { background: var(--ink-2); color: #d7e8ef; font-weight: 600; text-align: center; }
.week-grid__time { background: var(--sand); color: var(--muted); font-weight: 600; }
.week-grid__slot { background: color-mix(in srgb, var(--teal-bright) 22%, #fff); cursor: pointer; }
.week-grid__slot.is-busy { background: color-mix(in srgb, var(--amber) 35%, #fff); }

/* Kanban */
.kanban {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.85rem;
  align-items: start;
}
.kanban__col {
  background: rgba(255,255,255,0.55);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem;
  min-height: 220px;
}
.kanban__col h3 {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.kanban__card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem;
  margin-bottom: 0.55rem;
  box-shadow: 0 6px 16px rgba(6,20,31,0.05);
}
.kanban__card strong { display: block; margin-bottom: 0.25rem; }
.kanban__card p { margin: 0; font-size: 0.8rem; color: var(--muted); }

/* Permission matrix */
.perm-matrix { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.perm-matrix th, .perm-matrix td {
  border: 1px solid var(--line);
  padding: 0.45rem 0.5rem;
  text-align: center;
}
.perm-matrix th:first-child,
.perm-matrix td:first-child { text-align: left; }
.perm-matrix thead th { background: var(--ink-2); color: #e8f4f1; font-weight: 500; }

/* Contract live calc */
.live-calc {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.65rem;
  padding: 0.85rem;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--ink-2), #0f3d4a);
  color: #e8f4f1;
  margin-top: 0.75rem;
}
.live-calc strong { display: block; font-family: var(--font-display); font-size: 1.2rem; }
.live-calc span { font-size: 0.72rem; opacity: 0.75; }

/* Finance student card */
.finance-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.finance-card__item {
  padding: 0.85rem;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
}
.finance-card__item strong {
  display: block;
  white-space: nowrap !important;
  word-break: keep-all !important;
}
.finance-card__item.is-overdue { border-color: #fecdca; background: var(--danger-bg); }

/* Login */
.login-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: #0f172a;
  color: #e2e8f0;
  font-family: var(--font-body);
}
.login-shell {
  width: min(400px, 100%);
  padding: 2rem 1.75rem;
  border-radius: 12px;
  background: #1e293b;
  border: 1px solid #334155;
  box-shadow: none;
}
.login-shell .brand {
  font-family: var(--font-body);
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 0.25rem;
  letter-spacing: -0.03em;
}
.login-shell .brand span { color: var(--teal-bright); }
.login-shell .login-mark {
  display: block;
  width: 56px;
  height: 56px;
  margin: 0 0 0.9rem;
  filter: drop-shadow(0 4px 14px rgba(14, 165, 233, 0.3));
}
.login-shell .sub { color: #8aa8b8; margin: 0 0 1.6rem; }
.login-shell label { display: block; font-size: 0.8rem; color: #8aa8b8; margin-bottom: 0.3rem; }
.login-shell input {
  width: 100%;
  margin-bottom: 0.95rem;
  padding: 0.75rem 0.9rem;
  border-radius: 10px;
  border: 1px solid #2a4558;
  background: #0a1824;
  color: #e8f4f1;
  font: inherit;
  font-size: 16px;
}
.login-shell input:focus {
  outline: 2px solid color-mix(in srgb, var(--teal-bright) 55%, transparent);
  border-color: var(--teal-bright);
}
.login-shell button {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.85rem;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(135deg, var(--teal-bright), #0f766e);
  color: #042f2e;
}
.login-shell .demo-hint {
  margin-top: 1rem;
  font-size: 0.78rem;
  color: #7a96a8;
  text-align: center;
}

/* Responsive */
@media (max-width: 960px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    margin-left: 0 !important;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    z-index: 50;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  }
  .sidebar.is-open {
    transform: translateX(0);
    visibility: visible !important;
    pointer-events: auto !important;
  }
  .sidebar-backdrop {
    position: fixed; inset: 0;
    background: rgba(6, 20, 31, 0.45);
    z-index: 45;
    display: none;
  }
  .sidebar-backdrop.is-visible { display: block !important; }
  .topbar__menu-btn { display: inline-flex !important; }
  .form-grid--2 { grid-template-columns: 1fr; }
  .week-grid { grid-template-columns: 56px repeat(7, minmax(64px, 1fr)); overflow-x: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Dashboard / generic panels */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.1rem;
}
.stat-grid--dash {
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  margin-bottom: 1.65rem;
  gap: 1.15rem;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.35rem 1.4rem 1.45rem;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: block;
  min-height: 7.5rem;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.stat-card::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  background: #94a3b8;
}
.stat-card--link:hover {
  transform: none;
  border-color: #cbd5e1;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}
.stat-card__top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
}
.stat-card__icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: #ecfdf5;
  color: #0f766e;
}
.stat-card__icon .tile-ico { width: 22px; height: 22px; }
.stat-card__label {
  display: block;
  font-size: 0.84rem;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.3;
}
.stat-card__value {
  display: block;
  font-size: clamp(1.15rem, 1.8vw, 1.55rem);
  font-family: var(--font-body);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  white-space: nowrap !important;
  word-break: keep-all !important;
}
.stat-card--teal {
  background: #f0fdfa;
  border-color: #99f6e4;
}
.stat-card--teal::before { background: #0d9488; }
.stat-card--teal .stat-card__icon { background: #ccfbf1; color: #0f766e; }
.stat-card--green {
  background: #f0fdf4;
  border-color: #86efac;
}
.stat-card--green::before { background: #16a34a; }
.stat-card--green .stat-card__icon { background: #dcfce7; color: #15803d; }
.stat-card--blue {
  background: #eff6ff;
  border-color: #93c5fd;
}
.stat-card--blue::before { background: #2563eb; }
.stat-card--blue .stat-card__icon { background: #dbeafe; color: #1d4ed8; }
.stat-card--amber {
  background: #fffbeb;
  border-color: #fcd34d;
}
.stat-card--amber::before { background: #d97706; }
.stat-card--amber .stat-card__icon { background: #fef3c7; color: #b45309; }
.stat-card--rose {
  background: #fff1f2;
  border-color: #fda4af;
}
.stat-card--rose::before { background: #e11d48; }
.stat-card--rose .stat-card__icon { background: #ffe4e6; color: #be123c; }
.stat-card--violet {
  background: #f5f3ff;
  border-color: #c4b5fd;
}
.stat-card--violet::before { background: #7c3aed; }
.stat-card--violet .stat-card__icon { background: #ede9fe; color: #6d28d9; }

/* Keep installment tint cards readable */
tr.inst--paid .stat-card__value,
.stat-card.inst--paid .stat-card__value { color: #166534; }

.dash-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1.35rem;
  padding: 1.6rem 1.75rem;
  border-radius: 12px;
  background: linear-gradient(115deg, #0f172a 0%, #134e4a 55%, #0f766e 100%);
  color: #e2e8f0;
  box-shadow: var(--shadow);
  border: 0;
  min-height: 7.5rem;
}
.dash-hero::before { display: none !important; animation: none !important; }
.dash-hero__badge {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.18);
  flex-shrink: 0;
  animation: none !important;
}
.dash-hero__eyebrow {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.75;
  font-weight: 600;
}
.dash-hero__title {
  margin: 0.35rem 0 0.35rem;
  font-family: var(--font-body);
  font-size: 1.75rem;
  font-weight: 700;
  font-style: normal;
  letter-spacing: -0.02em;
  color: #f8fafc;
  text-shadow: none;
}
.dash-hero__sub {
  margin: 0;
  font-size: 0.95rem;
  opacity: 0.8;
  max-width: 40rem;
  line-height: 1.45;
}
.dash-hero__badge .tile-ico { width: 26px; height: 26px; color: #5eead4; }
.dash-alerts {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 1.15rem;
}
.dash-alert {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 0.95rem;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
}
.dash-alert__dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.dash-alert--green { background: #ecfdf3; color: #067647; border-color: #a6f4c5; }
.dash-alert--green .dash-alert__dot { background: #12b76a; }
.dash-alert--amber { background: #fffaeb; color: #b54708; border-color: #fec84b; }
.dash-alert--amber .dash-alert__dot { background: #f79009; }
.dash-alert--rose { background: #fef3f2; color: #b42318; border-color: #fecdca; }
.dash-alert--rose .dash-alert__dot { background: #f04438; }
.dash-alert--blue { background: #eff8ff; color: #175cd3; border-color: #b2ddff; }
.dash-alert--blue .dash-alert__dot { background: #2e90fa; }

.dash-section { margin-bottom: 1.75rem; }
.dash-section__head { margin-bottom: 0.95rem; }
.dash-section__head h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
}
.dash-section__head p {
  margin: 0.25rem 0 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.quick-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 1rem;
}
.quick-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1.25rem 1.2rem;
  border-radius: 12px;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line);
  background: #fff;
  min-height: 7.25rem;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.quick-tile:hover {
  transform: none;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
  border-color: #cbd5e1;
  color: var(--ink);
  text-decoration: none;
}
.quick-tile__icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: grid;
  place-items: center;
}
.quick-tile__icon .tile-ico { width: 22px; height: 22px; }
.quick-tile__label { font-size: 0.95rem; font-weight: 650; }
.quick-tile--teal {
  background: #f0fdfa;
  border-color: #99f6e4;
}
.quick-tile--teal .quick-tile__icon { background: #ccfbf1; color: #0f766e; }
.quick-tile--green {
  background: #f0fdf4;
  border-color: #86efac;
}
.quick-tile--green .quick-tile__icon { background: #dcfce7; color: #15803d; }
.quick-tile--blue {
  background: #eff6ff;
  border-color: #93c5fd;
}
.quick-tile--blue .quick-tile__icon { background: #dbeafe; color: #1d4ed8; }
.quick-tile--amber {
  background: #fffbeb;
  border-color: #fcd34d;
}
.quick-tile--amber .quick-tile__icon { background: #fef3c7; color: #b45309; }
.quick-tile--rose {
  background: #fff1f2;
  border-color: #fda4af;
}
.quick-tile--rose .quick-tile__icon { background: #ffe4e6; color: #be123c; }
.quick-tile--violet {
  background: #f5f3ff;
  border-color: #c4b5fd;
}
.quick-tile--violet .quick-tile__icon { background: #ede9fe; color: #6d28d9; }
.quick-tile--teal:hover,
.quick-tile--green:hover,
.quick-tile--blue:hover,
.quick-tile--amber:hover,
.quick-tile--rose:hover,
.quick-tile--violet:hover { border-color: #64748b; }

.dash-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  margin-bottom: 1rem;
}
@media (max-width: 860px) {
  .dash-columns { grid-template-columns: 1fr; }
  .dash-hero__badge { display: none; }
}

.dash-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.dash-list__item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.85rem 0.75rem;
  border-radius: 10px;
  background: rgba(255,255,255,0.65);
  border: 1px solid transparent;
}
.dash-list__item:hover {
  border-color: var(--line);
  background: #fff;
}
.dash-list__icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.dash-list__icon .tile-ico { width: 16px; height: 16px; }
.dash-list__icon--green { background: #dcfce7; color: #15803d; }
.dash-list__icon--teal { background: #ccfbf1; color: #0f766e; }
.dash-list__body { flex: 1; min-width: 0; }
.dash-list__body strong {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
}
.dash-list__body strong a { text-decoration: none; color: inherit; }
.dash-list__body strong a:hover { color: var(--teal); }
.dash-list__body small {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 0.1rem;
}
.dash-list__meta {
  font-weight: 700;
  font-size: 0.9rem;
  color: #15803d;
  white-space: nowrap;
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  background: #e0f2fe;
  color: #075985;
}
.badge--ok { background: #dcfce7; color: #166534; }
.badge--alert { background: #fecaca; color: #7f1d1d; border: 1px solid #f87171; }
.badge--info { background: #e0f2fe; color: #075985; }

.finance-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: end;
  padding: 0.25rem 0;
}
.finance-filter .field {
  min-width: 200px;
  flex: 0 1 240px;
}
.finance-filter .btn {
  margin: 0;
}

.form-actions { grid-column: 1 / -1; }
.inline-form { display: inline; }

.detail-list {
  display: grid;
  grid-template-columns: minmax(120px, 180px) 1fr;
  gap: 0.45rem 1rem;
  margin: 0;
}
.detail-list dt { color: var(--muted, #64748b); font-size: 0.85rem; }
.detail-list dd { margin: 0; }
.code-block {
  margin: 0;
  white-space: pre-wrap;
  font-size: 0.82rem;
  background: #0f1c2e;
  color: #e2e8f0;
  padding: 0.85rem;
  border-radius: 10px;
  overflow: auto;
}

/* Shared surfaces */
.glass-hero { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
.table-wrap {
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 12px;
}
.form-section.glass-panel,
details.form-section {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
  overflow: hidden;
  min-height: 4rem;
}
.panel__sub { margin: 0.2rem 0 0; font-size: 0.8rem; color: var(--muted); }
.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.15rem;
  margin: 1.25rem 0;
}
.chart-panel { margin-bottom: 0; min-height: 18rem; }
.chart-wrap { position: relative; height: 260px; margin-top: 0.5rem; }
.modal__panel {
  background: #fff;
  border: 1px solid var(--line);
  animation: none;
}
@media (max-width: 900px) {
  .chart-grid { grid-template-columns: 1fr; }
}

.lang-switch__menu {
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1);
}

/* Student Profile Hero (Kişisel Bilgiler & Profil Kartı) */
.student-profile-hero {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.03);
  margin-bottom: 1.25rem;
}
.student-profile-hero__inner {
  display: flex;
  gap: 1.75rem;
  align-items: flex-start;
}
.student-profile-hero__avatar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  width: 120px;
}
.student-profile-hero__avatar-wrap {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  overflow: hidden;
  border: 4px solid var(--line);
  background: #f8fafc;
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
}
.student-profile-hero__avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.student-profile-hero__info-col {
  flex: 1 1 auto;
  min-width: 0;
}
.student-profile-hero__head {
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.85rem;
  margin-bottom: 1rem;
}
.student-profile-hero__meta {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.student-profile-hero__name {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--ink);
  word-break: break-word;
}
.student-profile-hero__badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.student-profile-hero__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
}
.student-profile-hero__card {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  min-width: 0;
}
.student-profile-hero__card-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
}
.student-profile-hero__card-val {
  color: var(--ink-2);
  font-size: 0.9rem;
  margin-top: 2px;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Academy / dershane surfaces (coaching) */
.academy-page { display: grid; gap: 1.25rem; }
.academy-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  padding: 1.6rem 1.7rem;
  border-radius: 12px;
  background: linear-gradient(120deg, #0b1f33 0%, #123047 45%, #0f5c56 100%);
  color: #e8f1f5;
  min-height: 8rem;
  border: 1px solid #1e3a4c;
}
.academy-hero__eyebrow {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  color: #5eead4;
}
.academy-hero h1 {
  margin: 0.35rem 0 0.4rem;
  font-size: 1.7rem;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: -0.02em;
}
.academy-hero__copy p:last-child {
  margin: 0;
  max-width: 38rem;
  font-size: 0.95rem;
  line-height: 1.45;
  opacity: 0.85;
}
.academy-stats { margin: 0; }
.academy-board { min-height: 16rem; }
.academy-empty {
  text-align: center;
  padding: 2.5rem 1.5rem;
  border: 1px dashed #99f6e4;
  border-radius: 12px;
  background: #f0fdfa;
}
.academy-empty strong { display: block; font-size: 1.1rem; color: var(--ink); margin-bottom: 0.35rem; }
.academy-empty p { margin: 0 0 1rem; color: var(--muted); }
.academy-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.academy-card {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.15rem 1.2rem;
  min-height: 8.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  border-top: 3px solid #0d9488;
}
.academy-card__people {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.55rem;
  align-items: center;
}
.academy-card__role {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 0.2rem;
}
.academy-card__people strong {
  display: block;
  font-size: 0.98rem;
  color: var(--ink);
}
.academy-card__arrow {
  color: #0d9488;
  font-weight: 700;
  font-size: 1.1rem;
}
.academy-card__meta { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.academy-card__note {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.4;
}
@media (max-width: 640px) {
  .academy-card__people { grid-template-columns: 1fr; }
  .academy-card__arrow { display: none; }
}

.academy-hero--calendar {
  background: linear-gradient(120deg, #0f172a 0%, #1e3a5f 48%, #0f766e 100%);
}
.week-grid--filled {
  min-height: 420px;
  margin-bottom: 0;
}
.week-grid__empty {
  color: #cbd5e1;
  font-size: 0.85rem;
}
.form-grid--dense {
  gap: 1rem 1.15rem;
}
.form-grid--dense .field input,
.form-grid--dense .field select,
.form-grid--dense .field textarea {
  min-height: 2.6rem;
}

.academy-hero--finance {
  background: linear-gradient(120deg, #0b1f33 0%, #134e4a 50%, #115e59 100%);
}
.academy-hero--ops {
  background: linear-gradient(120deg, #1c1917 0%, #292524 48%, #0f766e 100%);
}
.academy-hero--academic {
  background: linear-gradient(120deg, #0c4a6e 0%, #155e75 50%, #0f766e 100%);
}
.academy-hero--mgmt {
  background: linear-gradient(120deg, #1e293b 0%, #334155 45%, #0f766e 100%);
}
.academy-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}
.academy-page > .table-wrap,
.academy-page > .panel {
  min-height: 14rem;
}
.academy-page .table-wrap {
  border-radius: 12px;
}
.academy-list-panel {
  padding: 0;
  overflow: hidden;
}
.academy-list-panel .panel__head {
  padding: 1rem 1.15rem 0.85rem;
}
.academy-list-panel .table-wrap {
  margin: 0;
  border: 0;
  box-shadow: none;
  border-radius: 0;
  background: transparent;
  min-height: 12rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}
.academy-page .form-section {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.35rem 0.5rem;
  margin-bottom: 0.85rem;
}

/* ==========================================================================
   UNIVERSAL RESPONSIVE SYSTEM (Mobile, Tablet, Desktop, Ultra-wide & TV)
   ========================================================================== */

/* --- Global Safe-Area & Touch Defaults --- */
html, body {
  max-width: 100%;
}
html {
  overflow-x: clip;
}
body {
  overflow-x: clip;
}
img, svg, video {
  max-width: 100%;
  height: auto;
}
canvas {
  max-width: 100%;
}
.chart-canvas-wrap {
  position: relative;
  width: 100% !important;
  min-width: 0 !important;
}
.chart-canvas-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

/* Touch Device Target Sizing */
@media (hover: none) and (pointer: coarse) {
  .btn,
  .field select,
  .field input[type="text"],
  .field input[type="email"],
  .field input[type="password"],
  .field input[type="number"],
  .field input[type="date"],
  .field input[type="tel"] {
    min-height: 42px;
  }
  .sidebar__link {
    padding: 0.65rem 0.75rem;
  }
}

/* --- 1. Mobile Screens & Phablets (<= 768px) --- */
@media (max-width: 768px) {
  .app-shell {
    overflow-x: clip;
  }
  .app-main {
    width: 100% !important;
    min-width: 0 !important;
  }
  .content {
    padding: 0.85rem 0.75rem 2.5rem;
    max-width: 100% !important;
  }
  .topbar {
    padding: 0.6rem 0.85rem;
  }
  .topbar__left {
    flex: 1 1 auto;
    min-width: 0;
  }
  .topbar__company-name {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.88rem;
  }
  .topbar-label-text {
    display: none;
  }
  .topbar__btn-new-year-text {
    display: none;
  }
  .academy-hero {
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 1.25rem 1rem !important;
    gap: 1rem !important;
  }
  .academy-hero h1 {
    font-size: 1.35rem !important;
  }
  .academy-hero__actions {
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.45rem !important;
  }
  .academy-hero__actions .btn {
    width: 100% !important;
    justify-content: center !important;
  }
  .stat-grid,
  .academy-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.6rem !important;
  }
  .stat-card {
    padding: 0.75rem 0.85rem !important;
  }
  .stat-card__value {
    font-size: 1.2rem !important;
  }
  .panel__head {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.75rem !important;
  }
  .panel__head form {
    width: 100% !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.45rem !important;
  }
  .panel__head form select,
  .panel__head form input,
  .panel__head form .btn {
    width: 100% !important;
  }
  .table-wrap {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    border-radius: 10px !important;
    margin-bottom: 1rem !important;
  }
  table.data th,
  table.data td {
    padding: 0.55rem 0.6rem !important;
    font-size: 0.8rem !important;
  }
  /* --- Fully Responsive Mobile Modals --- */
  .modal {
    padding: 0 !important;
    align-items: flex-end !important;
    justify-content: center !important;
    overflow-y: hidden !important;
  }
  .modal__backdrop {
    backdrop-filter: blur(2px);
  }
  .modal__panel {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100vw !important;
    height: auto !important;
    max-height: 94dvh !important;
    max-height: 94vh !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 20px 20px 0 0 !important;
    border-bottom: 0 !important;
    border-left: 0 !important;
    border-right: 0 !important;
    overflow: hidden !important;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.28) !important;
    animation: modalSlideUpMobile 0.24s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }
  @keyframes modalSlideUpMobile {
    from { transform: translateY(100%); opacity: 0.4; }
    to { transform: translateY(0); opacity: 1; }
  }
  .modal__header {
    flex-shrink: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.75rem !important;
    padding: 0.85rem 1rem !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 20 !important;
    border-bottom: 1px solid var(--line) !important;
  }
  .modal__title {
    font-size: 1.05rem !important;
    line-height: 1.3 !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    word-break: break-word !important;
  }
  .modal__close {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.5rem !important;
    border-radius: 8px !important;
    flex-shrink: 0 !important;
  }
  .modal__body {
    flex: 1 1 auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
    padding: 1rem 1rem 1.75rem !important;
    max-height: none !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .modal__body form {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
  }
  .modal .form-grid,
  .modal__body .form-grid,
  .modal form .form-grid {
    grid-template-columns: 1fr !important;
    gap: 0.75rem !important;
    width: 100% !important;
    padding: 0 !important;
  }
  .modal .form-section {
    margin-bottom: 0.75rem !important;
    border-radius: 10px !important;
  }
  .modal .form-section > summary {
    padding: 0.65rem 0.85rem !important;
    font-size: 0.88rem !important;
  }
  .modal .form-section .form-grid {
    padding: 0.75rem !important;
  }

  /* Prevent iOS zoom & enhance touch inputs in modals */
  .modal input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
  .modal select,
  .modal textarea,
  .modal .select,
  .modal .input {
    font-size: 16px !important;
    min-height: 42px !important;
    border-radius: 8px !important;
    box-sizing: border-box !important;
  }
  .modal input[type="file"] {
    min-height: auto !important;
    padding: 0.45rem 0.65rem !important;
    font-size: 0.85rem !important;
    border: 1px dashed var(--line) !important;
    background: var(--paper, #f8fafc);
    color: inherit;
    cursor: pointer !important;
    border-radius: 8px !important;
  }
  .modal input[type="date"] {
    min-height: 42px !important;
    -webkit-appearance: none !important;
    appearance: none !important;
  }
  .modal textarea {
    min-height: 72px !important;
  }
  .field-pair {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.65rem 0.75rem !important;
    width: 100% !important;
  }

  /* Student Profile Hero Responsive */
  .student-profile-hero {
    padding: 1rem !important;
  }
  .student-profile-hero__inner {
    flex-direction: column !important;
    align-items: center !important;
    gap: 1rem !important;
  }
  .student-profile-hero__avatar-col {
    width: 100% !important;
    margin-bottom: 0.25rem !important;
  }
  .student-profile-hero__info-col {
    width: 100% !important;
  }
  .student-profile-hero__name {
    text-align: center !important;
    font-size: 1.25rem !important;
  }
  .student-profile-hero__badges {
    justify-content: center !important;
  }
  .student-profile-hero__grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.65rem !important;
  }

  /* Modal Action Buttons (Grounded, Seamless, No Floating Box) */
  .modal footer,
  .modal .form-actions,
  .modal .modal__footer {
    display: flex !important;
    flex-direction: row-reverse !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 0.75rem !important;
    margin-top: 1.5rem !important;
    padding: 0.75rem 0 0.25rem !important;
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    position: static !important;
    width: 100% !important;
  }
  .modal footer .btn,
  .modal .form-actions .btn,
  .modal .modal__footer .btn {
    min-height: 44px !important;
    font-size: 0.95rem !important;
    padding: 0.65rem 1.25rem !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
    flex: 1 1 50% !important;
    justify-content: center !important;
  }

  /* Contract & Specific Component Adaptations */
  .modal .material-picker {
    padding: 0.5rem 0 !important;
    max-height: 300px !important;
  }
  .modal .material-picker__head {
    display: none !important;
  }
  .modal .material-picker__row,
  .modal .material-picker--stock .material-picker__row {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 0.45rem 0.5rem !important;
    padding: 0.65rem !important;
  }
  .modal .material-picker__row .material-check {
    margin-right: 0.25rem !important;
    transform: scale(1.15) !important;
  }
  .modal .material-picker__name {
    flex: 1 1 calc(100% - 40px) !important;
    font-size: 0.85rem !important;
  }
  .modal .material-picker .material-ro,
  .modal .material-picker .material-qty {
    flex: 1 1 calc(33.333% - 0.4rem) !important;
    min-height: 36px !important;
    font-size: 0.82rem !important;
  }

  /* Live calculation panel inside contract modal */
  .modal .live-calc {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.5rem !important;
    padding: 0.75rem !important;
    margin-top: 0.85rem !important;
  }
  .modal .live-calc > div:last-child:nth-child(odd) {
    grid-column: 1 / -1 !important;
  }
  .modal .live-calc strong {
    font-size: 0.95rem !important;
  }

  /* Tables inside modals (e.g. Rollover candidate table) */
  .modal .table-wrap {
    max-height: 250px !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  .modal table.data {
    min-width: 480px !important;
  }

  /* Force responsive collapse on grid views with high minmax */
  div[style*="minmax(320px"],
  div[style*="minmax(340px"],
  div[style*="minmax(360px"],
  div[style*="minmax(380px"],
  div[style*="grid-template-columns: 3fr 2fr"],
  div[style*="grid-template-columns: 2fr 1fr"],
  div[style*="grid-template-columns: 1fr 1fr"],
  div[style*="grid-template-columns:repeat(2,1fr)"],
  div[style*="grid-template-columns: 1fr 1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* --- 2. Small Mobile Phones (<= 480px) --- */
@media (max-width: 480px) {
  .content {
    padding: 0.65rem 0.5rem 2rem !important;
  }
  .topbar {
    display: flex !important;
    flex-direction: column !important;
    padding: 0 !important;
    gap: 0 !important;
    background: var(--paper, #ffffff) !important;
    border-bottom: 1px solid var(--line) !important;
  }
  .topbar__main-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    padding: 0.4rem 0.55rem !important;
    box-sizing: border-box !important;
  }
  .topbar__sub-row {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    padding: 0.25rem 0.55rem !important;
    background: var(--bg-card, #f8fafc) !important;
    border-top: 1px solid var(--line) !important;
    margin-left: 0 !important;
    box-sizing: border-box !important;
  }
  html.dark .topbar {
    background: #0f172a !important;
    border-bottom: 1px solid #1e293b !important;
  }
  html.dark .topbar__main-row {
    background: #0f172a !important;
  }
  html.dark .topbar__sub-row {
    background: #0b1120 !important;
    border-top: 1px solid #1e293b !important;
  }
  .topbar__left {
    display: flex !important;
    align-items: center !important;
    gap: 0.4rem !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
  }
  .topbar__company-name {
    font-size: 0.82rem !important;
    max-width: 95px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
  .topbar__user {
    display: none !important;
  }
  .topbar__primary-actions {
    display: flex !important;
    align-items: center !important;
    gap: 0.35rem !important;
    flex-shrink: 0 !important;
  }
  .topbar__primary-actions::before {
    display: none !important;
  }
  .topbar__primary-actions select,
  .branch-select {
    max-width: 90px !important;
    font-size: 0.72rem !important;
    padding: 0.2rem 0.35rem !important;
  }
  .topbar__btn-logout {
    padding: 3px 7px !important;
    font-size: 0.72rem !important;
  }
  .topbar-label-text {
    display: none !important;
  }
  .topbar__btn-new-year {
    display: none !important;
  }
  .academic-year-select {
    max-width: 125px !important;
    font-size: 0.72rem !important;
    padding: 0.2rem 0.35rem !important;
  }
  .lang-switch__btn {
    padding: 0.2rem 0.45rem !important;
    font-size: 0.72rem !important;
  }
  .lang-switch__code {
    font-size: 0.72rem !important;
  }
  .academy-hero {
    padding: 0.9rem 0.75rem !important;
    gap: 0.65rem !important;
  }
  .academy-hero h1 {
    font-size: 1.2rem !important;
  }
  .academy-hero__eyebrow {
    font-size: 0.68rem !important;
  }
  .academy-hero__copy p:last-child {
    font-size: 0.8rem !important;
  }
  .academy-hero__actions {
    flex-direction: column !important;
    width: 100% !important;
    gap: 0.35rem !important;
  }
  .academy-hero__actions .btn {
    width: 100% !important;
    justify-content: center !important;
    font-size: 0.82rem !important;
    padding: 0.5rem !important;
  }
  .stat-grid,
  .academy-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 0.45rem !important;
  }
  .stat-card {
    padding: 0.65rem 0.7rem !important;
  }
  .stat-card__label {
    font-size: 0.7rem !important;
  }
  .stat-card__value {
    font-size: 1.05rem !important;
  }
  .modal__header {
    padding: 0.7rem 0.85rem !important;
  }
  .modal__title {
    font-size: 1rem !important;
  }
  .modal__body {
    padding: 0.7rem 0.85rem !important;
  }
}

/* --- 3. Extra-Narrow Mobile Screens (<= 400px, e.g. 320px - 390px) --- */
@media (max-width: 400px) {
  .content {
    padding: 0.45rem 0.35rem 2rem !important;
  }
  .topbar__main-row {
    padding: 0.3rem 0.4rem !important;
    gap: 0.25rem !important;
  }
  .topbar__sub-row {
    padding: 0.2rem 0.4rem !important;
  }
  .topbar__company-name {
    max-width: 80px !important;
    font-size: 0.75rem !important;
  }
  .topbar__company-logo {
    width: 24px !important;
    height: 24px !important;
  }
  .topbar__menu-btn {
    width: 1.95rem !important;
    height: 1.95rem !important;
  }
  .topbar__primary-actions {
    gap: 0.25rem !important;
  }
  .topbar__primary-actions select,
  .branch-select {
    max-width: 78px !important;
    font-size: 0.68rem !important;
    padding: 0.15rem 0.25rem !important;
  }
  .topbar__btn-logout {
    padding: 2px 5px !important;
    font-size: 0.68rem !important;
  }
  .academic-year-select {
    max-width: 105px !important;
    font-size: 0.68rem !important;
    padding: 0.15rem 0.25rem !important;
  }
  .lang-switch__btn {
    padding: 0.15rem 0.35rem !important;
    font-size: 0.68rem !important;
  }

  /* Single Column Stat Cards for Clear Legibility on <= 400px */
  .stat-grid,
  .academy-stats {
    grid-template-columns: 1fr !important;
    gap: 0.4rem !important;
  }
  .stat-card {
    padding: 0.7rem 0.75rem !important;
  }
  .stat-card__value {
    font-size: 1.15rem !important;
  }

  /* Hero & Board on <= 400px */
  .academy-hero {
    padding: 0.75rem 0.65rem !important;
    gap: 0.5rem !important;
  }
  .academy-hero h1 {
    font-size: 1.1rem !important;
  }
  .academy-hero__eyebrow {
    font-size: 0.65rem !important;
  }
  .academy-hero__copy p:last-child {
    font-size: 0.76rem !important;
    line-height: 1.35 !important;
  }
  .academy-board {
    gap: 0.65rem !important;
  }
  .academy-board > div {
    padding: 0.75rem 0.7rem !important;
  }

  /* Panel head filters stack */
  .panel__head {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.65rem !important;
  }
  .panel__head form {
    width: 100% !important;
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .panel__head form .field,
  .panel__head form select,
  .panel__head form .btn {
    width: 100% !important;
  }

  /* Modal on <= 400px */
  .modal__panel {
    width: 100% !important;
    max-width: 100vw !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 16px 16px 0 0 !important;
  }
  .modal__header {
    padding: 0.65rem 0.85rem !important;
  }
  .modal__title {
    font-size: 0.95rem !important;
  }
  .modal__body {
    padding: 0.75rem 0.85rem 1.5rem !important;
  }
  .modal .live-calc {
    grid-template-columns: 1fr !important;
  }
  .field-pair {
    grid-template-columns: 1fr !important;
    gap: 0.65rem !important;
  }
  .student-profile-hero {
    padding: 0.85rem 0.75rem !important;
    border-radius: 12px !important;
  }
  .student-profile-hero__grid {
    grid-template-columns: 1fr !important;
    gap: 0.5rem !important;
  }
  .student-profile-hero__card {
    padding: 0.55rem 0.75rem !important;
  }
}

/* --- 3. Tablets (769px - 1024px) --- */
@media (min-width: 769px) and (max-width: 1024px) {
  .content {
    padding: 1.25rem 1.25rem 2.5rem;
  }
  .topbar {
    padding: 0.7rem 1.25rem;
  }
  .stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)) !important;
    gap: 0.85rem !important;
  }
  .modal__panel {
    max-width: min(720px, 92vw) !important;
    max-height: min(92vh, 880px) !important;
  }
  .modal--xl .modal__panel {
    max-width: min(880px, 95vw) !important;
  }
  .dash-columns,
  .chart-grid {
    grid-template-columns: 1fr !important;
  }
  div[style*="grid-template-columns: 3fr 2fr"] {
    grid-template-columns: 1fr !important;
  }
}

/* --- 4. Standard Laptops & Desktops (1025px - 1440px) --- */
@media (min-width: 1025px) and (max-width: 1440px) {
  .content {
    max-width: 1400px;
  }
}

/* --- 5. Wide Screen Monitors & Television (1441px - 2559px) --- */
@media (min-width: 1441px) {
  .content {
    max-width: 1680px;
    padding: 1.75rem 2.25rem 3.5rem;
  }
  .topbar {
    padding: 0.85rem 2.25rem;
  }
  .stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1.25rem;
  }
  .stat-card {
    padding: 1.45rem 1.55rem;
  }
  .stat-card__value {
    font-size: 1.6rem;
  }
}

/* --- 6. Ultra-HD, 4K Displays & Conference Room TVs (>= 2560px) --- */
@media screen and (min-width: 2560px) {
  html {
    font-size: 17px;
  }
  .content {
    max-width: 2200px;
    padding: 2rem 3rem 4rem;
  }
  .topbar {
    padding: 1rem 3rem;
  }
  .topbar__company-name {
    font-size: 1.1rem;
  }
  .topbar__menu-btn {
    width: 2.5rem;
    height: 2.5rem;
  }
  :root {
    --sidebar-w: 280px;
  }
  .sidebar {
    width: var(--sidebar-w);
  }
  .academy-hero {
    padding: 1.85rem 2rem;
    border-radius: 16px;
  }
  .academy-hero h1 {
    font-size: 2.1rem;
  }
  .stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
  }
  .stat-card {
    padding: 1.65rem 1.75rem;
    border-radius: 16px;
  }
  .stat-card__value {
    font-size: 1.95rem;
  }
  table.data th,
  table.data td {
    padding: 0.85rem 1rem;
    font-size: 0.92rem;
  }
  .modal__panel {
    border-radius: 18px;
  }
}

/* --- 7. Print Media Support --- */
@media print {
  .sidebar,
  .topbar,
  .sidebar-backdrop,
  .modal,
  .btn,
  .topbar__menu-btn {
    display: none !important;
  }
  .app-shell,
  .app-main,
  .content {
    background: #fff !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
  }
  table.data {
    border: 1px solid #cbd5e1;
  }
  table.data tr {
    page-break-inside: avoid;
  }
}

/* --- Dark Mode Form Inputs & Components --- */
html.dark input[type="date"],
html.dark select,
html.dark .modal input[type="date"] {
  background-color: #0f172a !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
  color-scheme: dark !important;
}
html.dark input[type="date"]::-webkit-calendar-picker-indicator,
html.dark .modal input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1) brightness(1.2) !important;
  cursor: pointer !important;
}
html.dark input[type="file"],
html.dark .modal input[type="file"] {
  background: #0f172a !important;
  border-color: #334155 !important;
  color: #cbd5e1 !important;
}
html.dark input[type="file"]::file-selector-button,
html.dark .modal input[type="file"]::file-selector-button {
  background: #1e293b !important;
  border: 1px solid #475569 !important;
  color: #f8fafc !important;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  cursor: pointer;
  margin-right: 0.5rem;
}
html.dark .student-profile-hero {
  background: #1e293b !important;
  border-color: #334155 !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25) !important;
}
html.dark .student-profile-hero__avatar-wrap {
  background: #0f172a !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4) !important;
}
html.dark .student-profile-hero__name {
  color: #f8fafc !important;
}
html.dark .student-profile-hero__head {
  border-bottom-color: #334155 !important;
}
html.dark .student-profile-hero__card {
  background: #0f172a !important;
  border-color: #334155 !important;
}
html.dark .student-profile-hero__card-label {
  color: #94a3b8 !important;
}
html.dark .student-profile-hero__card-val {
  color: #f8fafc !important;
}
html.dark .modal .form-actions,
html.dark .modal footer,
html.dark .modal .modal__footer {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* Dar ekran: üst çubuk, filtreler ve tablolar sayfayı yana taşımasın */
@media (max-width: 900px) {
  .login-body {
    align-items: start;
    padding: 1.25rem 0.75rem;
  }
  .login-shell {
    padding: 1.35rem 1rem;
  }
  .topbar {
    flex-wrap: wrap;
    align-items: center;
    row-gap: 0.4rem;
    padding: 0.5rem 0.7rem;
  }
  .topbar__center {
    display: none !important;
  }
  .topbar__left {
    order: 1;
    flex: 1 1 auto;
    min-width: 0;
  }
  .topbar__primary-actions {
    order: 2;
    margin-left: auto;
    flex: 0 0 auto;
  }
  .topbar__primary-actions::before {
    display: none;
  }
  .topbar__sub-row {
    order: 3;
    flex: 1 1 100%;
    width: 100%;
    margin-left: 0 !important;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.4rem;
  }
  .topbar__company-name,
  .branch-select,
  .lang-switch__btn {
    max-width: 46vw;
  }
  .academy-page,
  .panel,
  .content {
    max-width: 100% !important;
    min-width: 0 !important;
  }
  .content form,
  .panel form,
  .academy-page form {
    flex-wrap: wrap !important;
    max-width: 100%;
  }
  .content input,
  .content select,
  .content textarea,
  .panel input,
  .panel select,
  .academy-page input,
  .academy-page select {
    max-width: 100%;
    min-width: 0 !important;
  }
  .table-wrap,
  .table-wrap.staff-fit {
    overflow-x: auto !important;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }
  .staff-tabs {
    flex-wrap: wrap;
  }
  .staff-tabs .btn {
    white-space: normal;
  }
  .staff-filters,
  .staff-filters form {
    width: 100%;
  }
  .staff-filters input[type="text"],
  .staff-filters select,
  .staff-filters input[type="month"] {
    width: 100%;
    min-width: 0 !important;
    box-sizing: border-box;
  }
  .staff-panel {
    overflow: visible !important;
  }
  .staff-panel .staff-fit-table,
  .staff-panel table.data {
    min-width: 860px !important;
    table-layout: auto !important;
  }
  .week-grid,
  .schedule-board,
  .calendar-grid {
    max-width: 100%;
    overflow-x: auto;
  }
  .budget-page,
  .sms-page,
  .teacher-detail-wrapper,
  .tp-container,
  .payroll-panel {
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: clip;
  }
  .budget-kpis,
  .subject-pick {
    grid-template-columns: 1fr !important;
  }
  .budget-page form.budget-add {
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .budget-page form.budget-add input,
  .budget-page form.budget-add select,
  .budget-page form.budget-add button {
    width: 100% !important;
    flex: none !important;
    min-width: 0 !important;
    box-sizing: border-box;
  }
  .budget-page form.budget-month {
    width: 100%;
    flex-wrap: wrap !important;
    box-sizing: border-box;
  }
  .budget-page form.budget-month input[type="month"] {
    flex: 1 1 8rem;
    min-width: 0 !important;
    width: auto !important;
  }
  .budget-page h1 {
    font-size: 1.25rem !important;
  }
  .budget-page .budget-line {
    flex-wrap: wrap !important;
    align-items: flex-start !important;
    gap: 0.45rem !important;
  }
  .budget-page .budget-line form,
  .budget-page .budget-line button {
    width: auto !important;
    flex: none !important;
  }
  .payroll-panel {
    overflow: visible !important;
  }
  .payroll-table thead {
    display: none;
  }
  .payroll-table,
  .payroll-table tbody,
  .payroll-table tr,
  .payroll-table td {
    display: block;
    width: 100% !important;
    min-width: 0 !important;
    text-align: left !important;
    white-space: normal !important;
  }
  .payroll-table tr {
    padding: 0.85rem 0.9rem;
    border-bottom: 1px solid #334155;
  }
  .payroll-table td {
    padding: 0.22rem 0 !important;
  }
  .payroll-table td:nth-child(2)::before { content: "Sözleşme modeli"; }
  .payroll-table td:nth-child(3)::before { content: "Girilen ders"; }
  .payroll-table td:nth-child(4)::before { content: "Ders başı biriken"; }
  .payroll-table td:nth-child(5)::before { content: "Sabit maaş"; }
  .payroll-table td:nth-child(6)::before { content: "Kesinti / avans"; }
  .payroll-table td:nth-child(7)::before { content: "Net ödenecek"; }
  .payroll-table td:nth-child(8)::before { content: "İşlem"; }
  .payroll-table td:nth-child(n+2)::before {
    display: block;
    margin-bottom: 0.12rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #94a3b8;
  }
  .payroll-table td .btn {
    white-space: normal;
  }
  .budget-split,
  .sms-split,
  #ilksms-extra-fields,
  .sms-kpi-grid,
  .subject-grid {
    grid-template-columns: 1fr !important;
  }
  .budget-page [style*="justify-content:space-between"],
  .sms-page [style*="justify-content: space-between"] {
    flex-wrap: wrap !important;
    row-gap: 0.45rem;
  }
  .tab-nav-wrapper {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    align-items: start !important;
    height: auto !important;
    min-height: 0 !important;
    margin-bottom: 0.75rem !important;
    border-bottom: 0 !important;
    padding-bottom: 0 !important;
  }
  .tab-nav-wrapper .course-tab-btn {
    flex: none !important;
    height: auto !important;
    min-height: 0 !important;
    width: 100% !important;
    padding: 0.55rem 0.4rem !important;
    border: 1px solid #cbd5e1 !important;
    border-radius: 8px !important;
    background: #fff !important;
    color: #334155 !important;
    justify-content: center;
    text-align: center;
    white-space: normal;
    font-size: 0.8rem !important;
  }
  html.dark .tab-nav-wrapper .course-tab-btn {
    background: #1e293b !important;
    border-color: #475569 !important;
    color: #f8fafc !important;
  }
  .tab-nav-wrapper .course-tab-btn.active,
  html.dark .tab-nav-wrapper .course-tab-btn.active {
    background: #0f766e !important;
    border-color: #0f766e !important;
    color: #fff !important;
  }
  .academy-list-panel table.course-catalog {
    min-width: 0 !important;
  }
  .course-catalog thead {
    display: none;
  }
  .course-catalog,
  .course-catalog tbody,
  .course-catalog tr,
  .course-catalog td {
    display: block;
    width: 100% !important;
    min-width: 0 !important;
  }
  .course-catalog tr {
    padding: 0.8rem 0.9rem;
    border-bottom: 1px solid #e2e8f0;
  }
  html.dark .course-catalog tr {
    border-bottom-color: #334155;
  }
  .course-catalog td {
    padding: 0.28rem 0 !important;
    text-align: left !important;
  }
  .course-catalog td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.12rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #64748b;
  }
  .course-catalog td:first-child::before {
    display: none;
  }
  .course-catalog .course-desc,
  .course-catalog code {
    white-space: normal !important;
    max-width: 100% !important;
    overflow: visible !important;
  }
  .course-catalog td:last-child > div {
    display: flex !important;
    flex-wrap: wrap;
  }
  .academy-page .stat-card {
    min-height: 0 !important;
  }
  .academy-list-panel .panel__head > .btn {
    width: auto !important;
    align-self: flex-start !important;
  }
  .sms-page {
    padding: 0.75rem !important;
  }
  .academy-list-panel .table-wrap,
  .budget-page .table-wrap,
  .sms-page .table-wrap {
    overflow-x: auto !important;
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }
  .academy-list-panel table.data,
  .budget-page table.data,
  .sms-page table.data {
    min-width: 720px;
  }
  #modal-payment-add .modal__panel {
    width: 100% !important;
    max-width: 100vw !important;
  }
  #modal-payment-add .form-grid {
    grid-template-columns: 1fr !important;
  }
  #modal-payment-add .field {
    min-width: 0 !important;
    max-width: 100% !important;
  }
  #modal-payment-add .field select,
  #modal-payment-add .field input:not([type="checkbox"]):not([type="radio"]) {
    min-width: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
}

@media (max-width: 480px) {
  .stat-grid,
  .academy-stats,
  .stat-grid--dash {
    grid-template-columns: 1fr !important;
  }
  .topbar__user {
    display: none;
  }
  .content {
    padding: 0.7rem 0.55rem 2rem;
  }
}

@media (max-width: 900px) {
  .field,
  .form-grid,
  .form-actions,
  .modal__body,
  .modal__panel,
  .sched-board {
    min-width: 0;
    max-width: 100%;
  }
  .field select,
  .field input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  .field textarea,
  .modal select,
  .modal input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
  .modal textarea {
    width: 100%;
    max-width: 100%;
    min-width: 0 !important;
    box-sizing: border-box;
  }
  .form-actions {
    flex-wrap: wrap;
  }
  .form-actions .btn,
  .panel__head .btn,
  .academy-hero__actions .btn {
    max-width: 100%;
    white-space: normal;
  }
  .sched-board {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}