/* Laari ProjectSphere — design system (light). Dark overrides live in dark.css, phone rules in mobile.css. */
:root {
  --ps-navy-900: #070e24;
  --ps-navy-800: #0b1530;
  --ps-navy-700: #121f45;
  --ps-navy-600: #1b2a5a;
  --ps-purple: #6d5bf6;
  --ps-purple-600: #5a47e6;
  --ps-blue: #2f7cf6;
  --ps-blue-600: #1f66db;
  --ps-gradient: linear-gradient(135deg, #6d5bf6 0%, #2f7cf6 100%);
  --ps-success: #16a34a;
  --ps-warning: #d97706;
  --ps-danger: #dc2626;
  --ps-info: #0284c7;

  --ps-bg: #f3f5fb;
  --ps-bg-glow-1: rgba(109, 91, 246, .16);
  --ps-bg-glow-2: rgba(47, 124, 246, .14);
  --ps-surface: rgba(255, 255, 255, .78);
  --ps-surface-solid: #ffffff;
  --ps-surface-2: rgba(246, 247, 252, .9);
  --ps-border: rgba(15, 23, 42, .08);
  --ps-border-strong: rgba(15, 23, 42, .14);
  --ps-glass-edge: rgba(255, 255, 255, .7);
  --ps-text: #0f172a;
  --ps-text-2: #475569;
  --ps-text-3: #64748b;
  --ps-shadow-sm: 0 1px 2px rgba(15, 23, 42, .05), 0 2px 8px rgba(15, 23, 42, .04);
  --ps-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 12px 32px -8px rgba(15, 23, 42, .12);
  --ps-shadow-lg: 0 24px 64px -16px rgba(15, 23, 42, .25);
  --ps-radius-sm: 12px;
  --ps-radius: 20px;
  --ps-radius-lg: 24px;
  --ps-sidebar-w: 268px;
  --ps-topbar-h: 68px;
  --ps-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --ps-ease: cubic-bezier(.2, .8, .2, 1);

  --bs-body-font-family: var(--ps-font);
  --bs-body-color: var(--ps-text);
  --bs-body-bg: var(--ps-bg);
  --bs-primary: #6d5bf6;
  --bs-primary-rgb: 109, 91, 246;
  --bs-link-color: var(--ps-purple-600);
  --bs-link-color-rgb: 90, 71, 230;
  --bs-link-hover-color: var(--ps-blue-600);
  --bs-border-color: var(--ps-border-strong);
  --bs-secondary-color: var(--ps-text-3);
}

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: var(--ps-font);
  color: var(--ps-text);
  background:
    radial-gradient(900px 600px at 85% -10%, var(--ps-bg-glow-1), transparent 60%),
    radial-gradient(800px 600px at -10% 110%, var(--ps-bg-glow-2), transparent 60%),
    var(--ps-bg);
  background-attachment: fixed;
  min-height: 100vh;
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6 { letter-spacing: -0.022em; font-weight: 650; color: var(--ps-text); }
a { text-decoration: none; }
.text-2 { color: var(--ps-text-2) !important; }
.text-3 { color: var(--ps-text-3) !important; }
.nowrap { white-space: nowrap; }
.visually-hidden-focusable:focus { position: fixed; top: 8px; left: 8px; z-index: 2000; background: var(--ps-surface-solid); padding: 8px 14px; border-radius: 10px; }

/* ---------- Glass panels (spatial UI) ---------- */
.glass {
  background: var(--ps-surface);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid var(--ps-glass-edge);
  box-shadow: var(--ps-shadow);
  border-radius: var(--ps-radius);
}
.panel, .kpi {
  background: var(--ps-surface);
  -webkit-backdrop-filter: blur(22px) saturate(160%);
  backdrop-filter: blur(22px) saturate(160%);
  border: 1px solid var(--ps-glass-edge);
  box-shadow: var(--ps-shadow);
  border-radius: var(--ps-radius);
}
.panel { padding: 22px 24px; }
.panel + .panel { margin-top: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.panel-title { font-size: 1.02rem; font-weight: 650; margin: 0; display: flex; align-items: center; gap: 8px; }
.panel-title svg { width: 18px; height: 18px; color: var(--ps-purple); }
.panel-sub { color: var(--ps-text-3); font-size: .86rem; margin: 2px 0 0; }

/* ---------- KPI tiles ---------- */
.kpi { padding: 18px 20px; height: 100%; display: flex; flex-direction: column; gap: 6px; transition: transform .25s var(--ps-ease), box-shadow .25s var(--ps-ease); }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--ps-shadow-lg); }
.kpi-label { color: var(--ps-text-3); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; display: flex; align-items: center; gap: 8px; }
.kpi-icon { width: 34px; height: 34px; border-radius: 11px; display: inline-grid; place-items: center; background: rgba(109, 91, 246, .12); color: var(--ps-purple); flex: none; }
.kpi-icon svg { width: 18px; height: 18px; }
.kpi-icon.blue { background: rgba(47, 124, 246, .12); color: var(--ps-blue); }
.kpi-icon.green { background: rgba(22, 163, 74, .12); color: var(--ps-success); }
.kpi-icon.amber { background: rgba(217, 119, 6, .12); color: var(--ps-warning); }
.kpi-icon.red { background: rgba(220, 38, 38, .12); color: var(--ps-danger); }
.kpi-value { font-size: 1.85rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-foot { color: var(--ps-text-3); font-size: .82rem; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--ps-sidebar-w);
  flex: none;
  position: sticky; top: 0; height: 100vh;
  background: linear-gradient(180deg, var(--ps-navy-800) 0%, var(--ps-navy-900) 100%);
  color: #cbd5f5;
  display: flex; flex-direction: column;
  padding: 18px 14px;
  z-index: 1040;
  border-right: 1px solid rgba(255, 255, 255, .04);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 10px 18px; color: #fff; }
.brand:hover { color: #fff; }
.brand-mark { width: 38px; height: 38px; border-radius: 12px; background: var(--ps-gradient); display: grid; place-items: center; font-weight: 800; font-size: 1.15rem; color: #fff; box-shadow: 0 8px 20px -6px rgba(109, 91, 246, .7); flex: none; }
.brand-text { line-height: 1.05; }
.brand-name { font-weight: 800; letter-spacing: .14em; font-size: .95rem; }
.brand-sub { font-size: .66rem; letter-spacing: .26em; color: #93a3d8; font-weight: 600; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; }
.sidebar .sidebar-close { display: none; }
.nav-filter { margin: 0 6px 12px; position: relative; display: none; }
.nav-filter input { width: 100%; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .1); background: rgba(255, 255, 255, .06); color: #fff; padding: 9px 12px 9px 36px; font-size: 16px; }
.nav-filter input::placeholder { color: #8b9ad0; }
.nav-filter svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: #8b9ad0; }
.nav-scroll { flex: 1; overflow-y: auto; margin: 0 -6px; padding: 0 6px; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.12) transparent; }
.nav-section { margin-bottom: 18px; }
.nav-section-title { font-size: .68rem; text-transform: uppercase; letter-spacing: .14em; color: #7d8bc0; font-weight: 700; padding: 0 12px 8px; }
.nav-link-ps { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: #c3cdf0; font-size: .92rem; font-weight: 500; transition: background .2s var(--ps-ease), color .2s var(--ps-ease); }
.nav-link-ps svg { width: 18px; height: 18px; flex: none; opacity: .9; }
.nav-link-ps:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-link-ps.active { background: linear-gradient(135deg, rgba(109, 91, 246, .9), rgba(47, 124, 246, .85)); color: #fff; box-shadow: 0 8px 22px -10px rgba(109, 91, 246, .9); }
.nav-link-ps.soon { color: #7280b3; cursor: default; }
.nav-link-ps.soon:hover { background: transparent; color: #7280b3; }
.soon-badge { margin-left: auto; font-size: .64rem; font-weight: 700; letter-spacing: .04em; padding: 2px 7px; border-radius: 99px; background: rgba(255, 255, 255, .07); color: #8f9cd0; white-space: nowrap; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 16px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .06); margin-top: 10px; }
.sidebar-user .who { min-width: 0; }
.sidebar-user .name { color: #fff; font-weight: 600; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .org { color: #8b9ad0; font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 36px; height: 36px; border-radius: 12px; background: var(--ps-gradient); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .82rem; flex: none; }
.avatar.sm { width: 30px; height: 30px; border-radius: 10px; font-size: .72rem; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 1030;
  min-height: var(--ps-topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 12px 28px;
  background: color-mix(in srgb, var(--ps-bg) 72%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid var(--ps-border);
}
.topbar-title { min-width: 0; flex: 1; }
.topbar-title h1 { font-size: 1.28rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-title .crumb { font-size: .78rem; color: var(--ps-text-3); }
.topbar-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; display: inline-grid; place-items: center;
  border: 1px solid var(--ps-border); background: var(--ps-surface); color: var(--ps-text-2);
  transition: background .2s var(--ps-ease), color .2s var(--ps-ease), transform .15s var(--ps-ease);
  cursor: pointer; padding: 0;
}
.icon-btn:hover { color: var(--ps-purple); background: var(--ps-surface-solid); }
.icon-btn:active { transform: scale(.96); }
.icon-btn svg { width: 19px; height: 19px; }
.menu-btn, .back-btn { display: none; }
.theme-toggle .when-dark { display: none; }
[data-theme="dark"] .theme-toggle .when-dark { display: inline; }
[data-theme="dark"] .theme-toggle .when-light { display: none; }
.content { padding: 26px 28px 40px; flex: 1; width: 100%; max-width: 1440px; }
.footer-note { color: var(--ps-text-3); font-size: .78rem; padding: 0 28px 24px; }

.user-menu .dropdown-menu { border-radius: 16px; border: 1px solid var(--ps-border); box-shadow: var(--ps-shadow-lg); padding: 8px; min-width: 240px; background: var(--ps-surface-solid); }
.user-menu .dropdown-item { border-radius: 10px; padding: 9px 12px; display: flex; align-items: center; gap: 10px; color: var(--ps-text); }
.user-menu .dropdown-item svg { width: 16px; height: 16px; color: var(--ps-text-3); }
.user-menu .dropdown-item:hover { background: var(--ps-surface-2); }
.user-menu .dropdown-header { color: var(--ps-text-3); }

/* ---------- Buttons & forms ---------- */
.btn { border-radius: 12px; font-weight: 600; padding: .6rem 1.05rem; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .15s var(--ps-ease), box-shadow .2s var(--ps-ease), background .2s var(--ps-ease); }
.btn svg { width: 17px; height: 17px; }
.btn:active { transform: scale(.98); }
.btn-primary, .btn-gradient { background: var(--ps-gradient); border: 0; color: #fff; box-shadow: 0 10px 24px -12px rgba(109, 91, 246, .9); }
.btn-primary:hover, .btn-gradient:hover { color: #fff; filter: brightness(1.06); box-shadow: 0 14px 28px -12px rgba(109, 91, 246, 1); }
.btn-soft { background: var(--ps-surface-2); border: 1px solid var(--ps-border); color: var(--ps-text); }
.btn-soft:hover { background: var(--ps-surface-solid); color: var(--ps-purple); }
.btn-danger-soft { background: rgba(220, 38, 38, .1); color: var(--ps-danger); border: 1px solid rgba(220, 38, 38, .2); }
.btn-danger-soft:hover { background: rgba(220, 38, 38, .16); color: var(--ps-danger); }
.btn-success-soft { background: rgba(22, 163, 74, .1); color: var(--ps-success); border: 1px solid rgba(22, 163, 74, .2); }
.form-label { font-weight: 600; font-size: .86rem; color: var(--ps-text-2); margin-bottom: 6px; }
.form-control, .form-select {
  border-radius: 12px; border: 1px solid var(--ps-border-strong); background-color: var(--ps-surface-solid);
  color: var(--ps-text); padding: .65rem .9rem; font-size: 16px;
  transition: border-color .2s var(--ps-ease), box-shadow .2s var(--ps-ease);
}
.form-control:focus, .form-select:focus { border-color: var(--ps-purple); box-shadow: 0 0 0 4px rgba(109, 91, 246, .15); background-color: var(--ps-surface-solid); color: var(--ps-text); }
.form-check-input:checked { background-color: var(--ps-purple); border-color: var(--ps-purple); }
.invalid-feedback { display: block; }
.form-hint { font-size: .8rem; color: var(--ps-text-3); margin-top: 4px; }
.search-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.search-row .search-box { position: relative; flex: 1 1 240px; min-width: 0; }
.search-row .search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--ps-text-3); }
.search-row .search-box input { padding-left: 38px; }
.search-row .form-select { flex: 0 1 190px; width: auto; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -8px; padding: 0 8px; }
.table-ps { width: 100%; margin: 0; border-collapse: separate; border-spacing: 0; }
.table-ps th { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ps-text-3); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--ps-border); white-space: nowrap; background: transparent; }
.table-ps td { padding: 13px 12px; border-bottom: 1px solid var(--ps-border); vertical-align: middle; color: var(--ps-text); background: transparent; }
.table-ps tr:last-child td { border-bottom: 0; }
.table-ps tbody tr { transition: background .15s; }
.table-ps tbody tr:hover td { background: rgba(109, 91, 246, .04); }
.table-ps .num, .table-ps .date, .table-ps .code { white-space: nowrap; font-variant-numeric: tabular-nums; }
.cell-user { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.cell-user .name { font-weight: 600; }
.cell-user .sub { font-size: .8rem; color: var(--ps-text-3); }

/* ---------- Badges, chips, progress ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 650; padding: 4px 10px; border-radius: 99px; background: var(--ps-surface-2); color: var(--ps-text-2); border: 1px solid var(--ps-border); white-space: nowrap; }
.chip.purple { background: rgba(109, 91, 246, .12); color: var(--ps-purple-600); border-color: rgba(109, 91, 246, .2); }
.chip.blue { background: rgba(47, 124, 246, .12); color: var(--ps-blue-600); border-color: rgba(47, 124, 246, .2); }
.chip.green { background: rgba(22, 163, 74, .12); color: #15803d; border-color: rgba(22, 163, 74, .22); }
.chip.amber { background: rgba(217, 119, 6, .12); color: #b45309; border-color: rgba(217, 119, 6, .22); }
.chip.red { background: rgba(220, 38, 38, .1); color: #b91c1c; border-color: rgba(220, 38, 38, .2); }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.meter { height: 8px; border-radius: 99px; background: var(--ps-surface-2); border: 1px solid var(--ps-border); overflow: hidden; }
.meter > span { display: block; height: 100%; width: 0; border-radius: 99px; background: var(--ps-gradient); transition: width .8s var(--ps-ease); }
.meter.warn > span { background: linear-gradient(90deg, #f59e0b, #dc2626); }
.usage-row + .usage-row { margin-top: 16px; }
.usage-row .top { display: flex; justify-content: space-between; gap: 10px; font-size: .88rem; margin-bottom: 6px; }
.usage-row .top .val { color: var(--ps-text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Lists ---------- */
.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-list li { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--ps-border); }
.activity-list li:last-child { border-bottom: 0; }
.activity-dot { width: 32px; height: 32px; border-radius: 10px; background: rgba(109, 91, 246, .1); color: var(--ps-purple); display: grid; place-items: center; flex: none; }
.activity-dot svg { width: 16px; height: 16px; }
.activity-body { min-width: 0; }
.activity-body .what { font-size: .9rem; font-weight: 550; }
.activity-body .meta { font-size: .78rem; color: var(--ps-text-3); }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.check { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--ps-border-strong); flex: none; color: transparent; }
.check svg { width: 14px; height: 14px; }
.check.done { background: var(--ps-gradient); border-color: transparent; color: #fff; }
.checklist .done-text { color: var(--ps-text-3); text-decoration: line-through; }
.empty { text-align: center; padding: 36px 16px; color: var(--ps-text-3); }
.empty svg { width: 38px; height: 38px; color: var(--ps-purple); opacity: .6; margin-bottom: 10px; }
.dl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 24px; margin: 0; }
.dl-grid dt { font-size: .76rem; color: var(--ps-text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.dl-grid dd { margin: 3px 0 0; font-weight: 550; overflow-wrap: anywhere; }

.hero-card { background: linear-gradient(135deg, var(--ps-navy-700), var(--ps-navy-800) 60%, #1d1756); color: #fff; border-radius: var(--ps-radius-lg); padding: 26px 28px; position: relative; overflow: hidden; box-shadow: var(--ps-shadow-lg); }
.hero-card::after { content: ""; position: absolute; width: 380px; height: 380px; right: -120px; top: -160px; border-radius: 50%; background: radial-gradient(circle, rgba(109, 91, 246, .55), transparent 65%); pointer-events: none; }
.hero-card h2 { color: #fff; font-size: 1.45rem; margin: 0 0 6px; position: relative; }
.hero-card p { color: #b9c4ee; margin: 0; position: relative; }
.hero-card .chip { position: relative; background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .16); }
.hero-actions { position: relative; display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.hero-actions .btn-soft { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .18); }
.hero-actions .btn-soft:hover { background: rgba(255, 255, 255, .18); color: #fff; }

.role-card { padding: 18px; border-radius: 16px; border: 1px solid var(--ps-border); background: var(--ps-surface-2); height: 100%; }
.role-card h3 { font-size: .98rem; margin: 0; }
.perm-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 220px; }

/* ---------- Flash toasts ---------- */
.toast-stack { position: fixed; top: 84px; right: 22px; z-index: 1090; display: flex; flex-direction: column; gap: 10px; max-width: min(420px, calc(100vw - 32px)); }
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 13px 14px; border-radius: 16px; background: var(--ps-surface-solid); border: 1px solid var(--ps-border); box-shadow: var(--ps-shadow-lg); font-size: .9rem; animation: flash-in .35s var(--ps-ease); }
.flash svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.flash.success svg { color: var(--ps-success); } .flash.danger svg { color: var(--ps-danger); }
.flash.warning svg { color: var(--ps-warning); } .flash.info svg { color: var(--ps-info); }
.flash .x { margin-left: auto; background: none; border: 0; color: var(--ps-text-3); padding: 0 2px; cursor: pointer; }
.flash.hide { opacity: 0; transform: translateY(-6px); transition: all .3s var(--ps-ease); }
@keyframes flash-in { from { opacity: 0; transform: translateY(-8px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Pagination ---------- */
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; font-size: .86rem; color: var(--ps-text-3); }
.pager .btns { display: flex; gap: 8px; }

/* ---------- Help assistant ---------- */
.help-fab { position: fixed; right: 22px; bottom: 22px; z-index: 1060; width: 56px; height: 56px; border-radius: 18px; border: 0; background: var(--ps-gradient); color: #fff; display: grid; place-items: center; box-shadow: 0 16px 34px -12px rgba(109, 91, 246, .9); cursor: pointer; transition: transform .2s var(--ps-ease); }
.help-fab:hover { transform: translateY(-2px); }
.help-fab svg { width: 24px; height: 24px; }
.help-panel { position: fixed; right: 22px; bottom: 90px; z-index: 1061; width: 380px; max-width: calc(100vw - 32px); height: 520px; max-height: calc(100vh - 130px); display: none; flex-direction: column; overflow: hidden; background: var(--ps-surface-solid); border: 1px solid var(--ps-border); border-radius: var(--ps-radius-lg); box-shadow: var(--ps-shadow-lg); }
.help-panel.open { display: flex; animation: flash-in .25s var(--ps-ease); }
.help-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--ps-border); }
.help-head .title { font-weight: 700; font-size: .95rem; flex: 1; }
.help-head .icon-btn { width: 34px; height: 34px; }
.help-body { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 88%; padding: 10px 13px; border-radius: 16px; font-size: .9rem; line-height: 1.45; white-space: pre-line; }
.msg.bot { background: var(--ps-surface-2); border: 1px solid var(--ps-border); align-self: flex-start; border-bottom-left-radius: 6px; }
.msg.me { background: var(--ps-gradient); color: #fff; align-self: flex-end; border-bottom-right-radius: 6px; }
.msg .msg-title { font-weight: 700; display: block; margin-bottom: 4px; }
.msg .msg-note { display: block; margin-top: 6px; font-size: .8rem; color: var(--ps-text-3); }
.msg a.msg-link { display: inline-flex; margin-top: 8px; font-weight: 600; }
.help-suggest { display: flex; gap: 8px; overflow-x: auto; padding: 0 16px 10px; scrollbar-width: none; }
.help-suggest::-webkit-scrollbar { display: none; }
.help-suggest button { flex: none; border: 1px solid var(--ps-border); background: var(--ps-surface-2); color: var(--ps-text-2); border-radius: 99px; padding: 6px 12px; font-size: .8rem; white-space: nowrap; cursor: pointer; }
.help-suggest button:hover { color: var(--ps-purple); }
.help-form { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--ps-border); }
.help-form input { flex: 1; min-width: 0; }
.help-privacy { font-size: .72rem; color: var(--ps-text-3); padding: 0 16px 10px; }

/* ---------- Public & auth pages ---------- */
.public-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 28px; max-width: 1200px; margin: 0 auto; flex-wrap: wrap; }
.public-nav .brand { color: var(--ps-text); padding: 0; }
.public-nav .brand-sub { color: var(--ps-text-3); }
.public-nav .tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.landing-hero { max-width: 1100px; margin: 0 auto; padding: 56px 28px 40px; text-align: center; }
.landing-hero .eyebrow { display: inline-flex; gap: 8px; align-items: center; white-space: normal; max-width: 100%; text-align: left; }
.landing-hero .eyebrow svg { width: 15px; height: 15px; flex: none; }
.landing-hero h1 { font-size: clamp(2.1rem, 5vw, 3.6rem); font-weight: 750; letter-spacing: -0.04em; line-height: 1.04; margin: 18px 0 16px; }
.gradient-text { background: var(--ps-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.landing-hero .lead { color: var(--ps-text-2); max-width: 680px; margin: 0 auto; font-size: 1.12rem; }
.landing-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 28px; }
.section { max-width: 1200px; margin: 0 auto; padding: 36px 28px; }
.section-title { text-align: center; margin-bottom: 26px; }
.section-title h2 { font-size: 1.9rem; letter-spacing: -0.03em; }
.feature { padding: 22px; height: 100%; }
.feature .kpi-icon { margin-bottom: 12px; }
.feature h3 { font-size: 1.02rem; margin-bottom: 6px; }
.feature p { color: var(--ps-text-2); font-size: .92rem; margin: 0; }
.plan-card { padding: 26px; height: 100%; display: flex; flex-direction: column; }
.plan-card.featured { border: 2px solid var(--ps-purple); box-shadow: 0 24px 60px -24px rgba(109, 91, 246, .6); }
.plan-card .price { font-size: 2.2rem; font-weight: 750; letter-spacing: -0.03em; }
.plan-card .price small { font-size: .9rem; color: var(--ps-text-3); font-weight: 500; }
.plan-card ul { list-style: none; padding: 0; margin: 18px 0 24px; flex: 1; }
.plan-card li { display: flex; gap: 10px; padding: 6px 0; font-size: .92rem; color: var(--ps-text-2); }
.plan-card li svg { width: 17px; height: 17px; color: var(--ps-purple); flex: none; margin-top: 2px; }
.site-footer { text-align: center; color: var(--ps-text-3); font-size: .84rem; padding: 30px 20px 40px; }

/* Sign-in pages: neumorphism + spatial blend */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
.auth-aside { position: relative; overflow: hidden; background: linear-gradient(160deg, var(--ps-navy-700), var(--ps-navy-900)); color: #fff; padding: 44px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-aside::before, .auth-aside::after { content: ""; position: absolute; border-radius: 50%; filter: blur(10px); pointer-events: none; }
.auth-aside::before { width: 460px; height: 460px; right: -140px; top: -120px; background: radial-gradient(circle, rgba(109, 91, 246, .55), transparent 65%); }
.auth-aside::after { width: 420px; height: 420px; left: -160px; bottom: -160px; background: radial-gradient(circle, rgba(47, 124, 246, .45), transparent 65%); }
.auth-aside > * { position: relative; z-index: 1; }
.auth-aside .brand { padding: 0; }
.auth-aside h2 { color: #fff; font-size: clamp(1.8rem, 3vw, 2.6rem); letter-spacing: -0.035em; line-height: 1.08; }
.auth-aside p { color: #b9c4ee; max-width: 460px; }
.auth-points { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 12px; }
.auth-points li { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 16px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .1); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); color: #e2e8ff; font-size: .92rem; }
.auth-points svg { width: 18px; height: 18px; color: #a99cff; flex: none; }
.auth-main { display: flex; flex-direction: column; padding: 24px 32px; }
.auth-main .tools { display: flex; justify-content: flex-end; gap: 8px; }
.auth-card-wrap { flex: 1; display: grid; place-items: center; padding: 20px 0; }
.neu-card {
  width: 100%; max-width: 460px; padding: 34px;
  border-radius: var(--ps-radius-lg);
  background: var(--ps-neu-bg, #eef1f8);
  box-shadow: 14px 14px 32px var(--ps-neu-dark, rgba(163, 177, 204, .55)), -14px -14px 32px var(--ps-neu-light, rgba(255, 255, 255, .95));
  border: 1px solid var(--ps-glass-edge);
}
.neu-card.wide { max-width: 620px; }
.neu-card h1 { font-size: 1.6rem; margin-bottom: 4px; }
.neu-card .sub { color: var(--ps-text-3); margin-bottom: 24px; }
.neu-card .form-control, .neu-card .form-select {
  background-color: var(--ps-neu-bg, #eef1f8); border: 1px solid transparent;
  box-shadow: inset 4px 4px 10px var(--ps-neu-dark, rgba(163, 177, 204, .5)), inset -4px -4px 10px var(--ps-neu-light, rgba(255, 255, 255, .9));
}
.neu-card .form-control:focus, .neu-card .form-select:focus { border-color: var(--ps-purple); box-shadow: inset 3px 3px 8px var(--ps-neu-dark, rgba(163, 177, 204, .5)), 0 0 0 4px rgba(109, 91, 246, .15); }
.neu-card .btn-primary { width: 100%; padding: .8rem 1rem; }
.auth-switch { text-align: center; margin-top: 20px; color: var(--ps-text-3); font-size: .92rem; }
.pw-field { position: relative; }
.pw-field .form-control { padding-right: 48px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--ps-text-3); width: 38px; height: 38px; display: grid; place-items: center; cursor: pointer; }
.pw-toggle svg { width: 18px; height: 18px; }

.error-page { min-height: 70vh; display: grid; place-items: center; text-align: center; padding: 30px; }
.error-code { font-size: 4.5rem; font-weight: 800; letter-spacing: -0.05em; line-height: 1; }

.bottom-tabs { display: none; }
.drawer-overlay { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  html, body, [data-theme="dark"] body { background: #fff !important; color: #000 !important; }
  .sidebar, .topbar, .bottom-tabs, .help-fab, .help-panel, .toast-stack, .drawer-overlay { display: none !important; }
  .panel, .kpi { box-shadow: none !important; border: 1px solid #ddd !important; background: #fff !important; color: #000 !important; }
  * { color: #000 !important; }
}

/* ---------- Stage 2 ---------- */
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.row-actions form { margin: 0; }
.btn-sm { padding: .4rem .7rem; font-size: .8rem; border-radius: 10px; }
.btn-sm svg { width: 15px; height: 15px; }
.narrow-panel { max-width: 860px; }
.crumb a { color: var(--ps-text-3); }
.crumb a:hover { color: var(--ps-purple); }
.edit-details summary { cursor: pointer; font-weight: 600; color: var(--ps-purple-600); display: inline-flex; align-items: center; gap: 8px; list-style: none; }
.edit-details summary::-webkit-details-marker { display: none; }
.edit-details summary svg { width: 16px; height: 16px; }
.announce { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 16px; margin-bottom: 20px; font-size: .92rem; font-weight: 550;
  background: rgba(47, 124, 246, .1); border: 1px solid rgba(47, 124, 246, .25); color: var(--ps-text); }
.announce svg { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--ps-blue); }
.announce.warning { background: rgba(217, 119, 6, .1); border-color: rgba(217, 119, 6, .3); }
.announce.warning svg { color: var(--ps-warning); }
.announce.success { background: rgba(22, 163, 74, .1); border-color: rgba(22, 163, 74, .28); }
.announce.success svg { color: var(--ps-success); }
.credentials { max-width: 760px; }
code.secret { font-size: 1.15rem; padding: 6px 12px; border-radius: 10px; background: var(--ps-surface-2); border: 1px dashed var(--ps-purple); color: var(--ps-text); letter-spacing: .06em; user-select: all; display: inline-block; }
.thread { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.thread-msg { padding: 14px 16px; border-radius: 16px; background: var(--ps-surface-2); border: 1px solid var(--ps-border); }
.thread-msg.staff { background: rgba(109, 91, 246, .07); border-color: rgba(109, 91, 246, .2); }
.thread-msg.internal { background: rgba(217, 119, 6, .07); border: 1px dashed rgba(217, 119, 6, .4); }
.thread-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; font-size: .84rem; }
.thread-meta .who { font-weight: 650; }
.thread-meta .when { margin-left: auto; color: var(--ps-text-3); font-size: .78rem; }
.thread-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; font-size: .94rem; }
.row-actions .btn { white-space: nowrap; }
.avatar svg { width: 16px; height: 16px; }

/* ---------- Stage 3 ---------- */
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.check-tile, .perm-row { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--ps-border); background: var(--ps-surface-2); cursor: pointer; font-size: .9rem; transition: border-color .15s, background .15s; }
.check-tile:hover, .perm-row:hover { border-color: var(--ps-purple); }
.check-tile:has(input:checked), .perm-row:has(input:checked) { border-color: var(--ps-purple); background: rgba(109, 91, 246, .08); }
.check-tile .form-check-input, .perm-row .form-check-input { margin-top: 2px; flex: none; }
.check-tile.locked, .perm-row.locked { opacity: .55; cursor: not-allowed; }
fieldset legend.form-label { font-size: .86rem; float: none; width: auto; }
.perm-modules { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.perm-module { display: flex; flex-direction: column; gap: 8px; margin: 0; }
.perm-module legend { font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ps-text-3); margin-bottom: 4px; float: none; width: auto; }
.dept-card { color: var(--ps-text); transition: transform .2s var(--ps-ease), border-color .2s; }
.dept-card:hover { color: var(--ps-text); transform: translateY(-2px); border-color: var(--ps-purple); }
.copy-row { display: flex; gap: 8px; }
.copy-row .form-control { flex: 1; min-width: 0; font-size: .85rem; }
a.name { color: var(--ps-text); }
a.name:hover { color: var(--ps-purple); }

/* ---------- Stage 4: projects ---------- */
.segmented { display: inline-flex; padding: 4px; border-radius: 14px; background: var(--ps-surface-2); border: 1px solid var(--ps-border); gap: 4px; }
.segmented a { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 10px; font-weight: 600; font-size: .88rem; color: var(--ps-text-2); }
.segmented a svg { width: 16px; height: 16px; }
.segmented a[aria-current="page"] { background: var(--ps-surface-solid); color: var(--ps-purple-600); box-shadow: var(--ps-shadow-sm); }
.chip-toggle { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--ps-border-strong); background: var(--ps-surface-solid); font-size: .88rem; margin: 0; white-space: nowrap; cursor: pointer; }
.chip-toggle .form-check-input { margin: 0; float: none; }
.cat-dot { display: inline-block; width: 12px; height: 12px; border-radius: 4px; background: #94a3b8; flex: none; margin-top: 5px; }
.cat-dot.sm { width: 9px; height: 9px; border-radius: 3px; margin-top: 0; }
.cat-dot.lg { width: 30px; height: 30px; border-radius: 10px; margin-top: 0; }
.progress-line { display: flex; align-items: center; gap: 10px; min-width: 120px; }
.progress-line .meter { flex: 1; }
.progress-line .pct { font-size: .8rem; color: var(--ps-text-3); font-variant-numeric: tabular-nums; min-width: 36px; text-align: right; }
.meter.done > span { background: linear-gradient(90deg, #16a34a, #22c55e); }
.progress-cell { min-width: 150px; }
.cell-project { min-width: 240px; }
.avatar.xs { width: 22px; height: 22px; border-radius: 7px; font-size: .6rem; }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 10px; }
.icon-btn.sm svg { width: 16px; height: 16px; }
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(270px, 1fr); gap: 16px; overflow-x: auto; padding-bottom: 8px; margin-top: 20px; }
.board-col { background: var(--ps-surface-2); border: 1px solid var(--ps-border); border-radius: var(--ps-radius); padding: 12px; min-height: 200px; }
.board-col-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: .9rem; padding: 4px 6px 12px; }
.board-col-head .count { margin-left: auto; font-size: .78rem; color: var(--ps-text-3); background: var(--ps-surface-solid); border-radius: 99px; padding: 1px 9px; border: 1px solid var(--ps-border); }
.board-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ps-text-3); }
.board-dot.planning { background: var(--ps-blue); } .board-dot.active { background: var(--ps-purple); }
.board-dot.on_hold { background: var(--ps-warning); } .board-dot.completed { background: var(--ps-success); }
.board-cards { display: flex; flex-direction: column; gap: 10px; }
.board-card { display: block; padding: 14px; border-radius: 16px; background: var(--ps-surface-solid); border: 1px solid var(--ps-border); color: var(--ps-text); box-shadow: var(--ps-shadow-sm); transition: transform .2s var(--ps-ease), border-color .2s; }
.board-card:hover { color: var(--ps-text); transform: translateY(-2px); border-color: var(--ps-purple); }
.board-empty { color: var(--ps-text-3); font-size: .85rem; text-align: center; padding: 18px 0; }
.project-hero { margin-bottom: 20px; }
.lead-text { font-size: 1.02rem; color: var(--ps-text-2); }
.hero-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 16px 24px; }
.hero-stats .kpi-label { margin-bottom: 6px; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.objectives { padding-left: 1.2rem; margin: 0; display: grid; gap: 6px; }
.timeline { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; }
.timeline li { display: flex; gap: 12px; }
.timeline-body { flex: 1; min-width: 0; padding-bottom: 14px; border-bottom: 1px solid var(--ps-border); }
.timeline li:last-child .timeline-body { border-bottom: 0; }
.update-form { padding: 16px; border-radius: 16px; background: var(--ps-surface-2); border: 1px solid var(--ps-border); }
.dl-grid.one-col { grid-template-columns: 1fr; gap: 12px; }
.kpi-link { color: var(--ps-text); }
.kpi-link:hover { color: var(--ps-text); }
.kpi-money { font-size: 1.4rem; }
.closure { border-left: 4px solid var(--ps-success); }

.filters-extra { display: contents; }
.filters-toggle { display: none; }
.head-actions { flex-wrap: wrap; }

/* ---------- Stage 5: tasks, Gantt, calendar ---------- */
.page-tabs { display: flex; flex-wrap: wrap; width: fit-content; max-width: 100%; }
.wbs-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 240px; }
.wbs-title.depth-1 { padding-left: 20px; } .wbs-title.depth-2 { padding-left: 40px; }
.wbs-title.depth-3 { padding-left: 60px; } .wbs-title.depth-4, .wbs-title.depth-5 { padding-left: 80px; }
.summary-row td { background: rgba(109, 91, 246, .03); }
.done-row .name { color: var(--ps-text-3); text-decoration: line-through; }
.ms-icon svg { width: 15px; height: 15px; color: var(--ps-warning); fill: currentColor; }
.crit svg { width: 15px; height: 15px; color: var(--ps-danger); }
.dep-head { font-size: .76rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ps-text-3); margin: 6px 0 8px; }
.dep-list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 8px; }
.dep-list li { display: flex; align-items: center; gap: 10px; }
.board-dot.t-todo { background: var(--ps-text-3); } .board-dot.t-in_progress { background: var(--ps-blue); }
.board-dot.t-blocked { background: var(--ps-danger); } .board-dot.t-review { background: var(--ps-warning); }
.board-dot.t-done { background: var(--ps-success); }

.gantt-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .8rem; color: var(--ps-text-3); margin-bottom: 12px; }
.gantt-legend span { display: inline-flex; align-items: center; gap: 6px; }
.gantt-legend i { display: inline-block; }
.lg-bar { width: 22px; height: 10px; border-radius: 4px; background: var(--ps-gradient); }
.lg-bar.crit { background: linear-gradient(90deg, #ef4444, #f97316); }
.lg-bar.done { background: #22c55e; }
.lg-ms { width: 10px; height: 10px; background: var(--ps-warning); transform: rotate(45deg); }
.lg-today { width: 2px; height: 14px; background: var(--ps-danger); }
.gantt { border: 1px solid var(--ps-border); border-radius: 16px; overflow: hidden; background: var(--ps-surface-solid); }
.gantt-scroll { overflow: auto; max-height: 70vh; -webkit-overflow-scrolling: touch; }
.gantt-grid { display: grid; grid-template-columns: 300px max-content; position: relative; width: max-content; }
.g-corner, .g-label { position: sticky; left: 0; z-index: 3; background: var(--ps-surface-solid); border-right: 1px solid var(--ps-border); }
.g-corner { top: 0; z-index: 5; display: flex; align-items: flex-end; padding: 0 12px 8px; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ps-text-3); border-bottom: 1px solid var(--ps-border); }
.g-head { position: sticky; top: 0; z-index: 4; background: var(--ps-surface-solid); border-bottom: 1px solid var(--ps-border); }
.g-month { position: absolute; top: 0; height: 26px; padding: 5px 8px; font-size: .76rem; font-weight: 700; color: var(--ps-text-2); border-left: 1px solid var(--ps-border); white-space: nowrap; overflow: hidden; }
.g-tick { position: absolute; top: 26px; height: 26px; padding: 5px 4px; font-size: .7rem; color: var(--ps-text-3); border-left: 1px solid var(--ps-border); }
.g-label { display: flex; align-items: center; gap: 8px; padding-right: 10px; border-bottom: 1px solid var(--ps-border); color: var(--ps-text); font-size: .86rem; min-width: 0; }
.g-label:hover { color: var(--ps-purple); }
.g-label.summary { font-weight: 650; }
.g-label.critical .g-title { color: var(--ps-danger); }
.g-wbs { color: var(--ps-text-3); font-size: .74rem; font-variant-numeric: tabular-nums; flex: none; }
.g-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-lane { position: relative; border-bottom: 1px solid var(--ps-border); background-image: linear-gradient(90deg, transparent calc(100% - 1px), transparent 0); }
.g-bar { position: absolute; top: 10px; height: 20px; border-radius: 6px; background: rgba(109, 91, 246, .22); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(109, 91, 246, .45); transition: filter .15s; }
.g-bar:hover { filter: brightness(1.08); }
.g-fill { position: absolute; inset: 0 auto 0 0; background: var(--ps-gradient); }
.g-bar.critical { background: rgba(239, 68, 68, .2); box-shadow: inset 0 0 0 1px rgba(239, 68, 68, .55); }
.g-bar.critical .g-fill { background: linear-gradient(90deg, #ef4444, #f97316); }
.g-bar.done .g-fill { background: #22c55e; }
.g-bar.done { box-shadow: inset 0 0 0 1px rgba(34, 197, 94, .6); }
.g-bar.overdue { outline: 2px solid rgba(220, 38, 38, .55); outline-offset: 1px; }
.g-bar.summary { top: 15px; height: 10px; border-radius: 3px; background: rgba(15, 23, 42, .25); box-shadow: none; }
.g-bar.summary .g-fill { background: var(--ps-text-2); }
.g-bar-label { position: relative; z-index: 1; font-size: .68rem; font-weight: 700; color: #fff; padding: 2px 6px; line-height: 16px; text-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.g-ms { position: absolute; top: 11px; width: 18px; height: 18px; background: var(--ps-warning); transform: rotate(45deg); border-radius: 3px; box-shadow: 0 2px 6px rgba(217, 119, 6, .4); }
.g-ms.done { background: #22c55e; } .g-ms.critical { background: #ef4444; }
.g-overlay-cell { grid-column: 2; grid-row-start: 2; position: relative; pointer-events: none; z-index: 2; }
.g-overlay { position: absolute; top: 0; left: 0; overflow: visible; }
.g-link { fill: none; stroke: var(--ps-text-3); stroke-width: 1.4; opacity: .8; }
.g-arrowhead { fill: var(--ps-text-3); }
.g-today { stroke: var(--ps-danger); stroke-width: 2; stroke-dasharray: 4 3; }
.g-end { stroke: var(--ps-purple); stroke-width: 1.5; stroke-dasharray: 2 4; }

.cal-title { min-width: 150px; justify-content: center; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: .8rem; color: var(--ps-text-3); margin-bottom: 12px; }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend .ev { width: 14px; height: 10px; padding: 0; display: inline-block; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--ps-border); border-radius: 16px; overflow: hidden; background: var(--ps-surface-solid); }
.cal-dow { padding: 8px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ps-text-3); border-bottom: 1px solid var(--ps-border); text-align: center; }
.cal-day { min-height: 112px; padding: 6px; border-right: 1px solid var(--ps-border); border-bottom: 1px solid var(--ps-border); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day.other { background: var(--ps-surface-2); }
.cal-day.other .cal-num { color: var(--ps-text-3); opacity: .6; }
.cal-num { font-size: .8rem; font-weight: 650; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.cal-day.today .cal-num { background: var(--ps-gradient); color: #fff; }
.ev { display: block; font-size: .72rem; padding: 2px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: rgba(47, 124, 246, .12); color: var(--ps-text); border-left: 3px solid var(--ps-blue); }
.ev.milestone { background: rgba(217, 119, 6, .12); border-left-color: var(--ps-warning); }
.ev.project { background: rgba(109, 91, 246, .12); border-left-color: var(--ps-purple); }
.ev.overdue { background: rgba(220, 38, 38, .12); border-left-color: var(--ps-danger); }
.ev.done { opacity: .55; text-decoration: line-through; }
.ev.more { background: none; border: 0; color: var(--ps-text-3); }
.cal-agenda { display: none; }
.agenda-date { width: 44px; flex: none; text-align: center; font-size: .72rem; color: var(--ps-text-3); line-height: 1.1; }
.agenda-date b { display: block; font-size: 1.2rem; color: var(--ps-text); }
@media print {
  .gantt-scroll { max-height: none; overflow: visible; }
  .page-tabs, .segmented, [data-gantt-print] { display: none !important; }
}

/* ---------- Stage 6: finance ---------- */
.budget-bar { margin-bottom: 20px; }
.over-row td { background: rgba(220, 38, 38, .05); }
.table-ps tfoot td { border-top: 2px solid var(--ps-border-strong); padding-top: 14px; }
.table-ps th.num, .table-ps td.num { text-align: right; }
.amount-big { font-size: 2.2rem; font-weight: 750; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.date-input { flex: 0 1 170px; width: auto; }

/* ---------- Stage 7: timesheets & workload ---------- */
.ts-grid { min-width: 860px; }
.ts-grid th.ts-day { text-align: center; width: 72px; }
.ts-grid th.ts-day span { display: block; font-size: .95rem; color: var(--ps-text); letter-spacing: 0; }
.ts-grid th.ts-day.today span { color: var(--ps-purple); }
.ts-grid th.weekend, .ts-grid td.weekend { opacity: .75; }
.ts-target { min-width: 260px; }
.ts-target .form-select { margin-bottom: 6px; }
.ts-note { font-size: .85rem !important; padding: .4rem .7rem; }
.ts-cell { padding: 8px 4px !important; }
.ts-h { text-align: center; padding: .55rem .2rem; font-variant-numeric: tabular-nums; }
.ts-row-total, .ts-day-total, .ts-grand { text-align: center !important; font-variant-numeric: tabular-nums; }
.alloc-form { display: flex; align-items: center; gap: 6px; }
.alloc-form input { width: 74px; padding: .3rem .5rem; font-size: .85rem !important; text-align: right; }
.hours-line { display: flex; justify-content: space-between; font-size: .88rem; margin-bottom: 6px; }

/* ---------------------------------------------------------------- Stage 8: collaboration */
.badge-btn { position: relative; }
.count-badge { position: absolute; top: -3px; right: -3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--ps-danger, #dc2626); color: #fff; font-size: .68rem; font-weight: 750; line-height: 18px; text-align: center; box-shadow: 0 0 0 2px var(--ps-surface-solid); }
.count-badge.static { position: static; box-shadow: none; flex: none; }
.min-w-0 { min-width: 0; }
.text-purple { color: var(--ps-purple-600); }
.text-purple svg { width: 15px; height: 15px; }

.doc-list, .note-list, .inbox-list, .announce-list, .meeting-list, .people-list, .chat-thread { list-style: none; margin: 0; padding: 0; }
.doc-list li { display: flex; align-items: center; gap: 14px; padding: 12px 4px; border-bottom: 1px solid var(--ps-border); }
.doc-list li:last-child { border-bottom: 0; }
.doc-body { flex: 1; min-width: 0; }
.doc-body .name { overflow-wrap: anywhere; }
.doc-body .chip { padding: 2px 8px; font-size: .7rem; }
.doc-icon { flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: rgba(109, 91, 246, .12); color: var(--ps-purple-600); }
.doc-icon svg { width: 20px; height: 20px; }
.doc-icon.lg { width: 54px; height: 54px; border-radius: 16px; }
.doc-icon.lg svg { width: 26px; height: 26px; }
.doc-icon.ext-pdf { background: rgba(220, 38, 38, .1); color: #b91c1c; }
.doc-icon.ext-xlsx, .doc-icon.ext-xls, .doc-icon.ext-csv { background: rgba(22, 163, 74, .12); color: #15803d; }
.doc-icon.ext-pptx, .doc-icon.ext-ppt { background: rgba(217, 119, 6, .12); color: #b45309; }
.doc-icon.ext-docx, .doc-icon.ext-doc { background: rgba(47, 124, 246, .12); color: var(--ps-blue-600); }
.progress-line { height: 8px; border-radius: 99px; background: var(--ps-surface-2); overflow: hidden; }
.progress-line .bar { display: block; height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--ps-purple), var(--ps-blue)); }
.progress-line .bar.amber { background: var(--ps-warning, #d97706); }
.progress-line .bar.red { background: var(--ps-danger, #dc2626); }

.note-list li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 6px; border-bottom: 1px solid var(--ps-border); }
.note-list li:last-child { border-bottom: 0; }
.note-dot { flex: none; width: 9px; height: 9px; border-radius: 50%; margin-top: 7px; background: transparent; }
.note-list li.unread .note-dot { background: var(--ps-purple); }
.note-list li.unread .note-body > span:first-child { font-weight: 650; }
.note-body { flex: 1; min-width: 0; color: var(--ps-text); overflow-wrap: anywhere; }
.note-body:hover { color: var(--ps-purple-600); }

/* messages */
.chat-layout { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 20px; align-items: start; }
.chat-layout > .panel { margin: 0; min-width: 0; }
.chat-inbox { max-height: calc(100vh - 150px); overflow-y: auto; }
.inbox-list a { display: flex; gap: 10px; align-items: center; padding: 10px; border-radius: 14px; color: var(--ps-text); }
.inbox-list a:hover { background: var(--ps-surface-2); }
.inbox-list a.active { background: rgba(109, 91, 246, .1); }
.inbox-list a.unread .inbox-name, .inbox-list a.unread .inbox-last { font-weight: 700; color: var(--ps-text); }
.avatar.group svg { width: 15px; height: 15px; }
.inbox-body { flex: 1; min-width: 0; display: block; }
.inbox-top { display: flex; gap: 8px; align-items: baseline; }
.inbox-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-top .when { font-size: .72rem; color: var(--ps-text-3); white-space: nowrap; }
.inbox-last { display: block; font-size: .84rem; color: var(--ps-text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-pane { display: flex; flex-direction: column; min-height: 460px; max-height: calc(100vh - 150px); padding: 0; overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--ps-border); }
.chat-back { display: none; }
.chat-thread { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.bubble-row { display: flex; gap: 8px; align-items: flex-end; max-width: 82%; }
.bubble-row.mine { align-self: flex-end; flex-direction: row-reverse; }
.bubble { padding: 9px 13px; border-radius: 18px 18px 18px 6px; background: var(--ps-surface-2); border: 1px solid var(--ps-border); min-width: 0; }
.bubble-row.mine .bubble { border-radius: 18px 18px 6px 18px; background: linear-gradient(135deg, var(--ps-purple), var(--ps-blue)); color: #fff; border-color: transparent; }
.bubble .who { font-size: .74rem; font-weight: 700; color: var(--ps-purple-600); margin-bottom: 2px; }
.bubble .text { white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble .when { font-size: .68rem; opacity: .7; margin-top: 3px; text-align: right; }
.chat-compose { display: flex; gap: 10px; align-items: flex-end; padding: 12px 14px; border-top: 1px solid var(--ps-border); }
.chat-compose textarea { resize: none; min-height: 44px; }
.chat-placeholder { margin: auto; }
.chat-thread .empty { margin: auto; }

.announce-list li { padding: 16px 4px; border-bottom: 1px solid var(--ps-border); }
.announce-list li:last-child { border-bottom: 0; }
.announce-list li.pinned { background: rgba(109, 91, 246, .05); border-radius: 14px; padding: 16px 14px; }

.meeting-list li { display: flex; gap: 14px; align-items: flex-start; padding: 12px 4px; border-bottom: 1px solid var(--ps-border); }
.meeting-list li:last-child { border-bottom: 0; }
.meeting-list li.cancelled a { text-decoration: line-through; color: var(--ps-text-3); }
.date-tile { flex: none; width: 52px; border-radius: 14px; overflow: hidden; text-align: center; background: var(--ps-surface-solid); border: 1px solid var(--ps-border); box-shadow: var(--ps-shadow-sm); }
.date-tile .mon { display: block; font-size: .66rem; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; color: #fff; background: linear-gradient(135deg, var(--ps-purple), var(--ps-blue)); padding: 2px 0; }
.date-tile .day { display: block; font-size: 1.25rem; font-weight: 750; padding: 3px 0 4px; }
.people-list li { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.dash-list { list-style: none; margin: 0; padding: 0; }
.dash-list li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--ps-border); }
.dash-list li:last-child { border-bottom: 0; }
.ev.meeting { background: rgba(14, 165, 233, .14); border-left-color: #0ea5e9; }

/* ---------------------------------------------------------------- Stage 9: monitoring and evaluation */
.form-section { font-size: .8rem; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; color: var(--ps-text-3); margin: 22px 0 10px; }
.text-warning-strong { color: #b45309; }
.table-ps tr.muted td { opacity: .55; }
.progress-line { position: relative; }
.progress-line .bar.green { background: var(--ps-success, #16a34a); }
.progress-line.w-sm { display: inline-block; width: 80px; vertical-align: middle; margin-right: 8px; }
.expected-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; left: 0; background: var(--ps-text); opacity: .55; border-radius: 2px; }
.rf-node { border-left: 3px solid var(--ps-border-strong); padding: 4px 0 4px 16px; margin: 12px 0; }
.rf-node .rf-node { margin-left: 8px; }
.rf-node.level-goal { border-left-color: var(--ps-purple); }
.rf-node.level-outcome { border-left-color: var(--ps-blue); }
.rf-node.level-output { border-left-color: #14b8a6; }
.rf-head { display: flex; gap: 12px; align-items: flex-start; }
.rf-code { flex: none; min-width: 34px; height: 30px; padding: 0 8px; border-radius: 10px; display: grid; place-items: center; font-weight: 750; font-size: .82rem; background: var(--ps-surface-2); border: 1px solid var(--ps-border); }
.level-goal > .rf-head .rf-code { background: rgba(109, 91, 246, .12); color: var(--ps-purple-600); }
.level-outcome > .rf-head .rf-code { background: rgba(47, 124, 246, .12); color: var(--ps-blue-600); }
.level-output > .rf-head .rf-code { background: rgba(20, 184, 166, .12); color: #0f766e; }
.rf-level { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ps-text-3); }
.rf-statement { font-weight: 600; overflow-wrap: anywhere; }
.rf-actions { display: flex; gap: 4px; flex: none; }
.ind-list { list-style: none; margin: 8px 0 0 46px; padding: 0; }
.ind-list li { display: flex; gap: 14px; align-items: center; padding: 10px 12px; border-radius: 14px; background: var(--ps-surface-2); border: 1px solid var(--ps-border); margin-bottom: 8px; }
.ind-list li.retired { opacity: .6; }
.ind-main { flex: 1; min-width: 0; }
.ind-main a { color: var(--ps-text); overflow-wrap: anywhere; }
.ind-main a:hover { color: var(--ps-purple-600); }
.ind-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.ind-pct { font-size: 1.15rem; font-weight: 750; }
.ind-list .progress-line { background: var(--ps-border); }
.review-card { padding: 14px 16px; border-radius: 16px; background: rgba(217, 119, 6, .07); border: 1px solid rgba(217, 119, 6, .25); }
.review-card + .review-card { margin-top: 12px; }
.review-row { display: flex; gap: 8px; flex-wrap: wrap; }
.review-row .form-control { flex: 1 1 220px; }
.gps-box { border: 1px dashed var(--ps-border-strong); border-radius: 16px; padding: 12px 14px 10px; }
.gps-box legend { float: none; width: auto; padding: 0 6px; margin: 0; font-size: .9rem; }
.rating-list { list-style: none; margin: 0; padding: 0; }
.rating-list li { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--ps-border); }
.rating-list li:last-child { border-bottom: 0; }
.rating-dots { display: inline-flex; gap: 5px; }
.rating-dots i { width: 12px; height: 12px; border-radius: 50%; background: var(--ps-surface-2); border: 1px solid var(--ps-border-strong); }
.rating-dots i.on { background: var(--ps-gradient, var(--ps-purple)); border-color: transparent; }

/* ---------------------------------------------------------------- Stage 10: risk and procurement */
.chip.orange { background: rgba(234, 88, 12, .12); color: #c2410c; border-color: rgba(234, 88, 12, .22); }
.kpi-text { font-size: 1.35rem; }
.heat-wrap { display: flex; gap: 6px; align-items: stretch; }
.heat-y { writing-mode: vertical-rl; transform: rotate(180deg); font-size: .72rem; font-weight: 650; color: var(--ps-text-3); text-align: center; }
.heat { flex: 1; min-width: 0; display: grid; gap: 5px; max-width: 360px; }
.heat-row { display: grid; grid-template-columns: 18px repeat(5, minmax(0, 1fr)); gap: 5px; align-items: center; }
.heat-axis { display: grid; place-items: center; font-size: .72rem; font-weight: 650; color: var(--ps-text-3); }
.heat-caption { text-align: center; font-size: .72rem; font-weight: 650; color: var(--ps-text-3); }
.heat-cell { width: 100%; height: auto; min-height: 0; aspect-ratio: 1 / 1; border-radius: 10px; display: grid; place-items: center; font-weight: 750; color: #fff; text-decoration: none; min-width: 0; }
.heat-cell.low { background: #22c55e; } .heat-cell.medium { background: #eab308; } .heat-cell.high { background: #f97316; } .heat-cell.critical { background: #dc2626; }
.heat-cell.none { opacity: .22; }
.heat-cell:not(.none):hover, .heat-cell.active { outline: 3px solid var(--ps-text); outline-offset: 1px; color: #fff; }
.heat-legend { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: .76rem; color: var(--ps-text-3); margin-top: 12px; }
.heat-legend span { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.heat-legend .low { background: #22c55e; } .heat-legend .medium { background: #eab308; } .heat-legend .high { background: #f97316; } .heat-legend .critical { background: #dc2626; }
.risk-list { list-style: none; margin: 0; padding: 0; }
.risk-list li { display: flex; gap: 14px; align-items: center; padding: 12px 4px; border-bottom: 1px solid var(--ps-border); }
.risk-list li:last-child { border-bottom: 0; }
.risk-list a { color: var(--ps-text); overflow-wrap: anywhere; }
.risk-list a:hover { color: var(--ps-purple-600); }
.risk-score { flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; color: #fff; background: #22c55e; }
.risk-score.sm { width: 34px; height: 34px; border-radius: 10px; font-size: .85rem; }
.level-medium > .risk-score, .risk-score.level-medium { background: #ca8a04; }
.level-high > .risk-score, .risk-score.level-high { background: #ea580c; }
.level-critical > .risk-score, .risk-score.level-critical { background: #dc2626; }
.risk-meter { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; padding: 12px 16px; border-radius: 16px; background: var(--ps-surface-2); border: 1px solid var(--ps-border); }
.score-preview { margin: -6px 0 14px; font-size: .88rem; color: var(--ps-text-2); }
.score-preview b { font-weight: 750; }
.steps { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 20px; flex-wrap: wrap; }
.steps li { flex: 1 1 110px; display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 14px; background: var(--ps-surface-2); border: 1px solid var(--ps-border); font-size: .86rem; font-weight: 600; color: var(--ps-text-3); }
.steps li span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: .74rem; background: var(--ps-surface-solid); border: 1px solid var(--ps-border-strong); flex: none; }
.steps li.done { color: var(--ps-text); } .steps li.done span { background: #16a34a; border-color: #16a34a; color: #fff; }
.steps li.current { color: var(--ps-purple-600); border-color: rgba(109, 91, 246, .35); background: rgba(109, 91, 246, .08); }
.steps li.current span { background: var(--ps-purple); border-color: var(--ps-purple); color: #fff; }
.items-grid { display: grid; gap: 8px; }
.items-head, .item-row { display: grid; grid-template-columns: 2.2fr 2fr .8fr .8fr 1.1fr 1fr; gap: 8px; align-items: center; }
.items-head { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--ps-text-3); }
.item-total { font-weight: 650; white-space: nowrap; }
.items-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 6px; }
.award-box { padding: 16px; border-radius: 16px; background: rgba(109, 91, 246, .06); border: 1px solid rgba(109, 91, 246, .2); }
.table-ps tr.awarded td { background: rgba(22, 163, 74, .06); }
.stars { display: inline-flex; gap: 3px; vertical-align: middle; }
.stars i { width: 10px; height: 10px; border-radius: 50%; background: var(--ps-border-strong); }
.stars i.on { background: #f59e0b; }
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }

/* ---------------------------------------------------------------- Stage 11: billing and integrations */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.plan-card { display: flex; flex-direction: column; gap: 4px; padding: 20px; border-radius: 20px; background: var(--ps-surface-2); border: 1px solid var(--ps-border); }
.plan-card.current { border-color: rgba(109, 91, 246, .45); box-shadow: 0 0 0 3px rgba(109, 91, 246, .12); background: var(--ps-surface-solid); }
.plan-price { font-size: 1.6rem; font-weight: 800; margin: 6px 0 8px; }
.plan-price small { font-size: .85rem; font-weight: 600; color: var(--ps-text-3); }
.plan-features { list-style: none; padding: 0; margin: 0 0 16px; font-size: .88rem; }
.plan-features li { display: flex; gap: 6px; align-items: flex-start; padding: 3px 0; }
.plan-features svg { width: 15px; height: 15px; color: #16a34a; flex: none; margin-top: 3px; }
.key-reveal { border-color: rgba(22, 163, 74, .4); background: rgba(22, 163, 74, .06); }
.code-block { background: var(--ps-surface-2); border: 1px solid var(--ps-border); border-radius: 14px; padding: 12px 14px; font-size: .82rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.check-grid.one { grid-template-columns: 1fr; }
.notify-toggle { display: flex; gap: 12px; align-items: flex-start; }
