/* Hållplatskollen. Designtokens och formspråk följer UmeMap (Umeå kommuns webbkarta). */

:root {
    --color-green: #00a01e;
    --color-green-dark: #006e1e;
    --color-green-soft: #e8f8eb;
    --color-green-medium: #d3f0d8;
    --color-blue: #007ac8;
    --color-blue-soft: #e6f2fa;
    --color-orange: #be5900;
    --color-warn: #f59e0b;
    --color-warn-soft: #fff4e0;
    --color-warn-border: #fde68a;
    --color-error: #c83037;
    --color-error-soft: #fdecec;

    --color-surface: rgba(255, 255, 255, 0.92);
    --color-surface-solid: #ffffff;
    --color-surface-hover: #f5f7f5;
    --color-surface-active: #ebefeb;
    --color-surface-muted: #f8faf8;

    --text-primary: #555555;
    --text-strong: #333333;
    --text-tertiary: #8a8a8a;
    --text-muted: #707070;
    --text-warn: #b45309;

    --border-light: rgba(0, 0, 0, 0.06);
    --border-medium: rgba(0, 0, 0, 0.10);
    --border-strong: rgba(0, 0, 0, 0.14);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-pill: 100px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.10), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.14), 0 4px 12px rgba(0, 0, 0, 0.08);

    --font: Calibri, Candara, "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
    --transition: 180ms ease;
    --ease-panel: cubic-bezier(0.16, 1, 0.3, 1);
    --panel-width: 400px;
}

*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    height: 100%;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: #e8ecef;
    -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
    font: inherit;
    color: inherit;
}

a {
    color: var(--color-green-dark);
}

h1, h2, h3 {
    color: var(--text-strong);
    margin: 0;
}

::selection {
    background: var(--color-green-soft);
    color: var(--color-green-dark);
}

:focus-visible {
    outline: 2px solid var(--color-green);
    outline-offset: 2px;
}

/* ---------- Karta ---------- */

.map {
    position: fixed;
    inset: 0;
    background: #e8ecef;
}

.ol-zoom {
    top: auto;
    left: auto;
    bottom: 42px;
    right: 10px;
    background: var(--color-surface);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-md);
    padding: 1px;
}

.ol-zoom:hover {
    box-shadow: var(--shadow-lg);
}

.ol-zoom button,
.ol-zoom button:hover,
.ol-zoom button:focus {
    width: 32px;
    height: 31px;
    margin: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 400;
    transition: background var(--transition), color var(--transition), transform var(--transition);
}

.ol-zoom button:hover {
    background: var(--color-green-soft);
    color: var(--color-green-dark);
    transform: scale(1.04);
}

.ol-zoom .ol-zoom-in {
    position: relative;
    border-radius: 50%;
}

.ol-zoom .ol-zoom-in::before {
    content: "";
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: -1px;
    height: 1px;
    background: var(--border-medium);
}

.ol-scale-line {
    left: auto;
    right: 52px;
    bottom: 12px;
    background: var(--color-surface);
    border-radius: var(--radius-pill);
    padding: 2px 8px;
    box-shadow: var(--shadow-sm);
}

.ol-scale-line-inner {
    border-color: var(--text-primary);
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 11px;
}

.map-legend {
    position: fixed;
    right: 10px;
    top: 10px;
    display: flex;
    gap: 14px;
    padding: 7px 12px;
    background: var(--color-surface);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-md);
    font-size: 12px;
    animation: float-in 350ms var(--ease-panel);
}

.map-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.legend-line {
    width: 20px;
    height: 0;
    border-top: 3px dashed;
}

.legend-line.green { color: var(--color-green-dark); }
.legend-line.blue { color: var(--color-blue); }
.legend-line.orange { color: var(--color-orange); }
.legend-line.warn { color: #d97706; }
.legend-line.solid { border-top-style: solid; border-top-width: 4px; }
.legend-line.dotted { color: #787575; border-top-style: dotted; }

.legend-stop {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #787575;
    background: #fff;
}

.legend-stop.ok {
    border-color: #fff;
    background: var(--color-green);
    box-shadow: 0 0 0 1px var(--color-green);
}

/* ---------- Riktningsväxel på kartan ---------- */

.map-toolbar {
    position: fixed;
    top: 10px;
    left: calc(var(--panel-width) + 30px);
    z-index: 5;
    display: flex;
    gap: 2px;
    padding: 3px;
    background: var(--color-surface);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-md);
    animation: float-in 350ms var(--ease-panel);
}

.segment {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px 6px 10px;
    border: 0;
    border-radius: var(--radius-pill);
    background: transparent;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.segment:hover {
    background: var(--color-green-soft);
    color: var(--color-green-dark);
}

.segment.active {
    background: var(--color-green-dark);
    color: #fff;
}

.segment-status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
}

.segment-status.ok { background: var(--color-green); }
.segment-status.warn { background: var(--color-warn); }
.segment-status.error { background: var(--color-error); }

/* ---------- Hovringsruta på kartan ---------- */

.map-tooltip {
    padding: 5px 10px;
    background: rgba(33, 37, 33, 0.92);
    color: #fff;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
}

.map-tooltip-title {
    font-weight: 700;
}

.map-tooltip-subtitle {
    opacity: 0.85;
}

/* ---------- Popup på kartan ---------- */

.map-popup {
    position: relative;
    min-width: 220px;
    max-width: 300px;
    padding: 12px 14px;
    background: var(--color-surface-solid);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    animation: float-in 180ms var(--ease-panel);
}

.map-popup::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -7px;
    width: 12px;
    height: 12px;
    background: var(--color-surface-solid);
    border-right: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
    transform: translateX(-50%) rotate(45deg);
}

.map-popup-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.map-popup-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

.map-popup-title {
    padding-right: 24px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-strong);
}

.map-popup-subtitle {
    margin-bottom: 6px;
    color: var(--text-tertiary);
}

.map-popup-row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px;
    padding: 5px 0 5px 8px;
    border-left: 3px solid var(--border-strong);
    margin-top: 4px;
}

.map-popup-row.ok { border-left-color: var(--color-green); }
.map-popup-row.warn { border-left-color: var(--color-warn); }

.map-popup-label {
    font-weight: 600;
    color: var(--text-strong);
    white-space: nowrap;
}

/* ---------- Panel ---------- */

.panel {
    position: fixed;
    top: 10px;
    left: 10px;
    max-height: calc(100vh - 20px);
    width: var(--panel-width);
    max-width: calc(100vw - 20px);
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    /* Inte overflow: hidden, då klipps adressförslagen av när panelen är låg. */
    z-index: 10;
    animation: float-in 350ms var(--ease-panel);
}

.panel-header {
    padding: 14px 16px 0;
    border-bottom: 1px solid var(--border-light);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--color-green);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 6px rgba(0, 160, 30, 0.35);
}

.brand-title {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-strong);
    line-height: 1.15;
}

.brand-subtitle {
    font-size: 12px;
    color: var(--text-tertiary);
}

.info-button {
    margin: 0 0 0 auto;
}

/* Utan flikar (ej inloggad) behövs luft under rubriken. */
.panel-header:not(:has(.tabs)) {
    padding-bottom: 14px;
}

.account-tab {
    margin-left: auto;
    padding-left: 8px;
    padding-right: 8px;
}

.guide-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    font-weight: 600;
    text-decoration: none;
}

.staff-login {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
    margin-top: 16px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--color-surface-muted);
    border: 1px solid var(--border-light);
    font-size: 13px;
}

.staff-login .material-symbols-outlined {
    color: var(--color-green);
}

.staff-login a {
    margin-left: auto;
    font-weight: 600;
}

.tabs {
    display: flex;
    gap: 4px;
    margin-top: 12px;
}

.tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px 9px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: color var(--transition), border-color var(--transition);
}

.tab:hover {
    color: var(--color-green-dark);
}

.tab.active {
    color: var(--color-green-dark);
    border-bottom-color: var(--color-green);
}

.panel-section {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-light);
}

.panel-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    padding: 12px 16px 16px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}

.search-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ---------- Formulär ---------- */

.field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.field-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
}

.field-input {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 40px;
    background: var(--color-surface-solid);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.field-input:focus-within {
    border-color: var(--color-green);
    box-shadow: 0 0 0 3px rgba(0, 160, 30, 0.18);
}

.field-input input,
.field-input select {
    flex: 1;
    min-width: 0;
    height: 38px;
    border: 0;
    background: transparent;
    padding: 0 10px;
    font-size: 14px;
    color: var(--text-strong);
    outline: none;
    appearance: none;
}

.field-input.with-icon input,
.field-input.with-icon select {
    padding-left: 38px;
}

.field-input select {
    padding-right: 34px;
    cursor: pointer;
}

.field-icon {
    position: absolute;
    left: 10px;
    color: var(--text-tertiary);
    pointer-events: none;
}

.select-chevron {
    position: absolute;
    right: 8px;
    color: var(--text-tertiary);
    pointer-events: none;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-tertiary);
}

.field-hint {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--text-tertiary);
}

.field-hint.warn {
    color: var(--text-warn);
}

.search-date {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 13px;
    color: var(--text-muted);
}

.search-date strong {
    color: var(--text-strong);
}

.search-date input {
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    padding: 3px 8px;
}

/* ---------- Autokomplettering ---------- */

.combobox {
    position: relative;
}

.combobox-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 40;
    max-height: 280px;
    overflow-y: auto;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    background: var(--color-surface-solid);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    animation: float-in 180ms var(--ease-panel);
}

.combobox-list li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 12px;
    cursor: pointer;
    color: var(--text-tertiary);
}

.combobox-list li.active,
.combobox-list li:hover {
    background: var(--color-green-soft);
}

.combobox-list li.active {
    box-shadow: inset 3px 0 0 var(--color-green);
}

.combobox-primary {
    color: var(--text-strong);
    font-weight: 600;
}

.combobox-secondary {
    margin-left: auto;
    font-size: 12px;
}

/* ---------- Knappar ---------- */

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    background: var(--color-surface-solid);
    color: var(--text-strong);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.button:hover:not(:disabled) {
    background: var(--color-green-soft);
    border-color: var(--color-green-medium);
}

.button.primary {
    background: var(--color-green-dark);
    border-color: var(--color-green-dark);
    color: #fff;
    font-size: 14px;
}

.button.primary:hover:not(:disabled) {
    background: var(--color-green);
    border-color: var(--color-green);
}

.button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.button.block {
    width: 100%;
}

.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-right: 6px;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-primary);
    cursor: pointer;
}

.icon-button:hover {
    background: rgba(0, 0, 0, 0.10);
    color: var(--text-strong);
}

.link-button {
    border: 0;
    background: none;
    padding: 0;
    color: var(--color-green-dark);
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner.small {
    width: 16px;
    height: 16px;
    margin-right: 10px;
    border-color: var(--color-green-medium);
    border-top-color: var(--color-green);
}

/* ---------- Banderoller och chips ---------- */

.banner {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1px solid;
    margin-bottom: 12px;
    font-size: 13px;
}

.banner > .material-symbols-outlined {
    font-size: 22px;
    flex-shrink: 0;
}

.banner.ok {
    background: var(--color-green-soft);
    border-color: var(--color-green-medium);
}

.banner.ok > .material-symbols-outlined { color: var(--color-green); }

.banner.warn {
    background: var(--color-warn-soft);
    border-color: var(--color-warn-border);
}

.banner.warn > .material-symbols-outlined { color: var(--color-orange); }

.banner.error {
    background: var(--color-error-soft);
    border-color: rgba(200, 48, 55, 0.25);
}

.banner.error > .material-symbols-outlined { color: var(--color-error); }

.banner-title {
    font-weight: 700;
    color: var(--text-strong);
}

.banner-metric {
    margin-top: 6px;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-strong);
    display: flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px 3px 7px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.chip.ok { background: var(--color-green-soft); color: var(--color-green-dark); }
.chip.warn { background: var(--color-warn-soft); color: var(--text-warn); }
.chip.error { background: var(--color-error-soft); color: var(--color-error); }

/* ---------- Resultat ---------- */

.summary-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    margin-bottom: 10px;
    font-size: 12px;
    color: var(--text-tertiary);
}

.summary-meta span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.summary-meta span:first-letter {
    text-transform: uppercase;
}

.direction {
    background: var(--color-surface-solid);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: 12px 14px;
    margin-bottom: 12px;
}

.direction-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.direction-header h2 {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.direction-header .chip {
    margin-left: auto;
}

.direction.active {
    border-color: var(--color-green-medium);
    box-shadow: var(--shadow-sm), inset 3px 0 0 var(--color-green);
}

.map-toggle {
    margin-right: 0;
}

.map-toggle.active {
    background: var(--color-green-soft);
    color: var(--color-green-dark);
}

.direction-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-green-soft);
    color: var(--color-green-dark);
}

.direction.warn .direction-icon {
    background: var(--color-warn-soft);
    color: var(--text-warn);
}

.direction.error .direction-icon {
    background: var(--color-error-soft);
    color: var(--color-error);
}

.direction-text {
    margin: 0 0 8px;
}

.metric {
    display: flex;
    flex-direction: column;
    margin-bottom: 10px;
}

.metric-value {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--text-strong);
}

.metric-label {
    font-size: 13px;
}

.metric-label strong {
    color: var(--text-strong);
}

.method-note {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: 4px;
    font-size: 12px;
    font-weight: 400;
    color: var(--text-tertiary);
    white-space: nowrap;
}

.method-note.warn {
    color: var(--text-warn);
}

.timeline {
    list-style: none;
    margin: 0 0 10px;
    padding: 0;
}

.timeline-stop {
    display: grid;
    grid-template-columns: 42px 14px 1fr;
    align-items: start;
    gap: 6px;
    position: relative;
    padding-bottom: 10px;
}

.timeline-stop::before {
    content: "";
    position: absolute;
    left: 54px;
    top: 14px;
    bottom: -4px;
    width: 2px;
    background: var(--color-green-medium);
}

.timeline-stop.end::before {
    display: none;
}

.timeline-time {
    font-weight: 700;
    color: var(--text-strong);
    font-variant-numeric: tabular-nums;
}

.timeline-dot {
    width: 12px;
    height: 12px;
    margin-top: 5px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--color-green);
    position: relative;
    z-index: 1;
}

.timeline-stop.end .timeline-dot {
    background: var(--color-green);
}

.timeline-stop.alight .timeline-dot {
    border-color: var(--color-blue);
}

.timeline-stop.start .timeline-dot {
    border-color: #787575;
}

.timeline-name {
    font-weight: 600;
}

.timeline-place {
    color: var(--text-strong);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 8px;
}

.timeline-direction {
    font-size: 12px;
    color: var(--text-tertiary);
    width: 100%;
}

.line-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 0 7px 0 5px;
    border-radius: var(--radius-pill);
    background: var(--color-blue-soft);
    color: var(--color-blue);
    font-size: 12px;
    font-weight: 600;
}

.line-chip.train {
    background: #f3e8f0;
    color: #5c0044;
}

.facts {
    display: flex;
    gap: 6px;
    margin: 0;
}

.facts > div {
    flex: 1;
    background: var(--color-surface-muted);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
}

.facts dt {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
}

.facts dd {
    margin: 0;
    font-weight: 700;
    color: var(--text-strong);
}

.facts dd.warn {
    color: var(--text-warn);
}

.near-miss {
    background: var(--color-surface-muted);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
}

.near-miss-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    color: var(--text-strong);
    margin-bottom: 4px;
}

.violations {
    margin: 0 0 10px;
    padding-left: 22px;
    color: var(--text-warn);
}

.candidates {
    margin-top: 10px;
    border-top: 1px solid var(--border-light);
    padding-top: 8px;
}

.candidates summary {
    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    list-style: none;
}

.candidates summary::-webkit-details-marker {
    display: none;
}

.candidates[open] .chevron {
    transform: rotate(180deg);
}

.candidates ol {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    font-size: 12px;
}

.candidates li {
    display: grid;
    grid-template-columns: 18px 1fr auto;
    gap: 0 6px;
    padding: 5px 0;
    border-bottom: 1px solid var(--border-light);
}

.candidates li > .material-symbols-outlined {
    color: var(--text-tertiary);
    margin-top: 1px;
}

.candidates li.ok > .material-symbols-outlined {
    color: var(--color-green);
}

.candidate-name {
    color: var(--text-strong);
    font-weight: 600;
}

.candidate-distance {
    font-variant-numeric: tabular-nums;
}

.candidate-description {
    grid-column: 2 / 4;
    color: var(--text-tertiary);
}

/* ---------- Dialog ---------- */

dialog.dialog {
    padding: 0;
    border: 0;
    color: inherit;
}

dialog.dialog::backdrop {
    background: rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(6px);
}

dialog.dialog[open] {
    display: flex;
}

.dialog {
    width: min(540px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    flex-direction: column;
    background: var(--color-surface-solid);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: float-in 250ms var(--ease-panel);
}

.dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 54px;
    padding: 0 12px 0 18px;
    border-bottom: 1px solid var(--border-light);
}

.dialog-header h2 {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
}

.dialog-header h2 .material-symbols-outlined {
    color: var(--color-green);
}

.dialog-body {
    padding: 16px 18px 20px;
    overflow-y: auto;
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ---------- Hjälp ---------- */

.help h2 {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 6px;
}

.help h3 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
    margin: 14px 0 6px;
}

.help ol {
    margin: 0;
    padding-left: 20px;
}

.help ol li {
    margin-bottom: 4px;
}

.rules {
    list-style: none;
    margin: 0;
    padding: 0;
}

.rules li {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 5px 0;
    border-bottom: 1px solid var(--border-light);
}

.rules .material-symbols-outlined {
    color: var(--color-green);
    margin-top: 2px;
}

/* ---------- Listsidan ---------- */

.page {
    min-height: 100%;
    padding: 24px 16px;
    background: linear-gradient(180deg, #f7faf3 0%, #e8ecef 100%);
}

.page-card {
    max-width: 1180px;
    margin: 0 auto;
    background: var(--color-surface-solid);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.section-description {
    margin: 0 0 14px;
    max-width: 70ch;
}

.upload-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}

.dropzone {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border: 1.5px dashed var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--color-surface-muted);
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
}

.dropzone:hover {
    border-color: var(--color-green);
    background: var(--color-green-soft);
}

.dropzone .material-symbols-outlined {
    color: var(--color-green);
}

.dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.dropzone.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.dropzone-file {
    display: block;
    font-size: 12px;
    color: var(--color-green-dark);
}

.paste summary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 16px 0;
    font-weight: 600;
    cursor: pointer;
    color: var(--text-muted);
}

.paste textarea {
    width: 100%;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-family: Consolas, monospace;
    font-size: 12px;
    margin-bottom: 8px;
}

.actions {
    display: flex;
    gap: 8px;
    margin-top: 14px;
}

.progress {
    height: 6px;
    margin-top: 14px;
    border-radius: var(--radius-pill);
    background: var(--color-surface-active);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--color-green), #8cbe00);
    transition: width 300ms ease;
}

.result-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
}

table.results {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

table.results th {
    position: sticky;
    top: 0;
    background: var(--color-surface-muted);
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-medium);
}

table.results td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: top;
}

table.results tr:hover td {
    background: var(--color-surface-hover);
}

table.results .number {
    text-align: right;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

table.results .strong {
    font-weight: 700;
    color: var(--text-strong);
}

.muted {
    color: var(--text-tertiary);
}

.error-text {
    color: var(--color-error);
}

.cell-direction {
    display: flex;
    flex-direction: column;
    padding-left: 8px;
    border-left: 3px solid;
}

.cell-direction.ok { border-color: var(--color-green); }
.cell-direction.warn { border-color: var(--color-warn); }
.cell-direction.error { border-color: var(--color-error); }

.cell-direction strong {
    color: var(--text-strong);
}

/* ---------- Övrigt ---------- */

.page-message {
    max-width: 420px;
    margin: 15vh auto;
    text-align: center;
    padding: 24px;
    background: var(--color-surface-solid);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.login-card {
    max-width: 420px;
    margin: 12vh auto 0;
    padding: 28px;
    background: var(--color-surface-solid);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: float-in 350ms var(--ease-panel);
}

.login-card h1 {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 12px 0 6px;
}

.login-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: var(--color-green-soft);
    color: var(--color-green-dark);
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 18px;
    font-weight: 600;
    text-decoration: none;
}

body.plain {
    background: linear-gradient(180deg, #f7faf3 0%, #e8ecef 100%);
}

.page-message .account {
    font-size: 15px;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    background: var(--color-surface-active);
    color: var(--text-strong);
}

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--color-error-soft);
    color: var(--color-error);
    border: 1px solid rgba(200, 48, 55, 0.25);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-lg);
}

#blazor-error-ui .reload {
    font-weight: 700;
    color: var(--color-error);
}

@keyframes float-in {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
}

/* ---------- Mobil ---------- */

@media (max-width: 720px) {
    .panel {
        top: auto;
        left: 8px;
        right: 8px;
        bottom: 8px;
        width: auto;
        max-height: 62vh;
    }


    .map-legend {
        display: none;
    }

    .map-toolbar {
        left: 8px;
    }

    .ol-zoom {
        bottom: auto;
        top: 10px;
    }

    .ol-scale-line {
        display: none;
    }

    .upload-row {
        grid-template-columns: 1fr;
    }

    .page {
        padding: 8px;
    }
}

.field-input:has(:disabled) {
    background: var(--color-surface-muted);
    opacity: 0.7;
}
