/* Docking — Soft Daylight (coral) */

:root {
    --bg-page: #eef2f7;
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-input: #f1f5f9;
    --bg-elevated: #e2e8f0;

    --border-subtle: rgba(15, 23, 42, 0.08);
    --border-medium: rgba(15, 23, 42, 0.12);
    --border-accent: rgba(232, 93, 76, 0.28);

    --accent-coral: #e85d4c;
    --accent-coral-light: #fff5f2;
    --accent-coral-dim: rgba(232, 93, 76, 0.1);
    --accent-cyan: var(--accent-coral);
    --accent-indigo: #6366f1;
    --accent-teal: #0d9488;
    --accent-amber: #d97706;
    --accent-amber-dim: rgba(217, 119, 6, 0.1);
    --accent-emerald: #059669;
    --accent-emerald-dim: rgba(5, 150, 105, 0.1);
    --accent-rose: #e11d48;
    --accent-rose-dim: rgba(225, 29, 72, 0.08);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;

    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 16px;
    --sidebar-width: 280px;

    --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.06);
    --shadow-card: 0 2px 8px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-card-hover: 0 8px 24px rgba(15, 23, 42, 0.1), 0 2px 6px rgba(15, 23, 42, 0.05);
    --shadow-sidebar: 2px 0 16px rgba(15, 23, 42, 0.04);

    --font-base: 1.0625rem;
}

*, *::before, *::after { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-size: var(--font-base);
    background: var(--bg-page);
    color: var(--text-secondary);
    -webkit-font-smoothing: antialiased;
    line-height: 1.55;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background:
        radial-gradient(ellipse 70% 50% at 0% 0%, rgba(232, 93, 76, 0.07), transparent 55%),
        radial-gradient(ellipse 50% 40% at 100% 0%, rgba(255, 138, 101, 0.05), transparent 50%);
}

/* ── Layout ── */
.app-layout {
    display: flex;
    min-height: 100vh;
    background: var(--bg-page);
    position: relative;
    z-index: 1;
}

.app-sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-sidebar);
    flex-shrink: 0;
    display: none;
    flex-direction: column;
}

@media (min-width: 768px) {
    .app-sidebar {
        display: flex;
        position: sticky;
        top: 0;
        align-self: flex-start;
        height: 100vh;
        height: 100dvh;
        overflow-y: auto;
        z-index: 25;
    }
}

.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Hex grid background */
.app-content {
    flex: 1;
    padding: 1.75rem;
    background-color: var(--bg-page);
    position: relative;
}

@media (min-width: 768px) {
    .app-content { padding: 2.25rem 2.5rem 2.75rem; }
}

.app-content-inner {
    max-width: 80rem;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

/* ── Glass top bar ── */
.topbar {
    display: none;
    align-items: center;
    gap: 1rem;
    padding: 1rem 2.25rem;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 20;
}

@media (min-width: 768px) {
    .topbar { display: flex; }
}

.topbar-search {
    flex: 1;
    max-width: 28rem;
    position: relative;
}

.topbar-search svg {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1rem;
    height: 1rem;
    color: var(--text-muted);
    pointer-events: none;
}

.topbar-search input {
    width: 100%;
    padding: 0.75rem 1.125rem 0.75rem 2.875rem;
    background: var(--bg-input);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.topbar-search input::placeholder { color: var(--text-muted); }

.topbar-search input:focus {
    outline: none;
    border-color: var(--border-accent);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(232, 93, 76, 0.12);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.topbar-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    position: relative;
}

.topbar-icon-btn:hover {
    background: #fff;
    color: var(--accent-coral);
    border-color: var(--border-accent);
}

.topbar-icon-btn svg { width: 1.25rem; height: 1.25rem; }

.topbar-notify-dot {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 0.5rem;
    height: 0.5rem;
    background: var(--accent-amber);
    border-radius: 50%;
    border: 2px solid #fff;
}

.topbar-notify-wrap {
    position: relative;
}

.topbar-icon-btn.active {
    background: #fff;
    color: var(--accent-coral);
    border-color: var(--border-accent);
}

.topbar-notify-badge {
    position: absolute;
    top: -0.25rem;
    right: -0.25rem;
    min-width: 1.125rem;
    height: 1.125rem;
    padding: 0 0.3125rem;
    background: var(--accent-rose);
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    line-height: 1.125rem;
    text-align: center;
    border-radius: 9999px;
    border: 2px solid #fff;
}

.topbar-notify-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.18);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    animation: notify-fade-in 0.15s ease-out;
}

.topbar-notify-panel {
    position: fixed;
    top: 4.25rem;
    right: 2.25rem;
    width: min(24rem, calc(100vw - 1.5rem));
    max-height: min(32rem, calc(100vh - 5.5rem));
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card-hover), 0 0 0 1px rgba(255, 255, 255, 0.6) inset;
    z-index: 1010;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: notify-slide-in 0.2s ease-out;
}

@keyframes notify-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes notify-slide-in {
    from {
        opacity: 0;
        transform: translateY(-0.375rem) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.topbar-notify-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1rem 0.875rem;
    border-bottom: 1px solid var(--border-subtle);
    background: linear-gradient(180deg, rgba(255, 245, 242, 0.6) 0%, transparent 100%);
}

.topbar-notify-header-text {
    min-width: 0;
}

.topbar-notify-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.topbar-notify-subtitle {
    margin: 0.1875rem 0 0;
    font-size: 0.8125rem;
    color: var(--accent-coral);
    font-weight: 600;
}

.topbar-notify-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    flex-shrink: 0;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.topbar-notify-close:hover {
    background: #fff;
    color: var(--text-primary);
    border-color: var(--border-medium);
}

.topbar-notify-close svg {
    width: 1rem;
    height: 1rem;
}

.topbar-notify-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.topbar-notify-list {
    overflow-y: auto;
    max-height: min(22rem, calc(100vh - 12rem));
    padding: 0.375rem;
}

.topbar-notify-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
    position: relative;
}

.topbar-notify-item + .topbar-notify-item {
    margin-top: 0.125rem;
}

.topbar-notify-item:hover {
    background: var(--bg-input);
    border-color: var(--border-subtle);
}

.topbar-notify-item.unread {
    background: rgba(255, 255, 255, 0.9);
    border-color: var(--border-subtle);
    box-shadow: var(--shadow-sm);
    padding-right: 1.625rem;
}

.topbar-notify-item.unread:hover {
    background: #fff;
    border-color: var(--border-medium);
}

.topbar-notify-item-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
}

.topbar-notify-item-icon svg {
    width: 1.125rem;
    height: 1.125rem;
}

.topbar-notify-item.type-overdue-stage .topbar-notify-item-icon,
.topbar-notify-item.type-overdue-project .topbar-notify-item-icon {
    background: var(--accent-rose-dim);
    color: var(--accent-rose);
    border-color: rgba(225, 29, 72, 0.12);
}

.topbar-notify-item.type-upcoming .topbar-notify-item-icon {
    background: var(--accent-amber-dim);
    color: var(--accent-amber);
    border-color: rgba(217, 119, 6, 0.12);
}

.topbar-notify-item.type-blocked .topbar-notify-item-icon {
    background: #f1f5f9;
    color: var(--text-muted);
    border-color: var(--border-subtle);
}

.topbar-notify-item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3125rem;
}

.topbar-notify-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.topbar-notify-item-badge {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.topbar-notify-item.type-overdue-stage .topbar-notify-item-badge,
.topbar-notify-item.type-overdue-project .topbar-notify-item-badge {
    color: var(--accent-rose);
}

.topbar-notify-item.type-upcoming .topbar-notify-item-badge {
    color: var(--accent-amber);
}

.topbar-notify-item-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.45;
}

.topbar-notify-item-time {
    flex-shrink: 0;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.topbar-notify-item-dot {
    position: absolute;
    top: 0.875rem;
    right: 0.75rem;
    width: 0.4375rem;
    height: 0.4375rem;
    border-radius: 50%;
    background: var(--accent-coral);
    box-shadow: 0 0 0 2px #fff;
}

.topbar-notify-footer {
    padding: 0.625rem 0.75rem 0.75rem;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-input);
}

.topbar-notify-mark-all {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.topbar-notify-mark-all:hover {
    background: var(--accent-coral-dim);
    color: var(--accent-coral);
    border-color: rgba(232, 93, 76, 0.2);
}

.topbar-notify-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.topbar-notify-empty-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    margin-bottom: 0.375rem;
    border-radius: 50%;
    background: var(--accent-coral-dim);
    color: var(--accent-coral);
}

.topbar-notify-empty-icon svg {
    width: 1.5rem;
    height: 1.5rem;
}

.topbar-notify-empty-title {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary);
}

.topbar-notify-empty-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.topbar-notify-spinner {
    width: 1.75rem;
    height: 1.75rem;
    margin-bottom: 0.5rem;
    border: 2px solid var(--border-subtle);
    border-top-color: var(--accent-coral);
    border-radius: 50%;
    animation: notify-spin 0.7s linear infinite;
}

@keyframes notify-spin {
    to { transform: rotate(360deg); }
}

@media (max-width: 767px) {
    .topbar-notify-panel {
        top: 3.75rem;
        right: 0.75rem;
        left: 0.75rem;
        width: auto;
    }
}

.stage-list-item:target {
    scroll-margin-top: 5rem;
    box-shadow: 0 0 0 2px rgba(232, 93, 76, 0.35);
}

/* ── Mobile ── */
.mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 30;
}

@media (min-width: 768px) { .mobile-header { display: none; } }

.mobile-header-title {
    font-weight: 800;
    font-size: 1.125rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.mobile-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
}

.mobile-drawer {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.mobile-drawer-panel {
    width: var(--sidebar-width);
    height: 100%;
    background: var(--bg-sidebar);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

/* ── Sidebar ── */
.sidebar-logo {
    padding: 1.625rem 1.375rem;
}

.sidebar-logo-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: inherit;
}

.sidebar-logo-icon {
    width: 2.75rem;
    height: 2.75rem;
    background: linear-gradient(135deg, var(--accent-coral-light), #ffe4de);
    border: 1px solid rgba(232, 93, 76, 0.18);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-logo-icon svg {
    width: 1.375rem;
    height: 1.375rem;
    color: var(--accent-coral);
}

.sidebar-logo-name {
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.sidebar-logo-desc {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
    font-weight: 500;
}

.sidebar-body {
    flex: 1;
    padding: 0.625rem 1rem;
    overflow-y: auto;
}

.sidebar-group-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 0.5rem 0.875rem;
    margin-bottom: 0.375rem;
}

.sidebar-footer {
    padding: 1.125rem 1rem 1.5rem;
    border-top: 1px solid var(--border-subtle);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.875rem;
    border-radius: var(--radius);
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    margin-bottom: 0.75rem;
}

.sidebar-avatar {
    width: 2.625rem;
    height: 2.625rem;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, #ffc9bd, #ff9b88);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--accent-coral);
    flex-shrink: 0;
    line-height: 1;
}

.sidebar-user-info { min-width: 0; flex: 1; }

.sidebar-user-name {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.8125rem;
    color: var(--accent-coral);
    margin-top: 0.125rem;
    font-weight: 600;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
    transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    margin-bottom: 0.25rem;
}

.sidebar-link svg {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
    opacity: 0.55;
    transition: opacity 0.2s, color 0.2s;
}

.sidebar-link-label {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-link:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

.sidebar-link:hover svg { opacity: 1; color: var(--accent-coral); }

.sidebar-link.active {
    background: var(--accent-coral-dim);
    color: var(--accent-coral);
    border-color: rgba(232, 93, 76, 0.14);
    box-shadow: var(--shadow-sm);
}

.sidebar-link.active svg { opacity: 1; color: var(--accent-coral); }

.sidebar-footer form { margin: 0; }

/* ── Typography ── */
.page-header { margin-bottom: 2.25rem; }

.page-header-row {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
}

.page-title {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    margin: 0;
}

.page-subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin: 0.625rem 0 0;
    font-weight: 500;
    line-height: 1.55;
}

.page-back {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--accent-coral);
    text-decoration: none;
    margin-bottom: 0.5rem;
    opacity: 0.85;
}

.page-back:hover { opacity: 1; }
.page-back svg { width: 1rem; height: 1rem; }
.page-actions { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    padding: 0.75rem 1.375rem;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.25rem;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
    font-family: inherit;
}

.btn svg { width: 1.125rem; height: 1.125rem; }

.btn-icon-only {
    padding: 0.5rem;
    gap: 0;
    min-width: 2.25rem;
    min-height: 2.25rem;
}

.btn-primary {
    background: var(--accent-coral);
    color: #fff;
    border: 1px solid transparent;
    box-shadow: 0 4px 14px rgba(232, 93, 76, 0.32);
}

.btn-primary:hover {
    background: #d94a32;
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(232, 93, 76, 0.38);
}

.btn-primary:active {
    background: #c4432e;
}

.btn-primary:focus-visible {
    outline: 2px solid rgba(232, 93, 76, 0.45);
    outline-offset: 2px;
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
}

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-accent);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 0.375rem 0.625rem;
}

.btn-ghost:hover { background: var(--accent-coral-dim); color: var(--accent-coral); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }

/* ── Cards ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-subtle);
}

.card-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.card-body { padding: 1.25rem; }

/* KPI cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    .kpi-grid { grid-template-columns: repeat(3, 1fr); }
}

.kpi-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 0.625rem 0.875rem;
    min-height: 2.75rem;
    transition: border-color 0.15s, background 0.15s;
    box-shadow: none;
}

.kpi-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-medium);
    transform: none;
    box-shadow: none;
}

.kpi-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    margin: 0;
    min-width: 0;
    line-height: 1.3;
}

.kpi-value {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    line-height: 1;
    flex-shrink: 0;
}

.kpi-value.cyan { color: var(--accent-coral); }
.kpi-value.amber { color: var(--accent-amber); }
.kpi-value.emerald { color: var(--accent-emerald); }

/* Project grid */
.project-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 768px) {
    .project-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
    .project-grid { grid-template-columns: repeat(3, 1fr); }
}

.project-card {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
    box-shadow: var(--shadow-card);
}

.project-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-accent);
    transform: translateY(-3px);
    box-shadow: var(--shadow-card-hover);
}

.project-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.project-card-name {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0.5rem 0 0.875rem;
    line-height: 1.35;
    letter-spacing: -0.02em;
}

.project-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
    padding-top: 0.875rem;
    border-top: 1px solid var(--border-subtle);
}

.project-card-deadline {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
}

.project-card-deadline.overdue {
    color: var(--accent-rose);
    background: var(--accent-rose-dim);
    padding: 0.3125rem 0.625rem;
    border-radius: 8px;
    border: 1px solid rgba(225, 29, 72, 0.15);
}

/* Code chip */
.code-tag {
    display: inline-flex;
    align-items: center;
    font-family: 'JetBrains Mono', Consolas, monospace;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--accent-coral);
    background: var(--accent-coral-dim);
    padding: 0.3125rem 0.625rem;
    border-radius: 8px;
    border: 1px solid rgba(232, 93, 76, 0.14);
}

/* Avatars stack */
.avatar-stack {
    display: flex;
    align-items: center;
}

.avatar-stack .avatar {
    width: 2.125rem;
    height: 2.125rem;
    border-radius: 50%;
    border: 2px solid #fff;
    background: linear-gradient(135deg, #cbd5e1, #94a3b8);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    margin-left: -0.5rem;
    box-shadow: var(--shadow-sm);
}

.avatar-stack .avatar:first-child { margin-left: 0; }

.avatar-stack .avatar-more {
    background: var(--bg-input);
    color: var(--text-muted);
    font-size: 0.5625rem;
}

/* ── Progress (minimal) ── */
.progress-wrap {
    width: 100%;
    --progress-color: linear-gradient(90deg, var(--accent-coral), #ff8a65);
    --progress-track: #e2e8f0;
}

.progress-wrap.progress-auto {
    --progress-color: linear-gradient(90deg, #f07058, #ffab91);
}

.progress-wrap.progress-success {
    --progress-color: var(--accent-emerald);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.375rem;
}

.progress-header-compact {
    justify-content: flex-end;
    margin-bottom: 0.25rem;
}

.progress-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
}

.progress-pct {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

.progress-track {
    height: 8px;
    background: var(--progress-track);
    border-radius: 9999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    min-width: 0;
    border-radius: 9999px;
    background: var(--progress-color);
    transition: width 0.4s ease;
}

/* ── Status badges (pills) ── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.3125rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 9999px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    white-space: nowrap;
}

.badge-cyan { background: var(--accent-coral-dim); color: var(--accent-coral); border: 1px solid rgba(232, 93, 76, 0.16); }
.badge-amber { background: var(--accent-amber-dim); color: var(--accent-amber); border: 1px solid rgba(217, 119, 6, 0.15); }
.badge-emerald { background: var(--accent-emerald-dim); color: var(--accent-emerald); border: 1px solid rgba(5, 150, 105, 0.15); }
.badge-gray { background: #f1f5f9; color: var(--text-muted); border: 1px solid var(--border-subtle); }
.badge-red { background: var(--accent-rose-dim); color: var(--accent-rose); border: 1px solid rgba(225, 29, 72, 0.15); }

/* ── Table ── */
.table-wrap { overflow-x: auto; }

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.data-table thead {
    background: var(--bg-input);
    border-bottom: 1px solid var(--border-subtle);
}

.data-table th {
    text-align: left;
    padding: 0.75rem 1.25rem;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.data-table td {
    padding: 0.875rem 1.25rem;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-subtle);
}

.data-table tbody tr { transition: background 0.15s; }
.data-table tbody tr:hover { background: var(--bg-card-hover); cursor: pointer; }
.data-table tbody tr:last-child td { border-bottom: none; }

.data-table-group-header td {
    background: var(--bg-subtle, #f8fafc);
    border-bottom: 1px solid var(--border-subtle);
    border-top: 1px solid var(--border-subtle);
    padding: 0.625rem 1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    user-select: none;
}

.data-table-group-header:hover td {
    background: var(--bg-card-hover, #f1f5f9);
}

.data-table-group-chevron {
    display: inline-flex;
    vertical-align: middle;
    margin-right: 0.375rem;
    color: var(--text-muted);
    transition: transform 0.15s ease;
}

.data-table-group-chevron.is-open {
    transform: rotate(90deg);
}

.data-table-group-link {
    color: inherit;
    text-decoration: none;
}

.data-table-group-link:hover {
    color: var(--accent, #2563eb);
    text-decoration: underline;
}

.data-table-group-count {
    margin-left: 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
}

.data-table-cell-stack > * + * {
    margin-top: 0.25rem;
}

.data-table-cell-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Forms ── */
.form-group { margin-bottom: 1rem; }

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.375rem;
}

.form-input {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    color: var(--text-primary);
    background: var(--bg-input);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius);
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--border-accent);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(232, 93, 76, 0.12);
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 640px) { .form-grid-2 { grid-template-columns: 1fr; } }

/* ── Misc ── */
.stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.375rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1rem 1.125rem;
    box-shadow: var(--shadow-card);
}

.list-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    background: var(--bg-input);
    margin-bottom: 0.5rem;
}

a.list-item.my-work-item {
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
}

a.list-item.my-work-item:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}

.my-work-item-content {
    flex: 1;
    min-width: 0;
}

.my-work-item-date {
    flex-shrink: 0;
    white-space: nowrap;
}

.stage-list-item {
    align-items: center;
}

.stage-list-item .code-tag {
    flex-shrink: 0;
    align-self: center;
}

.stage-list-content {
    flex: 1;
    min-width: 0;
}

.stage-list-name {
    font-weight: 500;
    font-size: 0.875rem;
}

.stage-list-delete {
    flex-shrink: 0;
    align-self: center;
    color: #dc2626;
}

.stage-list-item--overdue {
    border-color: rgba(225, 29, 72, 0.25);
    background: var(--accent-rose-dim);
}

.stage-overdue-badge {
    margin-left: 0.375rem;
    font-size: 0.625rem;
    padding: 0.1875rem 0.5rem;
    vertical-align: middle;
}

.stage-list-meta .stage-overdue-badge {
    text-transform: none;
    letter-spacing: normal;
}

.attention-card-footer {
    display: flex;
    justify-content: flex-end;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border-subtle);
}

.overdue-stage-date {
    color: var(--accent-rose);
    font-weight: 600;
}

.filter-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(225, 29, 72, 0.2);
    border-radius: var(--radius);
    background: var(--accent-rose-dim);
    color: var(--accent-rose);
    font-size: 0.875rem;
    font-weight: 500;
}

.table-link {
    color: inherit;
    text-decoration: none;
}

.table-link:hover {
    color: var(--accent-coral);
    text-decoration: underline;
}

.stage-list-meta {
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.25rem 0;
}

.stage-list-meta-divider {
    display: inline-block;
    width: 1px;
    height: 0.875rem;
    background: var(--border-subtle);
    margin: 0 0.5rem;
    flex-shrink: 0;
}

.project-item {
    display: block;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    background: var(--bg-card);
    text-decoration: none;
    color: inherit;
    margin-bottom: 0.75rem;
    transition: background 0.2s, border-color 0.2s;
}

.project-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-accent);
}

.log-item {
    padding: 0.625rem 0 0.625rem 1rem;
    border-left: 2px solid rgba(232, 93, 76, 0.25);
    margin-bottom: 0.5rem;
}

.log-item:hover { border-left-color: var(--accent-coral); }

/* ── Composition (product BOM) ── */
.composition-list-header,
.composition-card-main {
    display: grid;
    grid-template-columns: minmax(4.5rem, 6rem) minmax(0, 2fr) minmax(5.5rem, 6.5rem) minmax(7rem, 9rem) 2.25rem;
    gap: 0.75rem 1rem;
    align-items: center;
    padding-left: 1rem;
    padding-right: 1rem;
}

.composition-list-header {
    padding-top: 0;
    padding-bottom: 0.5rem;
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.composition-list {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

.composition-card {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    background: var(--bg-input);
    overflow: hidden;
}

.composition-card-main {
    padding-top: 0.875rem;
    padding-bottom: 0.875rem;
}

.composition-cell-code,
.composition-cell-name {
    min-width: 0;
}

.composition-code-link {
    display: inline-block;
    text-decoration: none;
    color: inherit;
}

.composition-module-link {
    display: block;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.composition-module-link:hover .composition-module-title {
    color: var(--accent-coral);
}

.composition-module-title {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.35;
    transition: color 0.15s;
    min-width: 0;
}

.composition-module-responsible {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.composition-cell-label {
    display: none;
    font-size: 0.625rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.composition-cell-person {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.composition-firmware-input {
    width: 100%;
    font-size: 0.8125rem;
    padding: 0.375rem 0.5rem;
}

.composition-progress .progress-header {
    margin-bottom: 0.2rem;
}

.composition-progress .progress-pct {
    font-size: 0.6875rem;
}

.composition-progress .progress-track {
    height: 4px;
}

.composition-details {
    border-top: 1px solid var(--border-subtle);
    padding: 0.75rem 1rem 0.875rem;
    background: var(--bg-input);
}

.composition-details-title {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.composition-detail-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.3125rem 0;
    font-size: 0.8125rem;
}

.composition-detail-row + .composition-detail-row {
    border-top: 1px solid var(--border-subtle);
}

.composition-doc-row {
    font-size: 0.8125rem;
    padding: 0.25rem 0;
    color: var(--text-secondary);
}

.composition-add-form {
    display: grid;
    grid-template-columns: minmax(0, 2fr) 5rem minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: end;
    padding: 0.875rem 1rem;
    margin-bottom: 0.75rem;
    border: 1px dashed var(--border-medium);
    border-radius: var(--radius);
    background: var(--bg-input);
}

.composition-releases-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.composition-release-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.75rem 0;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.composition-release-group + .composition-release-group {
    margin-top: 0.75rem;
}

.composition-release-os {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.composition-release-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-subtle);
}

.composition-release-row:last-child {
    border-bottom: none;
}

.composition-release-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.5rem;
    min-width: 0;
}

.composition-release-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    justify-content: flex-end;
    flex-shrink: 0;
}

.work-task-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.work-task-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
}

.work-task-row:last-child {
    border-bottom: none;
}

.work-task-row--muted {
    cursor: pointer;
    opacity: 0.75;
}

.work-task-main {
    flex: 1;
    min-width: 0;
}

.work-task-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.work-task-status-select {
    max-width: 9rem;
    padding: 0.2rem 0.4rem;
    font-size: 0.75rem;
}

.work-task-completed {
  margin-top: 0.5rem;
}

.purchase-module-scope {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 0.375rem;
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 600;
  border: 1px solid #bfdbfe;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

@media (max-width: 768px) {
    .composition-list-header {
        display: none;
    }

    .composition-card-main {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }

    .composition-cell-code { grid-column: 1; grid-row: 1; }
    .composition-cell-name { grid-column: 1 / -1; grid-row: 2; }
    .composition-cell-actions { grid-column: 2; grid-row: 1; justify-self: end; align-self: start; }

    .composition-cell-label { display: block; }

    .composition-add-form {
        grid-template-columns: 1fr;
    }
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.text-muted { color: var(--text-muted); }
.text-coral { color: var(--accent-coral); }
.text-primary { color: var(--text-primary); }
.text-sm { font-size: 0.875rem; }

.reclamation-description {
    font-size: 0.9375rem;
    color: var(--text-primary);
    line-height: 1.6;
    white-space: pre-wrap;
}

.formatted-text {
    white-space: pre-wrap;
}
.text-xs { font-size: 0.75rem; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.gap-actions { display: flex; gap: 0.75rem; margin-top: 1.5rem; }

@media (max-width: 1024px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

.section-heading {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 1.25rem;
}

.section-heading::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-subtle);
}

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #dc2626;
    color: #fff;
    padding: 1rem 1.5rem;
    z-index: 1000;
}

#blazor-error-ui.show { display: block; }

/* Legacy stat helpers */
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
@media (min-width: 1024px) { .stats-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1280px) { .stats-grid { grid-template-columns: repeat(6, 1fr); } }
.stat-value { font-size: 1.75rem; font-weight: 700; color: var(--text-primary); }
.stat-value.blue { color: var(--accent-coral); }
.stat-value.green { color: var(--accent-emerald); }
.stat-value.amber { color: var(--accent-amber); }
.stat-value.red { color: var(--accent-rose); }

/* ── Account / Manage ── */
.account-page {
    max-width: 56rem;
}

.account-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .account-layout {
        grid-template-columns: 220px 1fr;
        gap: 2rem;
    }
}

.account-nav {
    list-style: none;
    margin: 0;
    padding: 0;
}

.account-nav-item { margin-bottom: 0.25rem; }

.account-nav-link {
    display: block;
    padding: 0.5625rem 0.875rem;
    border-radius: var(--radius);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}

.account-nav-link:hover {
    background: var(--accent-coral-dim);
    color: var(--text-primary);
}

.account-nav-link.active {
    background: var(--accent-coral-dim);
    color: var(--accent-coral);
    border: 1px solid rgba(232, 93, 76, 0.14);
}

.account-content {
    min-width: 0;
}

.account-form-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    max-width: 32rem;
    box-shadow: var(--shadow-card);
}

.account-section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 1.25rem;
}

.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}

.alert-success {
    background: rgba(52, 211, 153, 0.1);
    color: #34d399;
    border-color: rgba(52, 211, 153, 0.2);
}

.alert-danger {
    background: rgba(248, 113, 113, 0.1);
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.2);
}

.alert-warning {
    background: rgba(251, 191, 36, 0.1);
    color: #fbbf24;
    border-color: rgba(251, 191, 36, 0.2);
}

.validation-message,
.text-danger {
    color: #f87171 !important;
    font-size: 0.8125rem;
    margin-top: 0.25rem;
}

.form-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.account-info-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.account-info-row strong {
    color: var(--text-primary);
    font-weight: 500;
}

/* ── Auth (login) ── */
.auth-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1.25rem;
    background-color: var(--bg-page);
}

.auth-container {
    width: 100%;
    max-width: 26rem;
}

.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 1.75rem;
    text-decoration: none;
}

.auth-brand-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

.auth-brand-sub {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-card);
}

.auth-title {
    margin: 0 0 0.375rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
}

.auth-subtitle {
    margin: 0 0 1.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
    text-align: center;
    line-height: 1.5;
}

.auth-check {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.auth-check input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--accent-coral);
    cursor: pointer;
}

.auth-submit {
    width: 100%;
    padding: 0.625rem 1rem;
    font-size: 0.9375rem;
}

.auth-alt-btn {
    width: 100%;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.25rem 0;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: lowercase;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-subtle);
}

.auth-links {
    display: flex;
    justify-content: center;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-subtle);
}

.auth-links a {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.15s;
}

.auth-links a:hover {
    color: var(--accent-coral);
}

.auth-demo {
    margin-top: 1.25rem;
    padding: 0.875rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: calc(var(--radius) - 4px);
}

.auth-demo-title {
    margin: 0 0 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.auth-demo-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
}

.auth-demo-list .text-muted {
    display: inline-block;
    min-width: 5.5rem;
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}

.auth-demo-note {
    margin: 0.5rem 0 0;
    font-size: 0.6875rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.auth-hint {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--text-muted);
    line-height: 1.5;
    text-align: center;
}

.btn-link {
    background: none;
    border: none;
    color: var(--accent-coral);
    font-size: 0.8125rem;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    font-family: inherit;
}

.btn-link:hover { color: #d94a32; }

.stage-due-date-wrap {
    position: relative;
    display: inline;
}

.stage-date-link {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    font: inherit;
    font-size: inherit;
    font-weight: 600;
    color: var(--accent-coral);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.stage-date-link:hover {
    color: #d94a32;
}

.stage-date-input-hidden {
    position: absolute;
    left: 0;
    top: 100%;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    border: 0;
    padding: 0;
    margin: 0;
}

.stage-due-date-readonly {
    font-size: inherit;
    color: inherit;
}

.stage-status--not-started {
    color: var(--text-muted);
}

.stage-status--not-started:hover {
    color: #64748b;
}

.stage-status--in-progress {
    color: var(--accent-coral);
}

.stage-status--in-progress:hover {
    color: #d94a32;
}

.stage-status--completed {
    color: var(--accent-emerald);
}

.stage-status--completed:hover {
    color: #047857;
}

.stage-status--blocked {
    color: var(--accent-rose);
}

.stage-status--blocked:hover {
    color: #be123c;
}

.stage-status-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
}

.stage-status-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    z-index: 50;
    min-width: 10rem;
    padding: 0.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);
}

.stage-status-option {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.375rem 0.625rem;
    border: none;
    background: none;
    font: inherit;
    font-size: 0.8125rem;
    color: var(--text-primary);
    border-radius: 0.25rem;
    cursor: pointer;
}

.stage-status-option:hover {
    background: var(--accent-coral-dim);
}

.stage-status-option.active {
    font-weight: 600;
    background: var(--bg-input);
}

.btn-danger {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
    border: 1px solid rgba(248, 113, 113, 0.3);
}

.btn-danger:hover {
    background: rgba(248, 113, 113, 0.25);
}

.confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: confirm-overlay-in 0.22s ease-out;
}

@keyframes confirm-overlay-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

body:has(.confirm-overlay) .app-sidebar,
body:has(.confirm-overlay) .topbar,
body:has(.confirm-overlay) .mobile-header,
body:has(.topbar-notify-backdrop) .app-sidebar,
body:has(.topbar-notify-backdrop) .topbar,
body:has(.topbar-notify-backdrop) .mobile-header,
body:has(.undo-toast) .app-sidebar,
body:has(.undo-toast) .topbar,
body:has(.undo-toast) .mobile-header {
    z-index: 1;
}

.confirm-dialog {
    position: relative;
    width: 100%;
    max-width: 28rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    box-shadow:
        0 24px 48px rgba(15, 23, 42, 0.16),
        0 8px 16px rgba(15, 23, 42, 0.08);
    overflow: hidden;
    animation: confirm-dialog-in 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes confirm-dialog-in {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.confirm-dialog-accent {
    height: 4px;
    background: linear-gradient(90deg, var(--accent-coral), #ff8a65);
}

.confirm-dialog--danger .confirm-dialog-accent {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

.confirm-dialog--warning .confirm-dialog-accent {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.confirm-dialog-header {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 1rem 1.25rem 0;
}

.confirm-dialog-illustration {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 4.5rem;
    height: 4.5rem;
    margin: 0 auto 1.125rem;
}

.confirm-dialog-illustration::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    opacity: 0.9;
}

.confirm-dialog-illustration svg {
    position: relative;
    width: 2.125rem;
    height: 2.125rem;
}

.confirm-dialog--danger .confirm-dialog-illustration {
    color: #dc2626;
}

.confirm-dialog--danger .confirm-dialog-illustration::before {
    background: radial-gradient(circle, rgba(239, 68, 68, 0.16) 0%, rgba(239, 68, 68, 0.04) 55%, transparent 72%);
}

.confirm-dialog--warning .confirm-dialog-illustration {
    color: #d97706;
}

.confirm-dialog--warning .confirm-dialog-illustration::before {
    background: radial-gradient(circle, rgba(245, 158, 11, 0.18) 0%, rgba(245, 158, 11, 0.05) 55%, transparent 72%);
}

.confirm-dialog-content {
    padding: 0 1.5rem 1.5rem;
    text-align: center;
}

.confirm-dialog-title {
    margin: 0 0 0.625rem;
    font-size: 1.25rem;
    font-weight: 800;
    line-height: 1.3;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.confirm-dialog-message {
    margin: 0;
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    text-align: center;
}

.confirm-dialog-close {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    margin: -0.25rem -0.25rem 0 0;
    padding: 0;
    border: 1px solid var(--border-subtle);
    border-radius: 9999px;
    background: var(--bg-input);
    color: var(--text-muted);
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.15s;
}

.confirm-dialog-close:hover {
    background: #fff;
    color: var(--text-primary);
    border-color: var(--border-medium);
    transform: scale(1.04);
}

.confirm-dialog-close svg {
    width: 1rem;
    height: 1rem;
}

.confirm-dialog-details {
    margin-top: 1.125rem;
    padding: 1rem 1.125rem;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    text-align: left;
}

.confirm-dialog-details-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.confirm-dialog-details-label svg {
    width: 0.9375rem;
    height: 0.9375rem;
    color: var(--accent-coral);
}

.confirm-dialog-details-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.confirm-dialog-details-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    font-size: 0.9375rem;
    line-height: 1.45;
    color: var(--text-primary);
}

.confirm-dialog-details-list li::before {
    content: "";
    flex-shrink: 0;
    width: 0.4375rem;
    height: 0.4375rem;
    margin-top: 0.5em;
    border-radius: 50%;
    background: var(--accent-coral);
}

.confirm-dialog-note {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-top: 1.125rem;
    padding: 0.875rem 1rem;
    background: var(--accent-coral-dim);
    border: 1px solid rgba(232, 93, 76, 0.14);
    border-radius: 14px;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--text-secondary);
    text-align: left;
}

.confirm-dialog-note svg {
    flex-shrink: 0;
    width: 1.125rem;
    height: 1.125rem;
    margin-top: 0.125rem;
    color: var(--accent-coral);
}

.confirm-dialog-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem 1.5rem 1.5rem;
    border-top: 1px solid var(--border-subtle);
    background: linear-gradient(180deg, transparent, rgba(241, 245, 249, 0.65));
}

.confirm-dialog-cancel {
    min-width: 6.5rem;
}

.confirm-dialog-confirm {
    min-width: 6.5rem;
    border: none;
    color: #fff;
    font-weight: 700;
    transition: transform 0.15s, box-shadow 0.2s, background 0.2s;
}

.confirm-dialog-confirm:hover {
    transform: translateY(-1px);
}

.confirm-dialog-confirm--danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 4px 14px rgba(220, 38, 38, 0.28);
}

.confirm-dialog-confirm--danger:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.34);
}

.confirm-dialog-confirm--warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 4px 14px rgba(217, 119, 6, 0.28);
}

.confirm-dialog-confirm--warning:hover {
    background: linear-gradient(135deg, #d97706, #b45309);
    box-shadow: 0 6px 20px rgba(217, 119, 6, 0.34);
}

@media (max-width: 480px) {
    .confirm-dialog-actions {
        flex-direction: column-reverse;
    }

    .confirm-dialog-cancel,
    .confirm-dialog-confirm {
        width: 100%;
        min-width: 0;
    }
}

.undo-toast {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 1010;
    display: flex;
    flex-direction: column;
    max-width: min(28rem, calc(100vw - 2.5rem));
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card-hover);
    overflow: hidden;
    animation: undo-toast-in 0.2s ease;
}

.undo-toast-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
}

.undo-toast-message {
    flex: 1;
    font-size: 0.875rem;
    color: var(--text-primary);
    line-height: 1.4;
}

.undo-toast-progress {
    height: 3px;
    background: var(--accent-coral);
    transform-origin: left center;
    animation: undo-toast-progress var(--undo-duration, 3s) linear forwards;
}

@keyframes undo-toast-progress {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

.undo-toast-action {
    flex-shrink: 0;
    padding: 0.375rem 0.75rem;
    background: var(--accent-coral-dim);
    border: 1px solid rgba(232, 93, 76, 0.2);
    border-radius: calc(var(--radius) - 4px);
    color: var(--accent-coral);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.undo-toast-action:hover {
    background: rgba(232, 93, 76, 0.16);
}

@keyframes undo-toast-in {
    from {
        opacity: 0;
        transform: translateY(0.5rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Document add mode ── */
.doc-add-mode {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1.25rem;
    font-size: 0.875rem;
}

.doc-add-mode-option {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.document-title-link {
    color: var(--text-primary);
    text-decoration: none;
}

.document-title-link:hover {
    color: var(--accent-coral);
    text-decoration: underline;
}

/* ── PDF documents ── */
.pdf-document-viewer {
    overflow: hidden;
}

.pdf-document-frame {
    display: block;
    width: 100%;
    min-height: calc(100vh - 12rem);
    border: none;
    background: #fff;
}

/* ── Markdown documents ── */
.markdown-doc-body {
    min-height: 12rem;
}

.markdown-editor {
    width: 100%;
    min-height: 28rem;
    padding: 1rem 1.125rem;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    background: var(--bg-page);
    color: var(--text-primary);
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    resize: vertical;
}

.markdown-editor:focus {
    outline: none;
    border-color: var(--accent-coral);
    box-shadow: 0 0 0 3px var(--accent-coral-dim);
}

.markdown-body {
    color: var(--text-primary);
    font-size: 0.9375rem;
    line-height: 1.7;
    max-width: 48rem;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.3;
    margin: 1.5rem 0 0.75rem;
}

.markdown-body h1 { font-size: 1.75rem; margin-top: 0; }
.markdown-body h2 { font-size: 1.375rem; border-bottom: 1px solid var(--border-subtle); padding-bottom: 0.35rem; }
.markdown-body h3 { font-size: 1.125rem; }

.markdown-body p,
.markdown-body ul,
.markdown-body ol,
.markdown-body blockquote,
.markdown-body pre {
    margin: 0 0 1rem;
}

.markdown-body ul,
.markdown-body ol {
    padding-left: 1.5rem;
}

.markdown-body blockquote {
    border-left: 3px solid var(--accent-coral);
    padding-left: 1rem;
    color: var(--text-muted);
}

.markdown-body code {
    font-family: "JetBrains Mono", ui-monospace, monospace;
    font-size: 0.85em;
    background: var(--bg-page);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 0.1em 0.35em;
}

.markdown-body pre {
    background: var(--bg-page);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius);
    padding: 1rem;
    overflow-x: auto;
}

.markdown-body pre code {
    background: none;
    border: none;
    padding: 0;
}

.markdown-body a {
    color: var(--accent-coral);
    text-decoration: underline;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.markdown-body th,
.markdown-body td {
    border: 1px solid var(--border-subtle);
    padding: 0.5rem 0.75rem;
    text-align: left;
}

.markdown-body th {
    background: var(--bg-page);
    font-weight: 600;
}
