:root {
    --bg: #f6fafc;
    --surface: #ffffff;
    --surface-soft: #f4f5f7;
    --text: #1e293b;
    --text-secondary: #334155;
    --muted: #64748b;
    --faint: #718087;
    --line: rgba(15, 23, 42, .12);
    --line-strong: rgba(15, 23, 42, .22);
    --primary: #af2846;
    --primary-hover: #7b1830;
    --primary-secondary: #d24563;
    --primary-soft: rgba(175, 40, 70, .12);
    --primary-border: rgba(175, 40, 70, .45);
    --gold: #d6a451;
    --danger: #ef4444;
    --danger-soft: rgba(239, 68, 68, .12);
    --warning: #f59e0b;
    --warning-soft: rgba(245, 158, 11, .14);
    --success: #22c55e;
    --success-soft: rgba(34, 197, 94, .12);
    --info: #38bdf8;
    --neutral: #94a3b8;
    --shadow: 0 8px 24px rgba(15, 23, 42, .10);
    --sidebar: 300px;
    --slot-height: 42px;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
    letter-spacing: 0;
}

html[data-theme="dark"] {
    --bg: #0c0e12;
    --surface: #101419;
    --surface-soft: rgba(255, 255, 255, .05);
    --text: #f4f5ff;
    --text-secondary: #e2e2e8;
    --muted: #b89aa3;
    --faint: #718087;
    --line: rgba(255, 255, 255, .08);
    --line-strong: rgba(255, 255, 255, .16);
    --shadow: 0 8px 20px rgba(0, 0, 0, .16);
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font-size: 14px; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: 34px; line-height: 1.15; }
h2 { margin-bottom: 8px; font-size: 22px; line-height: 1.3; }
p { color: var(--muted); line-height: 1.55; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); display: flex; flex-direction: column; padding: 24px 16px 16px; background: var(--primary-hover); color: #fff; z-index: 40; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 16px 36px rgba(0, 0, 0, .22); }
body.menu-open .sidebar { transform: translateX(0); }
.sidebar-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sidebar-close { width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; border: 0; border-radius: 18px; background: transparent; color: #fff; cursor: pointer; font-size: 24px; line-height: 1; }
.sidebar-close:hover { background: rgba(255, 255, 255, .12); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; font-size: 16px; font-weight: 700; }
.sidebar-logo { width: 190px; height: auto; display: block; padding: 8px; border-radius: 12px; background: #fff; }
.brand-mark { width: 44px; height: 44px; flex: 0 0 44px; display: grid; place-items: center; border-radius: 16px; background: #fff; color: var(--primary); font-size: 13px; font-weight: 800; }
.main-nav { display: flex; flex-direction: column; gap: 6px; margin-top: 24px; }
.nav-link { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 14px; border-radius: 16px; color: #f8e9ed; font-weight: 600; }
.nav-link:hover { background: rgba(255, 255, 255, .10); color: #fff; }
.nav-link.active { background: rgba(255, 255, 255, .16); box-shadow: 0 0 24px rgba(175, 40, 70, .18); color: #fff; }
.nav-icon { width: 20px; text-align: center; font-size: 18px; line-height: 1; }
.nav-label { margin: 20px 14px 6px; color: #f0ccd5; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.sidebar-user { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 10px; margin-top: auto; padding: 16px 8px 4px; border-top: 1px solid rgba(255, 255, 255, .18); }
.sidebar-user-actions { display: flex; gap: 2px; }
.avatar { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--info); color: #00365f; font-weight: 800; }
.sidebar-user-copy { min-width: 0; display: flex; flex-direction: column; }
.sidebar-user-copy strong, .sidebar-user-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-copy strong { font-size: 12px; }
.sidebar-user-copy span { margin-top: 2px; color: #f0ccd5; font-size: 10px; }
.icon-link { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 14px; background: transparent; color: #f8e9ed; cursor: pointer; font-size: 17px; }
.icon-link:hover { background: rgba(255, 255, 255, .10); color: white; }
.main-area { min-height: 100vh; margin-left: 0; }
.page-content { width: 100%; margin: 0; padding: 40px 40px 40px 92px; }
.menu-toggle-floating { position: fixed; top: 40px; left: 24px; z-index: 30; width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--text); cursor: pointer; box-shadow: 0 4px 12px rgba(15, 23, 42, .08); font-size: 20px; }
.menu-toggle-floating:hover { border-color: var(--primary); color: var(--primary); }
body.menu-open .menu-toggle-floating { opacity: 0; pointer-events: none; }
.mobile-header { display: none; }
.mobile-overlay { position: fixed; inset: 0; z-index: 35; display: none; background: rgba(12, 22, 19, .46); }
body.menu-open .mobile-overlay { display: block; }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-heading p { margin-bottom: 0; }
.eyebrow { display: block; margin-bottom: 7px; color: var(--primary); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.heading-actions { display: flex; gap: 8px; }
.muted { color: var(--muted); }
.optional { color: var(--muted); font-size: 11px; font-weight: 400; }

.button, .icon-button { border: 1px solid transparent; border-radius: 18px; cursor: pointer; font-weight: 700; transition: background-color .15s, border-color .15s, color .15s, opacity .15s, transform .15s; }
.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0 18px; }
.button-primary { background: linear-gradient(135deg, var(--primary), var(--primary-secondary)); color: #fff; box-shadow: 0 4px 12px rgba(175, 40, 70, .18); }
.button-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.button-secondary { border-color: var(--line-strong); background: var(--surface); color: var(--text); }
.button-secondary:hover { background: var(--surface-soft); }
.button-danger { background: var(--danger); color: white; }
.button-danger:hover { background: #dc2626; }
.button-quiet { color: var(--muted); }
.button-quiet:hover { color: var(--text); background: var(--surface-soft); }
.button-small { min-height: 32px; padding: 0 10px; font-size: 12px; }
.button-block { width: 100%; }
.icon-button { width: 44px; height: 44px; display: grid; place-items: center; border-color: var(--line); background: var(--surface); color: var(--text); font-size: 22px; line-height: 1; }
.icon-button:hover { background: var(--surface-soft); }
button:disabled { cursor: not-allowed; opacity: .55; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--primary-secondary); outline-offset: 2px; }

label { display: flex; flex-direction: column; gap: 8px; color: var(--text-secondary); font-size: 12px; font-weight: 600; }
input, select, textarea { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-soft); color: var(--text); padding: 10px 16px; outline: none; }
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { border-color: var(--primary-border); box-shadow: 0 0 0 2px var(--primary-secondary); }
input[type="checkbox"] { width: 17px; min-height: 17px; accent-color: var(--primary); }
input[type="color"] { padding: 3px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.span-2 { grid-column: span 2; }
.participant-field { min-width: 0; margin: 0; padding: 0; border: 0; }
.participant-field legend { margin-bottom: 7px; color: var(--text); font-size: 11px; font-weight: 700; }
.participant-picker { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 210px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); }
.participant-picker label { min-width: 0; flex-direction: row; align-items: flex-start; gap: 9px; padding: 10px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.participant-picker label:nth-child(odd) { border-right: 1px solid var(--line); }
.participant-picker input { flex: 0 0 auto; margin-top: 2px; }
.participant-picker span { min-width: 0; }
.participant-picker strong, .participant-picker small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.participant-picker small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.narrow-form { max-width: 480px; }
.check-row { flex-direction: row; align-items: flex-start; gap: 10px; min-height: 48px; padding: 12px; border: 1px solid var(--line); border-radius: 18px; cursor: pointer; }
.check-row input { margin: 2px 0 0; flex: 0 0 auto; }
.check-row span { display: flex; flex-direction: column; gap: 3px; }
.check-row small { color: var(--muted); font-weight: 400; line-height: 1.35; }

.alert { padding: 12px 14px; border: 1px solid; border-radius: 18px; line-height: 1.4; }
.alert-success { border-color: rgba(34, 197, 94, .35); background: var(--success-soft); color: var(--text-secondary); }
.alert-danger { border-color: rgba(239, 68, 68, .35); background: var(--danger-soft); color: var(--text-secondary); }
.alert-warning { border-color: rgba(245, 158, 11, .35); background: var(--warning-soft); color: var(--text-secondary); }
.flash-stack { position: fixed; top: 18px; right: 18px; z-index: 100; width: min(390px, calc(100% - 36px)); display: grid; gap: 8px; margin: 0; pointer-events: none; }
.flash-toast { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; box-shadow: 0 12px 30px rgba(18, 35, 29, .16); pointer-events: auto; transition: opacity .18s ease, transform .18s ease; }
.flash-toast.is-closing { opacity: 0; transform: translateY(-8px); }
.flash-close { width: 24px; height: 24px; flex: 0 0 24px; display: grid; place-items: center; margin: -3px -5px -3px 0; border: 0; border-radius: 4px; background: transparent; color: currentColor; cursor: pointer; font-size: 18px; line-height: 1; opacity: .7; }
.flash-close:hover { background: rgba(0, 0, 0, .06); opacity: 1; }

.panel, .table-panel, .filter-panel, .calendar-toolbar, .calendar-surface, .import-summary { border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: 0 4px 12px rgba(15, 23, 42, .04); }
.panel { padding: 20px; }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-header p { margin: 0; font-size: 12px; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: 18px; align-items: start; }

.calendar-heading { justify-content: flex-end; margin-bottom: 18px; }
.calendar-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 16px; }
.toolbar-group { display: flex; align-items: center; gap: 8px; min-width: 0; }
.calendar-toolbar .button, .calendar-toolbar .icon-button, .calendar-toolbar .resource-switcher button { height: 44px; min-height: 44px; }
.calendar-toolbar .segmented { min-height: 44px; }
.calendar-new-button { flex: 0 0 auto; }
.calendar-control-cluster { display: flex; align-items: center; gap: 16px; min-width: 0; }
.calendar-view-group { display: flex; align-items: center; }
.calendar-navigation-group { min-width: 0; }
.calendar-period-context { display: grid; min-width: 0; gap: 2px; }
.calendar-hours { color: var(--muted); font-size: 11px; line-height: 1.2; white-space: nowrap; }
.calendar-period { display: block; font-size: 15px; line-height: 1.2; white-space: nowrap; }
.compact-field { flex-direction: row; align-items: center; gap: 8px; color: var(--muted); }
.resource-filter-group { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.resource-filter-group > span { flex: 0 0 auto; font-size: 12px; font-weight: 700; }
.resource-switcher { display: flex; flex-wrap: wrap; gap: 5px; max-width: 620px; }
.resource-switcher button { min-height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--text); cursor: pointer; font-size: 11px; font-weight: 700; white-space: nowrap; }
.resource-switcher button:hover { border-color: var(--primary); color: var(--primary); }
.resource-switcher button.active { border-color: var(--resource-filter-color, var(--primary)); background: var(--resource-filter-color, var(--primary)); color: var(--resource-filter-text, #fff); }
.segmented { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface-soft); }
.segmented button { min-height: 32px; padding: 0 14px; border: 0; border-radius: 14px; background: transparent; color: var(--muted); cursor: pointer; font-weight: 700; }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: 0 4px 12px rgba(15, 23, 42, .08); }
.resource-legend { display: flex; flex-wrap: wrap; gap: 16px; min-height: 35px; align-items: center; padding: 8px 2px; color: var(--muted); font-size: 11px; }
.resource-legend span { display: inline-flex; align-items: center; gap: 6px; }
.resource-legend i { width: 9px; height: 9px; border-radius: 50%; background: var(--resource-color); }
.calendar-surface { width: 100%; max-width: 100%; min-height: 360px; overflow: visible; }
.calendar-loading { min-height: 560px; display: grid; place-items: center; color: var(--muted); }
.calendar-table { min-width: 780px; background: var(--surface); }
.calendar-grid-header { position: sticky; top: 0; z-index: 8; display: grid; grid-template-columns: 66px repeat(var(--calendar-columns), minmax(150px, 1fr)); min-height: 56px; border-bottom: 1px solid var(--line-strong); background: var(--surface); }
.calendar-corner { position: sticky; left: 0; z-index: 10; border-right: 1px solid var(--line); background: var(--surface); }
.calendar-column-title { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px; border-right: 1px solid var(--line); text-align: center; }
.calendar-column-title strong { font-size: 12px; }
.calendar-column-title span { margin-top: 2px; color: var(--muted); font-size: 10px; }
.calendar-column-title.is-today { color: var(--primary); background: #f0f8f5; }
.calendar-grid-body { position: relative; display: grid; grid-template-columns: 66px repeat(var(--calendar-columns), minmax(150px, 1fr)); }
.time-axis { position: sticky; left: 0; z-index: 6; background: var(--surface); border-right: 1px solid var(--line-strong); }
.time-label { height: var(--slot-height); padding: 4px 9px 0 0; border-bottom: 1px solid var(--line); color: var(--muted); text-align: right; font-size: 10px; }
.calendar-lane { position: relative; min-height: calc(var(--slot-count) * var(--slot-height)); border-right: 1px solid var(--line); }
.calendar-slot { height: var(--slot-height); border-bottom: 1px solid var(--line); cursor: pointer; }
.calendar-slot:hover { background: #f0f8f5; }
.calendar-slot:nth-child(4n) { border-bottom-color: var(--line-strong); }
.calendar-event { position: absolute; z-index: 3; top: var(--event-top); left: calc(var(--event-left, 0%) + 3px); width: calc(var(--event-width, 100%) - 6px); height: var(--event-height); min-height: 26px; overflow: hidden; border: 0; border-left: 4px solid var(--event-color); border-radius: 12px; background: color-mix(in srgb, var(--event-color) 14%, var(--surface)); color: var(--text); padding: 5px 7px; cursor: pointer; text-align: left; box-shadow: 0 1px 2px rgba(15, 30, 25, .12); }
.calendar-event:hover { filter: brightness(.97); z-index: 4; }
.calendar-event strong, .calendar-event span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-event strong { font-size: 11px; }
.calendar-event span { margin-top: 2px; font-size: 9px; color: var(--muted); }
.calendar-empty { min-height: 560px; display: grid; place-items: center; text-align: center; color: var(--muted); }

.modal { width: min(650px, calc(100% - 24px)); max-width: none; max-height: calc(100vh - 24px); padding: 0; border: 0; border-radius: 28px; background: transparent; overflow: visible; }
.modal::backdrop { background: rgba(12, 22, 19, .56); }
.modal-panel { max-height: calc(100vh - 24px); overflow: auto; border-radius: 28px; background: var(--surface); padding: 24px; box-shadow: var(--shadow); }
.modal-panel-small { max-width: 500px; margin: auto; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.modal-header h2 { font-size: 21px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.detail-list { display: grid; gap: 14px; margin: 0; }
.detail-list div { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.detail-list dt { margin-bottom: 4px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.detail-list dd { margin: 0; line-height: 1.45; white-space: pre-wrap; }

.table-panel { overflow: hidden; }
.table-panel > .panel-header { padding: 18px 18px 0; }
.table-scroll { overflow-x: auto; }
.user-agent { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; white-space: nowrap; }
th { background: var(--surface-soft); color: var(--muted); font-size: 10px; text-transform: uppercase; }
td { font-size: 12px; }
td strong, td small { display: block; }
td small { margin-top: 3px; color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--surface-soft); }
.align-right { text-align: right; }
.badge { display: inline-flex; min-height: 24px; align-items: center; padding: 0 10px; border-radius: 9999px; font-size: 10px; font-weight: 800; }
.badge-neutral { background: var(--surface-soft); color: var(--text-secondary); }
.status-dot { display: inline-flex; align-items: center; gap: 6px; }
.status-dot::before { width: 7px; height: 7px; border-radius: 50%; content: ""; }
.status-dot.is-active::before { background: #20a06b; }
.status-dot.is-inactive::before { background: #9aa49f; }
.search-bar { display: flex; align-items: flex-end; gap: 8px; margin-bottom: 12px; }
.search-field { flex: 1; max-width: 430px; }
.import-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-bottom: 14px; padding: 13px 15px; }
.import-summary span { color: var(--muted); }
.import-summary small { width: 100%; color: var(--danger); }
.import-template-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 18px; }

.resource-settings { display: grid; gap: 10px; }
.resource-admin-grid { grid-template-columns: 1fr; }
.new-resource-form { margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.new-resource-form summary { width: fit-content; margin-bottom: 14px; color: var(--primary); font-size: 12px; font-weight: 800; cursor: pointer; }
.resource-create-grid { display: grid; grid-template-columns: minmax(240px, 1fr) 140px 72px minmax(250px, .8fr) 75px auto; align-items: end; gap: 10px; padding-bottom: 18px; }
.schedule-rules { display: grid; gap: 8px; }
.schedule-rule { display: grid; grid-template-columns: minmax(145px, 1fr) minmax(105px, .8fr) minmax(105px, .8fr); align-items: end; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.schedule-day { flex-direction: row; align-items: center; gap: 8px; min-height: 44px; }
.schedule-day input { width: 18px; min-height: 18px; }
.check-row-danger { border-color: rgba(239, 68, 68, .35); background: var(--danger-soft); }
.resource-row { display: grid; grid-template-columns: 42px minmax(210px, 1fr) 130px minmax(235px, .8fr) 72px 170px 80px; align-items: end; gap: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.resource-row:last-child { padding-bottom: 0; border-bottom: 0; }
.color-input { width: 42px; height: 40px; }
.toggle-row { min-height: 40px; flex-direction: row; align-items: center; gap: 7px; }
.resource-participant-flag { min-height: 40px; padding: 7px 10px; border-radius: 8px; }
.resource-delete-future { min-height: 40px; flex-direction: row; align-items: center; gap: 7px; color: var(--danger); font-size: 10px; }
.resource-delete-future input { flex: 0 0 auto; }
.schedule-panel-header { align-items: end; }
.schedule-resource-picker { min-width: 230px; }
.schedule-scope-note { display: grid; grid-template-columns: 10px auto 1fr; align-items: center; gap: 8px; margin: -4px 0 10px; padding: 10px 12px; background: var(--surface-soft); border-radius: 8px; }
.schedule-scope-note > span { width: 10px; height: 10px; border-radius: 50%; background: var(--resource-color); }
.schedule-scope-note small { color: var(--muted); }
.schedule-actions { display: flex; justify-content: flex-end; gap: 10px; }

.filter-panel { display: grid; grid-template-columns: 150px 150px minmax(180px, 1fr) minmax(180px, 1fr) auto; align-items: end; gap: 10px; margin-bottom: 16px; padding: 14px; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.kpi { min-height: 126px; padding: 20px; border: 1px solid var(--line); border-top: 3px solid var(--primary); border-radius: 20px; background: var(--surface); box-shadow: 0 4px 12px rgba(15, 23, 42, .04); }
.kpi:nth-child(2) { border-top-color: var(--info); }
.kpi:nth-child(3) { border-top-color: var(--warning); }
.kpi:nth-child(4) { border-top-color: var(--gold); }
.kpi span, .kpi small { display: block; color: var(--muted); }
.kpi span { font-size: 11px; font-weight: 700; }
.kpi strong { display: block; margin: 10px 0 4px; font-size: 27px; line-height: 1; }
.kpi small { font-size: 10px; }
.report-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, .6fr); gap: 16px; margin-bottom: 16px; }
.bar-list, .rank-list { display: grid; gap: 15px; }
.bar-item > div:first-child { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 7px; }
.bar-item span { color: var(--muted); font-size: 11px; }
.bar-track { height: 7px; border-radius: 4px; background: #edf1ef; overflow: hidden; }
.bar-track i { display: block; width: var(--bar-width); height: 100%; border-radius: inherit; background: var(--bar-color); }
.rank-list > div { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 9px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.rank-list > div > span { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-soft); color: var(--muted); font-size: 10px; font-weight: 800; }
.rank-list small { color: var(--muted); }
.empty-inline { margin: 25px 0; text-align: center; }
.empty-state { min-height: 65vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.empty-state p { max-width: 460px; }
.empty-code { color: var(--line-strong); font-size: 72px; font-weight: 800; }

/* Horizontal resource agenda: time flows left to right and each day is a band. */
.calendar-surface { width: 100%; max-width: 100%; min-height: 360px; overflow: visible; }
.calendar-scroll-x { width: 100%; overflow: visible; }
.horizontal-calendar { --resource-label-width: 165px; width: 100%; background: var(--surface); }
.horizontal-time-header, .horizontal-day-time-header, .horizontal-resource-row { display: grid; grid-template-columns: var(--resource-label-width) 1fr; }
.horizontal-time-header { position: sticky; top: 0; z-index: 12; min-height: 34px; border-bottom: 1px solid var(--line-strong); background: var(--surface); }
.horizontal-time-header .horizontal-resource-label { min-height: 34px; padding-top: 5px; padding-bottom: 5px; }
.horizontal-day-time-header { min-height: 28px; border-bottom: 1px solid var(--line-strong); background: var(--surface-soft); }
.horizontal-day-time-header .horizontal-resource-label { min-height: 28px; padding-top: 5px; padding-bottom: 5px; background: var(--surface-soft); }
.horizontal-day-time-header .horizontal-time-cell { height: 28px; font-size: 8px; }
.horizontal-resource-label { display: flex; align-items: center; gap: 7px; min-width: 0; padding: 8px 10px; border-right: 1px solid var(--line-strong); border-bottom: 1px solid var(--line); background: var(--surface-soft); }
.horizontal-resource-label strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.horizontal-resource-label span { width: 8px; height: 8px; flex: 0 0 8px; border-radius: 50%; background: var(--resource-color); }
.header-label { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.horizontal-time-grid, .horizontal-timeline { display: grid; grid-template-columns: repeat(var(--slot-count), minmax(0, 1fr)); }
.horizontal-time-cell { height: 34px; overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 0 4px; border-right: 1px solid var(--line-strong); border-bottom: 1px solid var(--line-strong); background: var(--surface-soft); color: var(--text); font-size: 9px; font-weight: 700; text-align: center; white-space: nowrap; }
.calendar-day-section { border-bottom: 1px solid var(--line-strong); }
.calendar-day-section.is-today .calendar-day-header { background: var(--calendar-day-color, #af2846); }
.calendar-day-header { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 7px 12px; background: var(--calendar-day-color, #af2846); color: var(--calendar-day-text, #fff); }
.calendar-day-header strong { font-size: 12px; }
.calendar-day-header span { color: var(--calendar-day-muted-text, #f5dce3); font-size: 11px; }
.horizontal-resource-row { min-height: 48px; }
.horizontal-timeline { position: relative; min-height: 48px; overflow: hidden; background: var(--surface); }
.horizontal-slot { width: 100%; height: 48px; padding: 0; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: transparent; cursor: pointer; }
.horizontal-slot:nth-child(4n) { border-right-color: var(--line-strong); }
.horizontal-slot:hover, .horizontal-slot:focus-visible { background: var(--primary-soft); outline: none; }
.horizontal-slot.is-blocked { background: var(--surface-soft); cursor: not-allowed; opacity: .55; }
.horizontal-timeline .calendar-event { top: 4px; left: var(--event-left); width: calc(var(--event-width) - 2px); height: 40px; min-height: 0; padding: 6px 8px; border-left: 4px solid var(--event-color); border-radius: 12px; background: color-mix(in srgb, var(--event-color) 18%, var(--surface)); }
.horizontal-timeline .calendar-event strong, .horizontal-timeline .calendar-event span { line-height: 1.2; }
.horizontal-timeline .calendar-event strong { font-size: 11px; }
.horizontal-timeline .calendar-event span { margin-top: 3px; font-size: 9px; }
.horizontal-timeline .calendar-event:hover { filter: brightness(.97); }

.auth-body { background: var(--bg); }
.auth-theme-toggle { position: fixed; top: 24px; right: 24px; z-index: 10; }
.auth-shell { width: min(1280px, calc(100% - 32px)); min-height: 680px; display: grid; grid-template-columns: minmax(390px, 460px) 1fr; margin: 4vh auto; overflow: hidden; border: 1px solid var(--line); border-radius: 28px; background: var(--surface); box-shadow: var(--shadow); }
.auth-shell-simple { width: min(960px, calc(100% - 32px)); min-height: 590px; grid-template-columns: minmax(360px, 460px) 1fr; }
.auth-panel { display: flex; flex-direction: column; justify-content: center; gap: 26px; padding: 56px 72px; }
.auth-panel h1 { margin: 0; font-size: 43px; letter-spacing: 0; }
.auth-panel p { margin: 3px 0 0; }
.auth-brand { display: flex; align-items: center; gap: 14px; }
.auth-brand .brand-logo { width: min(290px, 100%); height: auto; display: block; padding: 10px; border-radius: 14px; background: #fff; }
.auth-intro .eyebrow { margin-bottom: 10px; color: var(--muted); font-size: 16px; text-transform: none; }
.auth-intro h1 span { color: var(--primary); }
.auth-intro p { max-width: 330px; font-size: 17px; }
.auth-options { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: -8px; }
.auth-options > a { color: var(--primary); font-size: 13px; font-weight: 700; }
.auth-options > a:hover { color: var(--primary-hover); text-decoration: underline; }
.auth-remember { flex-direction: row; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 13px; font-weight: 500; }
.auth-remember input { width: 20px; height: 20px; margin: 0; }
.auth-panel .button-primary { min-height: 56px; font-size: 18px; }
.auth-back-link { min-height: 40px; }
.auth-context { display: flex; flex-direction: column; justify-content: space-between; gap: 24px; padding: 50px 64px; background: linear-gradient(135deg, var(--primary-hover), #450516); color: white; }
.auth-image-panel { display: block; padding: 0; overflow: hidden; background: #450516; }
.auth-image-panel img { width: 100%; height: 100%; display: block; object-fit: cover; object-position: center; }
.auth-context .eyebrow { color: #f0ccd5; }
.auth-context-mark { width: 58px; height: 58px; display: grid; place-items: center; margin-bottom: 22px; border: 1px solid rgba(255,255,255,.5); border-radius: 16px; font-size: 30px; }
.auth-context h2 { max-width: 620px; margin-bottom: 14px; font-size: 43px; line-height: 1.12; }
.auth-context h2 strong { color: #ff5371; }
.auth-context p { max-width: 400px; color: #f0d8de; }
.auth-context-copy > .eyebrow { font-size: 13px; }
.auth-resource-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.auth-resource-cards article { min-height: 190px; display: flex; flex-direction: column; justify-content: flex-end; gap: 5px; padding: 20px; border: 1px solid rgba(255,255,255,.4); border-radius: 20px; background: linear-gradient(145deg, rgba(255,255,255,.12), rgba(0,0,0,.16)); }
.auth-resource-icon { width: 48px; height: 48px; display: grid; place-items: center; margin-bottom: auto; border-radius: 50%; background: white; color: var(--primary); font-size: 28px; }
.auth-resource-cards strong { font-size: 20px; }
.auth-resource-cards small { color: #f0d8de; font-size: 13px; }
.auth-context-benefits { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.auth-context-benefits span { padding-left: 14px; border-left: 1px solid rgba(255,255,255,.35); color: #f0d8de; font-size: 13px; line-height: 1.35; }
.auth-context-benefits b { color: #ff5371; }
.auth-context-compact { justify-content: center; }
.reset-test-link { display: grid; gap: 6px; padding: 14px; border: 1px solid var(--primary-border); border-radius: 18px; background: var(--primary-soft); font-size: 12px; }
.reset-test-link a { overflow-wrap: anywhere; color: var(--primary); }
.auth-errors { margin: 0; padding-left: 18px; }

html[data-theme="dark"] .calendar-event { color: var(--text); }
html[data-theme="dark"] .calendar-event span { color: var(--muted); }
html[data-theme="dark"] .horizontal-resource-label,
html[data-theme="dark"] .horizontal-time-cell,
html[data-theme="dark"] .horizontal-day-time-header,
html[data-theme="dark"] .horizontal-day-time-header .horizontal-resource-label,
html[data-theme="dark"] th { background: var(--surface-soft); }
html[data-theme="dark"] .calendar-surface,
html[data-theme="dark"] .table-panel,
html[data-theme="dark"] .panel,
html[data-theme="dark"] .filter-panel,
html[data-theme="dark"] .calendar-toolbar,
html[data-theme="dark"] .import-summary,
html[data-theme="dark"] .modal-panel { box-shadow: 0 8px 20px rgba(0, 0, 0, .16); }

@supports not (background: color-mix(in srgb, red 10%, white)) {
    .calendar-event { background: #eef4f2; }
}

@media (max-width: 1180px) {
    .sidebar { width: 260px; }
    .page-content { padding: 32px 24px 32px 80px; }
    .settings-grid, .report-grid { grid-template-columns: 1fr; }
    .filter-panel { grid-template-columns: repeat(2, 1fr); }
    .filter-panel .button { align-self: end; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
    .sidebar { width: 260px; }
    .main-area { margin-left: 0; }
    .menu-toggle-floating { display: none; }
    .mobile-header { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; min-height: 64px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
    .mobile-header .brand { padding: 0; }
    .mobile-header .sidebar-logo { width: 128px; padding: 5px; }
    .mobile-header .icon-button { width: 44px; height: 44px; }
    .page-content { padding: 20px 16px; }
    .page-heading { align-items: flex-start; }
    .page-heading, .calendar-toolbar { flex-direction: column; }
    .page-heading .button, .heading-actions { width: 100%; }
    .heading-actions .button { flex: 1; }
    .calendar-toolbar { align-items: stretch; }
    .calendar-control-cluster { width: 100%; flex-wrap: wrap; gap: 10px; }
    .toolbar-group { flex-wrap: wrap; }
    .calendar-new-button { width: 100%; }
    .calendar-navigation-group { width: 100%; justify-content: flex-start; }
    .resource-filter-group { margin-left: 0; }
    .calendar-view-group { align-items: flex-start; }
    .compact-field { flex: 1; }
    .resource-filter-group { width: 100%; flex-direction: column; align-items: stretch; }
    .resource-switcher { max-width: none; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 3px; }
    .calendar-period { width: 100%; margin: 6px 0 0; }
    .calendar-surface { min-height: 360px; }
    .calendar-scroll-x { overflow-x: auto; }
    .horizontal-calendar { --resource-label-width: 140px; min-width: 900px; }
    .horizontal-time-cell { font-size: 8px; }
    .form-grid { grid-template-columns: 1fr; }
    .span-2 { grid-column: span 1; }
    .participant-picker { grid-template-columns: 1fr; }
    .participant-picker label:nth-child(odd) { border-right: 0; }
    .modal-panel { padding: 18px; }
    .modal-actions { flex-direction: column-reverse; }
    .modal-actions .button { width: 100%; }
    .settings-grid, .kpi-grid { grid-template-columns: 1fr; }
    .resource-row { grid-template-columns: 42px 1fr; align-items: end; }
    .resource-row .toggle-row, .resource-row .button { grid-column: span 1; }
    .resource-row .resource-participant-flag, .resource-row .resource-delete-future { grid-column: span 2; }
    .resource-create-grid { grid-template-columns: 1fr 1fr; }
    .resource-create-grid .check-row { grid-column: span 2; }
    .schedule-panel-header { align-items: stretch; flex-direction: column; }
    .schedule-resource-picker { min-width: 0; width: 100%; }
    .schedule-scope-note { grid-template-columns: 10px 1fr; }
    .schedule-scope-note small { grid-column: 2; }
    .schedule-actions { flex-direction: column-reverse; }
    .schedule-actions .button { width: 100%; }
    .filter-panel { grid-template-columns: 1fr; }
    .schedule-rule { grid-template-columns: 1fr 1fr; }
    .schedule-day { grid-column: span 2; }
    .search-bar { flex-wrap: wrap; }
    .search-field { flex-basis: 100%; max-width: none; }
    .auth-shell, .auth-shell-simple { grid-template-columns: 1fr; min-height: auto; margin: 16px auto; }
    .auth-panel { padding: 40px 24px; }
    .auth-panel h1 { font-size: 34px; }
    .auth-brand .brand-logo { width: min(250px, 100%); }
    .auth-resource-cards, .auth-context-benefits { grid-template-columns: 1fr; }
    .auth-context { display: none; }
    .auth-theme-toggle { top: 16px; right: 16px; }
}

@media print {
    .sidebar, .mobile-header, .page-heading .button, .filter-panel { display: none !important; }
    .main-area { margin: 0; }
    .page-content { max-width: none; padding: 0; }
    .panel, .table-panel, .kpi { break-inside: avoid; box-shadow: none; }
}
