/* ==========================================================================
   GZPM — light theme design system
   ========================================================================== */

@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2");
}

:root {
    color-scheme: light;

    --bg: #f6f7fb;
    --surface: #ffffff;
    --surface-2: #f9fafc;
    --border: #e7e9f0;
    --border-strong: #d6dae3;

    --text: #0f172a;
    --text-2: #334155;
    --muted: #64748b;
    --faint: #94a3b8;

    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-ring: rgba(79, 70, 229, .18);

    --danger: #dc2626;
    --danger-50: #fef2f2;
    --success: #059669;
    --success-50: #ecfdf5;
    --warning: #d97706;
    --info: #2563eb;

    /* Status palette */
    --backlog: #64748b;   --backlog-bg: #f1f5f9;
    --today: #d97706;     --today-bg: #fef3c7;     --today-text: #92400e;
    --progress: #2563eb;  --progress-bg: #dbeafe;  --progress-text: #1e40af;
    --done: #059669;      --done-bg: #d1fae5;      --done-text: #065f46;

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow-xs: 0 1px 2px rgba(15, 23, 42, .04);
    --shadow-sm: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .03);
    --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, .08), 0 2px 4px -2px rgba(15, 23, 42, .04);
    --shadow-lg: 0 24px 48px -12px rgba(15, 23, 42, .18);

    --sidebar-w: 252px;
    --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font: 14px/1.55 var(--font);
    font-feature-settings: "cv11", "ss01";
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
h1, h2, h3 { margin: 0; color: var(--text); letter-spacing: -.015em; }
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.05rem; font-weight: 650; }
h3 { font-size: .95rem; font-weight: 600; }
p { margin: 0 0 12px; }
svg.icon { flex-shrink: 0; vertical-align: middle; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Utilities ---------- */
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: .82rem; }
.strong { font-weight: 600; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-wrap; }
.stack > * + * { margin-top: 20px; }
.hstack { display: flex; align-items: center; gap: 10px; }
.spacer { flex: 1; }
.req { color: var(--danger); }
.danger-text { color: var(--danger); }

/* ==========================================================================
   App shell
   ========================================================================== */
.shell { display: flex; min-height: 100vh; }

.sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 40;
    width: var(--sidebar-w);
    display: flex; flex-direction: column;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 20px 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 22px; color: var(--text); font-weight: 750; font-size: 1.1rem; letter-spacing: -.02em; }
.brand:hover { color: var(--text); }
.logo {
    display: grid; place-items: center;
    width: 34px; height: 34px; border-radius: 10px;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 45%, #7c3aed 100%);
    color: #fff; font-weight: 800; font-size: 1rem;
    box-shadow: 0 6px 14px -4px rgba(79, 70, 229, .55), inset 0 1px 0 rgba(255,255,255,.25);
}
.brand small { display: block; font-size: .7rem; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-top: -2px; }

.nav-label { padding: 18px 10px 6px; font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.nav a {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 10px; margin-bottom: 2px;
    border-radius: 8px;
    color: var(--text-2); font-weight: 500;
    transition: background .15s, color .15s;
}
.nav a .icon { color: var(--faint); transition: color .15s; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a:hover .icon { color: var(--muted); }
.nav a.active { background: var(--primary-50); color: var(--primary); font-weight: 600; }
.nav a.active .icon { color: var(--primary); }

.sidebar-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--border); }
.user-card { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; }
.user-card .who { min-width: 0; flex: 1; }
.user-card .name { font-weight: 600; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card .role { font-size: .75rem; color: var(--muted); }
.icon-btn {
    display: inline-grid; place-items: center;
    width: 34px; height: 34px; border-radius: 8px;
    border: 0; background: transparent; color: var(--muted); cursor: pointer;
    transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); }
.content { max-width: 1240px; margin: 0 auto; padding: 32px 36px 56px; }

/* Mobile top bar + off-canvas sidebar (CSS-only toggle) */
.mobile-bar { display: none; }
#nav-toggle { display: none; }
.scrim { display: none; }

/* ==========================================================================
   Page header
   ========================================================================== */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 26px; }
.page-header .eyebrow { font-size: .78rem; font-weight: 600; color: var(--primary); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 6px; }
.page-header p { margin: 6px 0 0; color: var(--muted); }
.page-header .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.breadcrumb { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 500; font-size: .85rem; margin-bottom: 14px; }
.breadcrumb:hover { color: var(--text); }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 38px; padding: 0 16px;
    border: 1px solid transparent; border-radius: 8px;
    font: inherit; font-weight: 600; font-size: .875rem; line-height: 1;
    cursor: pointer; white-space: nowrap;
    transition: background .15s, border-color .15s, box-shadow .15s, color .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--primary-ring); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(79,70,229,.3), inset 0 1px 0 rgba(255,255,255,.12); }
.btn-primary:hover { background: var(--primary-hover); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--text-2); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: var(--surface-2); color: var(--text); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #047857; color: #fff; }
.btn-sm { height: 30px; padding: 0 11px; font-size: .8rem; border-radius: 7px; }
.btn-lg { height: 44px; padding: 0 20px; font-size: .95rem; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); cursor: pointer; font-weight: 500; }
.link-btn.danger { color: var(--danger); }
.link-btn:hover { text-decoration: underline; }
form.inline { display: inline; margin: 0; }

/* ==========================================================================
   Cards & panels
   ========================================================================== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-body { padding: 22px 24px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 24px; border-bottom: 1px solid var(--border); }
.card-header p { margin: 2px 0 0; font-size: .82rem; color: var(--muted); }
.card-footer { padding: 14px 24px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main-side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.grid-side-form { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }

/* ==========================================================================
   KPI / stat tiles
   ========================================================================== */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi {
    position: relative; overflow: hidden;
    display: block; padding: 18px 20px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm); color: inherit;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
a.kpi:hover { color: inherit; border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.kpi-label { font-size: .8rem; font-weight: 600; color: var(--muted); }
.kpi-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; }
.kpi-value { font-size: 1.85rem; font-weight: 750; letter-spacing: -.03em; line-height: 1.1; }
.kpi-sub { margin-top: 4px; font-size: .78rem; color: var(--muted); }
.kpi::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--accent, transparent); opacity: .85; }

.tone-backlog  { --accent: var(--backlog); }
.tone-today    { --accent: var(--today); }
.tone-progress { --accent: var(--progress); }
.tone-done     { --accent: var(--done); }
.tone-backlog .kpi-icon  { background: var(--backlog-bg); color: var(--backlog); }
.tone-today .kpi-icon    { background: var(--today-bg); color: var(--today); }
.tone-progress .kpi-icon { background: var(--progress-bg); color: var(--progress); }
.tone-done .kpi-icon     { background: var(--done-bg); color: var(--done); }

/* Highlight metrics row */
.highlights { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.highlight { padding: 20px 22px; }
.highlight-feature {
    background:
        radial-gradient(600px 200px at 100% 0%, rgba(124, 58, 237, .10), transparent 60%),
        linear-gradient(135deg, #eef2ff 0%, #ffffff 70%);
    border-color: var(--primary-100);
}
.big-number { font-size: 2.2rem; font-weight: 750; letter-spacing: -.035em; line-height: 1.05; }
.big-number small { font-size: 1rem; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-left: 2px; }

/* Progress bars */
.progress { height: 8px; background: #eef0f5; border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #6366f1, #4f46e5); }
.progress.thin { height: 6px; }
.progress.success > span { background: linear-gradient(90deg, #34d399, #059669); }
.stacked-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: #eef0f5; gap: 2px; }
.stacked-bar span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: .8rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* ==========================================================================
   Status pills, badges, avatars, chips
   ========================================================================== */
.status {
    display: inline-flex; align-items: center; gap: 6px;
    height: 24px; padding: 0 10px 0 8px;
    border-radius: 999px; font-size: .76rem; font-weight: 600; white-space: nowrap;
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-backlog     { background: var(--backlog-bg); color: var(--backlog); }
.status-today       { background: var(--today-bg); color: var(--today-text); }
.status-today::before { background: var(--today); }
.status-in_progress { background: var(--progress-bg); color: var(--progress-text); }
.status-in_progress::before { background: var(--progress); }
.status-completed   { background: var(--done-bg); color: var(--done-text); }
.status-completed::before { background: var(--done); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-backlog { background: var(--backlog); } .dot-today { background: var(--today); }
.dot-in_progress { background: var(--progress); } .dot-completed { background: var(--done); }

.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 6px; font-size: .74rem; font-weight: 600; background: #f1f5f9; color: var(--text-2); }
.badge-admin    { background: #f3e8ff; color: #7e22ce; }
.badge-employee { background: #e0f2fe; color: #0369a1; }
.badge-external { background: #ffedd5; color: #c2410c; }
.badge-success  { background: var(--success-50); color: var(--success); }
.badge-muted    { background: #f1f5f9; color: var(--muted); }

.avatar {
    display: inline-grid; place-items: center; flex-shrink: 0;
    width: 30px; height: 30px; border-radius: 50%;
    font-size: .72rem; font-weight: 700; letter-spacing: .02em;
    color: #fff; box-shadow: 0 0 0 2px #fff;
}
.avatar-sm { width: 24px; height: 24px; font-size: .62rem; }
.avatar-lg { width: 38px; height: 38px; font-size: .82rem; }
.avatar-0 { background: linear-gradient(135deg, #818cf8, #4f46e5); }
.avatar-1 { background: linear-gradient(135deg, #f472b6, #db2777); }
.avatar-2 { background: linear-gradient(135deg, #34d399, #059669); }
.avatar-3 { background: linear-gradient(135deg, #fbbf24, #d97706); }
.avatar-4 { background: linear-gradient(135deg, #60a5fa, #2563eb); }
.avatar-5 { background: linear-gradient(135deg, #a78bfa, #7c3aed); }
.avatar-empty { background: #f1f5f9; color: var(--faint); box-shadow: 0 0 0 1px var(--border) inset; }
.avatar-stack { display: flex; }
.avatar-stack .avatar + .avatar { margin-left: -8px; }
.person { display: inline-flex; align-items: center; gap: 9px; min-width: 0; }
.person .name { font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.chip { display: inline-flex; align-items: center; gap: 5px; font-size: .78rem; color: var(--muted); font-weight: 500; white-space: nowrap; }
.chip.overdue { color: var(--danger); }
.chip.project { color: var(--text-2); }

/* ==========================================================================
   Tables
   ========================================================================== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 16px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--border); }
th:first-child, td:first-child { padding-left: 24px; }
th:last-child, td:last-child { padding-right: 24px; }
th { font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); }
tbody tr { transition: background .12s; }
tbody tr:hover { background: #fafbff; }
tbody tr:last-child td { border-bottom: 0; }
.task-title { font-weight: 600; color: var(--text); }
.task-title:hover { color: var(--primary); }
.cell-sub { display: block; font-size: .78rem; color: var(--muted); margin-top: 2px; font-weight: 400; }

/* ==========================================================================
   Toolbar: tabs, filters, view switch
   ========================================================================== */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs { display: flex; gap: 4px; padding: 4px; background: #eef0f5; border-radius: 10px; overflow-x: auto; }
.tabs a {
    display: inline-flex; align-items: center; gap: 7px;
    height: 32px; padding: 0 12px; border-radius: 7px;
    color: var(--muted); font-weight: 600; font-size: .82rem; white-space: nowrap;
}
.tabs a:hover { color: var(--text); }
.tabs a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.tabs .count { font-size: .72rem; padding: 1px 7px; border-radius: 999px; background: rgba(100,116,139,.12); color: var(--muted); }
.tabs a.active .count { background: var(--primary-50); color: var(--primary); }

.filters { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filters select { width: auto; min-width: 150px; height: 36px; padding-top: 0; padding-bottom: 0; }

.segmented { display: inline-flex; padding: 3px; background: #eef0f5; border-radius: 9px; }
.segmented a { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 7px; color: var(--muted); font-weight: 600; font-size: .82rem; }
.segmented a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.pager { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; border-top: 1px solid var(--border); font-size: .85rem; }

/* ==========================================================================
   Kanban board
   ========================================================================== */
.board { display: grid; grid-template-columns: repeat(4, minmax(250px, 1fr)); gap: 16px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.column { background: #eff1f6; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 12px; min-height: 240px; }
.column-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 12px; font-weight: 650; font-size: .88rem; }
.column-head .count { margin-left: auto; font-size: .75rem; font-weight: 600; color: var(--muted); background: var(--surface); border: 1px solid var(--border); padding: 1px 8px; border-radius: 999px; }
.column-empty { padding: 26px 10px; text-align: center; color: var(--faint); font-size: .82rem; border: 1.5px dashed var(--border-strong); border-radius: var(--radius); }
.task-card {
    display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 13px 14px; margin-bottom: 10px; box-shadow: var(--shadow-xs);
    transition: box-shadow .15s, border-color .15s, transform .15s;
}
.task-card:hover { box-shadow: var(--shadow-md); border-color: var(--border-strong); transform: translateY(-1px); }
.task-card .project-name { font-size: .72rem; font-weight: 600; color: var(--primary); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 5px; }
.task-card .title { display: block; color: var(--text); font-weight: 600; line-height: 1.4; margin-bottom: 12px; }
.task-card .title:hover { color: var(--primary); }
.task-card .meta { display: flex; align-items: center; gap: 10px; }
.task-card .meta .spacer { flex: 1; }
.task-card .actions { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--border); }

/* ==========================================================================
   Lists (dashboard "my tasks", project list)
   ========================================================================== */
.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 14px; padding: 14px 24px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { display: block; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .title:hover { color: var(--primary); }
.list-item .sub { display: flex; gap: 12px; margin-top: 3px; flex-wrap: wrap; }

.project-row { padding: 14px 24px; border-bottom: 1px solid var(--border); }
.project-row:last-child { border-bottom: 0; }
.project-row .top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.project-row .name { font-weight: 600; color: var(--text); }
.project-row .pct { font-size: .8rem; font-weight: 600; color: var(--muted); }

/* Project cards grid */
.project-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.project-card { display: flex; flex-direction: column; padding: 20px; color: inherit; transition: box-shadow .15s, border-color .15s, transform .15s; }
.project-card:hover { color: inherit; box-shadow: var(--shadow-md); border-color: var(--border-strong); transform: translateY(-1px); }
.project-card .head { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.project-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; font-weight: 750; color: #fff; }
.project-card .desc { color: var(--muted); font-size: .85rem; min-height: 2.6em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.project-card .foot { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); font-size: .8rem; color: var(--muted); }

/* ==========================================================================
   Task detail: workflow stepper + details list
   ========================================================================== */
.stepper { display: flex; align-items: center; margin: 4px 0 22px; }
.step { display: flex; align-items: center; gap: 9px; flex: 1; }
.step:last-child { flex: 0; }
.step-dot {
    display: grid; place-items: center; flex-shrink: 0;
    width: 30px; height: 30px; border-radius: 50%;
    border: 2px solid var(--border-strong); background: var(--surface); color: var(--faint);
    font-size: .75rem; font-weight: 700;
}
.step-label { font-size: .8rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.step-line { flex: 1; height: 2px; background: var(--border-strong); margin: 0 10px; border-radius: 2px; }
.step.done .step-dot { background: var(--primary); border-color: var(--primary); color: #fff; }
.step.done .step-line { background: var(--primary); }
.step.current .step-dot { border-color: var(--primary); color: var(--primary); box-shadow: 0 0 0 5px var(--primary-ring); }
.step.current .step-label { color: var(--text); }
.step.done .step-label { color: var(--text-2); }

.action-panel { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; padding: 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }
.action-panel .field { margin: 0; }
.action-panel .text { flex: 1; min-width: 200px; }
.action-panel .text strong { display: block; font-size: .9rem; }

.details { margin: 0; }
.details div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.details div:last-child { border-bottom: 0; }
.details dt { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .85rem; }
.details dd { margin: 0; font-weight: 500; text-align: right; }
.description { color: var(--text-2); line-height: 1.7; white-space: pre-wrap; }

/* ==========================================================================
   Forms
   ========================================================================== */
.field { margin-bottom: 16px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
label, .label { display: block; margin-bottom: 6px; font-weight: 600; font-size: .82rem; color: var(--text-2); }
.hint { display: block; margin-top: 6px; font-size: .78rem; color: var(--muted); }
.field-error { display: block; margin-top: 6px; font-size: .78rem; color: var(--danger); font-weight: 500; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="date"], select, textarea {
    width: 100%; height: 40px; padding: 0 12px;
    font: inherit; font-size: .9rem; color: var(--text);
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: 8px;
    box-shadow: var(--shadow-xs);
    transition: border-color .15s, box-shadow .15s;
}
textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 96px; line-height: 1.55; }
select {
    appearance: none; padding-right: 34px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: #c3c9d5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ring); }
.input-icon { position: relative; }
.input-icon > .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.input-icon input { padding-left: 38px; }
.input-short { max-width: 160px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; }
.role-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.role-option { position: relative; }
.role-option input { position: absolute; opacity: 0; }
.role-option span {
    display: block; padding: 10px 12px; border: 1px solid var(--border-strong); border-radius: 8px;
    font-weight: 600; font-size: .82rem; text-align: center; cursor: pointer; color: var(--text-2);
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.role-option span small { display: block; font-weight: 500; font-size: .7rem; color: var(--muted); margin-top: 2px; }
.role-option input:checked + span { border-color: var(--primary); background: var(--primary-50); color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.role-option input:focus-visible + span { box-shadow: 0 0 0 4px var(--primary-ring); }

/* ==========================================================================
   Alerts / toasts
   ========================================================================== */
.alerts { display: grid; gap: 10px; margin-bottom: 20px; }
.alert {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 12px 14px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
    font-weight: 500; animation: alert-in .25s ease-out;
}
.alert .icon { margin-top: 1px; }
.alert .grow { flex: 1; }
.alert ul { margin: 0; padding-left: 18px; }
.alert-success { border-left: 4px solid var(--success); } .alert-success .icon { color: var(--success); }
.alert-info    { border-left: 4px solid var(--info); }    .alert-info .icon { color: var(--info); }
.alert-error   { border-left: 4px solid var(--danger); background: #fffafa; } .alert-error .icon { color: var(--danger); }
.alert .close { margin: -6px -6px -6px 0; width: 28px; height: 28px; }
.alert.hide { opacity: 0; transform: translateY(-4px); transition: opacity .3s, transform .3s; }
@keyframes alert-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   Empty states
   ========================================================================== */
.empty { text-align: center; padding: 48px 24px; }
.empty-icon { display: inline-grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: var(--primary-50); color: var(--primary); margin-bottom: 14px; }
.empty h3 { margin-bottom: 4px; }
.empty p { color: var(--muted); max-width: 360px; margin: 0 auto 16px; }

/* ==========================================================================
   Guest (login / error) layout
   ========================================================================== */
.auth { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; background: var(--surface); }
.auth-hero {
    position: relative; overflow: hidden;
    display: flex; flex-direction: column; justify-content: space-between;
    padding: 44px 56px;
    background:
        radial-gradient(520px 380px at 12% 8%, rgba(129, 140, 248, .28), transparent 65%),
        radial-gradient(560px 420px at 92% 88%, rgba(196, 181, 253, .35), transparent 62%),
        linear-gradient(160deg, #f5f7ff 0%, #eef0ff 45%, #f7f3ff 100%);
    border-right: 1px solid var(--border);
}
.auth-hero::before {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background-image: linear-gradient(rgba(79,70,229,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(79,70,229,.06) 1px, transparent 1px);
    background-size: 36px 36px;
    -webkit-mask-image: radial-gradient(ellipse at 40% 40%, #000 20%, transparent 75%);
            mask-image: radial-gradient(ellipse at 40% 40%, #000 20%, transparent 75%);
}
.auth-hero > * { position: relative; }
.auth-hero h1 { font-size: 2.5rem; line-height: 1.12; letter-spacing: -.035em; font-weight: 750; max-width: 520px; }
.auth-hero h1 .grad { background: linear-gradient(90deg, #4f46e5, #7c3aed); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-hero .lead { font-size: 1.05rem; color: var(--text-2); max-width: 470px; margin: 16px 0 30px; }
.features { display: grid; gap: 14px; max-width: 460px; }
.feature { display: flex; gap: 14px; align-items: flex-start; }
.feature-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: #fff; color: var(--primary); box-shadow: var(--shadow-sm); border: 1px solid var(--primary-100); flex-shrink: 0; }
.feature strong { display: block; font-size: .92rem; }
.feature span { color: var(--muted); font-size: .85rem; }

/* Product preview card on the hero */
.preview {
    margin-top: 34px; max-width: 470px;
    background: rgba(255,255,255,.85); backdrop-filter: blur(6px);
    border: 1px solid rgba(224, 231, 255, .9); border-radius: 16px;
    box-shadow: var(--shadow-lg); padding: 16px;
}
.preview-row { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--border); }
.preview-row:last-child { border-bottom: 0; }
.preview-row .bar { height: 8px; border-radius: 6px; background: #e2e8f0; }
.preview-row .grow { flex: 1; }
.hero-foot { font-size: .8rem; color: var(--muted); }

.auth-panel { display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.auth-box { width: 100%; max-width: 400px; }
.auth-box .brand { padding: 0 0 34px; }
.auth-box h2 { font-size: 1.6rem; font-weight: 750; letter-spacing: -.03em; }
.auth-box .sub { color: var(--muted); margin: 6px 0 28px; }
.auth-box .secure-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 22px; font-size: .78rem; color: var(--faint); }

.center-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.error-card { max-width: 440px; text-align: center; padding: 40px 36px; }
.error-code { font-size: 3.4rem; font-weight: 800; letter-spacing: -.05em; background: linear-gradient(135deg, #6366f1, #7c3aed); -webkit-background-clip: text; background-clip: text; color: transparent; line-height: 1; margin-bottom: 10px; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1100px) {
    .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .highlights { grid-template-columns: 1fr 1fr; }
    .highlight-feature { grid-column: 1 / -1; }
    .grid-main-side, .grid-side-form { grid-template-columns: 1fr; }
    .board { grid-template-columns: repeat(4, 270px); }
}
@media (max-width: 960px) {
    .auth { grid-template-columns: 1fr; }
    .auth-hero { display: none; }
}
@media (max-width: 860px) {
    .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
    #nav-toggle:checked ~ .sidebar { transform: none; }
    #nav-toggle:checked ~ .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(15, 23, 42, .3); }
    .main { margin-left: 0; }
    .mobile-bar {
        display: flex; align-items: center; justify-content: space-between;
        position: sticky; top: 0; z-index: 20;
        padding: 10px 16px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px);
        border-bottom: 1px solid var(--border);
    }
    .mobile-bar .brand { padding: 0; }
    .content { padding: 22px 16px 40px; }
    .grid-2, .grid-3, .field-row { grid-template-columns: 1fr; }
    .highlights { grid-template-columns: 1fr; }
    .role-options { grid-template-columns: 1fr; }
    .stepper .step-label { display: none; }
    h1 { font-size: 1.35rem; }
}
@media (max-width: 520px) {
    .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
    .kpi { padding: 14px; }
    .kpi-value { font-size: 1.5rem; }
    .hide-sm { display: none; }
    .filters select { min-width: 0; flex: 1; }
}

/* Width steps (CSP forbids inline styles) */
.w-0 { width: 0%; }
.w-5 { width: 5%; }
.w-10 { width: 10%; }
.w-15 { width: 15%; }
.w-20 { width: 20%; }
.w-25 { width: 25%; }
.w-30 { width: 30%; }
.w-35 { width: 35%; }
.w-40 { width: 40%; }
.w-45 { width: 45%; }
.w-50 { width: 50%; }
.w-55 { width: 55%; }
.w-60 { width: 60%; }
.w-65 { width: 65%; }
.w-70 { width: 70%; }
.w-75 { width: 75%; }
.w-80 { width: 80%; }
.w-85 { width: 85%; }
.w-90 { width: 90%; }
.w-95 { width: 95%; }
.w-100 { width: 100%; }
.error-card { margin: 40px auto; }
.error-text { margin: 8px 0 20px; }
.tone-danger .kpi-icon { background: var(--danger-50); color: var(--danger); }
.top-gap { margin-top: 14px; }
.top-gap-sm { margin-top: 8px; }

/* Review tweaks */
.btn-success-soft { background: var(--success-50); color: var(--success); border-color: #a7f3d0; }
.btn-success-soft:hover { background: #d1fae5; color: #047857; }
.avatar-stack .avatar + .avatar { margin-left: -5px; }
@media (min-width: 961px) { .auth-box .brand { display: none; } }
.label-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.label-row label { margin-bottom: 0; }
.center-text { text-align: center; }
.auth-box .empty-icon { margin-bottom: 18px; }

/* Task type badges + module chips */
.type { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: .74rem; font-weight: 600; white-space: nowrap; vertical-align: middle; }
.type-task  { background: var(--primary-50); color: var(--primary); }
.type-issue { background: var(--danger-50); color: var(--danger); }
.type-compact { width: 22px; padding: 0; justify-content: center; }
.title-line { display: flex; align-items: center; gap: 8px; min-width: 0; }
.chip.module { color: var(--text-2); }

/* Segmented radio picker (task type) */
.choice-group { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; }
.choice > span {
    display: flex; align-items: center; gap: 10px; padding: 10px 12px;
    border: 1px solid var(--border-strong); border-radius: 8px; cursor: pointer;
    font-weight: 600; font-size: .85rem; color: var(--text-2);
    transition: border-color .15s, background .15s, box-shadow .15s;
}
.choice > span small { display: block; font-weight: 500; font-size: .72rem; color: var(--muted); }
.choice .type { height: 28px; width: 28px; padding: 0; justify-content: center; }
.choice input:checked + span { border-color: var(--primary); background: var(--primary-50); box-shadow: 0 0 0 3px var(--primary-ring); color: var(--text); }
.choice input[value="issue"]:checked + span { border-color: var(--danger); background: #fffafa; box-shadow: 0 0 0 3px rgba(220, 38, 38, .14); }
.choice input:focus-visible + span { box-shadow: 0 0 0 4px var(--primary-ring); }

/* Modules list on the project page */
.module-row .count-pill { font-size: .75rem; font-weight: 600; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.inline-form { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 10px; align-items: start; }
.inline-form .btn { height: 40px; }
@media (max-width: 860px) { .inline-form { grid-template-columns: 1fr; } }
.tone-module.kpi-icon { background: var(--primary-50); color: var(--primary); width: 32px; height: 32px; }
.top-gap-lg { margin-top: 20px; }
.module-row .grow .small { display: block; margin-top: 1px; }
.readonly-field { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 12px; border: 1px dashed var(--border-strong); border-radius: 8px; background: var(--surface-2); color: var(--text-2); font-weight: 500; }
.count-pill { font-size: .75rem; font-weight: 600; color: var(--muted); background: var(--surface-2); border: 1px solid var(--border); padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.card-header .filters select { min-width: 180px; }
.revert-bar { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 12px; }

/* Activity timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.tl-item { position: relative; display: flex; gap: 14px; padding-bottom: 18px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item:not(:last-child)::before { content: ""; position: absolute; left: 13px; top: 30px; bottom: 2px; width: 2px; background: var(--border); border-radius: 2px; }
.tl-marker { position: relative; z-index: 1; flex-shrink: 0; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--border); }
.tl-created     { background: var(--primary-50); color: var(--primary); }
.tl-assigned    { background: #f3e8ff; color: #7e22ce; }
.tl-reverted    { background: #fff7ed; color: #c2410c; }
.tl-backlog     { background: var(--backlog-bg); color: var(--backlog); }
.tl-today       { background: var(--today-bg); color: var(--today); }
.tl-in_progress { background: var(--progress-bg); color: var(--progress); }
.tl-completed   { background: var(--done-bg); color: var(--done); }
.tl-body { min-width: 0; padding-top: 3px; }
.tl-text { color: var(--text-2); line-height: 1.5; }
.tl-text .strong { color: var(--text); }
.tl-time { display: block; margin-top: 2px; font-size: .76rem; color: var(--faint); }

/* Reports */
.report-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: 0 14px; align-items: start; }
.report-form .report-submit { padding-top: 22px; }
.report-form .report-submit .btn { height: 40px; }
.tone-danger .kpi-icon { background: var(--danger-50); color: var(--danger); }
.kpi.tone-danger { --accent: var(--danger); }
@media (max-width: 1100px) { .report-form { grid-template-columns: 1fr 1fr; } .report-form .report-submit { padding-top: 0; } }
@media (max-width: 520px)  { .report-form { grid-template-columns: 1fr; } }

/* Show/hide password toggle */
.input-icon.has-toggle input { padding-right: 44px; }
.pw-toggle {
    position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    display: grid; place-items: center; width: 34px; height: 32px;
    border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer;
    transition: background .15s, color .15s;
}
.pw-toggle[hidden] { display: none; }
.pw-toggle:hover { background: var(--surface-2); color: var(--text); }
.pw-toggle:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); }
.pw-toggle .when-shown { display: none; }
.pw-toggle[aria-pressed="true"] .when-shown { display: block; }
.pw-toggle[aria-pressed="true"] .when-hidden { display: none; }
/* Hide the browser's own reveal button (Edge) so there's only one. */
input[type="password"]::-ms-reveal { display: none; }
