:root {
    --color-primary: #9aabcb;
    --color-primary-hover: #7a8faf;
    --color-surface: #ffffff;
    --color-surface-soft: #f0f0f0;
    --color-surface-strong: #e0e0e0;
    --color-text: #000000;
    --color-muted: #6c757d;
    --color-line: #cccccc;
    --color-link: #2a397a;
    --color-success: #1d8b37;
    --color-warning: #ffc107;
    --color-danger: #dc3545;
    --admin-primary: color-mix(in srgb, #2a397a 31%, #cddeef 69%);
    --admin-primary-hover: color-mix(in srgb, #2a397a 45%, #cddeef 55%);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    background: #f5f5f5;
    color: var(--color-text);
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 13px;
    line-height: 1.4;
    padding: 20px 16px 32px;
}

a {
    color: var(--color-link);
    text-decoration: none;
}

a:hover { text-decoration: underline; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
    outline: 2px solid var(--color-link);
    outline-offset: 2px;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    color: var(--color-text);
    font-size: 17px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0;
}

h2 {
    margin-bottom: 10px;
    color: var(--color-text);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
}

h3 {
    margin-bottom: 8px;
    font-size: 13px;
    line-height: 1.2;
}

p { margin-bottom: 10px; }

.admin-shell {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    border: 1px solid #dddddd;
    background: #ffffff;
    padding: 1.35rem 2rem 2rem;
}

.admin-header,
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
    padding-bottom: 0;
    border-bottom: 0;
}

.admin-title,
.page-title-block {
    display: grid;
    gap: 7px;
    min-width: 0;
}

.page-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--color-link);
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    width: fit-content;
    margin-bottom: 2px;
    color: var(--color-link);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
}

.back-link:hover {
    color: var(--color-text);
    text-decoration: none;
}

.back-link-icon {
    flex: 0 0 auto;
    display: block;
    width: 14px;
    height: 14px;
}

.admin-kicker,
.admin-muted,
.view-tile-sub,
.admin-action-desc,
.status-sub {
    color: var(--color-muted);
}

.admin-kicker,
.view-tile-sub,
.admin-action-desc,
.admin-muted,
.status-sub {
    font-size: 12px;
}

.admin-actions,
.admin-header-actions,
.admin-button-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.admin-header-actions,
.page-actions {
    justify-content: flex-end;
}

.admin-header-actions .admin-button,
.admin-header-actions .admin-link-button {
    min-height: 32px;
    padding: 6px 10px;
}

.admin-icon-button {
    display: inline-grid;
    width: 34px;
    min-width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid var(--color-line);
    border-radius: 0;
    background: var(--color-surface-soft);
    color: var(--color-text);
    text-decoration: none;
}

.admin-icon-button:hover {
    background: var(--color-surface-strong);
    text-decoration: none;
}

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

.page-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    border: 1px solid var(--color-line);
    border-radius: 0;
    background: var(--color-surface-soft);
    color: #333333;
    padding: 6px 10px;
    font: inherit;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
}

.page-actions a:hover {
    background: var(--color-surface-strong);
    color: var(--color-text);
    text-decoration: none;
}

.admin-button,
button.admin-button,
.admin-link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 34px;
    border: 1px solid var(--color-line);
    border-radius: 0;
    background: var(--admin-primary);
    color: var(--color-text);
    padding: 7px 14px;
    font: inherit;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
}

.admin-button:hover,
button.admin-button:hover,
.admin-link-button:hover {
    background: var(--admin-primary-hover);
    color: var(--color-text);
    text-decoration: none;
}

.admin-button.secondary,
.admin-link-button.secondary {
    background: var(--color-surface-soft);
    color: #333333;
}

.admin-button.secondary:hover,
.admin-link-button.secondary:hover {
    background: var(--color-surface-strong);
    color: var(--color-text);
}

.admin-button.danger {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #4e1118;
}

.admin-button:disabled,
button.admin-button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.admin-card {
    margin-bottom: 14px;
    border: 1px solid var(--color-surface-strong);
    border-radius: 0;
    background: var(--color-surface-soft);
    padding: 14px;
}

.admin-card > h2 {
    margin: 0 0 12px;
    color: var(--color-link);
}

.status-overview-card {
    border: 0;
    background: transparent;
    padding: 0;
}

.view-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}

.view-tile,
.admin-action-tile {
    border: 1px solid var(--color-line);
    border-radius: 0;
    color: var(--color-text);
    text-decoration: none;
}

.view-tile {
    display: grid;
    grid-template-rows: 34px auto;
    align-items: center;
    justify-content: center;
    justify-items: center;
    gap: 5px;
    min-height: 62px;
    background: var(--color-surface-soft);
    padding: 9px 10px;
    text-align: center;
}

.view-tile:hover {
    background: var(--color-surface-strong);
    border-color: var(--color-line);
    text-decoration: none;
}

.admin-action-tile:hover {
    background: var(--color-surface-strong);
    text-decoration: none;
}

.view-tile-label,
.admin-action-title {
    color: var(--color-text);
    font-weight: 700;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.view-tile-sub,
.admin-action-desc {
    line-height: 1.3;
    overflow-wrap: anywhere;
}

.view-tile-icon {
    display: block;
    align-self: center;
    width: 32px;
    height: 32px;
    color: var(--color-link);
}

.admin-current-imports {
    margin: 0;
}

.admin-status-overview {
    margin-bottom: 14px;
}

.admin-current-imports h3 {
    margin: 0 0 8px;
    font-size: 13px;
}

.import-status-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.import-status-card {
    --status-color: var(--color-success);
    display: flex;
    flex-direction: column;
    min-height: 74px;
    border: 1px solid color-mix(in srgb, var(--status-color) 32%, var(--color-line) 68%);
    border-left: 4px solid var(--status-color);
    border-radius: 0;
    background: var(--color-surface);
    padding: 12px;
}

.import-status-link {
    color: inherit;
    text-decoration: none;
}

.import-status-link:hover {
    background: #f7f9fc;
    text-decoration: none;
}

.import-status-card:has(.status-pill.missing) {
    --status-color: var(--color-danger);
}

.import-status-card:has(.status-pill.review) {
    --status-color: #b98100;
}

.import-status-card:has(.status-pill.loading) {
    --status-color: #b98100;
}

.import-overview-card {
    --status-color: var(--color-success);
}

.import-overview-card:has(.import-state-line:first-child .status-pill.success) {
    --status-color: var(--color-success);
}

.import-overview-card:has(.import-state-line:first-child .status-pill.missing) {
    --status-color: var(--color-danger);
}

.import-overview-card:has(.import-state-line:first-child .status-pill.review),
.import-overview-card:has(.import-state-line:first-child .status-pill.loading) {
    --status-color: #b98100;
}

.planner-status-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    column-gap: 12px;
    align-items: center;
    flex: 1 1 auto;
    width: 100%;
    min-height: 100%;
}

.planner-status-row:has(> .planner-status-title) {
    grid-template-rows: max-content minmax(0, 1fr);
    row-gap: 8px;
    align-items: stretch;
}

.planner-status-row:has(> .planner-status-title) > .planner-status-title {
    grid-column: 1 / -1;
    grid-row: 1;
    align-self: start;
}

.planner-status-row:has(> .planner-status-title) > .planner-status-copy {
    grid-column: 1;
    grid-row: 2;
    align-self: center;
}

.planner-status-row:has(> .planner-status-title) > .planner-status-copy > .planner-status-detail:first-child {
    margin-top: 0;
}

.planner-status-row:has(> .planner-status-title) > .status-pill {
    grid-column: 2;
    grid-row: 2;
}

.planner-status-copy {
    min-width: 0;
}

.import-summary-row {
    grid-template-columns: minmax(0, 1fr);
}

.import-summary-row:has(> .planner-status-title) > .planner-status-copy {
    grid-column: 1;
}

.planner-status-title {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 18px;
    margin: 0;
    color: var(--color-link);
    font-weight: 700;
    line-height: 18px;
}

.planner-status-detail {
    min-height: 17px;
    margin: 4px 0 0;
    color: var(--color-text);
    font-weight: 500;
    line-height: 17px;
    overflow-wrap: anywhere;
}

.system-monitor-summary {
    margin-top: 2px;
}

.planner-status-meta {
    min-height: 16px;
    margin: 6px 0 0;
    color: var(--color-text);
    font-size: 13px;
    font-weight: 700;
    line-height: 16px;
    overflow-wrap: anywhere;
}

.planner-status-meta:empty::before {
    content: "\00a0";
}

.monitor-device-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
    margin-top: 7px;
}

.monitor-device-chip {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: center;
    column-gap: 8px;
    min-height: 24px;
    max-width: 100%;
    border: 1px solid color-mix(in srgb, var(--status-color, var(--color-line)) 45%, var(--color-line) 55%);
    border-left: 4px solid var(--status-color, var(--color-muted));
    background: #ffffff;
    padding: 3px 6px;
    font-size: 11px;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.monitor-device-chip strong {
    color: var(--color-text);
    font-size: 11px;
    line-height: 1.15;
    white-space: nowrap;
}

.monitor-device-chip span {
    color: var(--color-muted);
    min-width: 0;
}

.monitor-device-chip.ok {
    --status-color: var(--color-success);
}

.monitor-device-chip.review {
    --status-color: #b98100;
}

.monitor-device-chip.missing {
    --status-color: var(--color-danger);
}

.planner-status-warning {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    margin: 7px 0 0;
    border-left: 3px solid #b98100;
    background: #fff8e6;
    color: #7a4b00;
    padding: 4px 7px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.planner-status-error {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    margin: 7px 0 0;
    border-left: 3px solid var(--color-danger);
    background: color-mix(in srgb, var(--color-danger) 8%, #fff 92%);
    color: #8f1d2c;
    padding: 4px 7px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.import-state-list {
    display: grid;
    gap: 8px;
    margin-top: 0;
}

.import-state-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) max-content;
    gap: 10px;
    align-items: start;
    min-height: 38px;
}

.import-state-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.import-state-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
    color: var(--color-text);
    font-size: 13px;
    font-weight: 700;
    line-height: 16px;
    overflow-wrap: anywhere;
}

.import-state-value {
    color: var(--color-muted);
    font-size: 12px;
    font-weight: 400;
    line-height: 15px;
    overflow-wrap: anywhere;
}

.import-state-logo {
    width: 20px;
    height: 13px;
    border: 0;
    object-fit: contain;
}

.import-state-line .status-pill,
.import-state-line .status-pill.success,
.import-state-line .status-pill.missing,
.import-state-line .status-pill.review,
.import-state-line .status-pill.loading {
    justify-self: end;
    align-self: center;
    width: 20px;
    min-width: 20px;
    height: 20px;
    min-height: 20px;
}

.import-state-line .status-pill.success::before {
    width: 5px;
    height: 8px;
}

.import-state-line .status-pill.review::before {
    font-size: 13px;
}

.import-state-line .status-pill.missing::before,
.import-state-line .status-pill.missing::after {
    width: 10px;
}

.status-icon {
    flex: 0 0 auto;
    display: block;
    width: 16px;
    height: 16px;
    color: var(--color-text);
}

.admin-icon-button .status-icon {
    width: 21px;
    height: 21px;
}

.infoportal-logo-icon {
    width: 22px;
    height: 14px;
    border: 0;
    background: transparent;
    object-fit: contain;
}

.status-pill {
    --pill-color: var(--status-color, var(--color-success));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    justify-self: end;
    align-self: center;
    min-width: 30px;
    min-height: 32px;
    border-radius: 0;
    background: color-mix(in srgb, var(--pill-color) 8%, #fff 92%);
    border: 1px solid color-mix(in srgb, var(--pill-color) 58%, #fff 42%);
    color: var(--pill-color);
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--pill-color) 10%, transparent);
}

.status-pill.success {
    width: 32px;
    min-width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 0;
    font-size: 0;
}

.status-pill.success::before {
    content: "";
    width: 7px;
    height: 12px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translate(-1px, -1px);
}

.status-pill.missing {
    --pill-color: var(--color-danger);
    width: 32px;
    min-width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 0;
    font-size: 0;
}

.status-pill.missing::before,
.status-pill.missing::after {
    content: "";
    position: absolute;
    width: 14px;
    height: 2px;
    background: currentColor;
}

.status-pill.missing::before {
    transform: rotate(45deg);
}

.status-pill.missing::after {
    transform: rotate(-45deg);
}

.status-pill.review {
    --pill-color: #b98100;
    width: 32px;
    min-width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 0;
    font-size: 0;
}

.status-pill.review::before {
    content: "!";
    font-size: 18px;
    font-weight: 800;
    line-height: 1;
}

.status-pill.pending {
    --pill-color: var(--color-muted);
    background: #fff;
}

.status-pill.loading {
    --pill-color: var(--status-color, #b98100);
    width: 32px;
    min-width: 32px;
    height: 32px;
    min-height: 32px;
    padding: 0;
    font-size: 0;
}

.status-pill.loading::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    display: block;
    width: 13px;
    height: 13px;
    margin: 0;
    border: 2px solid color-mix(in srgb, currentColor 78%, #fff 22%);
    border-top-color: transparent;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transform-origin: center;
    animation: status-spin-clockwise 0.75s linear infinite;
}

@keyframes status-spin-clockwise {
    from { transform: translate(-50%, -50%) rotate(0deg); }
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

.status-grid,
.admin-action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
    gap: 8px;
}

.compact-status-grid {
    grid-template-columns: minmax(0, 17rem);
}

.timetable-current-imports {
    margin: 0 0 14px;
}

.timetable-current-imports .import-status-grid {
    grid-template-columns: minmax(0, 1fr);
}

.admin-action-grid {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.admin-action-tile {
    display: grid;
    place-items: center;
    min-height: 46px;
    padding: 10px;
    background: var(--color-surface);
    text-align: center;
}

.status-item {
    min-height: 78px;
    border: 1px solid color-mix(in srgb, var(--color-success) 32%, var(--color-line) 68%);
    border-left: 4px solid var(--color-success);
    border-radius: 0;
    background: var(--color-surface);
    padding: 10px;
}

.status-item.warn {
    border-color: color-mix(in srgb, #b98100 32%, var(--color-line) 68%);
    border-left-color: #b98100;
}

.status-item.danger {
    border-color: color-mix(in srgb, var(--color-danger) 32%, var(--color-line) 68%);
    border-left-color: var(--color-danger);
}

.compact-status-item {
    min-height: 0;
    padding: 7px 10px;
}

.compact-status-heading {
    display: inline-flex;
    align-items: center;
    gap: 0;
    margin-bottom: 2px;
}

.compact-status-item .status-label {
    margin-bottom: 0;
    font-size: 10px;
}

.compact-status-item .status-value {
    font-size: 18px;
    line-height: 1.1;
}

.compact-status-item .status-sub {
    margin-top: 2px;
    font-size: 11px;
}

.status-label {
    display: block;
    margin-bottom: 5px;
    color: var(--color-muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
}

.status-value {
    display: block;
    color: var(--color-text);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.status-sub {
    display: block;
    margin-top: 5px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.status-ok {
    color: var(--color-success);
    font-weight: 700;
}

.status-warn {
    color: #9a6500;
    font-weight: 700;
}

.database-schema-action {
    margin-top: 14px;
}

.status-error {
    color: var(--color-danger);
    font-weight: 700;
}

.notice,
.error-box,
.success-box,
.warning-box {
    border-radius: 0;
    padding: 8px 10px;
    margin: 12px 0;
    font-weight: 700;
}

.success-box {
    border: 1px solid var(--color-success);
    background: #d4edda;
    color: #0c3b18;
}

.warning-box {
    border: 1px solid var(--color-warning);
    border-left: 4px solid var(--color-warning);
    background: #fff8e6;
    color: #856404;
}

.error-box {
    border: 1px solid var(--color-danger);
    border-left: 4px solid var(--color-danger);
    background: #f8d7da;
    color: #4e1118;
}

.error-box h2 {
    margin: 0 0 6px;
    color: #4e1118;
}

.error-box p:last-child {
    margin-bottom: 0;
}

body.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    color: #000000;
    padding: 0;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 13px;
}

.login-panel,
.login-container {
    width: 100%;
    max-width: 360px;
    border: 1px solid #dddddd;
    border-radius: 0;
    background: #ffffff;
    padding: 2rem;
}

.login-panel h1,
.login-container h1 {
    margin: 0;
    color: #2a397a;
    font-size: 18px;
}

.login-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

.login-logo {
    width: auto;
    height: 80px;
}

.form-grid {
    display: grid;
    gap: 12px;
}

.field {
    display: grid;
    gap: 5px;
}

.field label {
    color: #333333;
    font-size: 12px;
    font-weight: 700;
}

.field input,
.field select,
.field textarea,
.rule-table input,
.rule-table select {
    width: 100%;
    min-height: 34px;
    border: 1px solid var(--color-line);
    border-radius: 0;
    background: var(--color-surface);
    color: var(--color-text);
    padding: 6px 8px;
    font: inherit;
}

.field textarea {
    min-height: 94px;
    resize: vertical;
}

.settings-form {
    width: 100%;
}

.settings-field-row {
    display: grid;
    gap: 5px;
}

.settings-input-unit {
    display: grid;
    grid-template-columns: minmax(0, 8rem) max-content;
    align-items: center;
    gap: 8px;
}

.settings-input-unit input {
    width: 100%;
}

.settings-check-row {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    width: 100%;
    cursor: pointer;
}

.settings-check-row input {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    accent-color: var(--color-link);
}

.settings-check-row > span {
    display: grid;
    gap: 3px;
}

.settings-check-row strong {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
}

.settings-check-state {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 18px;
    border: 1px solid color-mix(in srgb, var(--color-danger) 45%, #fff 55%);
    border-left: 4px solid var(--color-danger);
    background: color-mix(in srgb, var(--color-danger) 9%, #fff 91%);
    color: #8f1d2c;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.15;
}

.settings-check-state.is-active {
    border-color: color-mix(in srgb, var(--color-success) 45%, #fff 55%);
    border-left-color: var(--color-success);
    background: color-mix(in srgb, var(--color-success) 10%, #fff 90%);
    color: #0c3b18;
}

.settings-check-row-warning {
    border-left: 3px solid var(--color-warning);
    background: #fff8e6;
    padding: 7px 9px;
}

.settings-dev-section {
    display: grid;
    gap: 9px;
}

.settings-dev-section h2 {
    margin: 0;
    color: #7a4b00;
    font-size: 14px;
    line-height: 1.25;
}

.settings-dev-block {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(0, 2fr);
    gap: 8px;
    align-items: center;
    padding-top: 7px;
    border-top: 1px solid color-mix(in srgb, var(--color-warning) 35%, #ffffff 65%);
}

.settings-dev-copy {
    display: grid;
    gap: 2px;
    min-width: 0;
    color: var(--color-text);
    font-size: 12px;
    line-height: 1.25;
}

.settings-dev-copy strong {
    color: #5f3d00;
}

.settings-dev-copy span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.settings-dev-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
    min-width: 0;
}

.settings-dev-button {
    width: auto;
    min-width: 0;
    max-width: 100%;
    min-height: 30px;
    padding: 5px 8px;
    font-size: 12px;
    line-height: 1.2;
}

.settings-dev-download {
    max-width: 260px;
}

.settings-dev-download span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.settings-hint {
    margin: 0;
    color: var(--color-muted);
    font-size: 12px;
    line-height: 1.35;
}

.settings-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.settings-actions .admin-button,
.password-field-action .admin-button {
    width: 190px;
}

.password-management {
    display: grid;
    gap: 10px;
}

.password-section {
    display: grid;
    gap: 10px;
    border: 1px solid var(--color-line);
    background: var(--color-surface);
    padding: 12px;
}

.password-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border-bottom: 1px solid var(--color-surface-strong);
    padding-bottom: 8px;
}

.password-user {
    color: var(--color-muted);
    font-size: 12px;
}

.password-user code {
    border: 1px solid var(--color-line);
    background: var(--color-surface-soft);
    padding: 2px 5px;
    color: var(--color-text);
    font-size: 12px;
}

.password-fields {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) max-content;
    align-items: end;
    gap: 8px;
}

.password-fields .field {
    margin: 0;
}

.password-field-action {
    display: flex;
    align-items: end;
}

.login-page .form-group,
.login-page .field {
    display: block;
    margin-bottom: 1rem;
}

.login-page .form-group label,
.login-page .field label {
    display: block;
    margin-bottom: 0.3rem;
    color: #000000;
    font-size: 12px;
    font-weight: normal;
}

.login-page .form-group input[type="text"],
.login-page .form-group input[type="password"],
.login-page .field input[type="text"],
.login-page .field input[type="password"] {
    width: 100%;
    min-height: 0;
    border: 1px solid #cccccc;
    border-radius: 0;
    background: #ffffff;
    color: #000000;
    padding: 0.6rem;
    font: inherit;
    font-size: 13px;
    box-shadow: none;
}

.login-page .form-group input:focus,
.login-page .field input:focus {
    border-color: #2a397a;
    outline: none;
    box-shadow: none;
}

.login-page .btn-login,
.login-page .admin-button {
    width: 100%;
    min-height: 0;
    border: 1px solid #cccccc;
    border-radius: 0;
    background: color-mix(in srgb, #2a397a 31%, #cddeef 69%);
    color: #000000;
    padding: 0.7rem;
    font: inherit;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 0.5rem;
}

.login-page .btn-login:hover,
.login-page .admin-button:hover {
    background: color-mix(in srgb, #2a397a 45%, #cddeef 55%);
    color: #000000;
}

.login-page .error,
.login-page .error-box {
    background: #f8d7da;
    color: #dc3545;
    padding: 0.5rem;
    margin-bottom: 1rem;
    border: 1px solid #dc3545;
    text-align: left;
}

.login-page .footer,
.login-page .admin-footer,
.login-page .app-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 0;
    color: #000000;
    text-align: center;
    font-size: 13px;
}

.dropzone {
    display: grid;
    align-content: start;
    gap: 10px;
    min-height: 112px;
    border: 2px dashed #bbbbbb;
    border-radius: 8px;
    background: var(--color-surface);
    padding: 16px;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.compact-dropzone {
    min-height: 92px;
}

.file-card-title {
    margin: 0;
    color: var(--color-text);
    font-size: 15px;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.dropzone-title {
    color: var(--color-text);
    font-size: 15px;
    font-weight: 700;
}

.dropzone input[type="file"] {
    width: 100%;
    min-height: 38px;
    border: 1px solid var(--color-line);
    border-radius: 0;
    background: #fff;
    padding: 7px;
    font: inherit;
    font-size: 13px;
}

.dropzone input[type="file"]::file-selector-button {
    min-height: 28px;
    margin-right: 10px;
    border: 1px solid var(--color-line);
    border-radius: 0;
    background: var(--admin-primary);
    color: var(--color-text);
    padding: 5px 10px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.dropzone input[type="file"]::file-selector-button:hover {
    background: var(--admin-primary-hover);
}

.dropzone.dragover,
.dropzone.has-file {
    border-style: solid;
    border-color: var(--color-link);
    background: #f7f9fc;
    box-shadow: none;
}

.school-type-list {
    display: grid;
    overflow: hidden;
    margin-bottom: 12px;
    border: 1px solid var(--color-line);
    border-radius: 0;
}

.school-type-row {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 7px 10px;
    border-bottom: 1px solid var(--color-line);
    background: var(--color-surface);
}

.school-type-row:last-child {
    border-bottom: 0;
}

.school-type-row:nth-child(even) {
    background: var(--color-surface-soft);
}

.school-type-class {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
    min-width: 0;
}

.school-type-class strong {
    font-family: Consolas, "Courier New", monospace;
    font-size: 15px;
    line-height: 1.25;
}

.school-type-options {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

.school-type-option {
    position: relative;
    display: inline-flex;
    cursor: pointer;
}

.school-type-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.school-type-option span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    min-height: 30px;
    border: 1px solid var(--color-line);
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 13px;
    font-weight: 700;
}

.school-type-option input:focus-visible + span {
    outline: 2px solid var(--color-link);
    outline-offset: 2px;
}

.school-type-option input:checked + span,
.school-type-option:hover span {
    border-color: var(--color-link);
    background: var(--admin-primary);
}

.school-type-details {
    margin-top: 14px;
}

.school-type-details summary {
    min-height: 32px;
    color: var(--color-link);
    font-size: 14px;
    line-height: 32px;
}

.school-type-edit-form {
    margin-top: 8px;
}

.school-type-table {
    min-width: 560px;
}

.school-type-table th,
.school-type-table td {
    vertical-align: middle;
    white-space: normal;
}

.school-type-table th,
.school-type-table td,
.admin-table.school-type-table th,
.admin-table.school-type-table td {
    padding: 4px 5px;
}

.course-name {
    display: inline-block;
    min-width: 78px;
    margin-right: 8px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
}

.school-type-select {
    width: 100%;
    max-width: 140px;
    min-height: 30px;
    border: 1px solid var(--color-line);
    border-radius: 0;
    background: var(--color-surface);
    color: var(--color-text);
    padding: 3px 8px;
    font: inherit;
    font-size: 13px;
}

.school-type-edit-actions {
    justify-content: flex-start;
    margin-top: 8px;
}

.rule-table {
    min-width: 760px;
}

.rule-table .rule-col-position {
    width: 58px;
}

.rule-table .rule-col-label {
    width: 24%;
}

.rule-table .rule-col-type {
    width: 100px;
}

.rule-table .rule-col-school-type {
    width: 86px;
}

.rule-table .rule-col-active {
    width: 54px;
}

.rule-table .rule-col-actions {
    width: 42px;
}

.rule-table th,
.rule-table td {
    padding: 4px 5px;
}

.rule-table th {
    white-space: nowrap;
}

.rule-table td {
    vertical-align: middle;
    white-space: normal;
}

.rule-table input,
.rule-table select {
    min-height: 28px;
    padding: 3px 5px;
}

.rule-table input[type="checkbox"] {
    display: block;
    width: 16px;
    min-height: 16px;
    margin: 0 auto;
    padding: 0;
    accent-color: var(--color-link);
}

.rule-table input[type="number"] {
    width: 70px;
}

.admin-button.rule-delete-button {
    width: 32px;
    min-height: 30px;
    padding: 0;
}

.rule-delete-icon {
    display: block;
    flex: 0 0 20px;
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.new-rule-form {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--color-line);
}

.new-rule-grid {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) 96px minmax(180px, 1.4fr) 76px auto;
    gap: 8px;
    align-items: end;
}

.button-field {
    align-self: end;
}

.text-preview {
    max-height: 420px;
    overflow: auto;
    border: 1px solid var(--color-line);
    border-radius: 0;
    background: var(--color-surface);
    color: var(--color-text);
    padding: 10px;
    font: 12px/1.45 Consolas, "Courier New", monospace;
    white-space: pre-wrap;
}

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

.admin-table {
    width: 100%;
    margin: 10px 0 12px;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--color-surface);
    font-size: 12px;
}

.admin-table th,
.admin-table td {
    border-right: 1px solid var(--color-surface);
    border-top: 1px solid var(--color-surface);
    padding: 5px 7px;
    text-align: left;
    vertical-align: top;
}

.admin-table th {
    background: var(--color-primary);
    color: var(--color-text);
    font-weight: 700;
}

.admin-table td {
    background: var(--color-surface-soft);
    white-space: pre-wrap;
}

.admin-table tbody tr:nth-child(even) td {
    background: var(--color-surface-strong);
}

.monitor-device-table {
    min-width: 860px;
}

.monitor-view-table {
    min-width: 620px;
}

.monitor-device-table td {
    background: var(--color-surface);
    vertical-align: middle;
}

.monitor-device-table tbody tr:nth-child(even) td {
    background: var(--color-surface);
}

.monitor-device-table th:last-child,
.monitor-device-table td:last-child {
    width: 1%;
    padding-inline: 5px;
    text-align: center;
    white-space: nowrap;
}

.admin-table.school-type-table th,
.admin-table.school-type-table td {
    vertical-align: middle;
    white-space: normal;
    padding: 4px 5px;
}

.admin-table.rule-table th,
.admin-table.rule-table td {
    padding: 4px 5px;
}

.admin-table.rule-table th {
    white-space: nowrap;
}

.admin-table.rule-table td {
    vertical-align: middle;
    white-space: normal;
}

details {
    margin: 12px 0 4px;
}

summary {
    cursor: pointer;
    position: relative;
    display: block;
    box-sizing: border-box;
    padding-right: 24px;
    font-weight: 700;
    list-style: none;
}

summary::-webkit-details-marker {
    display: none;
}

summary::after {
    content: "";
    position: absolute;
    top: 50%;
    right: 4px;
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    opacity: 0.75;
    transform: translateY(-50%) rotate(-45deg);
    transform-origin: center;
    transition: transform 0.15s ease;
}

details[open] > summary::after {
    transform: translateY(-50%) rotate(45deg);
}

.admin-collapsible {
    margin: 0;
}

.admin-section-details {
    margin: 0 0 14px;
}

.admin-collapsible-summary {
    display: block;
    padding-bottom: 0;
    color: var(--color-text);
    font-size: 15px;
    line-height: 1.2;
}

.admin-section-details[open] > .admin-collapsible-summary {
    margin-bottom: 12px;
}

.admin-section-details .timetable-current-imports {
    margin-bottom: 0;
}

.admin-footer,
.app-footer {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 0;
    color: #000000;
    text-align: center;
    font-size: 13px;
}

.login-panel .admin-footer,
.login-panel .app-footer {
    border-top: 0;
}

@media (max-width: 860px) {
    .view-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .import-status-grid {
        grid-template-columns: 1fr;
    }

    .new-rule-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    body:not(.login-page) {
        padding: 12px;
    }

    .admin-shell {
        padding: 20px;
    }

    .page-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .page-actions {
        justify-content: flex-start;
    }

    .password-fields {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .admin-shell {
        width: 100%;
    }

    .admin-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .admin-header-actions,
    .admin-button,
    .admin-link-button,
    button.admin-button {
        width: 100%;
    }

    .admin-header-actions form {
        width: 100%;
    }

    .admin-header-actions .admin-button,
    .admin-header-actions .admin-link-button,
    .admin-header-actions form {
        width: auto;
    }

    .settings-actions .admin-button,
    .password-field-action .admin-button {
        width: 100%;
    }

    .view-grid,
    .status-grid,
    .admin-action-grid {
        grid-template-columns: 1fr;
    }

    .school-type-row,
    .new-rule-grid {
        grid-template-columns: 1fr;
    }

    .school-type-options {
        justify-content: flex-start;
    }
}

.stats-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.stats-card {
    margin-bottom: 1rem;
    border: 1px solid #e0e0e0;
    background: #f0f0f0;
    padding: 1rem;
}

.stats-card h2 {
    margin: 0 0 0.75rem;
    border-bottom: 1px solid #cccccc;
    padding-bottom: 0.4rem;
    color: #000000;
    font-size: 15px;
    font-weight: 700;
}

.stats-card p {
    margin-bottom: 0.75rem;
    color: #333333;
}

.stats-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
}

.stats-summary-item {
    border: 1px solid #cccccc;
    background: #ffffff;
    padding: 0.6rem;
    text-align: center;
}

.stats-summary-label {
    display: block;
    margin-bottom: 0.2rem;
    color: #666666;
    font-size: 11px;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-summary-value {
    display: block;
    margin-bottom: 0.2rem;
    color: #000000;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.stats-summary-detail {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    color: #666666;
    font-size: 11px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.stats-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid #cccccc;
    background: #ffffff;
    padding: 0.5rem;
}

.stats-nav-btn {
    border: 1px solid #cccccc;
    background: #f0f0f0;
    color: #0066cc;
    padding: 0.3rem 0.6rem;
    font-size: 12px;
    line-height: 1.2;
    text-decoration: none;
    white-space: nowrap;
}

.stats-nav-btn:hover {
    background: #e0e0e0;
    text-decoration: none;
}

.stats-nav-disabled,
.stats-nav-disabled:hover {
    border-color: #eeeeee;
    background: #f0f0f0;
    color: #bbbbbb;
    cursor: default;
}

.stats-nav-date {
    color: #000000;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
}

.stats-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
    margin-bottom: 0.75rem;
    font-size: 12px;
}

.stats-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.stats-dot {
    display: inline-block;
    flex: 0 0 auto;
    width: 10px;
    height: 10px;
    margin-right: 2px;
    border-radius: 2px;
}

.stats-dot-schueler {
    background: #3b82f6;
}

.stats-dot-lehrer {
    background: #22c55e;
}

.stats-dot-admin {
    background: #f59e0b;
}

.stats-chart {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 200px;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #cccccc;
    padding: 0.5rem 0;
}

.stats-bar-group {
    position: relative;
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    align-items: center;
    min-width: 0;
    height: 100%;
}

.stats-bar-stack {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    justify-content: flex-end;
    align-items: stretch;
    gap: 1px;
    width: 100%;
    min-height: 0;
}

.stats-bar {
    min-height: 2px;
    transition: height 0.3s ease;
}

.stats-bar-schueler {
    background: #3b82f6;
}

.stats-bar-lehrer {
    background: #22c55e;
}

.stats-bar-admin {
    background: #f59e0b;
}

.stats-bar-avg {
    min-height: 2px;
    background: #8b5cf6;
}

.stats-bar-label {
    flex: 0 0 auto;
    margin-top: 3px;
    color: #666666;
    font-size: 9px;
    line-height: 1.1;
}

.stats-bar-count {
    position: absolute;
    top: -12px;
    color: #999999;
    font-size: 8px;
    line-height: 1;
    white-space: nowrap;
}

.stats-chart-week {
    height: 180px;
}

.stats-chart-weekday {
    height: 140px;
}

.stats-bar-link {
    border-radius: 3px;
    color: inherit;
    padding: 2px;
    text-decoration: none;
    transition: background 0.15s ease;
}

.stats-bar-link:hover {
    background: #f0f0f0;
    text-decoration: none;
}

.stats-bar-active {
    border: 1px solid #aac8f0;
    background: #dce2ed;
}

.stats-bar-active:hover {
    background: #dde8f8;
}

.stats-bar-today .stats-bar-label {
    color: #333333;
    font-weight: 700;
}

.stats-bar-future {
    opacity: 0.4;
}

.stats-bar-sublabel {
    flex: 0 0 auto;
    color: #999999;
    font-size: 8px;
    line-height: 1.1;
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.stats-row .stats-card {
    margin-bottom: 0;
}

.stats-info {
    position: relative;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    margin-left: 0.3rem;
    border: 1px solid #999999;
    border-radius: 50%;
    background: #ffffff;
    color: #666666;
    cursor: help;
    font-size: 10px;
    font-style: normal;
    font-weight: 700;
    vertical-align: middle;
}

.stats-info:hover {
    border-color: #666666;
    background: #e8e8e8;
}

.stats-info .stats-tooltip {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    z-index: 100;
    display: none;
    width: 240px;
    background: #333333;
    color: #ffffff;
    padding: 0.5rem 0.6rem;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.4;
    text-align: left;
    transform: translateX(-50%);
    pointer-events: none;
}

.stats-info .stats-tooltip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    border: 5px solid transparent;
    border-top-color: #333333;
    transform: translateX(-50%);
}

.stats-info:hover .stats-tooltip {
    display: block;
}

.stats-empty {
    border: 1px solid #eeeeee;
    background: #ffffff;
    color: #999999;
    padding: 2rem;
    font-size: 13px;
    text-align: center;
}

.stats-detail-table {
    margin-bottom: 0;
}

.stats-page .app-footer,
.stats-page .admin-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 1rem;
    border-top: 1px solid #e0e0e0;
    padding-top: 0.75rem;
}

@media (max-width: 600px) {
    .stats-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .stats-nav {
        align-items: stretch;
        flex-direction: column;
    }

    .stats-nav-btn {
        width: 100%;
        text-align: center;
    }

    .stats-info .stats-tooltip {
        right: -10px;
        left: auto;
        transform: none;
    }

    .stats-info .stats-tooltip::after {
        right: 12px;
        left: auto;
        transform: none;
    }
}
