* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 700px;
    margin: 1.5rem auto;
    padding: 0 1rem;
}

header { text-align: center; margin-bottom: 1.25rem; }
header h1 { color: #e5230d; font-size: 1.7rem; }
.subtitle { color: #666; font-size: 0.95rem; }

/* Nav */
.nav-bar { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; }

.nav-btn {
    flex: 1;
    padding: 0.6rem 0.4rem;
    background: #fff;
    border: 2px solid #e5230d;
    color: #e5230d;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.nav-btn:hover { background: #e5230d; color: #fff; }

/* Sub bar */
.sub-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #e8f4f8;
    border-left: 3px solid #5ba7c4;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #2c6e8a;
}

.sub-bar-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: #5ba7c4;
    cursor: pointer;
    padding: 0 0.3rem;
    line-height: 1;
}
.sub-bar-close:hover { color: #2c6e8a; }

/* Action bar */
.action-bar {
    display: flex;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}

.action-btn {
    flex: 1;
    padding: 0.5rem 0.3rem;
    background: #e5230d;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.action-btn:hover { background: #c41e0b; }
.action-tg { background: #2c7be5; }
.action-tg:hover { background: #1a68d1; }
.action-del { background: #b54a4a; }
.action-del:hover { background: #943c3c; }

/* Card */
.card {
    background: #fff;
    padding: 1.25rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    margin-bottom: 1rem;
}
.card h2 { font-size: 1.1rem; margin-bottom: 0.75rem; }

/* Messages */
.message {
    padding: 0.6rem 0.85rem;
    border-radius: 4px;
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
}
.message.success { background: #dff0d8; border-left: 3px solid #5cb85c; color: #3c763d; }
.message.error { background: #f8d7da; border-left: 3px solid #d9534f; color: #721c24; }
.message.info { background: #e8f4f8; border-left: 3px solid #5ba7c4; color: #2c6e8a; }
.message a { color: inherit; font-weight: 600; }

/* Slot rows */
.slot-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.75rem;
    border-radius: 6px;
    margin-bottom: 0.35rem;
    border-left: 4px solid #ddd;
    background: #fafafa;
    gap: 0.5rem;
}

.slot-main { flex: 1; min-width: 0; }

.slot-thema {
    font-weight: 600;
    font-size: 0.88rem;
    line-height: 1.3;
}

.slot-details {
    font-size: 0.78rem;
    color: #777;
    margin-top: 0.1rem;
}

.slot-status {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 0.15rem;
}

/* Color coding - muted */
.slot-green { border-left-color: #8ec48e; background: #f3f9f3; }
.slot-green .slot-status { color: #5a8a5a; }

.slot-yellow { border-left-color: #d4b85c; background: #fdf9ef; }
.slot-yellow .slot-status { color: #8a7a3a; }

.slot-red { border-left-color: #c47a7a; background: #fdf3f3; }
.slot-red .slot-status { color: #8a4a4a; }

.slot-gray { border-left-color: #ccc; background: #f7f7f7; }
.slot-gray .slot-thema { color: #999; }
.slot-gray .slot-details { color: #bbb; }

/* Seats badge */
.seats {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.1rem 0.4rem;
    border-radius: 3px;
    margin-left: 0.3rem;
}
.seats-ok { background: #e8f5e9; color: #5a8a5a; }
.seats-med { background: #fff8e1; color: #8a7a3a; }
.seats-low { background: #fce4ec; color: #8a4a4a; }

/* Slot action buttons */
.slot-actions {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex-shrink: 0;
}

.slot-action {
    padding: 0.25rem 0.6rem;
    background: #eee;
    border: none;
    border-radius: 4px;
    font-size: 0.72rem;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}
.slot-action:hover { background: #ddd; color: #333; }
.slot-action-dim { color: #aaa; }
.slot-action-dim:hover { color: #666; }

/* Forms */
.hint { font-size: 0.82rem; color: #777; margin-bottom: 0.6rem; }

.inline-form {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
    margin-bottom: 0.6rem;
}

.inline-form input[type="text"] {
    flex: 1;
    max-width: 130px;
    padding: 0.55rem;
    text-align: center;
    font-size: 1.15rem;
    letter-spacing: 0.25em;
    font-family: monospace;
    border: 1px solid #ddd;
    border-radius: 4px;
}
.inline-form input:focus {
    outline: none;
    border-color: #e5230d;
    box-shadow: 0 0 0 2px rgba(229,35,13,0.12);
}

/* Thema rows (modal) */
.thema-row {
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 5px;
    padding: 0.5rem 0.65rem;
    margin-bottom: 0.3rem;
}
.thema-check { display: flex; align-items: center; gap: 0.4rem; }
.thema-check input[type="checkbox"] { width: 17px; height: 17px; accent-color: #e5230d; }
.thema-check label { font-size: 0.85rem; cursor: pointer; }
.thema-date { margin-top: 0.35rem; padding-left: 1.6rem; }
.thema-date input[type="date"] { max-width: 170px; padding: 0.35rem 0.5rem; border: 1px solid #ddd; border-radius: 4px; font-size: 0.85rem; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.65rem 1.2rem;
    background: #e5230d;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    text-align: center;
    text-decoration: none;
}
.btn:hover { background: #c41e0b; }
.btn:disabled { background: #999; cursor: not-allowed; }
.btn-full { display: block; width: 100%; }
.btn-secondary { background: #2c7be5; }
.btn-secondary:hover { background: #1a68d1; }
.btn-danger { background: #b54a4a; }
.btn-danger:hover { background: #943c3c; }

/* Code display */
.code-display {
    font-size: 2.4rem;
    font-weight: 700;
    font-family: monospace;
    color: #e5230d;
    letter-spacing: 0.3em;
    text-align: center;
    padding: 0.8rem;
    background: #fafafa;
    border-radius: 8px;
    margin-bottom: 0.75rem;
}
.code-command {
    background: #f0f0f0;
    padding: 0.5rem;
    border-radius: 5px;
    margin-bottom: 0.6rem;
    text-align: center;
    font-size: 0.95rem;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 100;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal-overlay.active { display: flex; }

.modal {
    background: #fff;
    border-radius: 10px;
    max-width: 520px;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    box-shadow: 0 8px 28px rgba(0,0,0,0.18);
}
.modal-small { max-width: 360px; }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid #eee;
}
.modal-header h2 { font-size: 1.05rem; margin: 0; }

.modal-close {
    background: none;
    border: none;
    font-size: 1.4rem;
    color: #aaa;
    cursor: pointer;
    padding: 0 0.2rem;
    line-height: 1;
}
.modal-close:hover { color: #333; }

.modal-body { padding: 1.1rem; }

/* How-to */
.howto-list { padding-left: 1.1rem; }
.howto-list li { margin-bottom: 0.4rem; font-size: 0.9rem; }
.howto-list code { background: #f0f0f0; padding: 0.1rem 0.3rem; border-radius: 3px; font-size: 0.85rem; }

/* Responsive */
@media (max-width: 480px) {
    .nav-bar { gap: 0.35rem; }
    .nav-btn { font-size: 0.78rem; padding: 0.55rem 0.3rem; }
    .slot-row { flex-direction: column; align-items: flex-start; }
    .slot-actions { flex-direction: row; margin-top: 0.3rem; }
    .action-bar { gap: 0.3rem; }
    .action-btn { font-size: 0.78rem; }
}
