/* Orar USV – the common style. The colours are defined only once, as variables. */

:root {
    --blue: #00338d;
    --light-blue: #e8eef9;
    --blue-hover: #002670;
    --text: #1c2433;
    --secondary-text: #5b6577;
    --background: #f4f6fa;
    --surface: #ffffff;
    --border: #dde3ec;
    --yellow: #fff4c2;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
    --radius: 10px;
    /* the common border of all the slots with activities */
    --slot-border: #3b4252;
    --slot-border-width: 3px;
    --max-width: 1200px;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background: var(--background);
}

* { box-sizing: border-box; }

/* the hidden attribute always hides, even if the element's style gives it another `display` (e.g. buttons) */
[hidden] { display: none !important; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--background);
    line-height: 1.45;
}

a { color: var(--blue); }
a:hover { color: var(--blue-hover); }

.visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

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

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.site-header__inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 12px 24px;
    flex-wrap: wrap;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
    margin-right: auto;
}

.brand img { display: block; }
.brand__text { display: flex; flex-direction: column; line-height: 1.2; }
.brand__text strong { color: var(--blue); font-size: 1.1rem; }
.brand__text small { color: var(--secondary-text); font-size: .8rem; }

.menu { display: flex; gap: 4px; }

.menu a {
    padding: 8px 12px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--secondary-text);
    font-weight: 500;
    white-space: nowrap;
}

.menu a:hover { background: var(--background); color: var(--text); }
.menu a[aria-current="page"] { background: var(--blue); color: #fff; }

.period-selector select {
    font: inherit;
    font-size: .85rem;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    max-width: 260px;
}

.archive-banner {
    background: var(--yellow);
    border-bottom: 1px solid #ecd97a;
    padding: 8px 16px;
    text-align: center;
    font-size: .9rem;
}

/* ---------- Content ---------- */

.content {
    flex: 1;
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 24px 16px 40px;
}

.page-title { font-size: 1.5rem; margin: 0 0 20px; }

.breadcrumbs { font-size: .9rem; color: var(--secondary-text); margin-bottom: 6px; }
.breadcrumbs a { text-decoration: none; }

.footer {
    text-align: center;
    padding: 16px;
    color: var(--secondary-text);
    font-size: .85rem;
    border-top: 1px solid var(--border);
    background: var(--surface);
}

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

.card__subtitle { margin: 0 0 12px; font-size: 1rem; }

.card-grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

.card-grid > li { display: flex; }

.card--link {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    text-decoration: none;
    color: var(--text);
    transition: border-color .15s, transform .15s;
}

.card--link:hover { border-color: var(--blue); transform: translateY(-1px); color: var(--text); }
.card__label { font-size: .75rem; font-weight: 700; letter-spacing: .04em; color: var(--blue); text-transform: uppercase; }
.card__title { font-weight: 600; }
.card--external .card__label { color: var(--secondary-text); }

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

.empty { color: var(--secondary-text); }

.badge {
    display: inline-block;
    font-size: .7rem;
    padding: 1px 6px;
    margin-left: 6px;
    border-radius: 999px;
    background: var(--light-blue);
    color: var(--blue);
    vertical-align: middle;
}

/* ---------- Lists ---------- */

.link-list { list-style: none; margin: 0; padding: 0; }
.link-list li { border-bottom: 1px solid var(--border); }
.link-list li:last-child { border-bottom: 0; }

.link-list a {
    display: inline-block;
    padding: 9px 2px;
    text-decoration: none;
    color: var(--text);
}

.link-list a:hover { color: var(--blue); text-decoration: underline; }

.link-list--compact { max-height: 60vh; overflow-y: auto; }

.link-list--columns { columns: 3 260px; column-gap: 24px; }
.link-list--columns li { break-inside: avoid; }

.pill-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }

.pill-list a {
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    text-decoration: none;
    color: var(--text);
    background: var(--surface);
}

.pill-list a:hover { border-color: var(--blue); color: var(--blue); }

.groups { display: flex; flex-direction: column; gap: 18px; }
.group__title { font-size: .95rem; margin: 0 0 8px; color: var(--secondary-text); }

.search { display: block; margin-bottom: 12px; }

.search input {
    width: 100%;
    font: inherit;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
}

.search input:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: var(--blue); }
.search--large input { font-size: 1.05rem; padding: 12px 14px; }
.result-count { margin: 0 0 8px; color: var(--secondary-text); font-size: .9rem; }

/* ---------- Tabs (Licență / Master / Postuniversitar) ---------- */

.tabs__buttons {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 16px;
}

.tabs__buttons button {
    font: inherit;
    border: 0;
    background: none;
    padding: 8px 16px;
    border-radius: 7px;
    cursor: pointer;
    color: var(--secondary-text);
    font-weight: 500;
}

.tabs__buttons button[aria-selected="true"] { background: var(--blue); color: #fff; }

/* without JavaScript: all the panels are visible, with titles */
html:not(.js) .tabs__buttons { display: none; }
html:not(.js) .tabs__panel[hidden] { display: block; }
.js .js-hidden { display: none; }
.tabs__panel h2 { font-size: 1.1rem; }

/* ---------- Text ---------- */

.text h2 { font-size: 1.1rem; margin: 20px 0 8px; }
.text h2:first-child { margin-top: 0; }

.error-details {
    white-space: pre-wrap;
    font-size: .8rem;
    background: var(--background);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
}

/* ---------- Timetables ---------- */

/* the activity types' colours (background / border) */
.type-1 { --type-background: #fff3c4; --type-border: #e6c84f; }  /* seminar */
.type-2 { --type-background: #fde0cc; --type-border: #e99a63; }  /* lab */
.type-3 { --type-background: #d5e6ff; --type-border: #6d9eea; }  /* course */
.type-4 { --type-background: #d3eedd; --type-border: #6cbf8a; }  /* project */
.type-0 { --type-background: #eceff3; --type-border: #a9b2c0; }  /* non-teaching */
.type-other { --type-background: var(--type-color, #eee); --type-border: #999; }

.timetable-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.page-title--timetable { margin-bottom: 4px; }
.title-info { font-size: .95rem; font-weight: 400; color: var(--secondary-text); }
.title-prefix { font-weight: 400; }
.subtitle { margin: 0; color: var(--secondary-text); }
.section-title { font-size: 1.15rem; margin: 28px 0 12px; }

.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.icon-button {
    font: inherit;
    font-size: .9rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}

.icon-button:hover { border-color: var(--blue); }
.icon-button[aria-pressed="true"] { background: var(--yellow); border-color: #e6c84f; }
.star { font-size: 1.1em; line-height: 1; }

/*
 * the timetable table: vertically only the page scrolls (a single scrollbar); horizontally the table
 * scrolls inside its box, with the hours column fixed. The header (the days) stays visible under the menu bar
 * through a fixed copy, the "floating header" (see app.js).
 */
.timetable-container {
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    touch-action: pan-x pan-y; /* two fingers on the timetable resize only the table (app.js), not the page */
}
/* after pinching: the way back to the normal size */
.timetable-zoom-reset {
    display: block;
    margin: 0 0 6px auto;
    font: inherit;
    font-size: .8rem;
    font-weight: 600;
    color: var(--blue);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 12px;
    cursor: pointer;
}
.timetable-zoom-reset[hidden] { display: none; }

/* Administrare › Backup */
.backup-rules { margin: 0 0 14px; padding-left: 1.2rem; display: flex; flex-direction: column; gap: 6px; }
.backup-now { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0; }

.timetable-table {
    border-collapse: collapse;
    width: 100%;
    font-size: .8rem;
    line-height: 1.25;
}

.timetable-table th, .timetable-table td {
    border: 1px solid var(--border);
    padding: 0;
    vertical-align: top;
}

.timetable-table thead { background: #f7f9fc; }

.timetable-table thead th {
    background: #f7f9fc;
    padding: 6px 4px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    /* the bottom border is visible also when the header "floats" over the table */
    box-shadow: inset 0 -1px 0 var(--border);
}

/* the hours column stays fixed when scrolling horizontally */
.timetable-table .hour-column {
    position: sticky;
    left: 0;
    z-index: 2;
}
.timetable-table thead .hour-column { z-index: 4; }

/* the header's copy, fixed under the menu bar while the table passes beneath it */
.floating-header {
    position: fixed;
    z-index: 9; /* under the menu bar (.site-header) */
    overflow: hidden;
    background: #f7f9fc;
    border-left: 1px solid var(--border);
    border-right: 1px solid var(--border);
    box-shadow: 0 3px 6px rgba(16, 24, 40, .12);
}
.floating-header[hidden] { display: none; }

/* the horizontal scrollbar fixed at the bottom (when the table's own bar is below the screen's edge) */
.floating-scrollbar {
    position: fixed;
    bottom: 0;
    z-index: 9;
    overflow-x: auto;
    overflow-y: hidden;
    background: rgba(244, 246, 250, .92);
    border-top: 1px solid var(--border);
}
.floating-scrollbar[hidden] { display: none; }
.floating-scrollbar > div { height: 1px; }
/* on touch screens the table scrolls with the finger, and the scrollbars take no space */
@media (pointer: coarse) {
    .floating-scrollbar { display: none !important; }
}
.floating-header .timetable-table, .floating-header .admin-table { margin: 0; }

.timetable-table thead th a { text-decoration: none; }

/* the subgroups in the header: oval pills, so it is obvious they lead to the subgroup's timetable */
.timetable-table thead .subgroup-link {
    display: inline-block;
    padding: 2px 10px;
    border: 1px solid var(--blue);
    border-radius: 999px;
    background: var(--surface);
    color: var(--blue);
    font-weight: 600;
    line-height: 1.3;
    transition: background-color .15s, color .15s;
}
.timetable-table thead .subgroup-link:hover,
.timetable-table thead .subgroup-link:focus-visible {
    background: var(--blue);
    color: #fff;
}
.timetable-table thead th[title] { cursor: help; text-decoration: underline dotted; text-underline-offset: 3px; }

.timetable-table .hour-column {
    width: 1%;
    padding: 4px 6px;
    background: #f7f9fc;
    color: var(--secondary-text);
    font-weight: 600;
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.timetable-table--weekly td { width: calc(100% / 6); }
/* on narrow screens the table does not shrink: it scrolls horizontally, with the hours column fixed */
.timetable-table--weekly { min-width: 760px; }
.timetable--editable .timetable-table--weekly { min-width: 1080px; } /* the staff plan, number and type fit in the cells */
.timetable-table--weekly tbody tr { height: 2.6rem; }
.timetable-table--group tbody tr { height: 2.2rem; }
.timetable-table--group td { min-width: 5.5rem; }

.timetable-table tr.odd-row td.free { background: #fbfcfe; }
.timetable-table td.occupied { padding: 2px; height: 1px; }

.timetable-day__title th {
    background: var(--blue);
    color: #fff;
    text-align: left;
    padding: 5px 10px;
    font-size: .85rem;
    letter-spacing: .02em;
}
/* the day's name stays visible on the left when the table is scrolled horizontally */
.timetable-day__name { position: sticky; left: 10px; }

.day-off { padding: 8px 10px !important; color: var(--secondary-text); font-style: italic; }

/* the activity (card) */
.activity {
    display: flex;
    flex-direction: column;
    gap: 1px;
    width: 100%;
    height: 100%;
    min-height: 100%;
    font: inherit;
    text-align: center;
    padding: 4px 5px;
    border: var(--slot-border-width) solid var(--slot-border);
    border-radius: 5px;
    background: var(--type-background);
    color: var(--text);
    cursor: pointer;
    justify-content: center;
}

/* explicit centering of each row: some browsers (e.g. Safari) do not apply flex styles to buttons */
.timetable-table .activity { align-items: center; text-align: center; }
.timetable-table .activity > span { display: block; width: 100%; text-align: center; }
/* as in the classic timetable, the rows do not wrap: the table grows horizontally (and scrolls), its height stays
   constant - an activity has as many text rows as the display mode gives it */
.timetable-table .activity > span { white-space: nowrap; overflow-wrap: normal; }
.activity__title-suffix { font-weight: 400; }
.activity + .activity { margin-top: 2px; }
.activity:hover { filter: brightness(.97); outline: 2px solid var(--blue); outline-offset: -1px; }
.activity:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.activity__title { font-weight: 700; overflow-wrap: anywhere; }
.activity__row { color: #2f3a4d; overflow-wrap: anywhere; }
.activity__time { font-weight: 600; font-size: .8em; color: var(--secondary-text); }
/* a group of overlapping activities: the first activity, with its colour, plus the "suprapunere" message */
.activity__overlap {
    margin-top: 2px;
    font-size: .72rem;
    color: var(--secondary-text);
}

.overlap-note { margin: 0 0 12px; color: var(--secondary-text); font-size: .9rem; }
.overlap-member {
    border: 1px solid var(--slot-border);
    background: var(--type-background);
    border-radius: 6px;
    padding: 8px 10px;
    margin-top: 10px;
}
.overlap-member h3 { margin: 0 0 6px; font-size: .95rem; }

/* cells with different activities in the odd / even weeks */
/* a single border for the whole interval; the dotted line separates the odd weeks from the even ones */
.parities {
    display: flex;
    flex-direction: column;
    height: 100%;
    border: var(--slot-border-width) solid var(--slot-border);
    border-radius: 5px;
    overflow: hidden;
    background: var(--surface);
}
.parity { flex: 1; display: flex; flex-direction: column; position: relative; }
/* the week without an activity: only as high as its "—" row; the other week's activity fills the slot */
.parity--free { flex: 0 0 auto; }
/* the odd / even separator: a thin dashed line, with long dashes and large gaps */
.parity + .parity::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: repeating-linear-gradient(to right, var(--slot-border) 0 8px, transparent 8px 14px);
    z-index: 1;
}
.parity .activity {
    flex: 1;
    border: 0;
    border-radius: 0;
}
.parity .activity + .activity { margin-top: 0; }
.parity__label {
    position: absolute;
    top: 1px;
    right: 3px;
    font-size: .6rem;
    color: var(--secondary-text);
    text-transform: uppercase;
    letter-spacing: .03em;
    pointer-events: none;
}
.parity__free {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--secondary-text);
    min-height: 1.6rem;
}

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin: 14px 2px 0;
    font-size: .85rem;
    color: var(--secondary-text);
}

.legend__item { display: inline-flex; align-items: center; gap: 6px; }

.legend__color {
    width: 16px; height: 16px;
    border-radius: 4px;
    background: var(--type-background);
    border: var(--slot-border-width) solid var(--slot-border);
}

.legend__parity {
    font-size: .7rem;
    padding: 1px 5px;
    border: 1px dashed var(--border);
    border-radius: 4px;
    text-transform: uppercase;
}

/* the modular activities' table */
.modular-table-container {
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.modular-table { border-collapse: collapse; width: 100%; min-width: 720px; font-size: .9rem; } /* on phones: horizontal scrolling */
.modular-table th, .modular-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.modular-table thead th { background: #f7f9fc; font-size: .8rem; color: var(--secondary-text); text-transform: uppercase; letter-spacing: .03em; }
/* the grouping by weeks: each week's title row */
.modular-table .modular-week__title th {
    background: var(--light-blue); color: var(--text); font-size: .9rem; font-weight: 700;
    text-transform: none; letter-spacing: 0; border-top: 2px solid #c5d3ee; padding: 7px 10px;
}
.modular-week__days { margin-left: 10px; font-weight: 400; color: var(--secondary-text); }
.modular-week__add { margin-left: 14px; font-size: .85rem; }
.modular-table .modular-week__empty td { color: var(--secondary-text); font-style: italic; }
.modular-table td[rowspan] { border-right: 1px solid var(--border); }
.modular-table--admin tr[data-edit-modular] { cursor: pointer; }
option.wrong-option { color: #b42318; }
.modular-table--admin tr[data-edit-modular]:hover td:not([rowspan]) { background: var(--light-blue); }
.modular-table .date { display: block; color: var(--secondary-text); font-size: .85em; }
.modular-table a { text-decoration: none; }
/* in the account: the staff plan column (the same controls as in the timetable's cells) */
.modular-table--editable { min-width: 1100px; }
.modular-table td.modular-stat { width: 250px; padding: 4px 8px; vertical-align: middle; }
.modular-staff-plan .staff-plan { border-top: 0; padding: 0; }

.type-dot {
    display: inline-block;
    width: 10px; height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    background: var(--type-border);
    vertical-align: baseline;
}

/* the tooltip shown when the mouse passes over an activity */
.activity-tooltip {
    position: fixed;
    z-index: 50;
    max-width: 360px;
    padding: 10px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(16, 24, 40, .2);
    font-size: .85rem;
    pointer-events: none;
}
.activity-tooltip[hidden] { display: none; }
.activity-tooltip__title { display: block; margin-bottom: 6px; font-size: .95rem; }
.activity-tooltip .details { gap: 3px 10px; }
.activity-tooltip .details a { color: inherit; text-decoration: none; }
.activity-tooltip .overlap-note { margin-bottom: 6px; }
.activity-tooltip .overlap-member { margin-top: 6px; padding: 6px 8px; }
.activity-tooltip .overlap-member h3 { font-size: .85rem; }

/* the details dialog */
.dialog {
    border: 0;
    border-radius: 14px;
    padding: 0;
    width: min(480px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    box-shadow: 0 20px 50px rgba(16, 24, 40, .25);
    color: var(--text);
}

.dialog::backdrop { background: rgba(16, 24, 40, .45); }
.dialog__header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 18px 0; }
.dialog__header h2 { font-size: 1.1rem; margin: 0; }
.dialog__close { font: inherit; font-size: 1.5rem; line-height: 1; border: 0; background: none; cursor: pointer; color: var(--secondary-text); padding: 0 4px; }
.dialog__content { padding: 12px 18px 18px; }

.details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.details dt { color: var(--secondary-text); font-size: .9rem; }
.details dd { margin: 0; }

.saved-list { list-style: none; margin: 0; padding: 0; }
.saved-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); }
.saved-list li:last-child { border-bottom: 0; }
.saved-list a { flex: 1; padding: 12px 2px; text-decoration: none; color: var(--text); }
.saved-list a small { display: block; color: var(--secondary-text); }
.saved-list button { font: inherit; font-size: .85rem; border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 5px 10px; cursor: pointer; color: #b42318; }

/* ---------- Forms and the teacher's account ---------- */

.narrow-form { max-width: 440px; margin: 0 auto; }
.narrow-form--wide { max-width: 640px; }

.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 0; }
.field > span { font-size: .9rem; font-weight: 600; }
.field input, .field select, .staff-plan-table select, .number-field {
    font: inherit;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
    width: 100%;
}
.field input:focus, .field select:focus, .staff-plan-table select:focus, .number-field:focus {
    outline: 2px solid var(--blue);
    outline-offset: 1px;
    border-color: var(--blue);
}
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row .field { min-width: 150px; }

.primary-button, .secondary-button {
    display: inline-block;
    font: inherit;
    font-weight: 600;
    padding: 10px 18px;
    border-radius: 8px;
    border: 1px solid var(--blue);
    cursor: pointer;
    text-decoration: none;
    text-align: center;
}
.primary-button { background: var(--blue); color: #fff; }
.primary-button:hover { background: var(--blue-hover); color: #fff; }
.secondary-button { background: var(--surface); color: var(--blue); }
.secondary-button:hover { background: var(--light-blue); }
.form .primary-button { align-self: flex-start; }

.text-button {
    font: inherit;
    font-size: .9rem;
    border: 0;
    background: none;
    color: var(--blue);
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}
.text-button--danger { color: #b42318; }
.logout-form { margin: 0; }
.site-header .logout-form .text-button { color: var(--secondary-text); text-decoration: none; padding: 8px 4px; }
.site-header .logout-form .text-button:hover { color: var(--text); }

.form-actions { display: flex; gap: 16px; align-items: center; margin: 16px 0 0; }

.note { color: var(--secondary-text); font-size: .9rem; }

.alert { position: relative; padding: 10px 40px 10px 14px; border-radius: 8px; margin: 0 0 14px; border: 1px solid; }
.alert__close {
    position: absolute;
    top: 50%;
    right: 6px;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 6px;
    background: none;
    color: inherit;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    opacity: .7;
}
.alert__close:hover, .alert__close:focus-visible { opacity: 1; background: rgba(0, 0, 0, .06); }
.alert--error { background: #fef3f2; border-color: #fda29b; color: #912018; }
.alert--success { background: #ecfdf3; border-color: #75e0a7; color: #085d3a; }
.alert--warning { background: #fffaeb; border-color: #fec84b; color: #7a4d06; }

.subtitle--account { margin: -12px 0 18px; }
.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.account-grid .card__subtitle:not(:first-child) { margin-top: 20px; }

.activity-list { list-style: none; margin: 0 0 12px; padding: 0; }
.activity-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.activity-list li > div:first-child { display: flex; flex-direction: column; }
.activity-list__actions { display: flex; gap: 14px; align-items: center; white-space: nowrap; }
.activity-list__actions form { margin: 0; }

.staff-plan-table select { min-width: 150px; padding: 6px 8px; }
.staff-plan-table .number-field { width: 5.5rem; padding: 6px 8px; }
.staff-plan-table td { vertical-align: middle; }

/* "Contul meu": the editable timetable */
.editable-activity {
    display: flex;
    flex-direction: column;
    height: 100%;
    border: var(--slot-border-width) solid var(--slot-border);
    border-radius: 5px;
    background: var(--type-background);
    overflow: hidden;
}
/* the button takes only the remaining space, so the staff plan below is always visible */
.editable-activity > .activity { border: 0; border-radius: 0; background: transparent; flex: 1 1 auto; height: auto; min-height: 0; }
.parity .editable-activity { border: 0; border-radius: 0; }
.timetable--editable .activity[data-edit] { cursor: pointer; }
.timetable--editable .activity[data-edit]:hover { outline-style: dashed; }

/* the staff plan, the position and the type on a single row, under the activity's data */
.staff-plan {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 3px;
    padding: 0 5px 5px;
    font-size: .75rem;
}
.staff-plan select, .staff-plan input {
    font: inherit;
    min-width: 0;
    padding: 2px 3px;
    border: 1px solid rgba(59, 66, 82, .35);
    border-radius: 4px;
    background: rgba(255, 255, 255, .85);
    color: var(--text);
}
.staff-plan [data-staff-plan="department"] { flex: 1 1 0; }
.staff-plan [data-staff-plan="position"] { flex: 0 0 2.9rem; width: 2.9rem; }
.staff-plan [data-staff-plan="type"] { flex: 0 1 4.3rem; }
.staff-plan--incomplete select, .staff-plan--incomplete input { border-color: #d92d20; background: #fff5f4; }
/* the "salvat ✓" message appears on the next row only while it is shown */
.staff-plan__status { flex-basis: 100%; color: var(--secondary-text); font-size: .7rem; }
.staff-plan__status:empty { display: none; }
.staff-plan__status--ok { color: #067647; }
.staff-plan__status--error { color: #b42318; }

.add-activity {
    width: 100%;
    height: 100%;
    min-height: 2.2rem;
    border: 0;
    background: none;
    color: transparent;
    font-size: 1.2rem;
    cursor: pointer;
    user-select: none; /* dragging with the mouse selects the interval; on touch screens dragging scrolls the table */
}
.add-activity:hover, .add-activity:focus-visible, .add-activity.selected { background: var(--light-blue); color: var(--blue); }
.add-activity.selected { box-shadow: inset 2px 0 0 var(--blue), inset -2px 0 0 var(--blue); }
.timetable-table td.free:has(.add-activity) { padding: 0; cursor: pointer; user-select: none; }

.faz { margin-bottom: 18px; }
.faz__form { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; }
.faz__form label { font-weight: 600; }
.faz__form select {
    font: inherit;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    color: var(--text);
}
.faz__form button { padding: 6px 16px; }
.faz__results { margin: 12px 0 0; }
.account-section { margin-bottom: 24px; }
.account-section__header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 10px; }
.account-section__header .note { margin: 0; flex: 1; min-width: 260px; }
.dialog--form { width: min(620px, calc(100vw - 32px)); }

/* the searchable choice lists: search + list, the items busy in the chosen interval in red */
.choice__search {
    font: inherit;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 8px 8px 0 0;
    background: var(--surface);
    color: var(--text);
}
.choice__search:focus { outline: 2px solid var(--blue); outline-offset: 1px; }
.choice__list {
    list-style: none;
    margin: -5px 0 0;
    padding: 0;
    max-height: 13rem;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-top: 0;
    border-radius: 0 0 8px 8px;
}
.choice__list li {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: 0 12px;
    padding: 5px 11px;
    cursor: pointer;
    font-size: .9rem;
}
.choice__list li[hidden] { display: none; }
.choice__list li:hover, .choice__list li.active { background: var(--light-blue); }
.choice__list li[aria-selected="true"] { font-weight: 600; box-shadow: inset 3px 0 0 var(--blue); }
.choice__list li.busy { color: #b42318; }
.choice__list li.busy:hover, .choice__list li.busy.active { background: #fef3f2; }
.choice__status { margin-left: auto; font-size: .8rem; text-align: right; }
.delete-form { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }

.file-list { margin: 0; padding-left: 18px; }
.file-list li { margin: 4px 0; }

/* ---------- Administration (desktop only) ---------- */

.admin-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px 24px; flex-wrap: wrap; margin-bottom: 14px; }
.admin-header .subtitle { max-width: 70ch; }
.admin-semester { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .9rem; }
.admin-semester select { font: inherit; font-weight: 400; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
/* "Orarele cadrelor" / "Orarele sălilor": the choice of the teacher or room, above the editable timetable */
.resource-choice { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; margin: 0 0 16px; font-weight: 600; font-size: .9rem; }
.resource-choice select { font: inherit; font-weight: 400; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); min-width: 18rem; }
.resource-choice .note { font-weight: 400; }

.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.admin-list { list-style: none; margin: 0; padding: 0; }
.admin-list li { display: flex; align-items: baseline; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.admin-list li:last-child { border-bottom: 0; }
.admin-list a { font-weight: 600; text-decoration: none; }
.admin-list a:hover { text-decoration: underline; }
.admin-list__count { margin-left: auto; color: var(--secondary-text); font-variant-numeric: tabular-nums; }

.admin-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.admin-bar .primary-button { margin-left: auto; }
.admin-search { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .9rem; }
.admin-search input { font: inherit; font-weight: 400; width: 320px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }

.admin-table-container { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.admin-table { border-collapse: collapse; width: 100%; font-size: .85rem; }
.admin-table th, .admin-table td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.admin-table thead th {
    background: #f7f9fc;
    font-size: .75rem;
    color: var(--secondary-text);
    text-transform: uppercase;
    letter-spacing: .02em;
    white-space: nowrap;
}
.admin-table tbody tr { cursor: pointer; }
/* zebra stripes: without JavaScript by position, with JavaScript by the rows left after searching */
.admin-table tbody tr:nth-child(even), html.js .admin-table tbody tr.alternate-row { background: #f1f4f9; }
html.js .admin-table tbody tr:nth-child(even):not(.alternate-row) { background: none; }
/* more specific than the zebra stripes, so they also show on the alternate rows */
.admin-table tbody tr[data-id]:hover, .admin-table tbody tr[data-id]:focus,
html.js .admin-table tbody tr[data-id]:hover, html.js .admin-table tbody tr[data-id]:focus { background: var(--light-blue); outline: none; }
html .admin-table tbody tr[data-id].highlighted { background: var(--yellow); }
.admin-table__id { color: var(--secondary-text); font-variant-numeric: tabular-nums; width: 1%; }
.admin-table__yes-no { text-align: center !important; max-width: 7rem; overflow: hidden; text-overflow: ellipsis; }
.admin-table__account { white-space: nowrap; }
.account-label, .inactive-label { display: inline-block; font-size: .72rem; font-weight: 600; padding: 1px 7px; border-radius: 999px; }
.account-label { background: var(--light-blue); color: var(--blue); }
.inactive-label { background: #fef3f2; color: #b42318; }

.dialog--admin { width: min(820px, calc(100vw - 32px)); }
.dialog--admin.sending { cursor: progress; }
.dialog--admin.sending form, .dialog--admin.sending .admin-account { opacity: .6; pointer-events: none; }
.admin-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; }
.admin-fields .field--wide { grid-column: 1 / -1; }
.field__help { color: var(--secondary-text); font-size: .8rem; }
.checkbox-field { display: flex; align-items: center; gap: 8px; font-size: .9rem; }
.checkbox-field input { width: 18px; height: 18px; }
.form-actions__right { margin-left: auto; }
.admin-account { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.admin-account h3 { margin: 0 0 6px; font-size: 1rem; }
.admin-account__actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }

/* the formation timetable editor: the cell selection, the action bar, the activity dialog */
.timetable-editor td.selectable { cursor: cell; }
.timetable-editor td.free.selectable:hover { background: var(--light-blue); }
.timetable-editor td.selected { background: #cfe0fb !important; box-shadow: inset 0 0 0 1px var(--blue); }
.timetable-editor td.occupied.selected .parity__free { background: #cfe0fb; }
.timetable-editor .activity { cursor: pointer; }
.selection-bar {
    position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 40;
    display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; max-width: calc(100vw - 32px);
    padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
    box-shadow: 0 8px 24px rgba(16, 24, 40, .18); font-size: .9rem;
}
.selection-bar--error { border-color: #fda29b; color: #912018; }
.timetable-editor__clipboard { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.alert--info { background: var(--light-blue); border-color: #c5d3ee; color: var(--text); }
#timetable-activity-dialog { width: min(820px, calc(100vw - 32px)); }
#timetable-activity-dialog.sending { cursor: progress; }
/* the searchable lists appear only when clicking the field, over the dialog's content (about 5 visible items) */
#timetable-activity-dialog .choice__search { border-radius: 8px; }
#timetable-activity-dialog .choice__search--open { border-radius: 8px 8px 0 0; }
#timetable-activity-dialog .choice__list {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 5; margin: 0;
    max-height: 9.5rem; background: var(--surface); box-shadow: 0 8px 20px rgba(16, 24, 40, .15);
}
.field--choice { position: relative; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
/* the width is shared only on rows with two fields (in the form, which is a column, it would become height) */
.field-row .field--choice { flex: 1 1 300px; }
.field-row--choices { align-items: flex-start; }
.field-row .field--wide { flex: 1 1 320px; }
.form-actions__right { display: inline-flex; gap: 8px; margin-left: auto; }

/* the overlap report: a group of overlapping activities = a <tbody>, separated from the next one */
.overlaps__sections { margin: 0 0 16px; }
.overlaps { margin-bottom: 20px; }
.overlap-table tbody.overlap-group { border-top: 2px solid var(--border); }
.overlap-table tbody.overlap-group th { text-align: left; vertical-align: top; font-weight: 600; }
.overlap-table td { vertical-align: top; }
.overlaps__shared { margin-top: 14px; }
.overlaps__shared summary { cursor: pointer; color: var(--secondary-text); font-size: .9rem; margin-bottom: 8px; }

/* the timetable columns editor */
.admin-list__highlighted { flex-wrap: wrap; }
.timetable-list-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.timetable-list-grid .pill-list a { font-size: .85rem; padding: 4px 10px; }
.columns-editor__name { display: flex; align-items: flex-end; gap: 12px; margin-bottom: 14px; }
.columns-editor__name .field { flex: 0 0 220px; }
.columns-editor__name .columns-editor__year { flex-basis: 70px; }
.columns-editor__container { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 10px; }
.columns-editor__grid { display: grid; gap: 4px; align-items: stretch; width: max-content; position: relative; }
/* where a dragged subgroup will go: a vertical bar between two columns, with the group and the final position */
.columns-insert-marker {
    position: absolute;
    width: 4px;
    margin-left: -2px;
    background: var(--blue);
    border-radius: 2px;
    pointer-events: none;
    z-index: 3;
}
.columns-insert-marker[hidden] { display: none; }
.columns-insert-marker::before, .columns-insert-marker::after {
    content: "";
    position: absolute;
    left: -4px;
    border: 6px solid transparent;
}
.columns-insert-marker::before { top: -6px; border-top-color: var(--blue); }
.columns-insert-marker::after { bottom: -6px; border-bottom-color: var(--blue); }
.columns-insert-marker__label {
    position: absolute;
    top: 2px;
    left: 8px;
    white-space: nowrap;
    background: var(--blue);
    color: #fff;
    font-size: .75rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
}
/* at the end of a group the label stays on the group's side, to the left of the bar */
.columns-insert-marker--end .columns-insert-marker__label { left: auto; right: 8px; }
.columns-insert-marker--invalid { background: #d92d20; }
.columns-insert-marker--invalid::before { border-top-color: #d92d20; }
.columns-insert-marker--invalid::after { border-bottom-color: #d92d20; }
.columns-insert-marker--invalid .columns-insert-marker__label { background: #d92d20; }
.columns-label { position: sticky; left: -10px; z-index: 2; background: var(--surface); display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; font-size: .75rem; font-weight: 600; color: var(--secondary-text); text-transform: uppercase; }
.columns-cell {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 38px;
    padding: 4px 6px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f7f9fc;
}
.columns-cell--specialization { background: var(--light-blue); border-color: #c5d3ee; }
.columns-cell--new { outline: 2px solid #3fae6a; outline-offset: -2px; }
.columns-cell.drop-target { outline: 2px dashed var(--blue); outline-offset: -2px; background: #fff; }
.columns-handle { cursor: grab; color: var(--secondary-text); font-size: 1rem; padding: 0 2px; user-select: none; }
.columns-handle:active { cursor: grabbing; }
.columns-text { font-weight: 600; flex: 1; }
.columns-select, .columns-input { font: inherit; font-size: .85rem; width: 100%; min-width: 0; flex: 1 1 0; padding: 4px 6px; border: 1px solid var(--border); border-radius: 6px; background: #fff; color: var(--text); }
.columns-input { font-weight: 600; text-align: center; }
.columns-input--suffix { flex: 1 1 0; max-width: 3rem; }
.columns-cell { min-width: 0; overflow: hidden; }
.columns-button { font: inherit; line-height: 1; border: 0; background: none; cursor: pointer; padding: 3px 5px; border-radius: 6px; font-size: 1rem; }
.columns-button--add { color: var(--blue); font-weight: 700; }
.columns-button--remove { color: #b42318; }
.columns-button--add:hover { background: #fff; }
.columns-button--remove:hover { background: #fef3f2; }
.columns-button--remove:disabled { color: #b42318; opacity: .3; cursor: not-allowed; background: none; }
.columns-button--end { border: 1px dashed var(--blue); color: var(--blue); font-size: .85rem; font-weight: 600; }
.columns-button--end.drop-target { background: var(--light-blue); }
.columns-editor__messages { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.columns-message { padding: 8px 12px; border-radius: 8px; font-size: .9rem; border: 1px solid var(--border); background: var(--surface); }
.columns-message--error { background: #fef3f2; border-color: #fda29b; color: #912018; }
.columns-message--warning { background: #fffaeb; border-color: #fec84b; color: #7a4d06; }
.columns-editor__actions { display: flex; align-items: center; gap: 14px; justify-content: flex-end; margin-top: 16px; }
.columns-editor__actions .note { margin-right: auto; }
.columns-editor.has-changes [data-columns-status] { color: #b54708; font-weight: 600; }
.columns-editor.sending { cursor: progress; opacity: .7; pointer-events: none; }

/* ---------- Phones ---------- */

@media (max-width: 720px) {
    .site-header__inner { padding: 8px 12px; gap: 8px; }
    .menu {
        order: 3;
        width: 100%;
        overflow-x: auto;
        scrollbar-width: none;
    }
    .menu a { padding: 7px 10px; font-size: .95rem; }
    .period-selector select { max-width: 150px; }
    .content { padding: 16px 12px 32px; }
    .page-title { font-size: 1.3rem; }
    .tabs__buttons { display: flex; width: 100%; }
    .tabs__buttons button { flex: 1; padding: 8px 6px; }
}

@media print {
    .site-header .menu, .period-selector, .footer, .archive-banner, .actions, .breadcrumbs { display: none !important; }
    body, .content { background: #fff; }
    .content { max-width: none; padding: 0; }
    .card, .timetable-container, .modular-table-container { box-shadow: none; border: 0; overflow: visible; max-height: none; }
    .timetable-table .hour-column, .timetable-day__name { position: static; }
    .site-header { position: static; border: 0; }
    .floating-header, .floating-scrollbar, .timetable-zoom-reset { display: none !important; }
    .timetable-table, .modular-table { font-size: 7.5pt; min-width: 0 !important; }
    .timetable-table { zoom: 1 !important; } /* the printout ignores the size chosen by pinching */
    .activity { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .timetable-day { break-inside: avoid; }
}
