:root {
    --cd-canvas: #f5efe6;
    --cd-surface: #fffaf4;
    --cd-surface-muted: #eee6da;
    --cd-sidebar: #dfe8dc;
    --cd-sidebar-border: #cad7c7;
    --cd-border: #e4d8ca;
    --cd-text: #303530;
    --cd-muted: #7a7d76;
    --cd-orange: #e4772e;
    --cd-orange-dark: #c9601d;
    --cd-orange-soft: #f7ddca;
    --cd-green: #6f8f70;
    --cd-green-soft: #e5eee2;
    --cd-red: #b94a4f;
    --cd-red-soft: #f8e3e3;
    --cd-shadow: 0 8px 26px rgba(76, 58, 36, 0.07);
    --cd-radius: 16px;
    --bg: var(--cd-canvas);
    --surface: var(--cd-surface);
    --surface-2: var(--cd-surface-muted);
    --border: var(--cd-border);
    --text: var(--cd-text);
    --muted: var(--cd-muted);
    --primary-color: var(--cd-orange);
    --secondary-color: var(--cd-orange-dark);
    --success-color: var(--cd-green);
    --warning-color: var(--cd-orange);
    --danger-color: var(--cd-red);
    --info-color: #708b83;
    --tint-success: var(--cd-green-soft);
    --tint-warning: #fff0e4;
    --tint-danger: var(--cd-red-soft);
    --tint-info: #e8efec;
    --tint-neutral: #f1e9de;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
    margin: 0;
    background: var(--cd-canvas);
    color: var(--cd-text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--cd-orange-dark); }
a:hover { color: #a94c14; }
.text-muted { color: var(--cd-muted) !important; }

.app-shell {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    min-height: 100vh;
    transition: grid-template-columns 180ms ease;
}
.app-shell[data-shell-state="compact"] { grid-template-columns: 78px minmax(0, 1fr); }
.app-shell[data-shell-state="hidden"] { grid-template-columns: 0 minmax(0, 1fr); }

.app-sidebar {
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    flex-direction: column;
    width: 232px;
    height: 100vh;
    overflow: hidden auto;
    padding: 20px 14px 16px;
    background: var(--cd-sidebar);
    border-right: 1px solid var(--cd-sidebar-border);
    transition: width 180ms ease, padding 180ms ease, transform 180ms ease;
}
.app-shell[data-shell-state="compact"] .app-sidebar { width: 78px; overflow: hidden; }
.app-shell[data-shell-state="hidden"] .app-sidebar {
    width: 0;
    padding-left: 0;
    padding-right: 0;
    transform: translateX(-100%);
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 44px;
    gap: 8px;
    margin-bottom: 22px;
    padding: 0 3px;
}
.sidebar-brand {
    min-width: 0;
    color: var(--cd-text);
    line-height: 1.05;
    text-decoration: none;
    white-space: nowrap;
}
.sidebar-brand small {
    display: block;
    margin-bottom: 4px;
    color: #718071;
    font-size: 0.62rem;
    font-weight: 750;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
.sidebar-brand strong { font-size: 1.18rem; letter-spacing: -0.035em; }

.sidebar-toggle, .focus-toggle, .sidebar-restore {
    border: 1px solid transparent;
    border-radius: 10px;
    background: rgba(255, 250, 244, 0.72);
    color: #4d5a4e;
    cursor: pointer;
}
.sidebar-toggle { flex: 0 0 auto; width: 40px; height: 40px; font-size: 1.1rem; }
.sidebar-toggle:hover, .focus-toggle:hover, .sidebar-restore:hover { background: var(--cd-surface); }
.primary-nav { display: grid; gap: 5px; }
.primary-nav-link, .admin-summary {
    display: flex;
    align-items: center;
    min-height: 46px;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 11px;
    color: #465147;
    font-size: 0.88rem;
    font-weight: 680;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
}
.primary-nav-link:hover, .admin-summary:hover { background: rgba(255, 255, 255, 0.4); color: #273027; }
.primary-nav-link.active, .sidebar-admin[open] > .admin-summary, .sidebar-admin.active > .admin-summary {
    background: rgba(255, 250, 244, 0.9);
    color: #273027;
    box-shadow: 0 1px 0 rgba(86, 105, 86, 0.07);
}
.nav-icon { flex: 0 0 24px; width: 24px; text-align: center; font-size: 1.05rem; }
.sidebar-admin { position: relative; }
.admin-summary { cursor: pointer; list-style: none; }
.admin-summary::-webkit-details-marker { display: none; }
.admin-summary .admin-chevron { margin-left: auto; font-size: 0.7rem; transition: transform 160ms ease; }
.sidebar-admin[open] .admin-chevron { transform: rotate(180deg); }
.admin-links { display: grid; gap: 2px; padding: 5px 8px 8px 48px; }
.admin-links a { padding: 7px 0; color: #607061; font-size: 0.76rem; text-decoration: none; }
.admin-links a:hover { color: var(--cd-orange-dark); }
.admin-links .admin-section-label {
    margin: 8px 0 2px;
    color: #839083;
    font-size: 0.62rem;
    font-weight: 760;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}
.sidebar-footer {
    margin-top: auto;
    padding: 14px 10px 2px;
    border-top: 1px solid var(--cd-sidebar-border);
    color: #6f7c70;
    font-size: 0.7rem;
    line-height: 1.65;
    white-space: nowrap;
}
.system-line { display: flex; align-items: center; gap: 7px; }
.system-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--cd-green); }
.app-shell[data-shell-state="compact"] .sidebar-brand,
.app-shell[data-shell-state="compact"] .sidebar-label,
.app-shell[data-shell-state="compact"] .admin-chevron,
.app-shell[data-shell-state="compact"] .admin-links,
.app-shell[data-shell-state="compact"] .sidebar-footer { display: none; }
.app-shell[data-shell-state="compact"] .sidebar-admin { display: none; }
.app-shell[data-shell-state="compact"] .sidebar-header { justify-content: center; }
.app-shell[data-shell-state="compact"] .primary-nav-link,
.app-shell[data-shell-state="compact"] .admin-summary { justify-content: center; padding-inline: 10px; }

.app-workspace { grid-column: 2; min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.workspace-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    min-height: 68px;
    gap: 10px;
    padding: 12px clamp(18px, 3vw, 42px);
    border-bottom: 1px solid rgba(214, 202, 187, 0.72);
    background: rgba(245, 239, 230, 0.91);
    backdrop-filter: blur(12px);
}
.workspace-spacer { flex: 1; }
.environment-badge {
    padding: 7px 9px;
    border-radius: 999px;
    background: var(--cd-orange-soft);
    color: #82431b;
    font-size: 0.68rem;
    font-weight: 760;
    letter-spacing: 0.05em;
}
.focus-toggle, .new-person-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    gap: 7px;
    padding: 8px 12px;
    font-size: 0.78rem;
    font-weight: 720;
    text-decoration: none;
}
.new-person-link { border-radius: 10px; background: var(--cd-orange); color: #fff; }
.new-person-link:hover { background: var(--cd-orange-dark); color: #fff; }
.app-content { width: 100%; max-width: 1540px; margin: 0 auto; padding: 30px clamp(18px, 3vw, 42px) 56px; }
.app-footer { margin-top: auto; padding: 18px 32px 24px; color: #929188; font-size: 0.7rem; text-align: center; }
.sidebar-restore {
    position: fixed;
    z-index: 1050;
    top: 14px;
    left: 14px;
    display: none;
    width: 42px;
    height: 42px;
    box-shadow: var(--cd-shadow);
}
.app-shell[data-shell-state="hidden"] .sidebar-restore { display: block; }

/* Legacy screens keep their Bootstrap structure inside the new shell. */
.card { background: var(--cd-surface); border: 1px solid var(--cd-border); border-radius: 14px; box-shadow: 0 2px 10px rgba(76, 58, 36, 0.035); }
.card-header { background: transparent; border-bottom: 1px solid var(--cd-border); font-weight: 650; }
.btn { border-radius: 9px; }
.btn-primary { background: var(--cd-orange); border-color: var(--cd-orange); }
.btn-primary:hover, .btn-primary:focus { background: var(--cd-orange-dark); border-color: var(--cd-orange-dark); }
.btn-outline-primary { color: var(--cd-orange-dark); border-color: #db9a6e; }
.btn-outline-primary:hover { background: var(--cd-orange); border-color: var(--cd-orange); color: #fff; }
.btn-success { background: var(--cd-green); border-color: var(--cd-green); }
.btn-warning { background: var(--cd-orange); border-color: var(--cd-orange); color: #fff; }
.btn-danger { background: var(--cd-red); border-color: var(--cd-red); }
.form-control, .form-select { border-color: var(--cd-border); background-color: #fffdf9; }
.form-control:focus, .form-select:focus { border-color: #e0a177; box-shadow: 0 0 0 0.2rem rgba(228, 119, 46, 0.14); }
.table { --bs-table-bg: transparent; --bs-table-border-color: var(--cd-border); }
.table thead th { background: #f2ebe1; }
.list-group-item { background: transparent; border-color: var(--cd-border); }
.bg-primary, .text-bg-primary { background-color: var(--cd-orange) !important; }
.bg-success, .text-bg-success { background-color: var(--cd-green) !important; }
.bg-warning, .text-bg-warning { background-color: var(--cd-orange) !important; }
.bg-danger, .text-bg-danger { background-color: var(--cd-red) !important; }
.text-primary { color: var(--cd-orange-dark) !important; }
.text-success { color: var(--cd-green) !important; }
.text-warning { color: var(--cd-orange-dark) !important; }
.text-danger { color: var(--cd-red) !important; }
.alert-success { background: var(--cd-green-soft); border-color: #b9ceb5; color: #416044; }
.alert-warning { background: #fff0e4; border-color: #efc3a2; color: #81491f; }
.alert-danger { background: var(--cd-red-soft); border-color: #dfb6b8; color: #7f3035; }
.alert-info { background: #e8efec; border-color: #bfcec8; color: #425f57; }

/* Vandaag */
.today-screen { height: 100dvh; min-height: 0; overflow: hidden; }
.today-screen .app-shell { grid-template-rows: minmax(0, 1fr); height: 100dvh; min-height: 0; overflow: hidden; }
.today-screen .app-workspace { height: 100dvh; min-height: 0; overflow: hidden; }
.today-screen .workspace-header { flex: 0 0 68px; }
.today-screen .app-content { flex: 0 0 calc(100dvh - 68px); height: calc(100dvh - 68px); min-height: 0; max-width: none; overflow: hidden; padding: 22px clamp(18px, 3vw, 42px) 26px; }
.today-screen .app-footer { display: none; }
.today-dashboard { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.today-heading { display: flex; flex: 0 0 auto; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 16px; }
.today-kicker { margin-bottom: 4px; color: #86847c; font-size: 0.66rem; font-weight: 740; letter-spacing: 0.12em; text-transform: uppercase; }
.today-heading h1 { margin: 0; font-size: clamp(1.75rem, 3vw, 2.2rem); font-weight: 790; letter-spacing: -0.045em; }
.today-heading p { margin: 4px 0 0; color: var(--cd-muted); font-size: 0.8rem; }
.today-sync { padding-top: 7px; color: #8b8981; font-size: 0.68rem; white-space: nowrap; }
.today-grid { display: grid; flex: 1; grid-template-rows: minmax(0, 1fr); min-height: 0; overflow: hidden; gap: 15px; }
.today-grid.with-schedule { grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.65fr); }
.today-grid.actions-only { grid-template-columns: minmax(0, 1fr); }
.today-card { display: flex; flex-direction: column; min-height: 0; overflow: hidden; border: 1px solid var(--cd-border); border-radius: var(--cd-radius); background: var(--cd-surface); box-shadow: 0 2px 14px rgba(76, 58, 36, 0.035); }
.today-card-header { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 19px 13px; border-bottom: 1px solid #eee5da; }
.today-card-header > div > span { display: block; margin-bottom: 3px; color: #958d83; font-size: 0.58rem; font-weight: 760; letter-spacing: 0.08em; text-transform: uppercase; }
.today-card-header h2 { margin: 0; font-size: 0.95rem; font-weight: 760; }
.today-card-header p { margin: 4px 0 0; color: var(--cd-muted); font-size: 0.66rem; }
.today-card-header a { font-size: 0.72rem; font-weight: 700; text-decoration: none; }
.today-card-count { min-width: 30px; padding: 5px 8px; border-radius: 999px; background: var(--cd-orange-soft); color: #7b411c; font-size: 0.68rem; font-weight: 760; text-align: center; }
.action-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 19px 5px; scrollbar-gutter: stable; }
.action-list:focus { outline: 2px solid rgba(228, 119, 46, 0.22); outline-offset: -2px; }
.action-item { display: grid; grid-template-columns: 9px minmax(0, 1fr) auto; gap: 11px; align-items: start; padding: 13px 0; border-top: 1px solid #eee5da; }
.action-item:first-child { border-top: 0; }
.action-dot { width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: #baa995; }
.action-dot.warn { background: var(--cd-orange); }
.action-dot.critical { background: var(--cd-red); }
.action-copy { min-width: 0; }
.action-meta { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 3px; color: #969088; font-size: 0.58rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.action-title { color: var(--cd-text); font-size: 0.78rem; font-weight: 740; }
.action-description { margin: 3px 0 0; color: var(--cd-muted); font-size: 0.67rem; line-height: 1.4; }
.action-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.action-link { padding: 7px 9px; border-radius: 8px; background: var(--cd-orange-soft); color: #7c3d16; font-size: 0.68rem; font-weight: 730; text-decoration: none; white-space: nowrap; }
.action-link:hover { background: #f1c6a7; color: #66300f; }
.action-link.secondary { background: #eee7dd; color: #675f56; }
.schedule-list { min-height: 0; overflow-y: auto; padding: 0 18px 6px; }
.schedule-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 0; border-top: 1px solid #eee5da; text-decoration: none; }
.schedule-item:first-child { border-top: 0; }
.schedule-copy { min-width: 0; }
.schedule-copy strong { display: block; overflow: hidden; color: var(--cd-text); font-size: 0.78rem; text-overflow: ellipsis; white-space: nowrap; }
.schedule-copy small { display: block; margin-top: 4px; overflow: hidden; color: var(--cd-muted); font-size: 0.67rem; text-overflow: ellipsis; white-space: nowrap; }
.status-pill { flex: 0 0 auto; padding: 5px 8px; border-radius: 999px; background: #eee7dd; color: #6f675e; font-size: 0.63rem; font-weight: 740; }
.status-pill.ok { background: var(--cd-green-soft); color: #4f6f52; }
.status-pill.attention { background: var(--cd-orange-soft); color: #81461f; }
.status-pill.problem { background: var(--cd-red-soft); color: #87363a; }
.empty-state { display: grid; flex: 1; min-height: 0; place-content: center; padding: 34px 20px; color: var(--cd-muted); text-align: center; }
.empty-state i { display: block; margin-bottom: 9px; color: var(--cd-green); font-size: 1.55rem; }
.empty-state strong { display: block; color: #5c655c; font-size: 0.8rem; }
.empty-state span { display: block; margin-top: 4px; font-size: 0.7rem; }
.phase-placeholder { max-width: 760px; margin: 7vh auto 0; padding: 36px; text-align: center; }
.phase-placeholder-icon { display: grid; width: 58px; height: 58px; margin: 0 auto 18px; place-items: center; border-radius: 18px; background: var(--cd-green-soft); color: var(--cd-green); font-size: 1.35rem; }
.phase-placeholder h1 { margin-bottom: 12px; font-size: 2rem; letter-spacing: -0.04em; }
.phase-placeholder p { color: var(--cd-muted); line-height: 1.65; }

@media (max-width: 980px) {
    .today-grid.with-schedule { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
    .schedule-card { max-height: 32vh; }
}
@media (max-width: 760px) {
    .app-shell, .app-shell[data-shell-state="compact"], .app-shell[data-shell-state="hidden"] { grid-template-columns: 0 minmax(0, 1fr); }
    .app-sidebar { position: fixed; width: 232px; box-shadow: var(--cd-shadow); }
    .app-shell[data-shell-state="compact"] .app-sidebar { width: 78px; }
    .workspace-header { padding-left: 66px; }
    .environment-badge { display: none; }
    .today-heading { display: block; }
    .today-sync { padding-top: 10px; }
    .action-item { grid-template-columns: 9px minmax(0, 1fr); }
    .action-buttons { grid-column: 2; justify-content: flex-start; }
}
@media (max-width: 480px) {
    .focus-toggle span, .new-person-link span { display: none; }
    .workspace-header { min-height: 60px; }
    .app-content { padding-top: 22px; }
}
@media (prefers-reduced-motion: reduce) {
    .app-shell, .app-sidebar, .admin-chevron { transition: none; }
}
