/* Theme: light by default, dark from the system setting or the header's Tema choice (html[data-theme]); Aurora is at the end */
:root {
  color-scheme: light;
  --bg: #fff; --fg: #222; --header: #f3f3f3; --line: #ccc; --border: #bbb; --th: #e8e8e8; --link: #1a5fb4;
  --hover: #ccc; --focus-bg: #fff; --placeholder: #ccc; --del: #a00; --strong-line: #666;
  --green: #b7e1cd; --orange: #ff9900; --red: #ff0000; --rose: #e06666; --peach: #f9cb9c; --yellow: #ffff00;
  --lav: #8e7cc3; --purple: #9900ff; --magenta: #ff00ff; --on-strong: #fff;
  --clash: #cfe2f3; --clash-line: #3d85c6; --clash-text: #1c4587; --willing: #2b7a3d;
  --opt-primary: #cfe2f3; --opt-alt: #fce5cd; --opt-none: #ea9999;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1b1d21; --fg: #e2e4e8; --header: #25282d; --line: #3a3f46; --border: #464c55; --th: #2d3137; --link: #7fb2ff;
  --hover: #5a616b; --focus-bg: #111316; --placeholder: #5f6670; --del: #ff7b7b; --strong-line: #9aa1ab;
  --green: #2f5d47; --orange: #9a5b00; --red: #a51d1d; --rose: #7f3636; --peach: #7a5230; --yellow: #6b6700;
  --lav: #4f4479; --purple: #5d1e9c; --magenta: #8c228c; --on-strong: #fff;
  --clash: #1f3a52; --clash-line: #4f95d6; --clash-text: #a7cdf3; --willing: #4caf6e;
  --opt-primary: #223a50; --opt-alt: #4e3b23; --opt-none: #6d2b2b;
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme]) {
    color-scheme: dark;
    --bg: #1b1d21; --fg: #e2e4e8; --header: #25282d; --line: #3a3f46; --border: #464c55; --th: #2d3137; --link: #7fb2ff;
    --hover: #5a616b; --focus-bg: #111316; --placeholder: #5f6670; --del: #ff7b7b; --strong-line: #9aa1ab;
    --green: #2f5d47; --orange: #9a5b00; --red: #a51d1d; --rose: #7f3636; --peach: #7a5230; --yellow: #6b6700;
    --lav: #4f4479; --purple: #5d1e9c; --magenta: #8c228c; --on-strong: #fff;
    --clash: #1f3a52; --clash-line: #4f95d6; --clash-text: #a7cdf3; --willing: #4caf6e;
    --opt-primary: #223a50; --opt-alt: #4e3b23; --opt-none: #6d2b2b;
  }
}
body { font-family: system-ui, sans-serif; font-size: 14px; margin: 0; color: var(--fg); background: var(--bg); }
a { color: var(--link); }
header { background: var(--header); border-bottom: 1px solid var(--line); padding: 6px 12px; position: sticky; top: 0; z-index: 2; }
h1 { font-size: 18px; margin: 0 0 4px; }
h1 .round, h1 .theme { font-size: 13px; font-weight: normal; margin-left: 12px; }
h1 .round select, h1 .theme select { font-size: 13px; }
h2 { font-size: 16px; margin: 16px 0 6px; }
nav a { margin-right: 12px; color: var(--link); text-decoration: none; }
nav a.active { font-weight: bold; text-decoration: underline; }
main { padding: 12px; }

table { border-collapse: collapse; margin-bottom: 12px; }
th, td { border: 1px solid var(--border); padding: 2px 4px; vertical-align: top; text-align: left; }
th { background: var(--th); font-weight: 600; }
thead th { position: sticky; top: 58px; }
tbody.cls { border-top: 3px solid var(--strong-line); }
td input, td select { font: inherit; color: inherit; border: 1px solid transparent; background: transparent; padding: 1px 2px; width: 100%; box-sizing: border-box; }
td select option { color: var(--fg); background: var(--bg); }
td input:hover, td select:hover { border-color: var(--hover); }
td input:focus, td select:focus { border-color: var(--link); background: var(--focus-bg); outline: none; }
td input.num { width: 3.5em; }
td input.room { width: 4.5em; }
td input.subj { width: 4.5em; }
td input.flag { width: 2.5em; text-align: center; }
td.num { text-align: right; }
.wide { min-width: 11em; }
.controls { display: flex; gap: 16px; align-items: end; flex-wrap: wrap; margin-bottom: 10px; }
.controls label { display: flex; flex-direction: column; font-weight: 600; gap: 2px; }
.controls input, .controls select { font: inherit; padding: 2px; min-width: 10em; }
button { font: inherit; cursor: pointer; }
button.del { border: none; background: none; color: var(--del); }
small.time { display: block; font-size: 11px; font-weight: normal; opacity: .75; white-space: nowrap; }
small.status { display: block; font-size: 11px; font-weight: normal; color: inherit; }
.grid td { min-width: 7em; height: 2.4em; }
.grid td span.code { display: block; font-weight: 600; padding: 1px 3px; margin-bottom: 1px; }
.legend td { padding: 2px 8px; }

/* Colors of the spreadsheet's conditional formatting (darker in dark mode) */
.c-green  { background: var(--green); }
.c-orange { background: var(--orange); }
.c-red    { background: var(--red); color: var(--on-strong); }
.c-rose   { background: var(--rose); }
.c-peach  { background: var(--peach); }
.c-yellow { background: var(--yellow); }
.c-lav    { background: var(--lav); color: var(--on-strong); }
.c-purple { background: var(--purple); color: var(--on-strong); }
.c-magenta{ background: var(--magenta); color: var(--on-strong); }
.chosen   { background: var(--green); }

#toast { white-space: pre-line; position: fixed; bottom: 16px; right: 16px; padding: 8px 12px; border-radius: 4px; background: #333; color: #fff; max-width: 40em; }
#toast.err { background: #b00020; }
td select { min-width: 9em; }
td select.flag { min-width: 3.5em; width: 3.5em; }
.timetable td { min-width: 8.5em; height: auto; }
.timetable td input { display: block; }
.timetable td input.subj { font-weight: 600; width: 100%; }
.timetable td input::placeholder { color: var(--placeholder); font-weight: normal; }
.report { white-space: pre-line; margin-bottom: 10px; font-family: ui-monospace, monospace; font-size: 13px; }
.timetable td select.group { min-width: 8em; font-size: 12px; }
/* Several presentations in the same hour */
.clash { background: var(--clash); box-shadow: inset 0 0 0 3px var(--clash-line); }
.clash-label { display: block; font-size: 11px; font-weight: 700; color: var(--clash-text); margin-bottom: 2px; }
.timetable .flags { display: flex; gap: 6px; align-items: center; font-size: 11px; margin-top: 2px; }
.timetable .flags label { display: flex; align-items: center; gap: 2px; }
.timetable .flags select.flag { min-width: 3em; width: 3em; font-size: 11px; }
.timetable .flags input[type=checkbox] { width: auto; display: inline; }
.timetable td.focus { outline: 3px solid var(--link); outline-offset: -3px; }
.willing { box-shadow: inset 5px 0 0 var(--willing); }   /* pripravljen manjkati */
label.inline { flex-direction: row !important; align-items: center; gap: 4px; }
.controls input[type=checkbox], td input[type=checkbox], label input[type=checkbox] { min-width: 0; width: auto; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
input.swatch { width: 3em; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; font-family: system-ui, sans-serif; }
.chip { padding: 2px 6px; border-radius: 3px; font-weight: 600; font-size: 13px; }
button.mini { padding: 0 4px; margin-left: 2px; font-size: 12px; min-width: 0; }

/* Termini: chosen option column + confirmed (potrjeno) option */
.opt-primary { background: var(--opt-primary); }
.opt-alt     { background: var(--opt-alt); }
.opt-none    { background: var(--opt-none); }
.confirmed, .confirmed input, .confirmed select { font-weight: 700; }
.badge { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 9px; background: #c01c28; color: #fff; font-size: 11px; font-weight: 700; }
/* Urnik dijaka: presentations in that hour */
.pres { display: inline-flex; flex-wrap: wrap; gap: 3px; font-size: 11px; margin-bottom: 2px; }
.pres b, .pres span { padding: 0 4px; border-radius: 3px; border: 1px solid var(--clash-line); }
.pres b { background: var(--clash-line); color: #fff; }
.pres span { color: var(--clash-text); }
/* Opravičevanje, Urnik profesorja: ✕ hides a row from view only (for copying); the column is never selected, copied or printed */
.table-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 6px; }
.table-tools small { opacity: .7; }
table.hideable .hide-cell { user-select: none; -webkit-user-select: none; width: 1.6em; padding: 0; text-align: center; vertical-align: middle; }
table.hideable td.hide-cell button { padding: 0 4px; opacity: .45; font-size: 13px; line-height: 1.4; }
table.hideable tr:hover td.hide-cell button, table.hideable td.hide-cell button:focus { opacity: 1; }
@media print { table.hideable .hide-cell, .table-tools { display: none; } }
table.hideable.copying small.time { display: inline; }

/* Checklist profesorjev: category choice, ticked (obveščen) teachers greyed out */
.check-cats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.check-cat { display: flex; align-items: center; gap: 6px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 4px; cursor: pointer; }
.check-cat.active { border-color: var(--link); box-shadow: inset 0 0 0 1px var(--link); font-weight: 600; }
.check-count { white-space: nowrap; font-size: 12px; font-weight: normal; padding: 0 6px; border-radius: 9px; background: var(--th); }
.check-hint { margin: 4px 0 8px; opacity: .8; }
.table-tools label.inline { display: flex; }
table.checklist td { vertical-align: middle; }
table.checklist td.check-items { font-size: 13px; }
table.checklist tr.checked td { opacity: .55; }
table.checklist tr.checked td.teacher { text-decoration: line-through; }

/* Emaili: template editor beside the preview; the preview is white "paper" like the e-mail itself, in every theme */
h3 { font-size: 14px; margin: 14px 0 6px; }
.email-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 1000px) { .email-cols { grid-template-columns: minmax(0, 1fr); } }
.email-field { display: flex; flex-direction: column; gap: 2px; font-weight: 600; margin-bottom: 8px; }
textarea, .email-subject, .email-from, .paste { font: inherit; color: inherit; background: var(--focus-bg); border: 1px solid var(--border); border-radius: 3px; padding: 4px 6px; box-sizing: border-box; }
.email-subject, .email-body { width: 100%; font-weight: normal; }
.email-body { resize: vertical; line-height: 1.45; min-height: 14em; }
.email-from { min-width: 22em; }
textarea:focus, .email-subject:focus, .email-from:focus, .paste:focus { outline: none; border-color: var(--link); }
textarea.paste { display: block; width: min(40em, 100%); margin-bottom: 6px; }
.email-ph { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.email-ph small { opacity: .75; }
.email-state { font-size: 12px; opacity: .75; }
.email-state.dirty { opacity: 1; color: var(--orange); font-weight: 600; }
table.email-head { margin-bottom: 6px; }
table.email-head th { width: 4em; }
.email-preview { background: #fff; color: #222; border: 1px solid var(--border); border-radius: 4px; padding: 12px 14px; margin-bottom: 8px;
  font-family: Arial, Helvetica, sans-serif; font-size: 13px; line-height: 1.4; overflow-x: auto; }
.missing { color: var(--del); }
.signature-src { width: 100%; font-family: ui-monospace, monospace; font-size: 13px; resize: vertical; min-height: 10em; }
.signature-paste { border: 1px dashed var(--border); border-radius: 3px; padding: 6px 8px; margin: 2px 0 8px; font-size: 13px; opacity: .8; cursor: text; }
.signature-paste:focus { outline: none; border-color: var(--link); opacity: 1; }
.email-frame { display: block; width: 100%; height: 3em; border: 0; background: #fff; }
.email-help ol { margin: 6px 0; padding-left: 22px; }
td input.email { min-width: 16em; }

/* Kdo lahko manjka: willing students per hour (the cell's colour grows with the count), the clicked hour's list beside */
.willing-layout { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.willing-grid td.willing-cell { cursor: pointer; background: color-mix(in srgb, var(--willing) var(--heat, 0%), transparent); }
.willing-grid td.willing-cell:hover { box-shadow: inset 0 0 0 2px var(--hover); }
.willing-grid td.willing-cell:focus-visible { outline: 2px solid var(--link); outline-offset: -2px; }
.willing-grid td.focus { outline: 3px solid var(--link); outline-offset: -3px; }
.willing-count { display: block; font-size: 17px; font-weight: 700; line-height: 1.2; }
.willing-count.none { color: var(--del); font-size: 14px; }
.willing-panel { position: sticky; top: 70px; flex: 1 1 26em; min-width: min(26em, 100%); max-height: calc(100vh - 90px); overflow: auto; }
.willing-panel h3 { margin-top: 0; }
.willing-heat { background: linear-gradient(90deg, color-mix(in srgb, var(--willing) 12%, transparent), color-mix(in srgb, var(--willing) 60%, transparent)); min-width: 4em; }
/* Theme "Aurora" (Tema → Aurora): deep night-sky background with violet / cyan / pink northern-light gradients,
   a frosted-glass header and soft neon glows. Only active with html[data-theme="aurora"]. */
html[data-theme="aurora"] {
  color-scheme: dark;
  --bg: #0a0a1f; --fg: #e8e6ff; --header: rgba(14, 13, 38, .72); --line: rgba(139, 120, 255, .28);
  --border: rgba(150, 140, 255, .2); --th: #19173d; --link: #9fb3ff;
  --hover: rgba(167, 139, 250, .55); --focus-bg: rgba(10, 10, 31, .85); --placeholder: #5d5a8c; --del: #ff7aa8; --strong-line: #8b7bff;
  --green: rgba(16, 185, 129, .3); --orange: rgba(249, 115, 22, .62); --red: rgba(244, 63, 94, .55); --rose: rgba(236, 72, 153, .32);
  --peach: rgba(251, 191, 36, .26); --yellow: rgba(250, 204, 21, .32); --lav: rgba(139, 92, 246, .5); --purple: rgba(168, 85, 247, .62);
  --magenta: rgba(217, 70, 239, .55); --on-strong: #fff;
  --clash: rgba(34, 211, 238, .14); --clash-line: #22d3ee; --clash-text: #a5f3fc; --willing: #34d399;
  --opt-primary: rgba(99, 102, 241, .28); --opt-alt: rgba(236, 72, 153, .22); --opt-none: rgba(244, 63, 94, .3);
  --glow: 0 0 0 1px rgba(167, 139, 250, .45), 0 0 18px rgba(124, 92, 255, .35);
  --grad: linear-gradient(120deg, #a78bfa 0%, #22d3ee 50%, #f472b6 100%);
  scrollbar-color: #4c3fa3 #0a0a1f;
}
html[data-theme="aurora"] ::selection { background: rgba(167, 139, 250, .45); color: #fff; }
html[data-theme="aurora"] body {
  background:
    radial-gradient(60vw 45vh at 8% -5%, rgba(124, 58, 237, .32), transparent 70%),
    radial-gradient(55vw 40vh at 95% 0%, rgba(34, 211, 238, .2), transparent 70%),
    radial-gradient(70vw 50vh at 60% 105%, rgba(236, 72, 153, .16), transparent 70%),
    linear-gradient(180deg, #0d0b26 0%, #0a0a1f 55%, #07071a 100%);
  background-attachment: fixed;
}
html[data-theme="aurora"] header {
  backdrop-filter: blur(14px) saturate(160%); -webkit-backdrop-filter: blur(14px) saturate(160%);
  border-bottom: 1px solid transparent;
  border-image: var(--grad) 1;
  box-shadow: 0 6px 30px rgba(10, 6, 40, .55);
}
html[data-theme="aurora"] h1 {
  background: linear-gradient(90deg, #c4b5fd 0, #67e8f9 130px, #f9a8d4 230px); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; letter-spacing: .2px;
}
html[data-theme="aurora"] h1 .round, html[data-theme="aurora"] h1 .theme { -webkit-text-fill-color: var(--fg); color: var(--fg); }
html[data-theme="aurora"] h2 {
  background: linear-gradient(90deg, #c4b5fd, #67e8f9); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; width: fit-content;
}
html[data-theme="aurora"] nav a { padding: 1px 8px; margin-right: 4px; border-radius: 999px; transition: background .2s, color .2s, box-shadow .2s; }
html[data-theme="aurora"] nav a:hover { background: rgba(139, 120, 255, .16); color: #fff; }
html[data-theme="aurora"] nav a.active {
  text-decoration: none; color: #fff;
  background: linear-gradient(120deg, rgba(124, 58, 237, .85), rgba(14, 165, 233, .75));
  box-shadow: 0 0 14px rgba(124, 92, 255, .55);
}

/* Tables: dark glass with a faint violet glow */
html[data-theme="aurora"] table { background: rgba(18, 16, 48, .55); box-shadow: 0 0 0 1px rgba(139, 120, 255, .25), 0 10px 40px rgba(5, 3, 30, .6); }
html[data-theme="aurora"] th { color: #d9d4ff; }
html[data-theme="aurora"] thead th { background: linear-gradient(180deg, #221e52, #19173d); }
html[data-theme="aurora"] tbody tr:hover > td { box-shadow: inset 0 0 0 999px rgba(167, 139, 250, .06); }
html[data-theme="aurora"] tbody.cls { border-top-color: #7c6bff; }

/* Form controls and buttons */
html[data-theme="aurora"] .controls input, html[data-theme="aurora"] .controls select,
html[data-theme="aurora"] header select, html[data-theme="aurora"] main > div > select, html[data-theme="aurora"] .table-tools select {
  background: rgba(20, 18, 54, .8); color: var(--fg); border: 1px solid rgba(150, 140, 255, .35); border-radius: 8px; padding: 3px 6px;
}
html[data-theme="aurora"] select option { color: var(--fg); background: #15133a; }
html[data-theme="aurora"] .controls input:focus, html[data-theme="aurora"] .controls select:focus,
html[data-theme="aurora"] header select:focus { outline: none; box-shadow: var(--glow); }
html[data-theme="aurora"] td input:focus, html[data-theme="aurora"] td select:focus { box-shadow: 0 0 10px rgba(124, 92, 255, .45); border-radius: 3px; }
html[data-theme="aurora"] button:not(.del) {
  color: #fff; border: 1px solid rgba(167, 139, 250, .5); border-radius: 8px; padding: 3px 10px;
  background: linear-gradient(120deg, rgba(124, 58, 237, .7), rgba(14, 165, 233, .55));
  transition: box-shadow .2s, transform .1s, filter .2s;
}
html[data-theme="aurora"] button.mini { padding: 0 5px; border-radius: 6px; }
html[data-theme="aurora"] button:not(.del):hover { box-shadow: 0 0 16px rgba(124, 92, 255, .6); filter: brightness(1.12); }
html[data-theme="aurora"] button:not(.del):active { transform: translateY(1px); }
html[data-theme="aurora"] input[type=file]::file-selector-button {
  color: #fff; border: 1px solid rgba(167, 139, 250, .5); border-radius: 6px; margin-right: 8px; cursor: pointer;
  background: linear-gradient(120deg, rgba(124, 58, 237, .55), rgba(14, 165, 233, .4));
}
html[data-theme="aurora"] button:disabled { opacity: .45; box-shadow: none; filter: none; cursor: default; }
html[data-theme="aurora"] input[type=checkbox] { accent-color: #8b5cf6; }

/* Small bits */
html[data-theme="aurora"] .chip { border-radius: 999px; padding: 2px 9px; box-shadow: 0 0 0 1px rgba(255, 255, 255, .08); }
html[data-theme="aurora"] .badge { background: linear-gradient(120deg, #f43f5e, #d946ef); box-shadow: 0 0 10px rgba(244, 63, 94, .7); }
html[data-theme="aurora"] .clash { box-shadow: inset 0 0 0 2px var(--clash-line), inset 0 0 14px rgba(34, 211, 238, .35); }
html[data-theme="aurora"] table.hideable td.hide-cell button:hover { text-shadow: 0 0 8px rgba(255, 122, 168, .9); }
html[data-theme="aurora"] .check-cat { border-radius: 999px; background: rgba(20, 18, 54, .6); border-color: rgba(150, 140, 255, .35); transition: box-shadow .2s; }
html[data-theme="aurora"] .check-cat:hover { box-shadow: 0 0 12px rgba(124, 92, 255, .4); }
html[data-theme="aurora"] .check-cat.active { background: linear-gradient(120deg, rgba(124, 58, 237, .55), rgba(14, 165, 233, .4)); border-color: rgba(167, 139, 250, .7); box-shadow: 0 0 14px rgba(124, 92, 255, .55); }
html[data-theme="aurora"] .check-count { background: rgba(255, 255, 255, .12); }
html[data-theme="aurora"] input[type=radio] { accent-color: #22d3ee; }
html[data-theme="aurora"] .pres b { background: linear-gradient(120deg, #0891b2, #7c3aed); border-color: transparent; }
html[data-theme="aurora"] .report:not(:empty) { background: rgba(18, 16, 48, .6); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
html[data-theme="aurora"] #toast {
  background: rgba(24, 20, 64, .88); border: 1px solid rgba(167, 139, 250, .5); border-radius: 10px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 0 24px rgba(124, 92, 255, .45);
}
html[data-theme="aurora"] #toast.err { background: rgba(80, 10, 40, .9); border-color: #f43f5e; box-shadow: 0 0 24px rgba(244, 63, 94, .5); }
html[data-theme="aurora"] textarea, html[data-theme="aurora"] .email-subject, html[data-theme="aurora"] .email-from, html[data-theme="aurora"] .paste {
  background: rgba(20, 18, 54, .8); border: 1px solid rgba(150, 140, 255, .35); border-radius: 8px;
}
html[data-theme="aurora"] textarea:focus, html[data-theme="aurora"] .email-subject:focus, html[data-theme="aurora"] .email-from:focus { box-shadow: var(--glow); }
html[data-theme="aurora"] .email-preview { border-radius: 10px; border-color: rgba(167, 139, 250, .6); box-shadow: 0 0 22px rgba(124, 92, 255, .45); }
html[data-theme="aurora"] h3 { color: #c9c2ff; }
html[data-theme="aurora"] .email-state.dirty { color: #fbbf24; }

/* Nastavitve: teachers in side-by-side tables; nastavitve.js picks the number of 32em columns that fit */
.teacher-cols { display: grid; column-gap: 24px; align-items: start; margin-bottom: 12px; }
.teacher-cols table { width: 100%; margin-bottom: 0; }
.teacher-cols td:first-child { width: 38%; }
.teacher-cols td:last-child { width: 1.6em; }
.teacher-cols td input.email { min-width: 0; }
