:root {
  --bg: #0f172a; /* slate-900 */
  --surface: #111827; /* gray-900 */
  --card: #0b1220; /* deep surface */
  --text: #e5e7eb; /* gray-200 */
  --muted: #9ca3af; /* gray-400 */
  --primary: #3b82f6; /* blue-500 */
  --primary-600: #2563eb;
  --danger: #ef4444;
  --success: #22c55e;
  --border: rgba(148,163,184,0.24);
  --shadow: 0 10px 30px rgba(2,6,23,0.35);
  --radius: 12px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f8fc;
    --surface: #ffffff;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #475569;
    --border: rgba(2,6,23,0.12);
    --shadow: 0 10px 25px rgba(2,6,23,0.08);
  }
}

/* Explicit theme overrides via attribute for manual toggle */
:root[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #111827;
  --card: #0b1220;
  --text: #e5e7eb;
  --muted: #9ca3af;
  --primary: #3b82f6;
  --primary-600: #2563eb;
  --danger: #ef4444;
  --success: #22c55e;
  --border: rgba(148,163,184,0.24);
  --shadow: 0 10px 30px rgba(2,6,23,0.35);
}

:root[data-theme="light"] {
  --bg: #f7f8fc;
  --surface: #ffffff;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --primary: #3b82f6;
  --primary-600: #2563eb;
  --danger: #ef4444;
  --success: #22c55e;
  --border: rgba(2,6,23,0.12);
  --shadow: 0 10px 25px rgba(2,6,23,0.08);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji"; margin: 0; background: radial-gradient(1200px 800px at 10% 10%, rgba(59,130,246,0.08), transparent 35%), var(--bg); color: var(--text); }

.topbar { position: sticky; top: 0; z-index: 50; display: flex; justify-content: center; align-items: center; gap: 12px; padding: 14px 20px; background: var(--surface); border-bottom: 1px solid var(--border); backdrop-filter: blur(8px); }
.topbar.topbar--left { justify-content: flex-start; }
.brand, .brand-center { font-weight: 800; letter-spacing: 0.2px; background: linear-gradient(90deg, #60a5fa, #22d3ee); -webkit-background-clip: text; background-clip: text; color: transparent; }
.topbar nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.topbar nav a { text-decoration: none; color: var(--text); opacity: 0.9; padding: 6px 10px; border-radius: 8px; border: 1px solid transparent; transition: all 180ms ease; }
.topbar nav a:hover { color: #fff; background: rgba(99,102,241,0.12); border-color: var(--border); }
.topbar nav button { margin-left: 4px; }
.topbar-right { position: absolute; right: 20px; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 8px; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; }
.icon-btn:hover { background: rgba(99,102,241,0.12); }
.icon-btn svg { width: 24px; height: 24px; display: block; }

/* Make only the theme toggle icon 200% of the base icon size */
.icon-btn.theme-toggle svg { width: 90px; height: 90px; }

/* Ensure the theme toggle button remains 36x36 while icon can overflow */
.icon-btn.theme-toggle { width: 36px; height: 36px; overflow: visible; }

/* Enlarge only the theme toggle icon by 200% (18px -> 36px) */
.icon-btn.theme-toggle svg { width: 36px; height: 36px; }
.avatar-btn { display: inline-flex; align-items: center; gap: 0; padding: 0; border-radius: 999px; border: none; background: transparent; color: var(--text); cursor: pointer; box-shadow: none; }
.avatar-circle { width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(180deg, #60a5fa, #22d3ee); color: #0f172a; display: flex; align-items: center; justify-content: center; font-weight: 800; }
.avatar-name { font-weight: 600; font-size: 14px; }
.dropdown-menu { position: absolute; right: 20px; top: 58px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: none; padding: 6px; min-width: 180px; display: none; }
.dropdown-menu.open { display: block; }
.dropdown-item { display: block; width: 100%; padding: 8px 10px; border-radius: 8px; color: var(--text); text-align: left; background: transparent; border: 1px solid transparent; cursor: pointer; }
.dropdown-item:hover { background: rgba(99,102,241,0.12); }
.dropdown-item.disabled { color: var(--muted); cursor: default; }

.container { max-width: 1100px; margin: 24px auto; padding: 0 16px; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.card#entry-root { display: flex; flex-direction: column; }
.card h1, .card h2, .card h3 { margin-top: 0; }

table { width: 100%; border-collapse: collapse; margin-top: 12px; overflow: hidden; border-radius: 12px; }
thead th { position: sticky; top: 0; background: linear-gradient(180deg, rgba(59,130,246,0.16), transparent); text-transform: uppercase; font-size: 12px; letter-spacing: 0.06em; color: var(--muted); }
th, td { border-bottom: 1px solid var(--border); padding: 10px 12px; text-align: left; }
tbody tr:nth-child(even) { background: rgba(59,130,246,0.06); }
tbody tr:hover { background: rgba(99,102,241,0.12); transition: background 150ms ease; }

label { display: block; margin: 8px 0; color: var(--muted); font-size: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 12px; }
.form-field { grid-column: span 6; }

.btn { background: #1f2937; color: white; padding: 8px 12px; border-radius: 10px; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border); transition: background 120ms ease; box-shadow: none; }
.btn:hover { transform: none; box-shadow: none; }
.btn.primary { background: linear-gradient(180deg, var(--primary), var(--primary-600)); border-color: rgba(59,130,246,0.35); }
.btn.secondary { background: #334155; }
.btn.danger { background: linear-gradient(180deg, #ef4444, #dc2626); }

.error { color: #fca5a5; margin: 8px 0; padding: 8px 10px; background: rgba(239,68,68,0.12); border: 1px solid rgba(239,68,68,0.35); border-radius: 10px; }

input[type="number"], input[type="text"], input[type="password"], select { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; width: 100%; background: var(--surface); color: var(--text); outline: none; transition: border-color 120ms ease, box-shadow 120ms ease; }
input[type="number"]:focus, input[type="text"]:focus, input[type="password"]:focus, select:focus { border-color: rgba(59,130,246,0.6); box-shadow: 0 0 0 3px rgba(59,130,246,0.25); }
/* Hide browser up/down arrows on number inputs */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield; /* Firefox */
}

button { padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; background: linear-gradient(180deg, var(--primary), var(--primary-600)); color: white; cursor: pointer; transition: transform 120ms ease, box-shadow 120ms ease; box-shadow: 0 6px 18px rgba(2,6,23,0.25); }
button:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(2,6,23,0.35); }

/* Remove shadows for profile and theme toggle in teacher topbar */
.topbar--left .avatar-btn,
.topbar--left .icon-btn,
.topbar--left button.icon-btn {
  box-shadow: none;
}

/* Pills for multi-select subjects */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; border: 1px dashed var(--border); background: rgba(59,130,246,0.08); color: var(--text); cursor: pointer; user-select: none; }
.pill input { accent-color: var(--primary); }

/* Utility spacing */
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.center { display: flex; align-items: center; justify-content: center; }

/* Footer */
.footer { text-align: center; padding: 18px; color: var(--muted); }

/* Titlebar for cards */
.titlebar { margin-bottom: 6px; }

/* Modal (dialog) styles */
dialog { border: 1px solid var(--border); border-radius: var(--radius); padding: 0; background: var(--card); color: var(--text); box-shadow: var(--shadow); }
dialog::backdrop { backdrop-filter: blur(2px); background: rgba(0,0,0,0.35); }
.modal-header { border-bottom: 1px solid var(--border); padding: 10px 16px; }
.modal-content { padding: 0 16px 16px 16px; }

/* Fallback modal styling when <dialog> is unsupported */
dialog.dlg-open { display: block; position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 1001; margin: 0; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.35); backdrop-filter: blur(2px); z-index: 1000; }

/* 1:3 rectangle and full-width field helpers */
.rect-13 { width: min(33vw, 520px); min-width: 300px; margin: 0 auto; }
.form-field.full { grid-column: span 12; }
.vh-center { min-height: 70vh; }

/* Fixed layout tables for even column widths */
.table-fixed { table-layout: fixed; }
.table-fixed th, .table-fixed td { overflow: hidden; text-overflow: ellipsis; }

/* Full-width utility */
.w-full { width: 100%; }

/* Compact tables and inputs for moderate widths and gaps */
.table-compact thead th,
.table-compact tbody td { padding: 6px 10px; }
.teachers-table thead th,
.teachers-table tbody td { padding: 4px 6px; }
.input-sm { max-width: 90px; width: 90px; }
.toolbar { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.toolbar.hidden { display: none; }
.toggle-round { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 4px 10px; cursor: pointer; }
.toggle-round.active { background: rgba(59,130,246,0.08); }

/* Single-line action buttons per row */
.row-actions { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.row-actions { white-space: nowrap; }
.row-actions form { display: inline-block; margin: 0; }

/* Compact select controls for export toolbar */
.compact-select {
  width: auto;
  min-width: 110px;
  max-width: 160px;
}

/* Export preview: vertical subject headers, tight columns, and separators */
.export-preview table { table-layout: auto; width: auto; margin: 0; }
.export-preview th, .export-preview td { padding: 2px 4px; }
.subject-group { text-align: center; padding: 4px 6px; }
.subject-header { border-left: 3px solid var(--border); border-right: 3px solid var(--border); font-weight: 600; }
.subject-header { text-align: center; }
.subject-label-vertical { /* vertical styling disabled for centered merged headers */ }
.level-th, .level-td { white-space: nowrap; border-left: 1px solid var(--border); }
.export-preview .level-th, .export-preview .level-td { width: 4ch; min-width: 4ch; max-width: 4ch; text-align: center; padding: 1px 2px; }
.subject-start { border-left: 3px solid var(--border); }
.subject-end { border-right: 3px solid var(--border); }

/* Rotated subject names (180 degrees), centered inside merged header cell */
/* Vertical subject names (90 degrees), centered in merged cell */
.subject-header .rot-v {
  display: inline-block;
  writing-mode: vertical-rl;
  transform: rotate(180deg); /* flip to read bottom-to-top */
  transform-origin: center;
}

/* Rotate Ad. No header vertically (90 degrees effect via vertical-rl + flip) */
.export-preview .col-roll .rot-v {
  display: inline-block;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  transform-origin: center;
}

/* Center align ad numbers */
.export-preview .col-roll, .export-preview .level-td {
  text-align: center;
}

/* Fixed and dynamic column widths */
.export-preview .col-roll { 
  white-space: nowrap; 
}
.export-preview .col-name { 
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}



/* (Removed) legacy grouping cell; no longer used in redesigned table */

/* Entry table styles */
.table-container {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.entry-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--card);
  min-width: 800px;
  table-layout: fixed;
}

.entry-table th,
.entry-table td {
  padding: 12px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  box-sizing: border-box;
}

.entry-table th:last-child,
.entry-table td:last-child {
  border-right: none;
}

.entry-table tr:last-child td {
  border-bottom: none;
}

/* Header styles */
.table-header th {
  background: var(--surface);
  font-weight: 600;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 10;
  color: var(--text);
  border-bottom: 2px solid var(--border);
}

.level-header {
  background: rgba(59,130,246,0.16) !important;
  color: var(--primary) !important;
  font-weight: 600;
}

.converted-header {
  background: rgba(34,197,94,0.16) !important;
  color: var(--success) !important;
  font-weight: 500;
  font-size: 13px;
}

/* Sticky columns */
.sticky-col {
  position: sticky;
  left: 0;
  background: var(--card);
  z-index: 5;
}

.admission-col {
  left: 0 !important;
  width: var(--ad-col-width);
  z-index: 15 !important;
}

.name-col {
  left: var(--ad-col-width) !important;
  width: var(--name-col-width);
  z-index: 15 !important;
}

.admission-cell {
  left: 0 !important;
  width: var(--ad-col-width);
  background: var(--surface);
  font-weight: 500;
  text-align: center;
  z-index: 8;
}

.name-cell {
  left: var(--ad-col-width) !important;
  width: var(--name-col-width);
  background: var(--surface);
  font-weight: 500;
  text-align: left;
  z-index: 8;
}

/* Mark input cells: fixed width */
.mark-cell {
  text-align: center;
  width: 6ch;
  padding: 4px !important;
  background: rgba(59,130,246,0.06);
}

.mark-input {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
  height: 28px;
  padding: 4px 2px;
  border: 1px solid var(--border);
  border-radius: 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  background: var(--surface);
  color: var(--text);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.mark-input:focus {
  outline: none;
  border-color: rgba(59,130,246,0.6);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.25);
}

.mark-input:hover {
  border-color: var(--muted);
}

/* Converted mark cells: read-only columns also 5ch */
.converted-cell {
  text-align: center;
  width: 6ch;
  padding: 4px !important;
  background: rgba(34,197,94,0.06);
}

.converted-mark {
  display: inline-block;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  background: rgba(34,197,94,0.16);
  color: var(--success);
  padding: 0;
  height: 28px;
  line-height: 28px;
  text-align: center;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13px;
  border: 1px solid rgba(34,197,94,0.25);
}

/* Row styles */
.student-row:hover {
  background: rgba(99,102,241,0.12);
  transition: background 150ms ease;
}

.student-row:hover .admission-cell,
.student-row:hover .name-cell {
  background: rgba(99,102,241,0.08);
}

/* Save controls */
.save-controls {
  margin-top: 20px;
  text-align: center;
  padding: 18px;
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.card#entry-root form { display: flex; flex-direction: column; flex: 1 1 auto; }
#entry-root .table-container { flex: 1 1 auto; }
#entry-root .save-controls { margin-top: auto; }

.save-btn {
  background: linear-gradient(180deg, var(--primary), var(--primary-600));
  color: white;
  padding: 12px 24px;
  border: 1px solid rgba(59,130,246,0.35);
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease;
  box-shadow: none;
}

.save-btn:hover { box-shadow: none; transform: none; }
.save-btn:active { transform: none; }

.save-status {
  margin-top: 10px;
  font-size: 14px;
  color: var(--muted);
}

.marks-input { width: 6ch; max-width: 6ch; border-radius: 8px; }
.marks-input:focus { outline: 2px solid var(--primary); outline-offset: 1px; }

/* Slightly smaller converted badge to reduce gaps */
.conv-badge { width: 2.0em; height: 2.0em; margin-left: 4px; }

/* Teacher dashboard tiles */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.tile { display: flex; align-items: center; justify-content: center; text-align: center; border-radius: var(--radius); color: #fff; text-decoration: none; box-shadow: 0 2px 6px rgba(0,0,0,0.1); aspect-ratio: 1 / 1; min-height: 160px; }
.tile:hover { box-shadow: 0 4px 10px rgba(0,0,0,0.15); filter: brightness(1.03); }
.tile-title { font-weight: 700; font-size: 2rem; letter-spacing: 0.3px; line-height: 1; }
.tile-subtitle { font-size: 3rem; opacity: 0.95; margin-top: 6px; line-height: 1; }

/* Per-tile color variants */
.tile--c0 { background: linear-gradient(180deg, #3b82f6, #2563eb); }
.tile--c1 { background: linear-gradient(180deg, #10b981, #059669); }
.tile--c2 { background: linear-gradient(180deg, #f59e0b, #d97706); }
.tile--c3 { background: linear-gradient(180deg, #ef4444, #dc2626); }
.tile--c4 { background: linear-gradient(180deg, #8b5cf6, #7c3aed); }
.tile--c5 { background: linear-gradient(180deg, #06b6d4, #0891b2); }
.tile--c6 { background: linear-gradient(180deg, #22c55e, #16a34a); }
.tile--c7 { background: linear-gradient(180deg, #e11d48, #be123c); }

/* Converted mark badge: circular, green, centered number */
.conv-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.2em;
  height: 2.2em;
  border-radius: 50%;
  background: var(--success);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(34,197,94,0.45);
  margin-left: 6px;
}

/* Desktop-first single UI: remove mobile-specific overrides */
.table-responsive { overflow-x: auto; }

/* Sticky table headers for better mobile UX */
.entry-table thead th { position: sticky; top: 0; z-index: 8; background: var(--surface); border-bottom: 2px solid var(--border); }

/* Remove blue zebra striping on teacher entry table rows */
.entry-table tbody tr:nth-child(even) { background: transparent; }

/* Clean level cell layout: input and converted badge side-by-side */
.entry-table .level-th { text-align: center; }
.entry-table .level-td { text-align: center; border-left: 1px solid var(--border); }
.entry-table .level-cell { display: inline-flex; align-items: center; gap: 8px; justify-content: center; }
.entry-table tbody tr:hover { background: rgba(0,0,0,0.06); transition: background 120ms ease; }

/* Admin shell and sidebar */
.admin-shell {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.sidebar {
  width: 240px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  box-shadow: var(--shadow);
}
.sidebar--stack { position: sticky; top: 16px; }
.sidebar-group { margin-bottom: 10px; }
.sidebar-title {
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: 0.06em;
}
.sidebar-link {
  display: block;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 120ms ease, border-color 120ms ease;
}
.sidebar-link:hover {
  background: rgba(99,102,241,0.12);
  border-color: var(--border);
}
.admin-content.container { flex: 1; }

/* Sticky first columns for clarity on mobile */
.entry-table .col-adno { min-width: 90px; width: 90px; }
.entry-table .col-name { min-width: 180px; width: 180px; }
.entry-table .col-sticky { position: sticky; left: 0; background: var(--surface); z-index: 3; }
.entry-table .col-sticky-2 { position: sticky; left: 90px; background: var(--surface); z-index: 3; }

/* Prevent header/labels wrapping; allow horiz scroll (desktop-style everywhere) */
.entry-table { table-layout: fixed; }
.entry-table th, .entry-table td { white-space: nowrap; }
/* Scale panel styles removed */
/* Scale panel removed */
/* Sticky toolbar and scale panel */
.sticky-toolbar { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--border); padding-bottom: 8px; margin-bottom: 8px; }
.scale-panel { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; background: rgba(59,130,246,0.06); margin: 8px 0; }
.scale-panel .scale-instruction { margin: 0 0 8px 0; color: var(--muted); font-size: 14px; }
.scale-title { font-weight: 700; color: var(--text); }
.scale-grid { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; }
.scale-item { border: 1px solid #b91c1c; border-radius: 12px; padding: 8px 10px; background: #dc2626; display: flex; align-items: center; gap: 10px; color: #ffffff; }
.scale-item small { color: var(--muted); }
/* Remove left accent strokes; use unified red fill */
.scale-l1, .scale-l2, .scale-l3, .scale-l4 { border-left: none; }
/* Circular light red input inside scale boxes */
.scale-item .input-sm {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #ffe4e6; /* light red fill inside circle */
  border: 1px solid #fca5a5;
  color: #991b1b; /* dark red number inside */
  font-weight: 700;
  text-align: center;
  box-shadow: none;
}
.scale-item .input-sm:focus { outline: none; border-color: #ef4444; box-shadow: 0 0 0 2px rgba(239,68,68,0.25); }
.scale-title { font-weight: 700; color: #ffffff; text-decoration: none; }

/* Distinct colors per level box */
.scale-l1 { background: #dc2626; border-color: #b91c1c; }
.scale-l1 .input-sm { background: #ffe4e6; border-color: #fca5a5; color: #991b1b; }

.scale-l2 { background: #2563eb; border-color: #1d4ed8; }
.scale-l2 .input-sm { background: #dbeafe; border-color: #93c5fd; color: #1e3a8a; }

.scale-l3 { background: #16a34a; border-color: #15803d; }
.scale-l3 .input-sm { background: #dcfce7; border-color: #86efac; color: #14532d; }

.scale-l4 { background: #f59e0b; border-color: #d97706; }
.scale-l4 .input-sm { background: #fef3c7; border-color: #fcd34d; color: #92400e; }

/* Ensure dropdown logout item has no shadow */
.dropdown-item { box-shadow: none; }

/* Status modal: aligned with app UI */
dialog.modal { border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); color: var(--text); box-shadow: var(--shadow); padding: 0; }
dialog.modal::backdrop { backdrop-filter: blur(2px); background: rgba(0,0,0,0.35); }

/* Centered content for simple status dialog */
.modal-center { padding: 16px; text-align: center; }

/* Two-line success status */
#saveModal .save-line1 { font-size: 1.35rem; font-weight: 800; letter-spacing: 0.2px; margin: 6px 0 2px; }
#saveModal .save-line2 { font-size: 1rem; color: var(--muted); margin: 2px 0 0; }

/* Actions row */
#saveModal .modal-actions { display: flex; gap: 10px; justify-content: center; margin-top: 12px; }

/* Button polish inside modal */
#saveModal .btn { min-width: 96px; }

/* Toast: bottom-center, simple modern popup */
dialog.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); margin: 0; border-radius: var(--radius); background: var(--card); color: var(--text); box-shadow: var(--shadow); padding: 0; border: 1px solid var(--border); animation: toast-pop 180ms ease-out; }
dialog.toast::backdrop { background: transparent; }
.toast-content { padding: 12px 16px; position: relative; display: flex; align-items: center; justify-content: center; gap: 8px; }
#saveModal #saveMsg { font-weight: 600; font-size: 0.95rem; letter-spacing: 0.1px; }
@keyframes toast-pop { from { transform: translateX(-50%) scale(0.96); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }

/* Theme toggle as text pill */
.theme-toggle { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 0; font-weight: 600; cursor: pointer; box-shadow: none; display: inline-flex; align-items: center; justify-content: center; gap: 0; height: 36px; width: 36px; }
.theme-toggle:hover { background: rgba(0,0,0,0.04); }
.theme-toggle svg { width: 18px; height: 18px; display: inline-block; }
.theme-toggle:hover, .theme-toggle:active { box-shadow: none; transform: none; }

/* Topbar controls: consistent heights for home, toggle, profile */
.topbar .icon-btn, .topbar .theme-toggle, .topbar .avatar-btn { height: 36px; min-height: 36px; }
.topbar .icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; border-radius: 999px; }
.avatar-btn { display: inline-flex; align-items: center; gap: 0; padding: 0; border: none; background: transparent; border-radius: 999px; box-shadow: none; }
.avatar-btn .avatar-circle { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; }
.avatar-btn .avatar-circle img.avatar-img { width: 28px; height: 28px; border-radius: 50%; display: block; object-fit: cover; object-position: center; }
/* Fixed widths for sticky first columns */
:root { --ad-col-width: 9ch; --name-col-width: 35ch; }
/* Enforce fixed header widths for level and converted columns */
.level-header { width: 6ch; }
.converted-header { width: 6ch; }
.table-header .level-header,
.table-header .converted-header {
  width: 6ch;
  padding: 4px 0 !important;
  box-sizing: border-box;
}