:root {
    --ecboces-blue: #17127a;
    --ecboces-blue-dark: #120f5f;
    --ecboces-blue-light: #e8ecff;
    --page-bg: #f5f6f8;
    --card-bg: #ffffff;
    --border: #d9dde3;
    --text: #222222;
    --muted: #666666;
    --danger: #b00020;
    --warn: #9a6700;
    --success: #1d7a32;
    --link: #0b57d0;
    --header-text: #ffffff;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--page-bg);
    color: var(--text);
    font-family: Arial, sans-serif;
}

a {
    color: var(--link);
}

.site-header {
    background: var(--ecboces-blue);
    color: var(--header-text);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 12px 18px;
    border-bottom: 3px solid var(--ecboces-blue-dark);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.header-logo {
    height: 44px;
    width: auto;
    display: block;
}

.header-title-wrap {
    min-width: 0;
}

.site-title {
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--header-text);
}

.site-subtitle {
    font-size: 0.9rem;
    color: #d9defb;
    margin-top: 2px;
}

.header-right {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.header-right a {
    color: var(--header-text);
    text-decoration: none;
    font-weight: 600;
}

.header-right a:hover,
.header-right a:focus {
    text-decoration: underline;
}

.page-shell {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 16px;
}

.page-card {
    width: 100%;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.05);
}

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

.toolbar {
    margin-bottom: 15px;
}

.section-box {
    margin: 20px 0;
    padding: 15px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
}

.muted {
    color: var(--muted);
    font-size: 0.92em;
}

.status-danger,
.capacity-full {
    color: var(--danger);
    font-weight: bold;
}

.status-warn,
.capacity-near {
    color: var(--warn);
    font-weight: bold;
}

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

.search-box {
    margin: 10px 0 15px 0;
}

.search-box input {
    width: 100%;
    max-width: 520px;
    padding: 8px;
    font: inherit;
}

.public-search {
    margin: 12px 0 18px 0;
}

.public-search input {
    width: 100%;
    max-width: 520px;
    padding: 8px;
    font: inherit;
}

.public-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 14px;
}

.course-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    padding: 14px;
}

.course-card h3 {
    margin: 0 0 6px 0;
}

.course-meta {
    color: var(--muted);
    font-size: 0.92em;
    margin-bottom: 8px;
}

.mobile-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    padding: 16px;
    margin-bottom: 16px;
}

.mobile-card.with-header {
    padding: 0;
    overflow: hidden;
}

.card-header {
    background: var(--ecboces-blue);
    color: #ffffff;
    padding: 10px 14px;
    font-weight: 700;
}

.card-header .muted {
    color: #d9defb;
}

.card-body {
    padding: 14px 16px;
}

.mobile-label {
    font-size: 0.9em;
    color: var(--muted);
    margin-bottom: 2px;
}

.mobile-field {
    margin-bottom: 8px;
}

.admin-grid {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.management-list {
    margin-top: 15px;
}

.management-row {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    background: #fafafa;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

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

.connection-line {
    margin-bottom: 6px;
}

.hidden {
    display: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

input[type="text"],
input[type="date"],
input[type="time"],
input[type="number"],
textarea,
select {
    max-width: 100%;
}

dialog {
    border: 1px solid #ccc;
    border-radius: 12px;
    padding: 20px;
    max-width: 760px;
    width: 92%;
    box-shadow: 0 8px 28px rgba(0,0,0,0.18);
}

dialog::backdrop {
    background: rgba(0,0,0,0.35);
}

.dialog-actions {
    margin-top: 15px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.toast {
    position: fixed;
    right: 16px;
    bottom: 16px;
    background: #222;
    color: #fff;
    padding: 12px 16px;
    border-radius: 10px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.25);
    z-index: 9999;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    max-width: 320px;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 900px) {
    .site-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .header-right {
        width: 100%;
    }

    .page-shell {
        padding: 10px;
    }

    .page-card {
        padding: 12px;
    }

    .public-grid {
        grid-template-columns: 1fr;
    }
}

.status-ok {
    color: #1d7a32;
    font-weight: bold;
}

.status-warn {
    color: #9a6700;
    font-weight: bold;
}

.status-danger {
    color: #b00020;
    font-weight: bold;
}
