/* ---------------------------------------------------------------------------
   Öndvegi — base stylesheet.

   Sober and high-contrast on purpose: the thing this site produces is a sheet
   of paper pinned to a classroom wall, so the screen should look like what
   comes out of the printer, not compete with it.
   --------------------------------------------------------------------------- */

:root {
    --ink:      #22262E;
    --brand:    #5A4A32;   /* dark oak — the sand of the high seat, deepened */
    --brand-dk: #463A27;
    --accent:   #C8843C;   /* oak — the high seat */
    --accent-lt:#F0DFC6;
    --muted:    #6E7480;
    --bg:       #F7F6F3;   /* paper */
    --card:     #FFFFFF;
    --line:     #E3E0DA;
    --radius:   10px;
    --shadow:   0 6px 18px rgba(34, 38, 46, .07);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    font-size: 16px;
    line-height: 1.55;
}

a { color: inherit; text-decoration: none; }

/* --- Header ---------------------------------------------------------------- */

.site-header { background: var(--brand); color: #fff; }

.header-bar {
    max-width: 1180px;
    margin: 0 auto;
    padding: 13px 22px;
    display: flex;
    align-items: center;
    gap: 22px;
}

.brand {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: .14em;
    display: flex;
    align-items: center;
    gap: 9px;
}

.brand-mark { color: var(--accent); font-size: 22px; }

.header-nav {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14.5px;
    font-weight: 600;
}

.header-nav > a { padding: 7px 12px; border-radius: 8px; }
.header-nav > a:hover { background: rgba(255, 255, 255, .13); }
.nav-name { color: var(--accent-lt); }

.nav-lang {
    font-size: 13px;
    letter-spacing: .06em;
    border: 1px solid rgba(255, 255, 255, .45);
}

/* The school's own crest, top right. On a dark header a dark logo would
   disappear, so it sits on its own light plate. */
.school-crest {
    margin-left: 18px;
    background: #fff;
    border-radius: 6px;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    max-height: 44px;
}

.school-crest img { max-height: 30px; max-width: 190px; display: block; }

.school-crest-text {
    color: var(--brand);
    font-weight: 700;
    font-size: 13px;
    max-width: 190px;
    line-height: 1.2;
}

.logo-preview-box {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-preview-box img { max-width: 100%; max-height: 90px; }

@media (max-width: 820px) {
    .school-crest { display: none; }
}

/* --- Layout ---------------------------------------------------------------- */

.site-main {
    max-width: 1180px;
    margin: 0 auto;
    padding: 32px 22px 60px;
    min-height: 65vh;
}

.page-title { font-size: 25px; margin: 0 0 6px; }
.page-sub { color: var(--muted); margin: 0 0 26px; }

.section-title {
    font-size: 19px;
    margin: 38px 0 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

/* --- Cards, buttons, alerts ------------------------------------------------ */

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.btn {
    display: inline-block;
    border: 0;
    border-radius: 8px;
    padding: 10px 22px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-align: center;
}

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dk); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #B0722F; }

.btn-quiet {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--ink);
}
.btn-quiet:hover { border-color: var(--accent); }

.alert {
    border-radius: 8px;
    padding: 11px 15px;
    margin-bottom: 20px;
    font-size: 14.5px;
    border: 1px solid;
}

.alert-success { background: #EFF5EF; border-color: #C6DCC6; color: #2A5A2E; }
.alert-error   { background: #FBEFEC; border-color: #E9C4B9; color: #94341F; }
.alert-info    { background: var(--accent-lt); border-color: var(--accent); color: #6B4415; }

/* A name inlined into alert prose (the locked-accounts list) needs the same
   clickable signal as the table links — underline stays put since the alert
   colors already vary too much per type to lean on a link color alone. */
.alert a { text-decoration: underline; font-weight: 700; }
.alert a:hover { opacity: .75; }

/* --- Front page ------------------------------------------------------------ */

.hero { text-align: center; padding: 42px 0 34px; }
.hero h1 { font-size: clamp(28px, 4.2vw, 42px); margin: 0 0 6px; }

.tagline {
    color: var(--accent);
    font-size: 17px;
    font-weight: 600;
    letter-spacing: .02em;
    margin: 0 0 18px;
}
.hero .lead { color: var(--muted); font-size: 17px; max-width: 560px; margin: 0 auto 26px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 18px;
}

.feature h3 { margin: 0 0 8px; font-size: 17px; }
.feature p { margin: 0; color: var(--muted); font-size: 14.5px; }

/* --- Forms ------------------------------------------------------------------ */

.auth-wrap { max-width: 420px; margin: 24px auto; }
.auth-card h1 { font-size: 22px; margin: 0 0 5px; text-align: center; }
.auth-card .sub { color: var(--muted); font-size: 14.5px; text-align: center; margin: 0 0 22px; }

.card-title { font-size: 17px; margin: 0 0 16px; }

.form-group { margin-bottom: 15px; }

label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 5px; }
.optional { font-weight: 400; color: var(--muted); }

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 7px;
    font-size: 15px;
    font-family: inherit;
    color: var(--ink);
    background: #fff;
}

.form-control:focus { outline: none; border-color: var(--accent); }
.form-control.is-invalid { border-color: #B5432A; }

.field-error { color: #B5432A; font-size: 12.5px; margin-top: 4px; display: block; }
.field-hint { color: var(--muted); font-size: 12.5px; margin-top: 4px; display: block; }

.btn-block { width: 100%; }
.btn-small { padding: 7px 14px; font-size: 13.5px; }

.auth-links { text-align: center; margin: 18px 0 0; font-size: 14px; color: var(--muted); }
.auth-links a { color: var(--brand); font-weight: 600; }
.auth-links a:hover { color: var(--accent); }

.two-col {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    align-items: start;
}

/* --- Lists and page heads ---------------------------------------------------- */

.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}

.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form .form-control { width: auto; min-width: 230px; }

.crumb { margin: 0 0 12px; font-size: 14px; }
.crumb a { color: var(--muted); }
.crumb a:hover { color: var(--brand); }

.layout-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}

.layout-card h3 { margin: 0 0 4px; font-size: 17px; }
.layout-meta { color: var(--muted); font-size: 13.5px; margin: 0 0 14px; }
.layout-actions { margin: 0; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.layout-actions form { margin: 0; }

.visibility-form { margin: 0 0 10px; }
.visibility-form .form-control { padding: 6px 9px; font-size: 13.5px; }

.share-list { list-style: none; margin: 0 0 10px; padding: 0; font-size: 13.5px; }

.share-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    border-bottom: 1px solid var(--line);
}

.share-list li:last-child { border-bottom: 0; }
.share-list form { margin: 0; }

.share-add { margin-bottom: 12px; }
.share-add .form-control { min-width: 0; flex: 1; padding: 6px 9px; font-size: 13.5px; }

.empty-state { text-align: center; padding: 42px 26px; }
.empty-state h2 { margin: 0 0 8px; font-size: 20px; }
.empty-state p { color: var(--muted); max-width: 420px; margin: 0 auto 20px; }
.empty-icon { font-size: 32px; color: var(--accent); margin: 0 0 8px; }

/* --- The classroom editor ---------------------------------------------------- */

.editor-wrap {
    display: grid;
    grid-template-columns: 1fr 260px;
    gap: 22px;
    align-items: start;
}

.title-input {
    font-size: 25px;
    font-weight: 700;
    font-family: inherit;
    color: var(--ink);
    border: 1px solid transparent;
    border-radius: 7px;
    padding: 2px 8px;
    margin-left: -8px;
    background: transparent;
    width: 100%;
    max-width: 420px;
}

.title-input:hover { border-color: var(--line); }
.title-input:focus { outline: none; border-color: var(--accent); background: #fff; }

.editor-actions { display: flex; align-items: center; gap: 14px; }

.seat-count { color: var(--muted); font-size: 14px; font-weight: 600; }
.seat-count.is-full { color: var(--accent); }

/* The room: a plain grid of cells, as close to graph paper as possible so it
   reads the same on screen as on the printed sheet. */
.room {
    display: grid;
    grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
    grid-template-rows: repeat(var(--rows), 62px);
    gap: 0;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px;
    box-shadow: var(--shadow);
}

.cell {
    /* Just dark enough to read as graph paper — the grid should guide the eye
       without competing with the desks sitting on it. */
    border: 1px dashed #D5CFC5;
    padding: 3px;
    cursor: pointer;
}

.cell:hover { background: #FAF8F4; }
.cell.drop-ok { background: var(--accent-lt); }

.desk {
    height: 100%;
    background: #fff;
    border: 2px solid var(--ink);
    border-left-width: 1px;
    border-right-width: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    cursor: grab;
    user-select: none;
}

/* Desks in one table share an outline, so a pair looks like a pair. */
.desk.t-first { border-left-width: 2px; border-radius: 6px 0 0 6px; }
.desk.t-last  { border-right-width: 2px; border-radius: 0 6px 6px 0; }
.desk.t-first.t-last { border-radius: 6px; }

.desk.t-toobig { border-color: #B5432A; background: #FBEFEC; }

.desk-teacher {
    background: var(--brand);
    color: #fff;
    border-color: var(--brand);
    border-radius: 6px !important;
    border-width: 2px !important;
    font-size: 11px;
}

.editor-side .card { padding: 18px; }

/* Quick setup, once the room has desks in it. */
.is-locked { opacity: .55; }
.is-locked .btn, .is-locked input { cursor: not-allowed; }

.table-buttons { display: flex; gap: 8px; }
.table-buttons .btn { flex: 1; padding: 10px 0; font-size: 16px; font-weight: 700; }

/* Seat numbers sit quietly on the desk — visible when scanning, not shouting. */
.desk { color: var(--muted); font-size: 12.5px; }
.desk-teacher { color: #fff; }
.side-note { color: var(--muted); font-size: 13px; margin: 0 0 14px; }

@media (max-width: 900px) {
    .editor-wrap { grid-template-columns: 1fr; }
    .room { grid-template-rows: repeat(var(--rows), 52px); }
}

/* --- Class pages ------------------------------------------------------------- */

.status-line { margin: 0 0 14px; font-size: 13.5px; font-weight: 600; }
.status-todo { color: var(--muted); }
.status-warn { color: #B5432A; }
.status-done { color: #2A5A2E; }

.roster {
    margin: 0;
    padding-left: 26px;
    columns: 2;
    column-gap: 26px;
    font-size: 15px;
}

.roster li { margin-bottom: 4px; break-inside: avoid; display: flex; align-items: center; gap: 4px; }

.roster li label { display: inline-flex; align-items: center; gap: 6px; }

.roster-input { font-family: inherit; line-height: 1.6; }

/* The rename/remove disclosure: a small "✎" that expands inline, so a row
   the teacher isn't fixing right now looks exactly like the plain checklist
   it used to be. */
.roster-edit { display: inline-block; }
.roster-edit summary {
    display: inline-block;
    cursor: pointer;
    color: var(--muted);
    font-size: 13px;
    list-style: none;
}
.roster-edit summary::-webkit-details-marker { display: none; }
.roster-edit[open] summary { color: var(--accent); }
.roster-edit .roster-name-input,
.roster-edit .link-btn { margin-left: 4px; }

.roster-name-input { width: 120px; padding: 2px 6px; font-size: 14px; }

.roster-select-all { margin: 0 0 6px; }

@media (max-width: 640px) {
    .roster { columns: 1; }
}

/* --- Admin ------------------------------------------------------------------- */

.nav-admin { color: var(--accent-lt); }

.admin-nav {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--line);
    padding-bottom: 12px;
}

.admin-nav-link {
    padding: 7px 15px;
    border-radius: 999px;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--muted);
}

.admin-nav-link:hover { background: #EFEDE8; color: var(--ink); }
.admin-nav-link.is-active { background: var(--brand); color: #fff; }

.table-wrap { overflow-x: auto; }

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.admin-table th, .admin-table td {
    padding: 7px 10px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
    line-height: 1.3;
}

.admin-table th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
}

.admin-table tr:last-child td { border-bottom: 0; }

/* A name that opens the person's page needs to read as clickable at a
   glance, distinct from the plain-text details (email, subject) sharing the
   same cell — plain color+no-underline everywhere else would hide it. */
.admin-table td a { color: var(--accent); font-weight: 600; }
.admin-table td a:hover,
.admin-table td a:focus-visible { color: var(--brand-dk); text-decoration: underline; }

/* A tint every other row — the table is scanned more than it is read line by
   line, and the stripe is what makes a row easy to track across nine columns
   without a ruler. Kept faint enough not to fight the status pills for
   attention. */
.admin-table tbody tr:nth-child(even) { background: #FAF9F6; }

.admin-table tr.row-current { background: #FBF7F0; }

/* A disabled row (bekkur, stofa, …) stays readable — Admin still needs the
   name to re-enable it — just visibly de-emphasized against active rows. */
.admin-table tr.row-muted { opacity: 0.55; }

/* A note wrapped inside a cell (an email under a name, a caveat under a class)
   reads as a detail, not a second fact — smaller and tighter than a side-note
   run at full width, so it does not blow the row out to three lines. */
.admin-table .side-note {
    font-size: 11.5px;
    margin: 2px 0 0;
    line-height: 1.25;
}

.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions form { margin: 0; }
.nowrap { white-space: nowrap; }

.pill {
    display: inline-block;
    border-radius: 999px;
    padding: 1px 10px;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid;
}

.pill-current { background: var(--accent-lt); border-color: var(--accent); color: #6B4415; }
.pill-ok      { background: #EFF5EF; border-color: #C6DCC6; color: #2A5A2E; }
.pill-todo    { background: #F2F1ED; border-color: var(--line); color: var(--muted); }
.pill-warn    { background: #FBEFEC; border-color: #E9C4B9; color: #94341F; }

/* A pill that is itself the link to the plan (Skiptivikur's Já cells) —
   the badge already reads as clickable, this just confirms it on hover. */
a > .pill-ok:hover { background: #DCEBDD; }

.btn-danger { color: #94341F; }
.btn-danger:hover { border-color: #94341F; }

.stat-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
    margin-bottom: 8px;
}

.stat-tile {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    text-align: center;
}

.stat-tile.stat-attention { border-color: var(--accent); background: #FDF7EF; }

.password-list { margin: 8px 0 0; padding-left: 20px; font-family: monospace; font-size: 14px; }

.stat-num { display: block; font-size: 29px; font-weight: 700; color: var(--brand); line-height: 1.1; }
.stat-label { display: block; color: var(--muted); font-size: 13.5px; margin-top: 4px; }

/* --- Rules ------------------------------------------------------------------- */

.pair-list { list-style: none; margin: 0 0 16px; padding: 0; }

.pair-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 7px 0;
    border-bottom: 1px solid var(--line);
    font-size: 14.5px;
}

.pair-list li:last-child { border-bottom: 0; }
.pair-list form { margin: 0; }

.link-btn {
    border: 0;
    background: none;
    color: var(--muted);
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
}

.link-btn:hover { color: #94341F; }

.pair-form { display: flex; flex-direction: column; gap: 8px; }

/* --- The draw ---------------------------------------------------------------- */

.draw-stage { display: flex; flex-direction: column; align-items: center; gap: 26px; }

.room-view { width: 100%; }
.room-view .cell { cursor: default; border-color: transparent; }
.room-view .cell:hover { background: transparent; }
.room-view .desk { cursor: default; font-size: 12.5px; padding: 2px; text-align: center; line-height: 1.2; }

/* Names arrive one at a time rather than all at once — the point of the
   ritual is the moment, not the result. */
@keyframes seatReveal {
    from { opacity: 0; transform: scale(.86); }
    to   { opacity: 1; transform: scale(1); }
}

.desk.is-revealing {
    animation: seatReveal .32s ease-out both;
}

.draw-form { margin: 0; }

/* Beat one: the chosen pupil, big enough to read from the back of the room. */
.chosen-panel { text-align: center; }

.chosen-label {
    color: var(--muted);
    font-size: 15px;
    letter-spacing: .06em;
    text-transform: uppercase;
    margin: 0 0 4px;
}

.chosen-name {
    font-size: clamp(34px, 6vw, 62px);
    font-weight: 700;
    color: var(--brand);
    margin: 0;
    line-height: 1.1;
}

@keyframes chosenIn {
    from { opacity: 0; transform: scale(.8); }
    to   { opacity: 1; transform: scale(1); }
}

.chosen-panel.is-revealing { animation: chosenIn .45s ease-out both; }

.draw-button-choose { background: var(--brand); box-shadow: 0 8px 20px rgba(90, 74, 50, .32); }
.draw-button-choose:hover { box-shadow: 0 12px 26px rgba(90, 74, 50, .38); }

.drawn-by-note {
    text-align: center;
    color: var(--muted);
    font-size: 15px;
    margin: 22px 0 0;
}

.approval-box {
    text-align: center;
    margin: 18px 0 0;
}

.approval-box form { display: inline-block; }

.approval-note {
    font-size: 15px;
    margin: 0;
}

.approval-note-ok {
    color: #2A5A2E;
    font-weight: 600;
}

.draw-button {
    border: 0;
    border-radius: 14px;
    background: var(--accent);
    color: #fff;
    padding: 22px 60px;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 8px 20px rgba(200, 132, 60, .32);
    transition: transform .1s ease, box-shadow .1s ease;
}

.draw-button:hover { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(200, 132, 60, .38); }
.draw-button:active { transform: translateY(1px); }

.draw-button-main {
    display: block;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: .04em;
}

.draw-button-sub { display: block; font-size: 13.5px; opacity: .9; margin-top: 4px; }

.teacher-note ul { margin: 8px 0 0; padding-left: 20px; font-size: 14px; }
.teacher-note li { margin-bottom: 3px; }

/* --- Printing any page -------------------------------------------------------
   print.php is the proper sheet for the wall, but a teacher may well just hit
   Ctrl+P on the seating page. When they do, the grid lines, the site chrome and
   the buttons should not come out with it — only the desks and the names.
   ----------------------------------------------------------------------------- */

@media print {
    body { background: #fff; }

    .site-header,
    .site-footer,
    .admin-nav,
    .crumb,
    .draw-form,
    .editor-actions,
    .editor-side,
    .alert,
    .btn { display: none !important; }

    .site-main { max-width: none; padding: 0; }

    /* The room prints as desks alone — no card, no grid, no shadow. */
    .room {
        border: 0;
        box-shadow: none;
        background: #fff;
        padding: 0;
    }

    .cell { border: 0 !important; background: #fff !important; }

    .desk {
        border: 1.5px solid #000;
        color: #000;
        background: #fff;
    }

    .desk-teacher {
        background: #fff !important;
        color: #000 !important;
        border: 2px solid #000 !important;
    }

    /* Reveal animation would otherwise leave desks mid-fade on paper. */
    .desk.is-revealing { animation: none !important; opacity: 1 !important; transform: none !important; }

    .card { border: 0; box-shadow: none; padding: 0; }
    .page-title { font-size: 20pt; }
}

/* --- Footer ----------------------------------------------------------------- */

.site-footer {
    background: var(--brand-dk);
    color: rgba(255, 255, 255, .72);
    padding: 22px;
    text-align: center;
    font-size: 14px;
}

.site-footer p { margin: 0; }

/* The way in for a new school. Quiet, but a real link — not a whisper. */
.footer-request { margin-top: 10px !important; }

.footer-request a {
    color: var(--accent-lt);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.footer-request a:hover { color: #fff; }

/* --- The ritual: three stages, readable from the back of the room ------------ */

/*
 * The border around the room is the status light. A teacher glancing up, or a
 * pupil at the back, should know which beat they are on without reading a word:
 *
 *   blue   — waiting, nobody has been picked yet
 *   orange — the chosen pupil is walking up; the draw is about to happen
 *   green  — drawn, this is the seating
 */
.room-ready,
.room-armed,
.room-final {
    border-width: 5px;
    border-style: solid;
    transition: border-color .3s ease, box-shadow .3s ease;
}

.room-ready {
    border-color: #2E7DAF;
    box-shadow: 0 0 0 5px rgba(46, 125, 175, .13), var(--shadow);
}

.room-armed {
    border-color: var(--accent);
    box-shadow: 0 0 0 5px rgba(200, 132, 60, .18), var(--shadow);
    animation: roomArmed 1.5s ease-in-out infinite;
}

.room-final {
    border-color: #2A5A2E;
    box-shadow: 0 0 0 5px rgba(42, 90, 46, .14), var(--shadow);
}

/* Only the "about to happen" stage moves — a room that pulsed the whole lesson
   would be exhausting. */
@keyframes roomArmed {
    0%, 100% { box-shadow: 0 0 0 5px rgba(200, 132, 60, .18), var(--shadow); }
    50%      { box-shadow: 0 0 0 11px rgba(200, 132, 60, .09), var(--shadow); }
}

/* An empty desk before the draw. The question mark carries the suspense, so it
   is the loudest thing on an otherwise blank desk. */
.desk-waiting {
    color: var(--accent);
    font-size: 19px;
    font-weight: 700;
    background: #FCFAF7;
}

.room-final .desk-waiting { color: var(--muted); }

/* Confetti sits above everything and catches no clicks. */
#confetti-layer {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

@media (prefers-reduced-motion: reduce) {
    .room-armed { animation: none; }
    .desk.is-revealing { animation: none; }
}

/* --- The user list ------------------------------------------------------------ */

.sort-link {
    color: inherit;
    text-decoration: none;
    white-space: nowrap;
}

.sort-link:hover { color: var(--accent); }

/* Three actions per row: stacked, so the table stays readable rather than
   sprouting a very wide last column. */
.user-actions form { margin: 0 0 5px; }
.user-actions form:last-child { margin-bottom: 0; }
.user-actions .btn { width: 100%; }

/* A checkbox with its label on one line, for the odd yes/no in a form. */
.form-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 14px;
    color: var(--ink);
    line-height: 1.35;
}

.form-check input { margin-top: 3px; }

/* A compact auto-submit control inside a table cell — the class-assignment
   dropdowns on Yfirlit and Bekkir. Deliberately not .inline-form: that one is
   sized for a standalone row of its own, with a 230px minimum that would blow
   a table cell back out to the width this whole pass was meant to fix. */
.table-inline-form { margin: 0; }

.table-inline-form .form-control-small {
    width: auto;
    max-width: 100%;
    padding: 3px 6px;
    font-size: 12.5px;
    font-family: inherit;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 5px;
}

.table-inline-form .form-control-small:focus { outline: none; border-color: var(--accent); }


/* --- The window over the list of skiptitímabil --------------------------------- */

.period-dialog {
    width: min(760px, calc(100vw - 24px));
    max-height: calc(100vh - 48px);
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    color: var(--ink);
    box-shadow: 0 18px 48px rgba(34, 38, 46, .22);
}
.period-dialog::backdrop { background: rgba(34, 38, 46, .45); }
.period-dialog-bar { display: flex; justify-content: flex-end; padding: 8px 10px 0; }
.period-dialog-close {
    border: 0; background: transparent; cursor: pointer;
    font-size: 26px; line-height: 1; color: var(--muted); padding: 2px 8px;
}
.period-dialog-close:hover { color: var(--accent); }
.period-dialog-body { padding: 0 24px 22px; overflow-y: auto; max-height: calc(100vh - 110px); }
.period-dialog-body .stat-row { margin: 12px 0 14px; }
.period-group { margin-top: 14px; }
.period-group-title { font-size: 15px; font-weight: 700; color: var(--brand); margin: 0 0 6px; }

/* The term's own dates under the term picker on Skiptitímabil */
.term-dates { font-size: 17px; line-height: 1.5; color: var(--ink); margin: -4px 0 18px; }
.term-dates .side-note { font-size: 14px; }

/* The term and its exam period, each in a rounded box */
.term-chip {
    display: inline-block;
    border: 1.5px solid var(--line);
    border-radius: 999px;
    background: var(--card);
    padding: 9px 24px;
    margin: 0 18px 14px 0;
    font-size: 17px;
    line-height: 1.4;
    box-shadow: var(--shadow);
}
.term-chip strong { margin: 0 3px; }
/* the term's own box in the brown of the page header */
.term-chip:not(.term-chip-exam) { border-color: var(--brand); background: #F3EFE7; color: var(--brand-dk); }
.term-chip:not(.term-chip-exam) strong { color: var(--brand); }
.term-chip-exam { background: var(--accent-lt); border-color: var(--accent); color: #6B4415; }
.term-dates { margin: 6px 0 14px; }
.term-dates .side-note { display: inline-block; margin: 0 0 14px 2px; vertical-align: middle; }

/* green + and red − */
.btn-plus  { color: #2A5A2E; background: #EFF5EF; border: 1px solid #C6DCC6; font-weight: 700; }
.btn-plus:hover  { background: #DCEBDD; border-color: #2A5A2E; }
.btn-minus { color: #94341F; background: #FBEFEC; border: 1px solid #E9C4B9; font-weight: 700; }
.btn-minus:hover { background: #F5DDD6; border-color: #94341F; }

/* Hefst / Lýkur (Byrjar / Lýkur) side by side in one row, button after them */
.date-row { display: flex; flex-wrap: nowrap; gap: 10px; align-items: flex-end; max-width: 100%; }
.date-field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 0; min-width: 0; max-width: 190px; }
.date-field .form-control-small { width: 100%; min-width: 0; }
.date-row .btn { flex: 0 0 auto; }

/* The term picker, and the one for older terms beside it */
.term-pickers { display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: flex-end; }
.term-pickers .form-group { margin-bottom: 10px; min-width: 240px; max-width: 320px; flex: 1 1 240px; }
