:root {
    --bg: #f3f6fb;
    --bg-alt: #eef2f9;
    --surface: #ffffff;
    --surface-soft: #f8faff;
    --text: #172033;
    --muted: #64748b;
    --line: #d9e2ef;
    --brand: #1d4ed8;
    --brand-strong: #1e40af;
    --danger: #c23636;
    --warning: #b87407;
    --success: #0d7c44;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --shadow-sm: 0 6px 16px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 12px 32px rgba(15, 23, 42, 0.09);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: radial-gradient(1400px 500px at 20% -10%, #dbe7ff 0%, transparent 65%), var(--bg);
    color: var(--text);
    font-family: "Segoe UI", "Inter", "Helvetica Neue", Arial, sans-serif;
}

a {
    color: var(--brand);
    text-decoration: none;
}

a:hover {
    color: var(--brand-strong);
}

.app-topbar {
    background: #101b2d;
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.app-topbar .navbar-brand {
    font-weight: 700;
    letter-spacing: 0.1px;
}

.app-user-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 0.84rem;
    color: #e8eefc;
}

.app-shell {
    display: flex;
    width: 100%;
    min-height: calc(100vh - 58px);
}

.app-sidebar {
    width: 260px;
    flex-shrink: 0;
    background: linear-gradient(180deg, #12213b 0%, #0f1a2f 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    padding: 24px 14px;
}

.row > .app-sidebar {
    width: auto;
    min-height: calc(100vh - 58px);
}

.sidebar-title {
    color: #adc0e5;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1.1px;
    margin: 0 12px 12px;
}

.sidebar-nav {
    display: grid;
    gap: 6px;
}

.sidebar-nav .nav-link {
    color: #d4dff3;
    font-size: 0.92rem;
    border-radius: 10px;
    padding: 10px 12px;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
    color: #fff;
    background: rgba(61, 121, 239, 0.35);
}

.app-main {
    flex: 1;
    min-width: 0;
    padding: 26px;
}

.content-wrap {
    max-width: 1200px;
}

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.page-title {
    margin: 0;
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.page-subtitle {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.94rem;
}

.action-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}

.card {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    background: var(--surface);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--line);
    font-weight: 600;
    padding: 14px 18px;
}

.card-body {
    padding: 18px;
}

.kpi-grid {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.kpi-card {
    padding: 18px;
    border-radius: var(--radius-md);
    border: 1px solid var(--line);
    background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
    box-shadow: var(--shadow-sm);
}

.kpi-label {
    color: var(--muted);
    font-size: 0.83rem;
    margin-bottom: 8px;
}

.kpi-value {
    font-size: 1.8rem;
    line-height: 1;
    font-weight: 700;
}

.table {
    margin-bottom: 0;
}

.table > :not(caption) > * > * {
    padding: 12px 14px;
    border-bottom-color: #e7edf7;
    vertical-align: middle;
}

.table thead th {
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.75px;
    font-weight: 700;
    background: #f9fbff;
}

.form-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #344158;
    margin-bottom: 6px;
}

.form-control,
.form-select {
    border-radius: 10px;
    border-color: #cfd9ea;
    min-height: 42px;
}

.form-control:focus,
.form-select:focus {
    border-color: #80a9ef;
    box-shadow: 0 0 0 0.2rem rgba(29, 78, 216, 0.15);
}

.btn {
    border-radius: 10px;
    font-weight: 600;
}

.btn-sm {
    border-radius: 9px;
}

.badge-pill {
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 0.73rem;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.status-not_started,
.status-pending,
.visibility-internal {
    background: #e8edf5;
    color: #43536f;
}

.status-in_progress,
.status-active,
.type-progress,
.type-informational,
.visibility-client {
    background: #dceafe;
    color: #1e3a8a;
}

.status-on_hold,
.type-issue {
    background: #fff2d8;
    color: #8f5200;
}

.status-completed,
.type-milestone {
    background: #dcf7e8;
    color: #16663e;
}

.project-hero {
    background: linear-gradient(140deg, #172d52 0%, #193b78 45%, #275cc2 100%);
    color: #fff;
    border: 0;
    box-shadow: var(--shadow-md);
}

.project-hero .text-muted,
.project-hero .project-meta {
    color: rgba(240, 245, 255, 0.86) !important;
}

.project-meta-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin: 14px 0;
}

.project-meta-card {
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 10px 12px;
}

.project-meta-label {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    opacity: 0.8;
}

.project-progress {
    height: 11px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.24);
    overflow: hidden;
}

.project-progress .progress-bar {
    background: linear-gradient(90deg, #6ee7b7, #34d399);
    font-size: 0;
}

.timeline-item {
    position: relative;
    padding-left: 22px;
}

.timeline-item::before {
    content: "";
    position: absolute;
    left: 5px;
    top: 9px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #5b7dc0;
}

.timeline-item::after {
    content: "";
    position: absolute;
    left: 8px;
    top: 20px;
    width: 2px;
    height: calc(100% - 16px);
    background: #dce7f8;
}

.timeline-item:last-child::after {
    display: none;
}

.phase-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
    background: var(--surface-soft);
}

.empty-state {
    text-align: center;
    padding: 36px 20px;
    color: var(--muted);
}

.empty-state h3 {
    font-size: 1rem;
    color: #2d3a52;
    margin-bottom: 8px;
}

.client-view .app-main {
    max-width: 1100px;
    margin: 0 auto;
    padding: 26px 18px 42px;
}

@media (max-width: 991.98px) {
    .app-shell {
        flex-direction: column;
    }

    .app-sidebar {
        width: 100%;
        padding: 12px;
    }

    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .project-meta-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 575.98px) {
    .app-main {
        padding: 14px;
    }

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

    .page-title {
        font-size: 1.2rem;
    }
}

.app-alert {
    border-radius: 12px;
    border-width: 1px;
    box-shadow: var(--shadow-sm);
}

form.is-loading {
    opacity: 0.92;
    pointer-events: none;
}

#toast-container > div {
    opacity: 1;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}

.cookie-banner {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: 16px;
    z-index: 1090;
}

.cookie-banner__inner {
    max-width: 760px;
    margin: 0 auto;
    border-radius: 14px;
    background: #0f1e35;
    color: #e8f0ff;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: var(--shadow-md);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.auth-shell {
    min-height: calc(100vh - 58px);
    display: grid;
    place-items: center;
    padding: 26px 14px;
}

.auth-panel {
    width: 100%;
    max-width: 460px;
}

.auth-brand {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.auth-subtitle {
    color: var(--muted);
    margin-bottom: 18px;
}

.form-panel {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    padding: 20px;
}

.table-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

@media (max-width: 768px) {
    .cookie-banner__inner {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Default Dark Theme */
:root {
    --bg: #0b1220;
    --bg-alt: #0f172a;
    --surface: #111b2e;
    --surface-soft: #17233a;
    --text: #e2e8f0;
    --muted: #93a4bd;
    --line: #23314a;
    --brand: #60a5fa;
    --brand-strong: #3b82f6;
}

body {
    background: radial-gradient(1200px 420px at 20% -5%, #1e2e52 0%, transparent 60%), var(--bg);
    color: var(--text);
}

.app-main {
    background: transparent;
}

.page-title,
.auth-brand,
.kpi-value,
.card,
.form-panel,
.table,
.table td,
.table th,
.form-label,
.form-text,
.empty-state h3,
.phase-card,
.project-meta-card {
    color: var(--text);
}

.card,
.form-panel,
.phase-card,
.kpi-card,
.project-meta-card {
    border-color: var(--line);
    background: var(--surface);
    box-shadow: 0 12px 30px rgba(2, 6, 23, 0.45);
}

.card-header {
    border-bottom-color: var(--line);
    background: #0f1a2d;
}

.kpi-card {
    background: linear-gradient(180deg, #14213a 0%, #101a2c 100%);
}

.table thead th {
    background: #0f1a2d;
    color: #9fb0ca;
    border-bottom-color: var(--line);
}

.table > :not(caption) > * > * {
    border-bottom-color: var(--line);
}

.form-control,
.form-select {
    background: #0d1728;
    color: var(--text);
    border-color: #2a3a57;
}

.form-control::placeholder {
    color: #7f93b2;
}

.form-control:focus,
.form-select:focus {
    background: #0d1728;
    color: var(--text);
    border-color: #4f8cf7;
    box-shadow: 0 0 0 0.2rem rgba(96, 165, 250, 0.18);
}

.text-muted,
.page-subtitle,
.auth-subtitle {
    color: var(--muted) !important;
}

.btn-outline-secondary {
    color: #c3d2e7;
    border-color: #3a4f72;
}

.btn-outline-secondary:hover {
    color: #fff;
    background: #334863;
    border-color: #445b80;
}

.btn-outline-primary {
    color: #9fc5ff;
    border-color: #3a66a5;
}

.btn-outline-primary:hover {
    color: #fff;
    background: #2b4f87;
    border-color: #4472b5;
}

.btn-outline-warning {
    color: #ffd18f;
    border-color: #7c5b2b;
}

.btn-outline-warning:hover {
    color: #fff;
    background: #7c5b2b;
}

.btn-outline-danger {
    color: #f9a8a8;
    border-color: #7c2d3d;
}

.btn-outline-danger:hover {
    color: #fff;
    background: #7c2d3d;
}

.project-hero {
    background: linear-gradient(140deg, #1d3a6b 0%, #214b88 46%, #2f65b8 100%);
}

.cookie-banner__inner {
    background: #0b1322;
    border-color: #30425f;
}
