:root {
    --djk-green-900: #103b6f;
    --djk-green-700: #1e5fa8;
    --djk-green-100: #e8f1fb;
    --djk-gold-500: #2f8f4e;
    --djk-gold-400: #44a863;
    --text-900: #1f2937;
    --text-700: #374151;
    --bg: #f3f7fc;
    --white: #ffffff;
    --danger: #b91c1c;
    --success: #15803d;
    --shadow: 0 10px 28px rgba(16, 59, 111, 0.14);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--text-900);
    background: linear-gradient(180deg, #f8faf9 0%, var(--bg) 100%);
}

.top-nav {
    background: var(--white);
    border-bottom: 2px solid #d4e2f1;
}

.top-nav-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.45rem 0.9rem;
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    align-items: center;
}

.top-nav-link {
    font-size: 0.85rem;
    text-decoration: none;
    color: #20466f;
    padding: 0.28rem 0.55rem;
    border-radius: 8px;
    background: #eef4fb;
}

.top-nav-link.active {
    background: #1e5fa8;
    color: #fff;
}

.page-title {
    margin: 0 0 0.7rem;
    font-size: 1.25rem;
    color: #123f72;
}

.brand-header {
    background: var(--white);
    border-bottom: 4px solid var(--djk-green-700);
    box-shadow: 0 2px 14px rgba(16, 59, 111, 0.1);
}

.brand-wrap {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.brand-main {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.brand-logo {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #4b84c3 0%, var(--djk-green-900) 75%);
    color: var(--white);
    border: 2px solid #d6e3f4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.88rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    overflow: hidden;
}

.brand-logo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.brand-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--djk-green-900);
}

.brand-subtitle {
    font-size: 0.8rem;
    color: #5a6c80;
}

.brand-tag {
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: #e9f4ed;
    border: 1px solid #c9e6d3;
    color: #237342;
    font-size: 0.8rem;
    font-weight: 700;
}

.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1.5rem;
}

.hero {
    background: linear-gradient(135deg, var(--djk-green-900), var(--djk-green-700));
    color: var(--white);
    border-radius: 16px;
    padding: 1.2rem 1.4rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.2rem;
    border: 1px solid rgba(255, 255, 255, 0.22);
}

.hero h1 {
    margin: 0 0 0.35rem;
    font-size: 1.9rem;
}

.hero p {
    margin: 0;
    opacity: 0.95;
}

.card {
    background: var(--white);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 1.1rem 1.2rem;
    margin-bottom: 1rem;
    border: 1px solid #d8e3ef;
}

.toolbar {
    display: flex;
    gap: 0.65rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 0.8rem;
}

.btn {
    border: none;
    border-radius: 10px;
    padding: 0.6rem 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    color: var(--white);
    background: var(--djk-gold-500);
}

.btn-primary:hover {
    background: var(--djk-gold-400);
}

.btn-secondary {
    color: var(--white);
    background: var(--djk-green-700);
}

.btn-secondary:hover {
    background: #184f8d;
}

.btn-danger {
    color: var(--white);
    background: var(--danger);
}

.btn-danger:hover {
    background: #a61414;
}

.link {
    color: var(--djk-green-700);
    text-decoration: none;
    font-weight: 600;
}

.link:hover {
    text-decoration: underline;
}

label {
    display: inline-flex;
    flex-direction: column;
    gap: 0.35rem;
    font-weight: 600;
    color: var(--text-700);
}

input, select {
    border: 1px solid #d0d9d4;
    border-radius: 10px;
    padding: 0.55rem 0.65rem;
    min-width: 180px;
    font-size: 0.95rem;
    background: var(--white);
}

input:focus, select:focus {
    outline: 2px solid rgba(47, 143, 78, 0.35);
    border-color: var(--djk-gold-500);
}

table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #d5e2ef;
    border-radius: 10px;
    overflow: hidden;
}

th, td {
    padding: 0.65rem;
    border-bottom: 1px solid #e5ebe7;
    text-align: left;
    vertical-align: middle;
}

th {
    color: #dbe9fb;
    background: var(--djk-green-900);
    font-size: 0.88rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.status-pill {
    display: inline-block;
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
    font-size: 0.8rem;
    font-weight: 700;
}

.status-active {
    color: var(--success);
    background: #e7f7ec;
}

.status-inactive {
    color: #6b7280;
    background: #edf0f2;
}

.flash-ok {
    color: var(--success);
    font-weight: 700;
}

.flash-err {
    color: var(--danger);
    font-weight: 700;
}

.inline {
    display: inline;
}

.js-tooltip {
    position: fixed;
    z-index: 99999;
    display: none;
    max-width: 280px;
    padding: 0.45rem 0.65rem;
    background: #102236;
    color: #fff;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 6px 18px rgba(15, 39, 64, 0.35);
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.35;
    white-space: pre-line;
    pointer-events: none;
    text-align: left;
    letter-spacing: 0;
    text-transform: none;
    animation: js-tooltip-fade 0.12s ease-out;
}

.js-tooltip::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border: 5px solid transparent;
}

.js-tooltip[data-placement="top"]::after {
    top: 100%;
    border-top-color: #102236;
}

.js-tooltip[data-placement="bottom"]::after {
    bottom: 100%;
    border-bottom-color: #102236;
}

@keyframes js-tooltip-fade {
    from { opacity: 0; transform: translateY(2px); }
    to { opacity: 1; transform: translateY(0); }
}

[data-tooltip] {
    cursor: help;
}

.alloc-chip[data-tooltip],
.team-chip[data-tooltip] {
    cursor: grab;
}

.alloc-chip[data-tooltip]:active,
.team-chip[data-tooltip]:active {
    cursor: grabbing;
}

/* Wochenplan K/R-Viertel: globales th-Styling (hell auf dunkel) hier aushebeln */
.planner-table.quarter-view thead th.quarter-head {
    color: #0a1e33 !important;
    background: #d8e6f4 !important;
    text-transform: none;
    letter-spacing: 0.04em;
    font-size: 0.95rem;
    font-weight: 800;
    line-height: 1.2;
    vertical-align: middle;
    border-bottom: 2px solid #1e5fa8;
}

.planner-table.quarter-view thead th.quarter-head.is-today {
    color: #0a1e33 !important;
    box-shadow: inset 0 -3px 0 #ffd54a;
}

.planner-table.quarter-view thead th.day-group-head {
    text-transform: none;
    letter-spacing: normal;
}

/* Trennung Kunstrasen | Rasen (innerhalb eines Tages) */
.planner-table.quarter-view .venue-end {
    border-right: 2px solid #68b981 !important;
}

.planner-table.quarter-view .venue-start {
    border-left: 2px solid #68b981 !important;
}

/* Trennung zwischen Wochentagen (Mo | Di | …) */
.planner-table.quarter-view .weekday-end {
    border-right: 5px solid #123f72 !important;
}

.planner-table.quarter-view .weekday-start {
    border-left: 5px solid #123f72 !important;
}

.planner-table.quarter-view thead th.day-group-head {
    background: linear-gradient(180deg, #184f8d, #123f72) !important;
    color: #fff !important;
    text-align: center;
    font-size: 0.82rem;
    font-weight: 700;
    vertical-align: middle;
    text-transform: none !important;
    letter-spacing: normal !important;
    border-left: 5px solid #0d2f56;
    border-right: 5px solid #0d2f56;
}

.planner-table.quarter-view thead th.time-col.day-group-head {
    position: sticky;
    left: 0;
    z-index: 9;
    background: linear-gradient(180deg, #184f8d, #123f72) !important;
    color: #fff !important;
}

.planner-table.quarter-view thead th.time-corner {
    position: sticky;
    left: 0;
    z-index: 8;
    padding: 0;
    min-width: 52px;
    width: 52px;
    min-height: 1.6rem;
    border-bottom: 2px solid #1e5fa8;
    color: #0a1e33 !important;
    background: #d8e6f4 !important;
}

.planner-table.quarter-view th.time-col,
.planner-table.quarter-view td.time-col {
    width: 52px;
    min-width: 52px;
}

.planner-table.quarter-view tbody td.time-col {
    position: sticky;
    left: 0;
    z-index: 5;
    background: #f0f6fc;
}

/* Raster: Termine ohne Lücken (durchgehend vertikal/horizontal) */
.planner-table.quarter-view tbody td.day-cell {
    padding: 0;
    border-bottom: none;
    vertical-align: top;
    height: 28px;
    line-height: 0;
}

.planner-table.quarter-view tbody tr {
    height: 28px;
}

.planner-table.quarter-view tbody td.time-col {
    border-bottom: 1px solid #dce4ed;
    padding: 0.1rem 0.25rem;
    vertical-align: middle;
    line-height: 1.2;
}

.planner-table.quarter-view .slot {
    min-height: 28px;
    height: 28px;
    border-radius: 0;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.planner-table.quarter-view .slot.empty-slot {
    border: none;
    box-shadow: inset 0 -1px 0 rgba(15, 35, 60, 0.08);
}

.planner-table.quarter-view .slot:has(.alloc-chip) {
    box-shadow: none;
}

.planner-table.quarter-view .slot.drop-hover {
    outline: 2px solid #4a90d9;
    outline-offset: -2px;
}

.planner-table.quarter-view .alloc-chip {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 28px;
    min-height: 28px;
    margin: 0;
    padding: 0;
    border-radius: 0;
    box-sizing: border-box;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.planner-table.quarter-view .alloc-chip.is-continuation {
    color: transparent !important;
}

.planner-table.quarter-view .alloc-chip.is-start.is-end {
    border-radius: 3px;
}

.planner-table.quarter-view .alloc-chip.is-start:not(.is-end) {
    border-radius: 3px 3px 0 0;
}

.planner-table.quarter-view .alloc-chip.is-end:not(.is-start) {
    border-radius: 0 0 3px 3px;
}

.planner-table.quarter-view .alloc-bundle {
    position: relative;
    width: 100%;
    height: 28px;
    min-height: 28px;
}

.planner-table.quarter-view .alloc-bundle .alloc-chip.is-primary {
    width: 100%;
    height: 28px;
    min-height: 28px;
}

.planner-table.quarter-view .alloc-bundle.has-guests .alloc-chip.is-primary.is-start {
    height: 17px;
    min-height: 17px;
    font-size: 0.62rem;
}

.planner-table.quarter-view .alloc-bundle.has-guests .alloc-chip.is-primary.is-continuation {
    height: 28px;
    min-height: 28px;
}

.planner-table.quarter-view .alloc-chip.alloc-guest-tag {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 11px;
    min-height: 11px;
    font-size: 0.58rem;
    font-weight: 800;
    line-height: 11px;
    border-top: 1px solid rgba(255, 255, 255, 0.35);
    z-index: 2;
}

.venue-aerial-overview {
    display: flex;
    align-items: flex-end;
    gap: 0;
    margin-top: 0.75rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.venue-aerial-time-spacer {
    flex: 0 0 52px;
    min-width: 52px;
    max-width: 52px;
}

.venue-aerial-strip {
    display: flex;
    flex: 1 1 auto;
    gap: 0;
    min-width: 0;
    width: 100%;
    align-items: stretch;
}

.venue-aerial-item {
    display: flex;
    flex-direction: column;
    margin: 0;
    min-width: 0;
    border: 1px solid #c5d4e6;
    border-radius: 6px;
    overflow: hidden;
    background: #f4f8fc;
}

.venue-aerial-media {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
    background: #d8e6f2;
}

.venue-aerial-item + .venue-aerial-item {
    border-left: none;
    border-radius: 0 6px 6px 0;
}

.venue-aerial-item:first-of-type {
    border-radius: 6px 0 0 6px;
}

.venue-aerial-item:only-of-type {
    border-radius: 6px;
}

.venue-aerial-item img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center;
}

.venue-aerial-item figcaption {
    display: flex;
    flex-direction: column;
    gap: 0.05rem;
    padding: 0.2rem 0.35rem;
    font-size: 0.68rem;
    line-height: 1.2;
    background: #e8f1fb;
    color: #123f72;
}

.venue-aerial-codes {
    font-weight: 800;
    letter-spacing: 0.03em;
}

.venue-aerial-label {
    font-weight: 500;
    opacity: 0.9;
}

.venue-aerial-overview:has(.venue-aerial-strip:empty) {
    display: none;
}

@media (max-width: 700px) {
    .brand-wrap {
        flex-direction: column;
        align-items: flex-start;
    }
}
