/* EVML infosüsteem */

:root {
    --bg: #f0f2f5;
    --bg-subtle: #f7f9fb;
    --fg: #1a1a2e;
    --fg-muted: #555e6d;
    --accent: #1a5f7a;
    --accent-dark: #134d63;
    --accent-light: #e8f4f8;
    --border: #d1d9e0;
    --radius: 6px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.10), 0 2px 4px rgba(0,0,0,0.06);
    --bg-subtle: #f4f6f9;
}

* {
    box-sizing: border-box;
}

body {
    font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--fg);
    background: var(--bg);
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ─── Header ─── */
.site-header {
    background: var(--accent);
    color: white;
    padding: 0 1.5rem;
    height: 52px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.18);
}

.site-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.site-nav {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    flex-wrap: wrap;
    height: 100%;
}

.site-nav .nav-link {
    color: rgba(255,255,255,0.92);
    text-decoration: none;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    transition: background 0.15s;
}

.site-nav .nav-link:hover,
.site-nav .nav-link.active {
    background: rgba(255,255,255,0.18);
    color: white;
}

/* ─── Dropdown ─── */
.nav-dropdown {
    position: relative;
    display: inline-flex;
    align-items: center;
    height: 100%;
}

.nav-dropdown-trigger {
    color: rgba(255,255,255,0.92);
    cursor: pointer;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    user-select: none;
    background: none;
    border: none;
    font-size: 0.875rem;
    font-family: inherit;
    transition: background 0.15s;
}

.nav-dropdown-trigger:hover,
.nav-dropdown.open .nav-dropdown-trigger {
    background: rgba(255,255,255,0.18);
    color: white;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    margin: 0;
    padding: 0.375rem 0;
    list-style: none;
    background: white;
    min-width: 190px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
    z-index: 200;
}

.nav-dropdown.open .nav-dropdown-menu {
    display: block;
}

.nav-dropdown-menu li {
    margin: 0;
}

.nav-dropdown-menu a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--fg);
    text-decoration: none;
    font-size: 0.875rem;
    white-space: nowrap;
    transition: background 0.12s;
}

.nav-dropdown-menu a:hover {
    background: var(--accent-light);
    color: var(--accent);
}

.nav-logout {
    margin-left: 0.5rem;
    border-left: 1px solid rgba(255,255,255,0.25);
    padding-left: 0.75rem;
}

/* ─── Main ─── */
.site-main {
    flex: 1;
    padding: 2rem 1.5rem;
    max-width: 1040px;
    margin: 0 auto;
    width: 100%;
}

/* ─── Page title ─── */
.site-main > h2:first-child,
.page-title {
    margin: 0 0 1.5rem 0;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--fg);
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--accent-light);
}

h2 {
    font-size: 1.25rem;
    margin-top: 0;
    margin-bottom: 1.25rem;
}

h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 0.75rem;
}

/* ─── Footer ─── */
.site-footer {
    background: #2a3240;
    color: rgba(255,255,255,0.65);
    padding: 0.875rem 1.5rem;
    font-size: 0.8125rem;
    text-align: center;
}

.site-footer p {
    margin: 0;
}

.site-footer a,
.site-footer a:link,
.site-footer a:visited,
.site-footer a:hover,
.site-footer a:active {
    color: #fff;
    text-decoration: none;
}

.site-footer a:hover {
    text-decoration: underline;
}

/* ─── Tabelid ─── */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

/* import.php samm 1: veergude vastendamine — lai tabel + loetavad <select> */
.table-wrap.import-mapping-scroll {
    -webkit-overflow-scrolling: touch;
}

table.import-mapping-table {
    width: max-content;
    min-width: 100%;
    box-shadow: none;
    border: 0;
}

table.import-mapping-table th,
table.import-mapping-table td {
    vertical-align: top;
}

/* Vaikimisi: kompaktne select; täpsem laius .import-col--* all */
table.import-mapping-table thead select {
    width: auto;
    padding: 0.25rem 1.5rem 0.25rem 0.35rem;
    font-size: 0.75rem;
    line-height: 1.25;
}

/* tight: M1–M6, tühi, üks tulemusveerg — numbrid + lühike M# */
table.import-mapping-table thead th.import-col--tight select {
    min-width: 3.75rem;
    max-width: 5rem;
}

table.import-mapping-table th.import-col--tight,
table.import-mapping-table td.import-col--tight {
    width: 1%;
    max-width: 5.65rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* compact: Sugu, Seeria — päises lühem sõna täies ulatuses */
table.import-mapping-table thead th.import-col--compact select {
    min-width: 5.35rem;
    max-width: 6.85rem;
}

table.import-mapping-table th.import-col--compact,
table.import-mapping-table td.import-col--compact {
    width: 1%;
    max-width: 7.15rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Keskmine: kuupäev — „Kuupäev“ + kuupäeva string */
table.import-mapping-table thead th.import-col--medium select {
    min-width: 6.35rem;
    max-width: 8rem;
}

table.import-mapping-table th.import-col--medium,
table.import-mapping-table td.import-col--medium {
    width: 1%;
    max-width: 8.75rem;
}

/* Lai: nimi */
table.import-mapping-table thead th.import-col--wide select {
    min-width: 4.5rem;
    max-width: 8rem;
}

table.import-mapping-table th.import-col--wide,
table.import-mapping-table td.import-col--wide {
    min-width: 6rem;
    max-width: 16rem;
    width: 1%;
}

table.import-mapping-table td.import-col--wide {
    white-space: normal;
    word-break: break-word;
}

table.import-mapping-table thead th:not(:first-child) {
    min-width: 0;
    width: 1%;
}

table.import-mapping-table td.import-col--tight small,
table.import-mapping-table td.import-col--compact small,
table.import-mapping-table td.import-col--medium small {
    font-variant-numeric: tabular-nums;
}

/* Esimene veerg „Veerg“ / Päis / Näidis — kitsam kui andmeveerud */
table.import-mapping-table thead th:first-child,
table.import-mapping-table tbody td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    box-shadow: 4px 0 12px -4px rgba(0, 0, 0, 0.18);
    max-width: 3.45rem;
    width: 3.25rem;
    min-width: 2.95rem;
    padding: 0.28rem 0.22rem !important;
    font-size: 0.68rem;
    line-height: 1.2;
    white-space: normal !important;
    word-break: break-word;
    vertical-align: top;
}

table.import-mapping-table thead th:first-child {
    z-index: 3;
    font-size: 0.62rem;
    letter-spacing: 0.02em;
}

table.import-mapping-table tbody td:first-child {
    background: #fff;
}

table.import-mapping-table tbody tr:hover td:first-child {
    background: var(--accent-light);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 0.875rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

th, td {
    padding: 0.7rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

table.import-mapping-table th,
table.import-mapping-table td {
    padding: 0.35rem 0.28rem;
}

th {
    background: var(--accent);
    color: white;
    font-weight: 600;
    font-size: 0.8125rem;
    letter-spacing: 0.025em;
    text-transform: uppercase;
    white-space: nowrap;
}

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

tbody tr:hover {
    background: var(--accent-light);
}

/* ─── Vormid ─── */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="search"],
select,
textarea {
    font-size: 0.9375rem;
    font-family: inherit;
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: white;
    color: var(--fg);
    width: 100%;
    transition: border-color 0.15s, box-shadow 0.15s;
    line-height: 1.5;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
/* Flatpickr: nähtav kuupäev pp.kk.aaaa (eesti kalender, nädal algab esmaspäevast) */
.flatpickr-calendar {
    z-index: 2000;
    font-family: inherit;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.12);
}

input.evml-date-alt {
    max-width: 11rem;
}

input[type="date"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(26, 95, 122, 0.15);
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--fg-muted);
    margin-bottom: 0.3rem;
}

/* ─── Nupud ─── */
button, .btn {
    font-size: 0.875rem;
    font-family: inherit;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    line-height: 1.4;
    transition: background 0.15s, box-shadow 0.15s, opacity 0.15s;
    white-space: nowrap;
    border: none;
    background: var(--accent);
    color: white;
}

button:hover, .btn:hover {
    background: var(--accent-dark);
    box-shadow: var(--shadow-sm);
}

/* Sekundaarne nupp */
.btn-secondary {
    background: white;
    color: var(--accent);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--accent-light);
    border-color: var(--accent);
}

/* Hävitusnupp */
.btn-danger {
    background: #c0392b;
    color: white;
}

.btn-danger:hover {
    background: #a93226;
}

/* Väike nupp */
.btn-sm {
    font-size: 0.8125rem;
    padding: 0.3rem 0.65rem;
}

/* Ikooni nupp (pliiats, prügi jms) – läbipaistev taust, nähtav ikoon */
.btn-icon {
    background: none;
    border: 1px solid transparent;
    color: var(--fg-muted);
    padding: 0.2rem 0.4rem;
    font-size: 1rem;
    line-height: 1;
    border-radius: var(--radius);
    box-shadow: none;
}

.btn-icon:hover {
    background: var(--accent-light);
    border-color: var(--border);
    color: var(--accent);
    box-shadow: none;
}

/* ─── Teated ─── */
.error, .alert-error {
    color: #7b1a1a;
    background: #fdecea;
    border: 1px solid #f5c6c2;
    border-left: 4px solid #c0392b;
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin: 0.75rem 0;
    font-size: 0.9rem;
}

.success, .alert-success {
    color: #1a4a2a;
    background: #eafaf1;
    border: 1px solid #a9dfbf;
    border-left: 4px solid #27ae60;
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin: 0.75rem 0;
    font-size: 0.9rem;
}

.alert-info {
    color: #1a3a5f;
    background: var(--accent-light);
    border: 1px solid #b3d4e4;
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin: 0.75rem 0;
    font-size: 0.9rem;
}

/* ─── Kaardid ─── */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border);
}

/* ─── Filter-vorm (Eesti 100, tulemused jms) ─── */
.filter-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: flex-end;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.filter-form label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 110px;
}

.filter-form input,
.filter-form select {
    width: auto;
    min-width: 100px;
}

.filter-form .filter-submit {
    align-self: flex-end;
}

/* ─── Avaleht (dashboard) ─── */
.dashboard-section {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}

.dashboard-section h3 {
    margin: 0 0 1rem 0;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border);
}

.dashboard-links {
    margin: 0;
}

.dashboard-links dt {
    margin-top: 0.9rem;
    font-weight: 600;
    font-size: 0.9375rem;
}

.dashboard-links dt:first-child {
    margin-top: 0;
}

.dashboard-links dt a {
    color: var(--accent);
    text-decoration: none;
}

.dashboard-links dt a:hover {
    text-decoration: underline;
}

.dashboard-links dd {
    margin: 0.2rem 0 0 0;
    padding-left: 0;
    color: var(--fg-muted);
    font-size: 0.875rem;
    line-height: 1.5;
}

.dashboard-footer {
    margin-top: 1.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    font-size: 0.875rem;
    color: var(--fg-muted);
}

/* ─── Import – rea muutmise paneel ─── */
.edit-row-panel {
    background: var(--accent-light);
    border: 1px solid var(--accent);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.25rem;
}

.edit-row-title {
    margin: 0 0 0.75rem 0;
    font-size: 0.9375rem;
    color: var(--fg);
}

.edit-row-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    align-items: flex-end;
}

.edit-row-form label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--fg-muted);
    min-width: 0;
}

.input-narrow {
    width: 4.5em !important;
    min-width: 0;
}

.edit-row-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    align-self: flex-end;
}

/* ─── Import – mitteklappivad nimed ─── */
.unmatched-names-table {
    margin: 0.75rem 0 1.25rem;
    border-collapse: collapse;
    width: 100%;
}
.unmatched-names-table th,
.unmatched-names-table td {
    padding: 0.5rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
.unmatched-names-table th {
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    font-size: 0.8125rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.inline-details {
    display: inline-block;
    margin-right: 0.75rem;
}
.inline-details summary {
    cursor: pointer;
    color: var(--accent);
    font-size: 0.875rem;
    user-select: none;
}
.inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    align-items: flex-end;
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--accent-light);
    border-radius: var(--radius);
}
.field-group {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.field-group label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--fg-muted);
    white-space: nowrap;
}
.field-group label small {
    font-weight: 400;
    color: var(--fg-muted);
}
.field-group--btn {
    justify-content: flex-end;
}
.search-results-cell {
    background: var(--bg-subtle);
    padding: 1rem !important;
    vertical-align: top;
}
.search-results-cell p {
    margin: 0 0 0.5rem;
}
.similar-names-table {
    margin-top: 0.5rem;
    border-collapse: collapse;
    width: 100%;
    max-width: 36rem;
}
.similar-names-table th,
.similar-names-table td {
    padding: 0.4rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
.similar-names-table th {
    font-size: 0.8125rem;
}
.similar-names-table td a {
    color: var(--accent);
}
.similar-names-table td a:hover {
    text-decoration: underline;
}
.btn-small {
    font-size: 0.8125rem;
    padding: 0.25rem 0.5rem;
}

/* ─── Abiklassid ─── */
.mt-0 { margin-top: 0; }
.mb-1 { margin-bottom: 1rem; }
.text-muted { color: var(--fg-muted); font-size: 0.875rem; }
.table-responsive { overflow-x: auto; }

/* ─── AVK tabel ─── */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.avk-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.875rem;
    background: white;
}

.avk-table th,
.avk-table td {
    padding: 0.5rem 0.85rem;
    text-align: right;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    vertical-align: middle;
}

.avk-table th {
    background: var(--accent);
    color: #fff;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* Grupipäised (1. rida päises): AVK ja Hooaeg */
.avk-table .col-group-header {
    text-align: center;
    background: var(--accent-dark);
    border-left: 3px solid rgba(255,255,255,0.25);
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
}

/* Alampäised (2. rida päises): Sarjad, Kesk, Muutus, HA sarjad ... */
.avk-table thead tr:last-child th {
    background: #1f728f;
    font-size: 0.75rem;
    padding-top: 0.35rem;
    padding-bottom: 0.35rem;
    border-top: 1px solid rgba(255,255,255,0.15);
}

/* Grupipiir "Hooaeg" veergude alguses */
.avk-table thead tr:last-child th:nth-child(4),
.avk-table tbody td:nth-child(7) {
    border-left: 3px solid var(--accent-dark);
}

.avk-table .col-koht  { text-align: center; width: 3rem; }
.avk-table .col-nimi  { text-align: left; min-width: 10rem; }
/* col-klubi värvireegel ainult td-le, mitte th-le */
.avk-table td.col-klubi { color: var(--fg-muted); }
.avk-table .col-klubi   { text-align: left; min-width: 7rem; }
.avk-table .col-kesk    { font-weight: 700; }

.avk-table tbody tr:hover { background: var(--accent-light) !important; }
.avk-table tbody tr:nth-child(odd) { background: var(--bg-subtle); }

/* Muutuse värvikoodid */
.col-muutus {
    font-weight: 600;
    text-align: center;
    min-width: 5rem;
}

.muutus-pos  { color: #1e7e4a; }
.muutus-neg  { color: #c0392b; }
.muutus-zero { color: var(--fg-muted); font-weight: 400; }
.muutus-null { color: var(--fg-muted); font-weight: 400; }

/* Noole ikoon muutuse sees */
.muutus-arrow {
    display: inline-block;
    font-size: 0.7em;
    vertical-align: middle;
    margin-right: 0.15em;
    line-height: 1;
}

/* ─── Lehekülje ülaosa metainfo ─── */
.page-meta {
    font-size: 0.875rem;
    color: var(--fg-muted);
    margin-bottom: 1.25rem;
}

/* ─── Sisselogimise leht (index.php) ─── */
body.login-page {
    min-height: 100vh;
    background: var(--bg);
}

.login-header-only {
    justify-content: center;
}

.login-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    padding: 1.75rem 1.5rem;
}

.login-heading {
    margin: 0 0 0.35rem 0;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--fg);
}

.login-lead {
    margin: 0 0 1.25rem 0;
    font-size: 0.875rem;
}

.login-form label {
    margin-top: 0.75rem;
}

.login-form label:first-of-type {
    margin-top: 0;
}

.login-form input[type="text"],
.login-form input[type="password"] {
    width: 100%;
    margin-top: 0.25rem;
}

.login-form .error {
    margin-bottom: 0.5rem;
}

.login-actions {
    margin-top: 1.25rem;
}

.login-submit {
    width: 100%;
    padding: 0.55rem 1rem;
    font-size: 0.9375rem;
}

.login-footer {
    background: #2a3240;
    color: rgba(255, 255, 255, 0.65);
    padding: 0.75rem 1.5rem;
    font-size: 0.8125rem;
    text-align: center;
}

.login-footer p {
    margin: 0;
}

.login-footer p + p {
    margin-top: 0.25rem;
}

.release-note {
    margin: 0 0 1.25rem;
    max-width: 42rem;
}

.release-note h3 {
    margin-bottom: 0.35rem;
}

.release-note p {
    margin: 0 0 0.35rem;
}

.release-current {
    display: inline-block;
    margin-left: 0.35rem;
    padding: 0.1rem 0.45rem;
    border-radius: var(--radius);
    background: var(--accent);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    vertical-align: middle;
}

/* ─── Importi juhend (juhend-import.php) ─── */
.guide-page {
    max-width: 52rem;
}

.guide-intro {
    margin-bottom: 1.5rem;
    line-height: 1.55;
}

.guide-intro code {
    font-size: 0.88em;
    background: var(--accent-light);
    padding: 0.1em 0.35em;
    border-radius: 3px;
}

.guide-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.guide-section:last-of-type {
    border-bottom: none;
}

.guide-section h3 {
    margin: 0 0 0.75rem 0;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--accent);
}

.guide-list {
    margin: 0 0 1rem 0;
    padding-left: 1.25rem;
    color: var(--fg);
}

.guide-list li {
    margin-bottom: 0.35rem;
}

.guide-list li strong {
    color: var(--fg);
}

.guide-figure {
    margin: 1rem 0 0 0;
    padding: 0.75rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.guide-figure img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.guide-figure figcaption {
    margin-top: 0.6rem;
    font-size: 0.8125rem;
    color: var(--fg-muted);
}

.guide-figure figcaption code {
    font-size: 0.9em;
    background: var(--bg-subtle);
    padding: 0.05em 0.3em;
    border-radius: 3px;
}

/* Avaleht: importi sektsiooni link juhendile */
.dashboard-import-guide {
    margin: 1rem 0 0 0;
    padding: 0.75rem 1rem;
    background: var(--accent-light);
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    border-radius: var(--radius);
    font-size: 0.9rem;
}

/* Ranking-tabel: päise sorteerimine + filter (voistlus-tulemused.php, import eelvaade — AVK-06) */
.ranking-edit-table .ranking-sort-btn {
    font: inherit;
    font-weight: 600;
    border: none;
    background: transparent;
    padding: 0.2rem 0.15rem;
    margin: 0;
    cursor: pointer;
    width: 100%;
    text-align: left;
    color: inherit;
    border-radius: 4px;
}

.ranking-edit-table .ranking-sort-btn:hover {
    background: rgba(0, 0, 0, 0.06);
}

.ranking-edit-table .ranking-sort-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.ranking-edit-table .ranking-sort-arrow::after {
    content: '';
    white-space: pre;
}

.ranking-edit-table .ranking-sort-btn.is-sorted-asc .ranking-sort-arrow::after {
    content: ' \2191';
}

.ranking-edit-table .ranking-sort-btn.is-sorted-desc .ranking-sort-arrow::after {
    content: ' \2193';
}

/* AVK-14: importi kuupäevade hajuvus — hoiatus ja esiletõst */
.import-date-spread-warning {
    margin: 0.75rem 0 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid #c17a00;
    border-radius: 6px;
    background: #fff8e6;
    color: #3d2800;
}

.import-date-spread-warning__note {
    display: block;
    margin-top: 0.5rem;
    font-size: 0.95em;
}

.import-date-spread-note {
    margin: 0.75rem 0 1rem;
    padding: 0.65rem 1rem;
    border: 1px solid #888;
    border-radius: 6px;
    background: #f5f5f5;
    color: #222;
}

.ranking-edit-table tbody tr.import-date-outlier {
    background: #fff3cd;
}

.ranking-edit-table tbody tr.import-date-outlier:nth-child(even) {
    background: #ffe69c;
}

/* Ekraaniluger: peidetud tekst (päised, ARIA) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Võistlused: tegevuste veerud — ikoonid fikseeritud veergudes (voistlused.php) */
.voistlused-table th.voistlus-action-col-header {
    width: 2.25rem;
    min-width: 2rem;
    max-width: 2.75rem;
    padding: 0.45rem 0.15rem;
    vertical-align: middle;
    text-align: center;
    cursor: help;
    font-variant-numeric: tabular-nums;
}

.voistlus-action-cell {
    text-align: center;
    vertical-align: middle;
    width: 2.25rem;
    min-width: 2rem;
    max-width: 2.75rem;
    padding: 0.35rem 0.15rem;
    white-space: nowrap;
}

.voistlus-action-cell--readonly {
    width: auto;
    max-width: none;
    text-align: left;
}

/* Võistlused: importi ajaloost tulev esiletõstmine (highlight_event_id) */
tr.voistlus-row--highlight {
    outline: 2px solid #0d6efd;
    background: #f0f7ff;
}

/* Võistlused: ankur #event-ID (muutmine / pärast salvestamist) — scroll ei peida päist */
.voistlused-table tbody tr:target,
tr.voistlus-row--editing:target {
    outline: 2px solid #0d6efd;
    background: #f0f7ff;
    scroll-margin-top: 1.25rem;
}

.icon-action-form {
    display: inline-flex;
    margin: 0;
    padding: 0;
    border: 0;
    vertical-align: middle;
    justify-content: center;
}

.icon-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    color: var(--accent);
    cursor: pointer;
    text-decoration: none;
    box-sizing: border-box;
    font: inherit;
    line-height: 1;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.icon-action-btn:hover {
    background: var(--accent-light);
    border-color: var(--accent);
}

.icon-action-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.icon-action-btn svg {
    display: block;
    flex-shrink: 0;
}

.icon-action-btn--danger {
    color: #a93226;
    border-color: #e0b4b4;
    background: #fff;
}

.icon-action-btn--danger:hover {
    background: #fdeded;
    border-color: #c0392b;
    color: #922b21;
}

.icon-action-btn--warn {
    color: #fff;
    background: #c0392b;
    border-color: #a93226;
}

.icon-action-btn--warn:hover {
    background: #a93226;
    border-color: #922b21;
    color: #fff;
}

/* ─── Paigalduse juhend (AVK-12) ─── */
.deploy-section {
    margin-bottom: 1.75rem;
}

.deploy-section h3 {
    margin-top: 0;
}

.deploy-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.deploy-table th,
.deploy-table td {
    border: 1px solid var(--border, #ccc);
    padding: 0.45rem 0.55rem;
    vertical-align: top;
    text-align: left;
}

.deploy-table th {
    background: var(--bg-subtle, #f5f5f5);
    font-weight: 600;
}

.deploy-table code {
    font-size: 0.82rem;
    word-break: break-word;
}

/* ─── AVK kuu sulgemine (AVK-19) ─── */
.avk-month-closure-warning {
    margin: 1rem 0;
    padding: 1rem;
    border: 1px solid #c0392b;
    background: #fdedec;
    border-radius: 4px;
}
.avk-month-closure-warning p {
    margin: 0 0 0.5rem;
}
.avk-month-closure-warning p:last-child {
    margin-bottom: 0;
}

/* ─── AVK kuu sulgemine – toimingute veerg ─── */
.action-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.action-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.action-row form {
    margin: 0;
}
.action-form {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}
.action-row .action-label {
    font-size: 0.78rem;
    color: var(--fg-muted);
    white-space: nowrap;
}
/* ─── Kesk arvutus: metoodika ─── */
.kesk-event-table th a.kesk-sort-btn,
.kesk-event-table th a.kesk-sort-btn:link,
.kesk-event-table th a.kesk-sort-btn:visited,
.kesk-event-table th a.kesk-sort-btn:hover,
.kesk-event-table th a.kesk-sort-btn:active {
    font: inherit;
    font-weight: 600;
    font-size: 0.8125rem;
    letter-spacing: 0.025em;
    text-transform: uppercase;
    color: #fff;
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
    text-align: left;
    text-decoration: none;
    display: inline-block;
}

.kesk-pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    margin: 0.75rem 0 1rem;
}

.kesk-pager a,
.kesk-pager span {
    display: inline-block;
    min-width: 2rem;
    padding: 0.3rem 0.55rem;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--fg);
    background: #fff;
}

.kesk-pager a:hover {
    background: var(--accent-light);
}

.kesk-pager .is-current {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    font-weight: 600;
}

.kesk-pager .is-disabled {
    color: var(--fg-muted);
}

.kesk-event-table .kesk-sort-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.kesk-event-table .kesk-sort-btn.is-sorted-asc .kesk-sort-arrow::after {
    content: ' \2191';
}

.kesk-event-table .kesk-sort-btn.is-sorted-desc .kesk-sort-arrow::after {
    content: ' \2193';
}

.kesk-event-table tr.kesk-bad-date td {
    color: var(--fg-muted);
}

.mangija-export {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem 1rem;
    margin: 0 0 1rem;
}

.mangija-export label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
}

.kesk-event-actions {
    margin: 0 0 0.75rem;
}

.kesk-cart-table .kesk-cart-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.kesk-n-input {
    display: block;
    width: 6rem;
    margin-top: 0.25rem;
}

.kesk-lead {
    margin: 0.25rem 0 1rem;
    max-width: 42rem;
    color: var(--fg-muted);
}

.kesk-guide {
    margin: 0 0 1.5rem;
    max-width: 42rem;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.kesk-guide summary {
    cursor: pointer;
    list-style: none;
    padding: 0.7rem 1rem;
    font-weight: 600;
    color: var(--accent-dark);
    background: var(--accent-light);
    border-radius: var(--radius);
}

.kesk-guide[open] summary {
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: 1px solid var(--border);
}

.kesk-guide summary::-webkit-details-marker {
    display: none;
}

.kesk-guide summary::before {
    content: "▸ ";
    color: var(--accent);
}

.kesk-guide[open] summary::before {
    content: "▾ ";
}

.kesk-guide-body {
    padding: 0.25rem 1.15rem 1rem;
}

.kesk-guide-body h3 {
    margin: 1rem 0 0.35rem;
    font-size: 0.95rem;
    color: var(--accent-dark);
}

.kesk-guide-body p,
.kesk-guide-body li {
    margin: 0.35rem 0;
}

.kesk-guide-body ol,
.kesk-guide-body ul {
    margin: 0.35rem 0 0.6rem;
    padding-left: 1.25rem;
}

.check-replace {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.775rem;
    color: #7a5800;
    background: #fff8e1;
    border: 1px solid #f0c040;
    border-radius: var(--radius);
    padding: 2px 6px;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1.4;
}
.check-replace input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

/* Testkeskkonna riba (ainult kui seadistuses environment = test) */
.env-banner {
    background: #b91c1c;
    color: #fff;
    text-align: center;
    font-weight: 700;
    letter-spacing: 0.03em;
    padding: 0.4rem 1rem;
    font-size: 0.9rem;
}
