/* ==========================================================================
   CitizenProjectOS — single stylesheet (Citizen Pipeline)
   ==========================================================================
   ONE file replaces all CSS. Built from the v0/Pipeline tokens with
   Tailwind-equivalent utilities where v0 used them, plus component-specific
   styles for the calendar, projects, and other custom widgets.

   SECTIONS
     1. Tokens (fonts, colors, spacing, motion)
     2. Base reset + typography
     3. Utilities (Tailwind-equivalent: layout, spacing, type, color)
     4. App shell (sidebar, topbar, page-body)
     5. Page heads
     6. Buttons
     7. Forms (inputs, selects, checkboxes)
     8. Cards
     9. Badges, glyphs, chips, alerts
    10. KPI strip
    11. Progress bars
    12. Empty states
    13. Calendar (month grid + cell stamps)
    14. Cycle ribbon
    15. Cycle budget cards
    16. Modals
    17. Tabs
    18. Auth layout
    19. Today screen
    20. Brain dump / AI organizer / Reflection / Settings
    21. Responsive
   ========================================================================== */


/* ==========================================================================
   1. TOKENS
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700&family=Geist+Mono:wght@400;500;600&family=Instrument+Serif:ital@0;1&display=swap');

:root {
    --font-sans:  'Geist', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
    --font-mono:  'Geist Mono', ui-monospace, 'SF Mono', monospace;
    --font-serif: 'Instrument Serif', 'Times New Roman', serif;

    /* Type scale */
    --text-3xs: 10px;
    --text-2xs: 11px;
    --text-xs:  12px;
    --text-sm:  13px;
    --text-base: 14px;
    --text-md:  15px;
    --text-lg:  17px;
    --text-xl:  20px;
    --text-2xl: 24px;
    --text-3xl: 30px;
    --text-4xl: 38px;
    --text-5xl: 48px;

    --weight-light:    300;
    --weight-regular:  400;
    --weight-medium:   500;
    --weight-semibold: 600;
    --weight-bold:     700;

    --track-tightest: -0.04em;
    --track-tighter:  -0.025em;
    --track-tight:    -0.015em;
    --track-normal:   0;
    --track-wide:     0.04em;
    --track-wider:    0.08em;
    --track-widest:   0.16em;

    --leading-none:    1;
    --leading-tight:   1.1;
    --leading-snug:    1.25;
    --leading-normal:  1.4;
    --leading-relaxed: 1.55;

    /* Spacing (4px base) */
    --space-0:  0;
    --space-1:  2px;
    --space-2:  4px;
    --space-3:  6px;
    --space-4:  8px;
    --space-5:  12px;
    --space-6:  16px;
    --space-7:  20px;
    --space-8:  24px;
    --space-9:  32px;
    --space-10: 40px;
    --space-11: 48px;
    --space-12: 64px;

    /* Radii */
    --radius-xs:   2px;
    --radius-sm:   4px;
    --radius-md:   6px;
    --radius-lg:   10px;
    --radius-xl:   14px;
    --radius-2xl:  20px;
    --radius-full: 9999px;

    /* Motion */
    --ease-out:    cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --duration-fast: 120ms;
    --duration-base: 200ms;
    --duration-slow: 400ms;

    /* Status colors */
    --success: oklch(62% 0.16 152);
    --warning: oklch(76% 0.15 75);
    --danger:  oklch(60% 0.22 25);
    --info:    oklch(64% 0.13 230);
    --hot:     oklch(62% 0.22 22);

    --success-soft: oklch(62% 0.16 152 / 0.12);
    --warning-soft: oklch(76% 0.15 75 / 0.16);
    --danger-soft:  oklch(60% 0.22 25 / 0.10);
    --info-soft:    oklch(64% 0.13 230 / 0.12);
}

/* Light mode (default) */
:root,
[data-theme="light"] {
    --bg-canvas:     oklch(98.5% 0.002 270);
    --bg-surface:    oklch(100% 0 0);
    --bg-surface-2:  oklch(97% 0.003 270);
    --bg-surface-3:  oklch(94% 0.005 270);
    --bg-overlay:    oklch(98% 0.002 270 / 0.72);

    --text-primary:    oklch(18% 0.01 270);
    --text-secondary:  oklch(42% 0.01 270);
    --text-tertiary:   oklch(58% 0.008 270);
    --text-quaternary: oklch(72% 0.005 270);
    --text-disabled:   oklch(82% 0.003 270);
    --text-inverse:    oklch(98% 0.002 270);

    --border-subtle:   oklch(89% 0.005 270);
    --border-default:  oklch(82% 0.007 270);
    --border-strong:   oklch(68% 0.010 270);

    --accent:       oklch(18% 0.01 270);
    --accent-hover: oklch(28% 0.01 270);
    --accent-soft:  oklch(18% 0.01 270 / 0.06);
    --accent-fg:    oklch(98% 0.002 270);

    --shadow-xs:   0 1px 2px 0 oklch(0% 0 0 / 0.06);
    --shadow-sm:   0 2px 4px 0 oklch(0% 0 0 / 0.08), 0 1px 2px -1px oklch(0% 0 0 / 0.04);
    --shadow-md:   0 6px 16px -2px oklch(0% 0 0 / 0.10), 0 2px 4px -2px oklch(0% 0 0 / 0.06);
    --shadow-lg:   0 18px 40px -6px oklch(0% 0 0 / 0.14), 0 6px 12px -4px oklch(0% 0 0 / 0.06);
    --shadow-glow: 0 0 0 4px oklch(18% 0.01 270 / 0.10);
    --shadow-card-hover: 0 8px 24px -4px oklch(0% 0 0 / 0.10), 0 2px 6px -2px oklch(0% 0 0 / 0.06);
}

/* Dark mode */
[data-theme="dark"] {
    --bg-canvas:    oklch(13% 0.005 270);
    --bg-surface:   oklch(16% 0.006 270);
    --bg-surface-2: oklch(19% 0.007 270);
    --bg-surface-3: oklch(23% 0.008 270);
    --bg-overlay:   oklch(13% 0.005 270 / 0.78);

    --text-primary:    oklch(98% 0.002 270);
    --text-secondary:  oklch(76% 0.007 270);
    --text-tertiary:   oklch(58% 0.008 270);
    --text-quaternary: oklch(44% 0.008 270);
    --text-disabled:   oklch(34% 0.006 270);
    --text-inverse:    oklch(13% 0.005 270);

    --border-subtle:  oklch(30% 0.009 270);
    --border-default: oklch(38% 0.010 270);
    --border-strong:  oklch(52% 0.012 270);

    --accent:       oklch(98% 0.002 270);
    --accent-hover: oklch(88% 0.003 270);
    --accent-soft:  oklch(98% 0.002 270 / 0.10);
    --accent-fg:    oklch(13% 0.005 270);

    --shadow-xs:   0 1px 2px 0 oklch(0% 0 0 / 0.40);
    --shadow-sm:   0 2px 4px 0 oklch(0% 0 0 / 0.50), 0 1px 2px -1px oklch(0% 0 0 / 0.40);
    --shadow-md:   0 6px 18px -2px oklch(0% 0 0 / 0.55), 0 2px 6px -2px oklch(0% 0 0 / 0.40);
    --shadow-lg:   0 20px 48px -6px oklch(0% 0 0 / 0.65), 0 8px 16px -4px oklch(0% 0 0 / 0.45);
    --shadow-glow: 0 0 0 4px oklch(98% 0.002 270 / 0.15);
    --shadow-card-hover: 0 0 0 1px oklch(98% 0.002 270 / 0.10), 0 12px 32px -6px oklch(0% 0 0 / 0.55);
}


/* ==========================================================================
   2. BASE
   ========================================================================== */

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

html {
    background: var(--bg-canvas);
    color-scheme: light;
}
[data-theme="dark"] html { color-scheme: dark; }

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    background: var(--bg-canvas);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'cv11', 'ss01', 'ss02';
    transition: background-color var(--duration-base) var(--ease-out),
                color var(--duration-base) var(--ease-out);
}

::selection { background: var(--accent); color: var(--accent-fg); }

button, input, textarea, select { font-family: inherit; }
button { cursor: pointer; background: none; border: none; padding: 0; color: inherit; }

a { color: inherit; text-decoration: none; transition: color var(--duration-fast) var(--ease-out); }
a:hover { color: var(--accent); }

h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: var(--weight-medium); }
p { margin: 0 0 var(--space-5); }

ul, ol { margin: 0; padding: 0; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border-default);
    border-radius: var(--radius-full);
    border: 2px solid var(--bg-canvas);
}
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }


/* ==========================================================================
   3. UTILITIES (Tailwind-equivalents)
   ========================================================================== */

/* Display + flex */
.flex      { display: flex; }
.inline-flex { display: inline-flex; }
.grid      { display: grid; }
.block     { display: block; }
.inline-block { display: inline-block; }
.hidden    { display: none; }

.flex-col  { flex-direction: column; }
.flex-row  { flex-direction: row; }
.flex-1    { flex: 1 1 0%; }
.flex-shrink-0 { flex-shrink: 0; }
.flex-wrap { flex-wrap: wrap; }
.flex-grow { flex-grow: 1; }

.items-start    { align-items: flex-start; }
.items-center   { align-items: center; }
.items-end      { align-items: flex-end; }
.items-baseline { align-items: baseline; }
.items-stretch  { align-items: stretch; }

.justify-start    { justify-content: flex-start; }
.justify-center   { justify-content: center; }
.justify-end      { justify-content: flex-end; }
.justify-between  { justify-content: space-between; }

.gap-0 { gap: 0; }
.gap-1 { gap: var(--space-2); }
.gap-2 { gap: var(--space-3); }
.gap-3 { gap: var(--space-4); }
.gap-4 { gap: var(--space-5); }
.gap-5 { gap: var(--space-6); }
.gap-6 { gap: var(--space-7); }
.gap-7 { gap: var(--space-8); }
.gap-8 { gap: var(--space-9); }
.gap-px { gap: 1px; }

/* Grid */
.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid-cols-5 { grid-template-columns: repeat(5, 1fr); }
.grid-cols-7 { grid-template-columns: repeat(7, 1fr); }

.col-span-1 { grid-column: span 1 / span 1; }
.col-span-2 { grid-column: span 2 / span 2; }
.col-span-3 { grid-column: span 3 / span 3; }

/* Sizing */
.w-full      { width: 100%; }
.w-auto      { width: auto; }
.w-screen    { width: 100vw; }
.w-fit       { width: fit-content; }
.h-full      { height: 100%; }
.h-screen    { height: 100vh; }
.h-auto      { height: auto; }
.min-h-screen { min-height: 100vh; }
.min-w-0     { min-width: 0; }
.max-w-sm    { max-width: 24rem; }
.max-w-md    { max-width: 28rem; }
.max-w-lg    { max-width: 32rem; }
.max-w-xl    { max-width: 36rem; }
.max-w-2xl   { max-width: 42rem; }
.max-w-3xl   { max-width: 48rem; }
.max-w-4xl   { max-width: 56rem; }
.max-w-5xl   { max-width: 64rem; }
.max-w-7xl   { max-width: 80rem; }

/* Spacing — padding */
.p-0  { padding: 0; }
.p-1  { padding: var(--space-2); }
.p-2  { padding: var(--space-3); }
.p-3  { padding: var(--space-4); }
.p-4  { padding: var(--space-5); }
.p-5  { padding: var(--space-6); }
.p-6  { padding: var(--space-7); }
.p-7  { padding: var(--space-8); }
.p-8  { padding: var(--space-9); }
.p-9  { padding: var(--space-10); }

.px-1 { padding-left: var(--space-2); padding-right: var(--space-2); }
.px-2 { padding-left: var(--space-3); padding-right: var(--space-3); }
.px-3 { padding-left: var(--space-4); padding-right: var(--space-4); }
.px-4 { padding-left: var(--space-5); padding-right: var(--space-5); }
.px-5 { padding-left: var(--space-6); padding-right: var(--space-6); }
.px-6 { padding-left: var(--space-7); padding-right: var(--space-7); }
.px-7 { padding-left: var(--space-8); padding-right: var(--space-8); }
.px-8 { padding-left: var(--space-9); padding-right: var(--space-9); }
.px-9 { padding-left: var(--space-10); padding-right: var(--space-10); }

.py-1 { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.py-2 { padding-top: var(--space-3); padding-bottom: var(--space-3); }
.py-3 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.py-4 { padding-top: var(--space-5); padding-bottom: var(--space-5); }
.py-5 { padding-top: var(--space-6); padding-bottom: var(--space-6); }
.py-6 { padding-top: var(--space-7); padding-bottom: var(--space-7); }
.py-7 { padding-top: var(--space-8); padding-bottom: var(--space-8); }
.py-8 { padding-top: var(--space-9); padding-bottom: var(--space-9); }
.py-9 { padding-top: var(--space-10); padding-bottom: var(--space-10); }

/* Margin */
.m-0 { margin: 0; }
.mx-auto { margin-left: auto; margin-right: auto; }
.mt-1 { margin-top: var(--space-2); }
.mt-2 { margin-top: var(--space-3); }
.mt-3 { margin-top: var(--space-4); }
.mt-4 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-7); }
.mt-8 { margin-top: var(--space-9); }
.mt-12 { margin-top: 3rem; }
.mb-1 { margin-bottom: var(--space-2); }
.mb-2 { margin-bottom: var(--space-3); }
.mb-3 { margin-bottom: var(--space-4); }
.mb-4 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-7); }
.mb-8 { margin-bottom: var(--space-9); }
.mb-9 { margin-bottom: var(--space-10); }

/* Space-y (between children) */
.space-y-1 > * + * { margin-top: var(--space-2); }
.space-y-2 > * + * { margin-top: var(--space-3); }
.space-y-3 > * + * { margin-top: var(--space-4); }
.space-y-4 > * + * { margin-top: var(--space-5); }
.space-y-5 > * + * { margin-top: var(--space-6); }
.space-y-6 > * + * { margin-top: var(--space-7); }
.space-y-8 > * + * { margin-top: var(--space-9); }

/* Text */
.text-3xs   { font-size: var(--text-3xs); }
.text-2xs   { font-size: var(--text-2xs); }
.text-xs    { font-size: var(--text-xs); }
.text-sm    { font-size: var(--text-sm); }
.text-base  { font-size: var(--text-base); }
.text-md    { font-size: var(--text-md); }
.text-lg    { font-size: var(--text-lg); }
.text-xl    { font-size: var(--text-xl); }
.text-2xl   { font-size: var(--text-2xl); }
.text-3xl   { font-size: var(--text-3xl); }
.text-4xl   { font-size: var(--text-4xl); }
.text-5xl   { font-size: var(--text-5xl); }

.font-light    { font-weight: var(--weight-light); }
.font-normal   { font-weight: var(--weight-regular); }
.font-medium   { font-weight: var(--weight-medium); }
.font-semibold { font-weight: var(--weight-semibold); }
.font-bold     { font-weight: var(--weight-bold); }

.font-sans  { font-family: var(--font-sans); }
.font-mono  { font-family: var(--font-mono); }
.font-serif { font-family: var(--font-serif); }

.italic   { font-style: italic; }
.uppercase { text-transform: uppercase; }
.lowercase { text-transform: lowercase; }
.capitalize { text-transform: capitalize; }

.tracking-tightest  { letter-spacing: var(--track-tightest); }
.tracking-tighter   { letter-spacing: var(--track-tighter); }
.tracking-tight     { letter-spacing: var(--track-tight); }
.tracking-normal    { letter-spacing: var(--track-normal); }
.tracking-wide      { letter-spacing: var(--track-wide); }
.tracking-wider     { letter-spacing: var(--track-wider); }
.tracking-widest    { letter-spacing: var(--track-widest); }

.leading-none    { line-height: var(--leading-none); }
.leading-tight   { line-height: var(--leading-tight); }
.leading-snug    { line-height: var(--leading-snug); }
.leading-normal  { line-height: var(--leading-normal); }
.leading-relaxed { line-height: var(--leading-relaxed); }

.text-left   { text-align: left; }
.text-center { text-align: center; }
.text-right  { text-align: right; }

.tabular-nums { font-variant-numeric: tabular-nums; }
.line-through { text-decoration: line-through; }
.underline    { text-decoration: underline; }

.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Color tokens */
.text-primary    { color: var(--text-primary); }
.text-secondary  { color: var(--text-secondary); }
.text-tertiary   { color: var(--text-tertiary); }
.text-quaternary { color: var(--text-quaternary); }
.text-inverse    { color: var(--text-inverse); }
.text-accent     { color: var(--accent); }
.text-accent-fg  { color: var(--accent-fg); }
.text-success    { color: var(--success); }
.text-warning    { color: var(--warning); }
.text-danger     { color: var(--danger); }
.text-info       { color: var(--info); }

.bg-canvas    { background: var(--bg-canvas); }
.bg-surface   { background: var(--bg-surface); }
.bg-surface-2 { background: var(--bg-surface-2); }
.bg-surface-3 { background: var(--bg-surface-3); }
.bg-accent    { background: var(--accent); }
.bg-accent-soft { background: var(--accent-soft); }
.bg-success    { background: var(--success); }
.bg-success-soft { background: var(--success-soft); }
.bg-warning-soft { background: var(--warning-soft); }
.bg-danger     { background: var(--danger); }
.bg-danger-soft  { background: var(--danger-soft); }
.bg-info-soft    { background: var(--info-soft); }

.border         { border: 1px solid var(--border-default); }
.border-subtle  { border-color: var(--border-subtle); }
.border-default { border-color: var(--border-default); }
.border-strong  { border-color: var(--border-strong); }
.border-accent  { border-color: var(--accent); }
.border-t       { border-top: 1px solid var(--border-default); }
.border-b       { border-bottom: 1px solid var(--border-default); }
.border-r       { border-right: 1px solid var(--border-default); }
.border-l       { border-left: 1px solid var(--border-default); }
.border-t-subtle { border-top: 1px solid var(--border-subtle); }
.border-b-subtle { border-bottom: 1px solid var(--border-subtle); }

/* Radius */
.rounded-none { border-radius: 0; }
.rounded-xs   { border-radius: var(--radius-xs); }
.rounded-sm   { border-radius: var(--radius-sm); }
.rounded      { border-radius: var(--radius-md); }
.rounded-md   { border-radius: var(--radius-md); }
.rounded-lg   { border-radius: var(--radius-lg); }
.rounded-xl   { border-radius: var(--radius-xl); }
.rounded-2xl  { border-radius: var(--radius-2xl); }
.rounded-full { border-radius: var(--radius-full); }

/* Shadow */
.shadow-none { box-shadow: none; }
.shadow-xs   { box-shadow: var(--shadow-xs); }
.shadow-sm   { box-shadow: var(--shadow-sm); }
.shadow      { box-shadow: var(--shadow-md); }
.shadow-md   { box-shadow: var(--shadow-md); }
.shadow-lg   { box-shadow: var(--shadow-lg); }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed    { position: fixed; }
.sticky   { position: sticky; }
.static   { position: static; }

.inset-0 { top: 0; right: 0; bottom: 0; left: 0; }
.top-0   { top: 0; }
.left-0  { left: 0; }
.right-0 { right: 0; }
.bottom-0 { bottom: 0; }

/* Overflow */
.overflow-hidden { overflow: hidden; }
.overflow-auto   { overflow: auto; }
.overflow-y-auto { overflow-y: auto; }
.overflow-x-auto { overflow-x: auto; }

/* Misc */
.cursor-pointer { cursor: pointer; }
.cursor-grab    { cursor: grab; }
.cursor-grabbing { cursor: grabbing; }
.cursor-not-allowed { cursor: not-allowed; }
.select-none { user-select: none; }
.transition  { transition: all var(--duration-base) var(--ease-out); }
.transition-fast { transition: all var(--duration-fast) var(--ease-out); }
.transition-colors { transition: color var(--duration-fast) var(--ease-out), background-color var(--duration-fast) var(--ease-out), border-color var(--duration-fast) var(--ease-out); }
.transition-opacity { transition: opacity var(--duration-base) var(--ease-out); }

.opacity-0   { opacity: 0; }
.opacity-40  { opacity: 0.4; }
.opacity-60  { opacity: 0.6; }
.opacity-80  { opacity: 0.8; }
.opacity-100 { opacity: 1; }

.z-10 { z-index: 10; }
.z-40 { z-index: 40; }
.z-50 { z-index: 50; }
.z-100 { z-index: 100; }

/* Group hover (Tailwind-style) */
.group:hover .group-hover\:opacity-100 { opacity: 1; }
.group:hover .group-hover\:opacity-60 { opacity: 0.6; }
.group:hover .group-hover\:visible { visibility: visible; }

/* Hover states */
.hover\:bg-surface-2:hover { background: var(--bg-surface-2); }
.hover\:bg-surface-3:hover { background: var(--bg-surface-3); }
.hover\:bg-accent-soft:hover { background: var(--accent-soft); }
.hover\:bg-danger-soft:hover { background: var(--danger-soft); }
.hover\:bg-success-soft:hover { background: var(--success-soft); }
.hover\:text-primary:hover { color: var(--text-primary); }
.hover\:text-accent:hover  { color: var(--accent); }
.hover\:text-danger:hover  { color: var(--danger); }
.hover\:text-success:hover { color: var(--success); }
.hover\:text-warning:hover { color: var(--warning); }
.hover\:border-strong:hover { border-color: var(--border-strong); }
.hover\:opacity-80:hover { opacity: 0.8; }

/* Whitespace + word-break */
.whitespace-pre-wrap { white-space: pre-wrap; }
.whitespace-nowrap   { white-space: nowrap; }
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Eyebrow utility */
.eyebrow {
    font-family: var(--font-mono);
    font-size: var(--text-3xs);
    text-transform: uppercase;
    letter-spacing: var(--track-widest);
    color: var(--text-quaternary);
    line-height: 1;
    font-weight: var(--weight-regular);
}

/* Serif italic accent */
.serif-accent {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: var(--weight-regular);
}


/* ==========================================================================
   4. APP SHELL
   ========================================================================== */

.app-shell {
    display: flex;
    min-height: 100vh;
    background: var(--bg-canvas);
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: oklch(0% 0 0 / 0.5);
    z-index: 49;
}
.sidebar-backdrop.is-open { display: block; }

.sidebar {
    width: 240px;
    flex-shrink: 0;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-default);
    box-shadow: 1px 0 0 0 var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    z-index: 50;
    transition: transform var(--duration-base) var(--ease-out);
}

.brand {
    display: flex;
    align-items: center;
    gap: var(--space-5);
    padding: var(--space-8) var(--space-6);
    border-bottom: 1px solid var(--border-subtle);
    text-decoration: none;
    color: var(--text-primary);
    transition: opacity var(--duration-fast) var(--ease-out);
}
.brand:hover { opacity: 0.8; color: var(--text-primary); }

.logo-mark {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-serif);
    font-style: italic;
    font-size: var(--text-xl);
    font-weight: var(--weight-regular);
    flex-shrink: 0;
    border: 1px solid var(--border-default);
    box-shadow: var(--shadow-sm), inset 0 1px 0 oklch(100% 0 0 / 0.08);
}

/* When the logo box holds the pyramid SVG (instead of a serif "C") */
.logo-mark-pyramid {
    background: linear-gradient(135deg, var(--bg-surface), var(--bg-surface-2));
    color: var(--accent);
}
[data-theme="dark"] .logo-mark-pyramid {
    background: linear-gradient(135deg, var(--bg-surface-2), var(--bg-surface-3));
}

.brand-name {
    display: block;
    font-size: var(--text-md);
    font-weight: var(--weight-semibold);
    letter-spacing: var(--track-tighter);
    line-height: 1.1;
}
.brand-tag {
    display: block;
    font-family: var(--font-mono);
    font-size: var(--text-3xs);
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: var(--track-wider);
    margin-top: 4px;
}

.nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: var(--space-6) var(--space-4);
    overflow-y: auto;
}

.nav a {
    display: flex;
    align-items: center;
    gap: var(--space-5);
    padding: var(--space-4) var(--space-5);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    letter-spacing: var(--track-tight);
    color: var(--text-tertiary);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: all var(--duration-fast) var(--ease-out);
    position: relative;
}
.nav a:hover { color: var(--text-primary); background: var(--bg-surface-2); }
.nav a.active {
    color: var(--text-primary);
    background: var(--bg-surface-2);
    box-shadow: inset 0 0 0 1px var(--border-default);
}
.nav a.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
    box-shadow: 0 0 8px var(--accent-soft);
}
.nav-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    stroke: currentColor;
    stroke-width: 1.75;
    fill: none;
}

.sidebar-foot {
    padding: var(--space-6);
    border-top: 1px solid var(--border-subtle);
    font-family: var(--font-mono);
    font-size: var(--text-3xs);
    color: var(--text-tertiary);
    line-height: 1.6;
    letter-spacing: var(--track-wide);
}
.sidebar-foot strong {
    color: var(--text-primary);
    font-weight: var(--weight-medium);
}
.sidebar-foot a {
    color: var(--text-tertiary);
    text-decoration: underline;
    text-decoration-color: var(--border-default);
    text-underline-offset: 3px;
}
.sidebar-foot a:hover { color: var(--accent); text-decoration-color: var(--accent); }

.app-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-8) var(--space-10);
    gap: var(--space-7);
}

.topbar-actions {
    display: flex;
    gap: var(--space-4);
    align-items: center;
    flex-shrink: 0;
}

.menu-toggle {
    display: none;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
    color: var(--text-secondary);
    align-items: center;
    justify-content: center;
}
.menu-toggle:hover { background: var(--bg-surface-2); }

.theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-default);
    background: var(--bg-surface);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all var(--duration-fast) var(--ease-out);
    box-shadow: var(--shadow-xs);
}
.theme-toggle:hover {
    background: var(--bg-surface-2);
    color: var(--text-primary);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}

.page-body {
    flex: 1;
    padding: 0 var(--space-10) var(--space-12);
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
}

.app-foot {
    padding: var(--space-8) var(--space-10);
    font-family: var(--font-mono);
    font-size: var(--text-3xs);
    text-transform: uppercase;
    letter-spacing: var(--track-wider);
    color: var(--text-quaternary);
    border-top: 1px solid var(--border-subtle);
}


/* ==========================================================================
   5. PAGE HEADS
   ========================================================================== */

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-9);
    margin-bottom: var(--space-10);
    padding-bottom: var(--space-8);
    border-bottom: 1px solid var(--border-subtle);
}
.page-head-l { min-width: 0; flex: 1; }

.page-crumbs {
    display: flex;
    align-items: center;
    gap: var(--space-5);
    font-family: var(--font-mono);
    font-size: var(--text-3xs);
    text-transform: uppercase;
    letter-spacing: var(--track-widest);
    color: var(--text-quaternary);
    margin-bottom: var(--space-5);
}
.page-crumbs a {
    color: var(--text-quaternary);
    transition: color var(--duration-fast) var(--ease-out);
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}
.page-crumbs a:hover { color: var(--text-primary); }
.page-crumbs .sep { color: var(--text-disabled); }

.page-title {
    font-size: var(--text-4xl);
    font-weight: var(--weight-medium);
    letter-spacing: var(--track-tightest);
    line-height: 1;
    margin: 0;
}
.page-title em {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: var(--weight-regular);
}

.page-sub {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    margin: var(--space-3) 0 0;
}

.page-actions {
    display: flex;
    gap: var(--space-4);
    align-items: center;
    flex-shrink: 0;
}


/* ==========================================================================
   6. BUTTONS
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    padding: 0 14px;
    height: 36px;
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    letter-spacing: var(--track-tight);
    border: 1px solid var(--border-default);
    background: var(--bg-surface);
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
    transition: all var(--duration-fast) var(--ease-out);
    cursor: pointer;
    user-select: none;
    box-shadow: var(--shadow-xs);
}
.btn:hover {
    background: var(--bg-surface-2);
    border-color: var(--border-strong);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}
.btn:active { transform: translateY(0); box-shadow: var(--shadow-xs); }
.btn:focus-visible {
    outline: none;
    box-shadow: var(--shadow-glow);
}
.btn[disabled] { opacity: 0.5; cursor: not-allowed; box-shadow: none; }

.btn-primary {
    background: var(--accent);
    color: var(--accent-fg);
    border-color: var(--accent);
    box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: var(--accent-fg);
    box-shadow: var(--shadow-md), 0 0 0 4px var(--accent-soft);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover {
    background: var(--bg-surface-2);
    color: var(--text-primary);
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border-color: var(--border-default);
}
.btn-danger:hover {
    background: var(--danger-soft);
    border-color: var(--danger);
}

.btn-sm   { height: 28px; padding: 0 10px; font-size: var(--text-xs); }
.btn-lg   { height: 44px; padding: 0 18px; font-size: var(--text-md); }
.btn-icon { width: 36px; padding: 0; }

.btn svg { width: 16px; height: 16px; flex-shrink: 0; stroke-width: 1.75; }

.btn-block { width: 100%; }

.link-btn {
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: var(--space-2);
    transition: color var(--duration-fast) var(--ease-out);
}
.link-btn:hover { color: var(--text-primary); }


/* ==========================================================================
   7. FORMS
   ========================================================================== */

.label,
label {
    display: block;
    font-family: var(--font-mono);
    font-size: var(--text-3xs);
    text-transform: uppercase;
    letter-spacing: var(--track-wider);
    color: var(--text-tertiary);
    margin-bottom: var(--space-3);
    font-weight: var(--weight-medium);
}

.input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="time"],
input[type="date"],
input[type="number"],
input[type="search"],
input[type="color"],
textarea,
select {
    width: 100%;
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    padding: 0 var(--space-5);
    height: 36px;
    color: var(--text-primary);
    font-size: var(--text-sm);
    letter-spacing: var(--track-tight);
    font-family: var(--font-sans);
    transition: all var(--duration-fast) var(--ease-out);
}

input[type="color"] { padding: 4px; height: 36px; cursor: pointer; }

textarea {
    height: auto;
    min-height: 80px;
    padding: var(--space-4) var(--space-5);
    line-height: 1.5;
    resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--text-primary);
    box-shadow: var(--shadow-glow);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-quaternary);
}

input[type="checkbox"] {
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--bg-surface);
    appearance: none;
    cursor: pointer;
    position: relative;
    transition: all var(--duration-fast) var(--ease-out);
    flex-shrink: 0;
    padding: 0;
}
input[type="checkbox"]:checked {
    background: var(--accent);
    border-color: var(--accent);
}
input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 4px;
    width: 4px;
    height: 8px;
    border: solid var(--accent-fg);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.input-with-icon {
    position: relative;
}
.input-with-icon svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-quaternary);
    stroke: currentColor;
    stroke-width: 1.75;
    fill: none;
    pointer-events: none;
}
.input-with-icon input {
    padding-left: 36px;
}
.input-with-icon .input-suffix {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-quaternary);
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 0;
}
.input-with-icon .input-suffix:hover { color: var(--text-primary); }

.field-error {
    color: var(--danger);
    font-size: var(--text-xs);
    margin-top: var(--space-2);
    text-transform: none;
    letter-spacing: 0;
    font-family: var(--font-sans);
    font-weight: var(--weight-regular);
}

.checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
}
.checkbox-row label {
    margin: 0;
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-primary);
    font-weight: var(--weight-regular);
    cursor: pointer;
    line-height: 1.5;
}
.checkbox-row label a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

.password-rules {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-top: var(--space-3);
}
.password-rule {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-xs);
    color: var(--text-quaternary);
    transition: color var(--duration-fast) var(--ease-out);
}
.password-rule.met { color: var(--success); }
.password-rule svg { width: 12px; height: 12px; opacity: 0.4; stroke: currentColor; stroke-width: 2; fill: none; }
.password-rule.met svg { opacity: 1; }


/* ==========================================================================
   8. CARDS
   ========================================================================== */

.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: border-color var(--duration-fast) var(--ease-out),
                box-shadow var(--duration-base) var(--ease-out),
                transform var(--duration-base) var(--ease-out);
}
.card.is-clickable { cursor: pointer; }
.card.is-clickable:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-1px);
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5) var(--space-7);
    border-bottom: 1px solid var(--border-subtle);
    gap: var(--space-5);
}

.card-title {
    font-size: var(--text-base);
    font-weight: var(--weight-medium);
    letter-spacing: var(--track-tight);
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    color: var(--text-primary);
}

.card-title svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 1.75;
    fill: none;
}

.card-body { padding: var(--space-7); }
.card-body-tight { padding: var(--space-5); }


/* ==========================================================================
   9. BADGES, GLYPHS, CHIPS, ALERTS
   ========================================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 2px 8px;
    height: 20px;
    border-radius: var(--radius-sm);
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    font-weight: var(--weight-medium);
    letter-spacing: var(--track-wider);
    text-transform: uppercase;
    background: var(--bg-surface-2);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
    line-height: 1;
    white-space: nowrap;
}
.badge-success { background: var(--success-soft); color: var(--success); border-color: oklch(62% 0.16 152 / 0.20); }
.badge-warning { background: var(--warning-soft); color: oklch(58% 0.15 75); border-color: oklch(76% 0.15 75 / 0.22); }
.badge-danger  { background: var(--danger-soft);  color: var(--danger);  border-color: oklch(60% 0.22 25 / 0.20); }
.badge-info    { background: var(--info-soft);    color: var(--info);    border-color: oklch(64% 0.13 230 / 0.22); }

.alert {
    padding: var(--space-5) var(--space-6);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
    background: var(--bg-surface-2);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-5);
}
.alert-success { background: var(--success-soft); color: var(--success); border-color: oklch(62% 0.16 152 / 0.18); }
.alert-warn,
.alert-warning  { background: var(--warning-soft); color: oklch(48% 0.15 75); border-color: oklch(76% 0.15 75 / 0.22); }
.alert-error,
.alert-danger  { background: var(--danger-soft);  color: var(--danger); border-color: oklch(60% 0.22 25 / 0.18); }
.alert-info    { background: var(--info-soft);    color: var(--info); border-color: oklch(64% 0.13 230 / 0.22); }
.alert strong { font-weight: var(--weight-semibold); }
.alert a { color: inherit; text-decoration: underline; }

.cpos-glyph,
.glyph {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-md);
    color: oklch(100% 0 0 / 0.96);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    flex-shrink: 0;
    background: var(--accent);
}
.glyph-sm { width: 22px; height: 22px; font-size: var(--text-xs); }
.glyph-lg { width: 40px; height: 40px; font-size: var(--text-md); }

.cpos-glyph-tag {
    width: auto;
    padding: 0 var(--space-4);
    height: 22px;
    font-size: var(--text-3xs);
    text-transform: uppercase;
    letter-spacing: var(--track-wider);
    border-radius: var(--radius-sm);
}

/* Filter chips */
.chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    background: var(--bg-surface-2);
    color: var(--text-tertiary);
    border: none;
    transition: all var(--duration-fast) var(--ease-out);
    cursor: pointer;
    white-space: nowrap;
}
.chip:hover { background: var(--bg-surface-3); color: var(--text-secondary); }
.chip.is-active { background: var(--accent); color: var(--accent-fg); }

.chip-sq {
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: var(--radius-md);
    justify-content: center;
    font-family: var(--font-mono);
}


/* ==========================================================================
   10. KPI STRIP
   ========================================================================== */

.kpi-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--border-default);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.kpi {
    background: var(--bg-surface);
    padding: var(--space-6) var(--space-7);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    transition: background var(--duration-fast) var(--ease-out);
}
.kpi:hover { background: var(--bg-surface-2); }

.kpi-label {
    font-family: var(--font-mono);
    font-size: var(--text-3xs);
    text-transform: uppercase;
    letter-spacing: var(--track-widest);
    color: var(--text-quaternary);
    line-height: 1;
}

.kpi-value {
    font-size: var(--text-3xl);
    font-weight: var(--weight-medium);
    letter-spacing: var(--track-tightest);
    line-height: 1;
    color: var(--text-primary);
}
.kpi-value em {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: var(--weight-regular);
}

.kpi-delta {
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    color: var(--text-quaternary);
}
.kpi-delta.up   { color: var(--success); }
.kpi-delta.down { color: var(--danger); }


/* ==========================================================================
   11. PROGRESS BARS
   ========================================================================== */

.progress {
    height: 4px;
    background: var(--bg-surface-2);
    border-radius: var(--radius-full);
    overflow: hidden;
    width: 100%;
}
.progress-sm { height: 3px; }
.progress-md { height: 4px; }
.progress-lg { height: 8px; }

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: var(--radius-full);
    transition: width var(--duration-slow) var(--ease-out);
}
.progress-fill-sched { background: var(--accent); opacity: 0.4; }


/* ==========================================================================
   12. EMPTY STATES
   ========================================================================== */

.empty {
    text-align: center;
    padding: var(--space-12) var(--space-6);
    border: 1px dashed var(--border-default);
    border-radius: var(--radius-xl);
    background: var(--bg-surface);
}
.empty-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto var(--space-5);
    border-radius: var(--radius-full);
    background: var(--bg-surface-2);
    color: var(--text-quaternary);
    display: flex;
    align-items: center;
    justify-content: center;
}
.empty-icon svg { width: 24px; height: 24px; stroke: currentColor; stroke-width: 1.75; fill: none; }
.empty-title {
    font-size: var(--text-lg);
    font-weight: var(--weight-medium);
    color: var(--text-primary);
    margin: 0 0 var(--space-3);
    letter-spacing: var(--track-tight);
}
.empty-title em {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: var(--weight-regular);
}
.empty-desc {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    margin: 0 0 var(--space-6);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}


/* ==========================================================================
   13. CALENDAR
   ========================================================================== */

.cpos-db {
    display: flex;
    flex-direction: column;
    gap: var(--space-7);
}

.cpos-db-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-7);
    padding-bottom: var(--space-7);
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: var(--space-2);
}

.cpos-db-head-l { min-width: 0; }
.cpos-db-head-r {
    display: flex;
    gap: var(--space-3);
    align-items: center;
    flex-shrink: 0;
}

.cpos-db-title {
    font-size: var(--text-4xl);
    font-weight: var(--weight-medium);
    letter-spacing: var(--track-tightest);
    line-height: 1;
    margin-top: var(--space-3);
}
.cpos-db-title em {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: var(--weight-regular);
}

.cpos-db-grid {
    display: grid;
    grid-template-columns: 240px 1fr 320px;
    gap: var(--space-5);
    align-items: start;
}

/* Library */
.cpos-db-side {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
    position: sticky;
    top: var(--space-5);
    box-shadow: var(--shadow-sm);
}

.cpos-side-section { display: flex; flex-direction: column; gap: var(--space-3); }
.cpos-side-label {
    font-family: var(--font-mono);
    font-size: var(--text-3xs);
    text-transform: uppercase;
    letter-spacing: var(--track-widest);
    color: var(--text-quaternary);
    padding: 0 var(--space-3);
    margin-bottom: var(--space-2);
}

.cpos-tpl-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cpos-tpl-item {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-3);
    border-radius: var(--radius-md);
    cursor: grab;
    transition: background var(--duration-fast) var(--ease-out);
    user-select: none;
}
.cpos-tpl-item:hover { background: var(--bg-surface-2); }
.cpos-tpl-item:active { cursor: grabbing; }
.cpos-tpl-item.is-dragging { opacity: 0.4; }

.cpos-tpl-meta { flex: 1; min-width: 0; }
.cpos-tpl-name {
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--text-primary);
    letter-spacing: var(--track-tight);
    line-height: 1.3;
    display: flex;
    align-items: center;
    gap: var(--space-3);
}
.cpos-tpl-time {
    font-family: var(--font-mono);
    font-size: var(--text-3xs);
    color: var(--text-quaternary);
    letter-spacing: var(--track-wide);
    margin-top: 2px;
    line-height: 1;
}
.cpos-tpl-focus-badge {
    color: var(--warning);
    font-size: var(--text-xs);
    margin-left: var(--space-2);
}
.cpos-tpl-edit {
    background: transparent;
    border: none;
    color: var(--text-quaternary);
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    font-size: var(--text-md);
    line-height: 1;
    opacity: 0;
    transition: all var(--duration-fast) var(--ease-out);
    cursor: pointer;
}
.cpos-tpl-item:hover .cpos-tpl-edit { opacity: 1; }
.cpos-tpl-edit:hover { color: var(--text-primary); background: var(--bg-surface-3); }

.cpos-side-add {
    margin-top: var(--space-3);
    width: 100%;
    justify-content: center;
}

/* Center: month grid */
.cpos-db-cal {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.cpos-dow-row {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--bg-surface-2);
    border-bottom: 1px solid var(--border-default);
}
.cpos-dow-row > div {
    padding: var(--space-4) var(--space-5);
    font-family: var(--font-mono);
    font-size: var(--text-3xs);
    text-transform: uppercase;
    letter-spacing: var(--track-widest);
    color: var(--text-tertiary);
    text-align: center;
}

.cpos-month-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: minmax(110px, auto);
}

.cpos-cell {
    position: relative;
    padding: var(--space-4) var(--space-4) var(--space-3);
    border-right: 1px solid var(--border-default);
    border-bottom: 1px solid var(--border-default);
    background: var(--bg-surface);
    cursor: pointer;
    transition: background var(--duration-fast) var(--ease-out),
                box-shadow var(--duration-fast) var(--ease-out);
    overflow: hidden;
    min-height: 110px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.cpos-cell:nth-child(7n) { border-right: none; }
.cpos-cell:hover {
    background: var(--bg-surface-2);
    box-shadow: inset 0 0 0 1px var(--border-strong);
}

.cpos-cell.is-adjacent {
    background: var(--bg-canvas);
    color: var(--text-quaternary);
}
.cpos-cell.is-adjacent .cpos-cell-num { color: var(--text-quaternary); }

.cpos-cell.is-today { background: var(--accent-soft); }
.cpos-cell.is-today .cpos-cell-num {
    color: var(--accent);
    font-weight: var(--weight-medium);
}

.cpos-cell.is-selected {
    box-shadow: inset 0 0 0 2px var(--accent);
    background: var(--bg-surface);
}
.cpos-cell.is-drop-target {
    background: var(--accent-soft);
    box-shadow: inset 0 0 0 2px var(--accent);
}

.cpos-cell-num {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: var(--text-md);
    font-weight: var(--weight-regular);
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: var(--track-tighter);
}

.cpos-cell-cycles {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--text-quaternary);
    letter-spacing: var(--track-wide);
    line-height: 1;
}
.cpos-cell-cycles:empty { display: none; }
.cpos-cell.is-today .cpos-cell-cycles { color: var(--accent); opacity: 0.7; }

.cpos-cell-stack {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 2px;
    min-height: 0;
    overflow: hidden;
}

.cpos-cell-tag {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 1px 6px;
    background: var(--bg-surface-3);
    color: var(--text-secondary);
    border-radius: var(--radius-xs);
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: var(--weight-medium);
    text-transform: uppercase;
    letter-spacing: var(--track-wider);
    align-self: flex-start;
    line-height: 1.4;
}
.cpos-cell-tag-dot { width: 6px; height: 6px; border-radius: 50%; }

.cpos-cell-stamp {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 2px 5px;
    border-radius: var(--radius-xs);
    font-size: var(--text-3xs);
    line-height: 1.3;
    background: color-mix(in oklab, var(--vc, var(--accent)) 14%, var(--bg-surface));
    border-left: 2px solid var(--vc, var(--accent));
    color: var(--text-primary);
    letter-spacing: var(--track-tight);
    overflow: hidden;
}
[data-theme="dark"] .cpos-cell-stamp {
    background: color-mix(in oklab, var(--vc, var(--accent)) 22%, var(--bg-surface));
}
.cpos-cell-stamp-glyph {
    font-family: var(--font-mono);
    font-weight: var(--weight-semibold);
    color: var(--vc, var(--accent));
    flex-shrink: 0;
    font-size: 9px;
}
.cpos-cell-stamp-time {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--text-tertiary);
    flex-shrink: 0;
    letter-spacing: var(--track-wide);
}
.cpos-cell-stamp-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: var(--weight-medium);
}

.cpos-cell-session {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 2px 5px;
    border-radius: var(--radius-xs);
    background: var(--accent-soft);
    border-left: 2px solid var(--accent);
    font-size: var(--text-3xs);
    line-height: 1.3;
    color: var(--text-primary);
    letter-spacing: var(--track-tight);
    overflow: hidden;
}
.cpos-cell-session.is-completed { opacity: 0.55; text-decoration: line-through; }

.cpos-cell-more {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--text-quaternary);
    letter-spacing: var(--track-wide);
    padding-left: 5px;
    margin-top: 2px;
}

.cpos-cal-foot {
    padding: var(--space-4) var(--space-7);
    font-family: var(--font-mono);
    font-size: var(--text-3xs);
    color: var(--text-quaternary);
    letter-spacing: var(--track-wide);
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-surface-2);
    text-transform: uppercase;
}
.cpos-cal-foot strong { color: var(--text-secondary); font-weight: var(--weight-semibold); }


/* ==========================================================================
   14. CYCLE RIBBON (right rail of calendar + Today screen)
   ========================================================================== */

.cpos-db-detail {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    position: sticky;
    top: var(--space-5);
    max-height: calc(100vh - var(--space-10));
    overflow-y: auto;
    box-shadow: var(--shadow-sm);
}

.cpos-detail-empty {
    padding: var(--space-9) var(--space-5);
    text-align: center;
    color: var(--text-quaternary);
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    text-transform: uppercase;
    letter-spacing: var(--track-wider);
}

.cpos-detail-head { margin-bottom: var(--space-5); }
.cpos-detail-dow {
    font-family: var(--font-mono);
    font-size: var(--text-3xs);
    text-transform: uppercase;
    letter-spacing: var(--track-widest);
    color: var(--text-tertiary);
    line-height: 1;
}
.cpos-detail-date {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: var(--text-2xl);
    font-weight: var(--weight-regular);
    letter-spacing: var(--track-tighter);
    color: var(--text-primary);
    margin-top: var(--space-3);
    line-height: 1;
}

.cpos-detail-tags {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    margin-bottom: var(--space-5);
    padding-bottom: var(--space-5);
    border-bottom: 1px solid var(--border-subtle);
}

.cpos-tag-row {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-3);
    background: var(--bg-surface-2);
    border-radius: var(--radius-md);
}
.cpos-tag-row-name { flex: 1; font-size: var(--text-sm); font-weight: var(--weight-medium); }
.cpos-tag-row-x {
    background: transparent;
    border: none;
    color: var(--text-quaternary);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: var(--text-md);
    line-height: 1;
}
.cpos-tag-row-x:hover { background: var(--bg-surface-3); color: var(--danger); }

.cpos-cycle-ribbon {
    display: flex;
    flex-direction: column;
    gap: 1px;
    background: var(--border-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-top: var(--space-3);
}

.cpos-cycle-row {
    display: grid;
    grid-template-columns: 56px 1fr;
    background: var(--bg-surface);
    min-height: 28px;
    transition: background var(--duration-fast) var(--ease-out);
}
.cpos-cycle-row:hover { background: var(--bg-surface-2); }
.cpos-cycle-row.is-current { background: var(--accent-soft); }
.cpos-cycle-row.is-current .cpos-cycle-time {
    color: var(--accent);
    font-weight: var(--weight-semibold);
}

.cpos-cycle-time {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: var(--track-wide);
    color: var(--text-quaternary);
    padding: var(--space-3) var(--space-3);
    text-align: right;
    border-right: 1px solid var(--border-subtle);
    line-height: 1.35;
    user-select: none;
}

.cpos-cycle-content {
    display: flex;
    align-items: stretch;
    overflow: hidden;
    min-width: 0;
}

.cpos-cycle-occupant {
    flex: 1;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-2xs);
    line-height: 1.2;
    min-width: 0;
    border-left: 3px solid var(--vc, var(--accent));
    background: color-mix(in oklab, var(--vc, var(--accent)) 12%, var(--bg-surface));
    color: var(--text-primary);
    letter-spacing: var(--track-tight);
}
[data-theme="dark"] .cpos-cycle-occupant {
    background: color-mix(in oklab, var(--vc, var(--accent)) 22%, var(--bg-surface));
}
.cpos-cycle-occupant-session {
    background: var(--accent-soft);
    border-left-color: var(--accent);
}
.cpos-cycle-occupant-session.is-completed { opacity: 0.55; text-decoration: line-through; }

.cpos-cycle-occupant-glyph {
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: var(--weight-semibold);
    color: var(--vc, var(--accent));
    background: var(--bg-surface);
    padding: 1px 5px;
    border-radius: var(--radius-xs);
    flex-shrink: 0;
    letter-spacing: var(--track-tight);
}

.cpos-cycle-occupant-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: var(--weight-medium);
}

.cpos-cycle-occupant-sub {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--text-tertiary);
    flex-shrink: 0;
    letter-spacing: var(--track-wide);
    text-transform: uppercase;
}

.cpos-cycle-occupant-x {
    background: transparent;
    color: var(--text-quaternary);
    border: none;
    padding: 1px 5px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    font-size: var(--text-xs);
    line-height: 1;
    flex-shrink: 0;
    transition: all var(--duration-fast) var(--ease-out);
}
.cpos-cycle-occupant-x:hover { background: var(--bg-surface-3); color: var(--danger); }

.cpos-cycle-empty {
    flex: 1;
    color: var(--text-disabled);
    font-family: var(--font-mono);
    font-size: 9px;
    padding: var(--space-3) var(--space-4);
    letter-spacing: var(--track-wider);
    text-transform: uppercase;
}

.cpos-cycle-partial {
    background-image: repeating-linear-gradient(
        45deg,
        transparent 0,
        transparent 4px,
        oklch(0% 0 0 / 0.04) 4px,
        oklch(0% 0 0 / 0.04) 6px
    );
}

.cpos-cycle-summary {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    margin-top: var(--space-5);
    padding-top: var(--space-5);
    border-top: 1px solid var(--border-subtle);
}

.cpos-cycle-summary-stat {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: 0 var(--space-3);
    border-right: 1px solid var(--border-subtle);
}
.cpos-cycle-summary-stat:last-child { border-right: none; }

.cpos-cycle-summary-num {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: var(--text-xl);
    font-weight: var(--weight-regular);
    color: var(--text-primary);
    letter-spacing: var(--track-tighter);
    line-height: 1;
}
.cpos-cycle-summary-label {
    font-family: var(--font-mono);
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: var(--track-widest);
    color: var(--text-quaternary);
}

.cpos-detail-actions {
    margin-top: var(--space-5);
    padding-top: var(--space-5);
    border-top: 1px solid var(--border-subtle);
}


/* ==========================================================================
   15. CYCLE BUDGET CARDS
   ========================================================================== */

.cpos-cycle-budget {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    padding: var(--space-6) var(--space-7);
}
.cpos-cycle-budget-head {
    margin-bottom: var(--space-5);
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-5);
}
.cpos-cycle-budget-title {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: var(--text-xl);
    font-weight: var(--weight-regular);
    letter-spacing: var(--track-tighter);
    color: var(--text-primary);
    margin-top: var(--space-3);
}
.cpos-cycle-budget-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-4);
}
.cpos-cycle-card {
    background: var(--bg-surface-2);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-4) var(--space-5);
}
.cpos-cycle-card-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-4);
    margin-bottom: var(--space-3);
    min-width: 0;
}
.cpos-cycle-card-name {
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
    letter-spacing: var(--track-tight);
}
.cpos-cycle-card-count {
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    color: var(--text-tertiary);
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: var(--track-wide);
}
.cpos-cycle-card-count strong { color: var(--text-primary); font-weight: var(--weight-semibold); }
.cpos-cycle-card-bar {
    display: flex;
    height: 4px;
    background: var(--border-default);
    border-radius: var(--radius-full);
    overflow: hidden;
}
.cpos-cycle-card-fill {
    height: 100%;
    transition: width var(--duration-slow) var(--ease-out);
}
.cpos-cycle-fill-logged { background: var(--accent); }
.cpos-cycle-fill-sched  { background: var(--accent); opacity: 0.4; }


/* ==========================================================================
   16. MODALS
   ========================================================================== */

.cal-modal,
.modal {
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: var(--space-5);
    animation: cpos-modal-in var(--duration-base) var(--ease-out);
}
.cal-modal[hidden],
.modal[hidden] { display: none; }

@keyframes cpos-modal-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.cal-modal-card,
.modal-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-lg);
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: cpos-modal-card-in var(--duration-base) var(--ease-spring);
}

@keyframes cpos-modal-card-in {
    from { opacity: 0; transform: translateY(8px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.cal-modal-head,
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-6) var(--space-7);
    border-bottom: 1px solid var(--border-subtle);
}
.cal-modal-head h3,
.modal-head h3 {
    font-size: var(--text-lg);
    font-weight: var(--weight-medium);
    letter-spacing: var(--track-tightest);
    margin: 0;
}

.cal-modal-card form,
.modal-card form,
.modal-body { padding: var(--space-7); }

.cal-form-row,
.form-row {
    display: flex;
    gap: var(--space-5);
    margin-bottom: var(--space-5);
}
.cal-form-field,
.form-field { flex: 1; min-width: 0; }
.cal-form-field label,
.form-field label { display: block; }

.cal-radio {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    background: var(--bg-surface);
    font-size: var(--text-sm);
    transition: all var(--duration-fast) var(--ease-out);
}
.cal-radio:hover { border-color: var(--border-default); background: var(--bg-surface-2); }
.cal-radio input { width: auto; margin: 0; height: auto; padding: 0; flex-shrink: 0; }

.cal-color-row {
    display: flex;
    gap: var(--space-4);
    align-items: center;
}
.cal-color-swatches {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
    flex: 1;
}
.cal-color-swatch {
    width: 26px;
    height: 26px;
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform var(--duration-fast) var(--ease-out);
    padding: 0;
}
.cal-color-swatch:hover { transform: scale(1.12); }
.cal-color-swatch.is-selected {
    border-color: var(--text-primary);
    box-shadow: 0 0 0 2px var(--bg-surface), var(--shadow-glow);
}
.cal-color-custom { width: 38px; flex-shrink: 0; padding: 2px; }

.cpos-day-toggles {
    display: flex;
    gap: var(--space-2);
    flex-wrap: wrap;
}
.cpos-day-toggles label {
    margin: 0;
    cursor: pointer;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-secondary);
}
.cpos-day-toggles label input { display: none; }
.cpos-day-toggles label span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 30px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    transition: all var(--duration-fast) var(--ease-out);
}
.cpos-day-toggles label input:checked + span {
    background: var(--accent);
    color: var(--accent-fg);
    border-color: var(--accent);
}

.cal-modal-foot,
.modal-foot {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding-top: var(--space-5);
    border-top: 1px solid var(--border-subtle);
    margin-top: var(--space-6);
}

.cpos-tpl-preview {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-5);
    background: var(--bg-surface-2);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-6);
}
.cpos-tpl-preview-mark {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    color: oklch(100% 0 0 / 0.96);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-weight: var(--weight-semibold);
    font-size: var(--text-md);
    flex-shrink: 0;
}
.cpos-tpl-preview-name {
    font-size: var(--text-md);
    font-weight: var(--weight-medium);
    letter-spacing: var(--track-tight);
}
.cpos-tpl-preview-meta {
    font-family: var(--font-mono);
    font-size: var(--text-3xs);
    color: var(--text-tertiary);
    letter-spacing: var(--track-wide);
    margin-top: 2px;
}


/* ==========================================================================
   17. TABS
   ========================================================================== */

.tabs {
    display: flex;
    gap: 1px;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: var(--space-6);
}
.tab {
    padding: var(--space-4) var(--space-5);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--text-tertiary);
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    background: transparent;
    border-top: none;
    border-left: none;
    border-right: none;
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
}
.tab:hover { color: var(--text-primary); }
.tab.is-active { color: var(--text-primary); border-bottom-color: var(--accent); }
.tab-count {
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    color: var(--text-quaternary);
}


/* ==========================================================================
   18. AUTH LAYOUT
   ========================================================================== */

.auth-shell {
    min-height: 100vh;
    background: var(--bg-canvas);
    display: flex;
}

.auth-side {
    display: none;
    width: 50%;
    background: linear-gradient(135deg, var(--accent), oklch(28% 0.01 270));
    padding: var(--space-12);
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    color: oklch(98% 0.002 270);
}

.auth-side::before {
    content: '';
    position: absolute;
    top: 80px;
    left: 80px;
    width: 256px;
    height: 256px;
    border-radius: 50%;
    background: oklch(100% 0 0 / 0.10);
    filter: blur(80px);
}
.auth-side::after {
    content: '';
    position: absolute;
    bottom: 80px;
    right: 80px;
    width: 384px;
    height: 384px;
    border-radius: 50%;
    background: oklch(100% 0 0 / 0.06);
    filter: blur(96px);
}

.auth-side-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(oklch(100% 0 0 / 0.10) 1px, transparent 1px),
        linear-gradient(90deg, oklch(100% 0 0 / 0.10) 1px, transparent 1px);
    background-size: 40px 40px;
    opacity: 0.3;
}

.auth-side-content {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: var(--space-12);
    flex: 1;
    justify-content: space-between;
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}
.auth-brand-mark {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-xl);
    background: oklch(100% 0 0 / 0.20);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: oklch(100% 0 0 / 0.96);
    border: 1px solid oklch(100% 0 0 / 0.30);
    box-shadow: 0 4px 16px -2px oklch(0% 0 0 / 0.20);
}
.auth-brand-name {
    font-size: var(--text-2xl);
    font-weight: var(--weight-semibold);
    letter-spacing: var(--track-tighter);
    color: oklch(100% 0 0 / 0.96);
}
.auth-brand-tag {
    font-size: var(--text-sm);
    color: oklch(100% 0 0 / 0.70);
    margin-top: var(--space-2);
}

.auth-quote {
    font-size: var(--text-xl);
    font-weight: var(--weight-light);
    line-height: 1.5;
    color: oklch(100% 0 0 / 0.90);
    max-width: 28rem;
}
.auth-quote-em {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: var(--weight-regular);
}
.auth-attribution {
    margin-top: var(--space-6);
    font-size: var(--text-sm);
}
.auth-attribution-name {
    color: oklch(100% 0 0 / 0.96);
    font-weight: var(--weight-medium);
}
.auth-attribution-role {
    color: oklch(100% 0 0 / 0.60);
    margin-top: 2px;
}

.auth-footer-meta {
    display: flex;
    align-items: center;
    gap: var(--space-6);
    font-size: var(--text-sm);
    color: oklch(100% 0 0 / 0.50);
}
.auth-footer-meta .dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: oklch(100% 0 0 / 0.30);
}

.auth-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-9);
}

.auth-card {
    width: 100%;
    max-width: 28rem;
}

.auth-mobile-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    margin-bottom: var(--space-8);
}
.auth-mobile-brand-mark {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-xl);
    background: var(--bg-surface);
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-default);
    box-shadow: var(--shadow-sm);
}
.auth-mobile-brand-name {
    font-size: var(--text-xl);
    font-weight: var(--weight-semibold);
    letter-spacing: var(--track-tighter);
    color: var(--text-primary);
}

.auth-back {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    text-decoration: none;
    margin-bottom: var(--space-6);
    transition: color var(--duration-fast) var(--ease-out);
}
.auth-back:hover { color: var(--text-primary); }
.auth-back svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.75; fill: none; }

.auth-title {
    font-size: var(--text-3xl);
    font-weight: var(--weight-medium);
    letter-spacing: var(--track-tightest);
    line-height: 1;
    margin: 0 0 var(--space-3);
    color: var(--text-primary);
}
.auth-title em {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: var(--weight-regular);
}
.auth-sub {
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    margin: 0 0 var(--space-7);
}

.auth-success-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--success-soft);
    color: var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-5);
}
.auth-success-icon svg { width: 32px; height: 32px; stroke: currentColor; stroke-width: 1.75; fill: none; }

.auth-divider {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin: var(--space-7) 0;
}
.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-subtle);
}
.auth-divider span {
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    color: var(--text-quaternary);
    text-transform: uppercase;
    letter-spacing: var(--track-wider);
}

.oauth-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
}

@media (min-width: 1024px) {
    .auth-side { display: flex; }
    .auth-mobile-brand { display: none; }
}


/* ==========================================================================
   19. TODAY SCREEN
   ========================================================================== */

.today-head {
    text-align: center;
    margin-bottom: var(--space-10);
    padding-bottom: var(--space-8);
    border-bottom: 1px solid var(--border-subtle);
}
.today-dow {
    font-family: var(--font-mono);
    font-size: var(--text-3xs);
    text-transform: uppercase;
    letter-spacing: var(--track-widest);
    color: var(--text-quaternary);
    margin-bottom: var(--space-4);
}
.today-date {
    font-size: var(--text-5xl);
    font-weight: var(--weight-medium);
    letter-spacing: var(--track-tightest);
    line-height: 1;
    margin-bottom: var(--space-3);
}
.today-date em {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: var(--weight-regular);
}
.today-meta {
    color: var(--text-tertiary);
    font-size: var(--text-sm);
}

.today-tags {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    margin-top: var(--space-5);
}
.today-tag {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-full);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    background: var(--bg-surface-2);
    color: var(--text-secondary);
}
.today-tag-dot { width: 8px; height: 8px; border-radius: 50%; }

.today-quick-capture {
    display: flex;
    gap: var(--space-4);
    align-items: stretch;
}
.today-quick-capture textarea {
    flex: 1;
    min-height: 48px;
    resize: none;
}

.today-cycles {
    margin: 0;
}
.today-cycle-row {
    display: grid;
    grid-template-columns: 80px 1fr;
    border-bottom: 1px solid var(--border-subtle);
    transition: background var(--duration-fast) var(--ease-out);
}
.today-cycle-row:last-child { border-bottom: none; }
.today-cycle-row.is-current { background: var(--accent-soft); }

.today-cycle-time {
    padding: var(--space-5) var(--space-5);
    text-align: center;
    border-right: 1px solid var(--border-subtle);
}
.today-cycle-time-start {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-primary);
}
.today-cycle-time-end {
    font-family: var(--font-mono);
    font-size: var(--text-3xs);
    color: var(--text-quaternary);
    margin-top: var(--space-2);
}

.today-cycle-content {
    padding: var(--space-4);
    display: flex;
    align-items: center;
}

.today-cycle-stamp,
.today-cycle-session {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-5);
    border-radius: var(--radius-lg);
    width: 100%;
}
.today-cycle-stamp {
    background: color-mix(in oklab, var(--vc, var(--accent)) 12%, var(--bg-surface));
    border-left: 3px solid var(--vc, var(--accent));
}
[data-theme="dark"] .today-cycle-stamp {
    background: color-mix(in oklab, var(--vc, var(--accent)) 22%, var(--bg-surface));
}
.today-cycle-session {
    background: var(--accent-soft);
    border-left: 3px solid var(--accent);
    cursor: pointer;
    justify-content: space-between;
}
.today-cycle-session.is-completed { opacity: 0.6; }
.today-cycle-session.is-completed .session-title { text-decoration: line-through; }

.today-cycle-empty {
    padding: var(--space-3) var(--space-5);
    color: var(--text-quaternary);
    font-family: var(--font-mono);
    font-size: var(--text-3xs);
    text-transform: uppercase;
    letter-spacing: var(--track-wider);
}

.session-checkbox {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--border-strong);
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all var(--duration-fast) var(--ease-out);
    flex-shrink: 0;
}
.session-checkbox:hover { border-color: var(--accent); }
.session-checkbox.is-checked {
    background: var(--success);
    border-color: var(--success);
}
.session-checkbox svg { width: 12px; height: 12px; stroke: currentColor; stroke-width: 2.5; fill: none; }


/* ==========================================================================
   20. PROJECT LIST + DETAIL + DASHBOARD MISC
   ========================================================================== */

/* Project grid — equal-height auto-fill */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    grid-auto-rows: 1fr;
    gap: var(--space-5);
}

.project-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: var(--space-6);
    transition: border-color var(--duration-fast) var(--ease-out),
                box-shadow var(--duration-base) var(--ease-out),
                transform var(--duration-base) var(--ease-out);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-shadow: var(--shadow-sm);
    min-height: 200px;
}
.project-card:hover {
    border-color: var(--border-strong);
    color: inherit;
    box-shadow: var(--shadow-card-hover);
    transform: translateY(-2px);
}

.project-card-meta {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}
.project-card-cat {
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    color: var(--text-quaternary);
    text-transform: uppercase;
    letter-spacing: var(--track-wider);
}

.project-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}
.project-card-title {
    font-size: var(--text-base);
    font-weight: var(--weight-medium);
    color: var(--text-primary);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}
.project-card-pri {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    background: var(--accent);
    color: var(--accent-fg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    flex-shrink: 0;
}

.project-card-progress { margin-top: auto; margin-bottom: var(--space-5); }
.project-card-progress-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: var(--space-3);
}
.project-card-foot {
    display: flex;
    justify-content: space-between;
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    color: var(--text-tertiary);
    letter-spacing: var(--track-wide);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border-subtle);
}

/* Dashboard mini-cycle ribbon */
.mini-ribbon {
    display: flex;
    gap: 2px;
}
.mini-ribbon-cycle {
    flex: 1;
    height: 32px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    background: var(--bg-surface-2);
    color: var(--text-quaternary);
    transition: all var(--duration-fast) var(--ease-out);
}
.mini-ribbon-cycle.is-current {
    box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 4px var(--accent);
}
.mini-ribbon-cycle.is-stamped { color: white; font-weight: var(--weight-medium); }
.mini-ribbon-cycle.is-scheduled { background: var(--accent); color: var(--accent-fg); }
.mini-ribbon-cycle.is-completed { background: var(--success); color: white; }

.mini-ribbon-legend {
    display: flex;
    align-items: center;
    gap: var(--space-5);
    margin-top: var(--space-4);
    font-size: var(--text-2xs);
    color: var(--text-quaternary);
}
.mini-ribbon-legend-item { display: flex; align-items: center; gap: var(--space-2); }
.mini-ribbon-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: var(--radius-sm);
}

/* Action items list (project detail) */
.task-row {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    transition: all var(--duration-fast) var(--ease-out);
}
.task-row:hover { border-color: var(--border-default); }
.task-row.is-done { opacity: 0.6; }
.task-row.is-done .task-title { text-decoration: line-through; }

.task-grip {
    color: var(--text-quaternary);
    cursor: grab;
    opacity: 0;
    transition: opacity var(--duration-fast) var(--ease-out);
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}
.task-row:hover .task-grip { opacity: 1; }

.task-title {
    flex: 1;
    font-size: var(--text-sm);
    color: var(--text-primary);
    min-width: 0;
}

.task-cycles {
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    color: var(--text-tertiary);
    background: var(--bg-surface-2);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.task-star {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    color: var(--text-quaternary);
    opacity: 0;
    transition: all var(--duration-fast) var(--ease-out);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.task-row:hover .task-star { opacity: 1; }
.task-star:hover { color: var(--warning); }
.task-star.is-active { opacity: 1; color: var(--warning); }
.task-star svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.75; fill: none; }
.task-star.is-active svg { fill: currentColor; }

.task-x {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    color: var(--text-quaternary);
    opacity: 0;
    transition: all var(--duration-fast) var(--ease-out);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.task-row:hover .task-x { opacity: 1; }
.task-x:hover { color: var(--danger); background: var(--danger-soft); }


/* ==========================================================================
   21. RESPONSIVE
   ========================================================================== */

@media (max-width: 1280px) {
    .cpos-db-grid { grid-template-columns: 220px 1fr 280px; gap: var(--space-4); }
}

@media (max-width: 1024px) {
    .cpos-db-grid { grid-template-columns: 1fr; }
    .cpos-db-side, .cpos-db-detail {
        position: static;
        max-height: none;
    }
    .page-body { padding: 0 var(--space-7) var(--space-10); }
    .topbar { padding: var(--space-6) var(--space-7); }

    /* hide right rails on lower breakpoints */
    .lg-hide { display: none; }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
    }
    .sidebar.is-open { transform: translateX(0); }
    .menu-toggle { display: inline-flex; }

    .topbar h1 { font-size: var(--text-2xl); }
    .topbar-actions .btn-text { display: none; }

    .cpos-db-head { flex-direction: column; align-items: flex-start; }
    .cpos-cycle-budget-grid { grid-template-columns: 1fr; }
    .cpos-cycle-row { grid-template-columns: 48px 1fr; }
    .cpos-cycle-occupant-sub { display: none; }
    .cpos-month-grid { grid-auto-rows: minmax(80px, auto); }
    .cpos-cell { min-height: 80px; padding: var(--space-3); }
    .cpos-cell-stamp-time { display: none; }

    .kpi-strip { grid-template-columns: repeat(2, 1fr); }
    .grid-cols-2, .grid-cols-3, .grid-cols-4 { grid-template-columns: 1fr; }
    .md\:grid-cols-2 { grid-template-columns: 1fr; }
    .md\:grid-cols-3 { grid-template-columns: 1fr; }
    .md\:grid-cols-4 { grid-template-columns: 1fr; }

    .auth-shell { flex-direction: column; }
    .auth-side { display: none; }
    .auth-mobile-brand { display: flex; }

    .today-date { font-size: var(--text-3xl); }
}

/* Larger breakpoints */
@media (min-width: 768px) {
    .md\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
    .md\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
    .md\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1024px) {
    .lg\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
    .lg\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
    .lg\:grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1280px) {
    .xl\:grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
    .xl\:grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
}

/* ============================================================
   AUTH — Successful Citizen Suite module color families
   ------------------------------------------------------------
   Each module renders the same auth_layout but with its own
   color family. Scope is limited to .auth-shell[data-module=…]
   so the dashboard accent stays neutral post-login.

   Modules:
     projectos   — indigo  (structure / ascent)        [current site]
     pipeline    — teal    (flow / channels)
     cloudos     — sky     (cloud / central hub)
     relay       — amber   (signal / broadcast)
     lifeos      — green   (growth / vitality)
     pingtreeos  — magenta (pulse / ping)
   ============================================================ */

.auth-shell[data-module] {
    /* universal text color for module-tinted surfaces */
    --module-accent-fg: oklch(98% 0.002 270);
}

.auth-shell[data-module="projectos"] {
    --module-accent:       oklch(45% 0.18 275);
    --module-accent-deep:  oklch(26% 0.14 282);
    --module-accent-soft:  oklch(45% 0.18 275 / 0.10);
    --module-accent-hover: oklch(52% 0.18 273);
}

.auth-shell[data-module="pipeline"] {
    --module-accent:       oklch(58% 0.13 195);
    --module-accent-deep:  oklch(32% 0.10 200);
    --module-accent-soft:  oklch(58% 0.13 195 / 0.10);
    --module-accent-hover: oklch(64% 0.13 195);
}

.auth-shell[data-module="cloudos"] {
    --module-accent:       oklch(58% 0.14 235);
    --module-accent-deep:  oklch(34% 0.12 242);
    --module-accent-soft:  oklch(58% 0.14 235 / 0.10);
    --module-accent-hover: oklch(64% 0.14 235);
}

.auth-shell[data-module="relay"] {
    --module-accent:       oklch(65% 0.16 55);
    --module-accent-deep:  oklch(38% 0.13 50);
    --module-accent-soft:  oklch(65% 0.16 55 / 0.10);
    --module-accent-hover: oklch(70% 0.16 55);
}

.auth-shell[data-module="lifeos"] {
    --module-accent:       oklch(58% 0.15 145);
    --module-accent-deep:  oklch(32% 0.12 150);
    --module-accent-soft:  oklch(58% 0.15 145 / 0.10);
    --module-accent-hover: oklch(64% 0.15 145);
}

.auth-shell[data-module="pingtreeos"] {
    --module-accent:       oklch(60% 0.20 350);
    --module-accent-deep:  oklch(35% 0.16 355);
    --module-accent-soft:  oklch(60% 0.20 350 / 0.10);
    --module-accent-hover: oklch(66% 0.20 350);
}

/* Apply the module color family to the side panel + form button */
.auth-shell[data-module] .auth-side {
    background: linear-gradient(135deg, var(--module-accent), var(--module-accent-deep));
}
.auth-shell[data-module] .auth-main .btn-primary {
    background:    var(--module-accent);
    border-color:  var(--module-accent);
    color:         var(--module-accent-fg);
}
.auth-shell[data-module] .auth-main .btn-primary:hover {
    background:    var(--module-accent-hover);
    border-color:  var(--module-accent-hover);
    color:         var(--module-accent-fg);
    box-shadow:    var(--shadow-md), 0 0 0 4px var(--module-accent-soft);
}
.auth-shell[data-module] .auth-mobile-brand-mark {
    color: var(--module-accent);
}
.auth-shell[data-module] .auth-main a.text-accent {
    color: var(--module-accent);
}
.auth-shell[data-module] .auth-main a.text-accent:hover {
    color: var(--module-accent-hover);
}

/* Suite hub badge — sits under the brand block on the side panel */
.auth-suite-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: var(--space-5, 12px);
    padding: 7px 14px;
    border-radius: var(--radius-full);
    background: oklch(100% 0 0 / 0.10);
    border: 1px solid oklch(100% 0 0 / 0.20);
    color: oklch(100% 0 0 / 0.88);
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    letter-spacing: 0.01em;
    text-decoration: none;
    backdrop-filter: blur(6px);
    transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}
.auth-suite-link:hover {
    background: oklch(100% 0 0 / 0.18);
    border-color: oklch(100% 0 0 / 0.34);
    color: oklch(100% 0 0 / 1);
    transform: translateY(-1px);
}
.auth-suite-link-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: oklch(100% 0 0 / 0.85);
    box-shadow: 0 0 0 3px oklch(100% 0 0 / 0.15);
}
.auth-suite-link-sep {
    opacity: 0.5;
}
.auth-suite-link-cta {
    font-weight: var(--weight-semibold, 600);
}
.auth-suite-link-arrow {
    font-size: 12px;
    line-height: 1;
    opacity: 0.85;
    transition: transform 160ms ease;
}
.auth-suite-link:hover .auth-suite-link-arrow {
    transform: translateX(2px);
}

/* Mobile suite footer (under the form, visible at all widths but
   really matters on narrow viewports where the side panel is hidden) */
.auth-suite-mobile {
    margin-top: var(--space-7, 20px);
    text-align: center;
    font-size: var(--text-xs);
    color: var(--text-tertiary);
}
.auth-suite-mobile a {
    color: var(--text-secondary);
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: var(--weight-medium);
}
.auth-suite-mobile a:hover {
    color: var(--text-primary);
}

/* Mobile brand text wrapper — two-line lockup on the form-side header */
.auth-mobile-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}
.auth-mobile-brand-tag {
    display: block;
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    color: var(--text-tertiary);
    letter-spacing: 0.01em;
    margin-top: 2px;
}


/* ==========================================================================
   22. PROJECTS SECTION (v5) — list, drift, detail modular grid, form
   --------------------------------------------------------------------------
   Mobile-first: every rule below targets 360px first; desktop layout is
   layered on at min-width breakpoints.
   ========================================================================== */

:root {
    --c-purple:      oklch(58% 0.20 300);
    --c-purple-soft: oklch(58% 0.20 300 / 0.12);
}

/* ---- Filter bar ---------------------------------------------------------- */
.proj-filters { margin-bottom: var(--space-7); }

.btn-filters { display: inline-flex; }

.proj-filters-body {
    display: none;
    flex-direction: column;
    gap: var(--space-5);
}
.proj-filters-body.is-open {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 70;
    background: var(--bg-surface);
    padding: var(--space-6);
    overflow-y: auto;
}
.proj-filters-drawer-head,
.proj-filters-drawer-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.proj-filters-drawer-foot { margin-top: auto; }

.proj-search { width: 100%; }
.proj-filter-group { display: flex; flex-direction: column; gap: var(--space-3); }
.proj-filter-label {
    font-family: var(--font-mono);
    font-size: var(--text-3xs);
    text-transform: uppercase;
    letter-spacing: var(--track-wider);
    color: var(--text-quaternary);
}
.chip-row { display: flex; flex-wrap: wrap; gap: var(--space-3); }

.saved-views {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    margin-top: var(--space-5);
}
.saved-views .chip { text-decoration: none; }

@media (min-width: 720px) {
    .btn-filters { display: none; }
    .proj-filters-body {
        display: flex;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-end;
        gap: var(--space-5);
        position: static;
        padding: 0;
    }
    .proj-filters-drawer-head,
    .proj-filters-drawer-foot { display: none; }
    .proj-search { width: auto; flex: 1; min-width: 240px; max-width: 22rem; }
}

/* ---- Project card extras ------------------------------------------------ */
.project-card-wrap { display: flex; flex-direction: column; gap: var(--space-3); }

.project-card.is-drift { border-left: 2px solid var(--danger); }

.energy-glyph {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    color: var(--text-tertiary);
    cursor: help;
}

.project-card-title-block {
    font-size: var(--text-md);
    font-weight: var(--weight-medium);
    color: var(--text-primary);
    line-height: var(--leading-snug);
    margin: 0 0 var(--space-3);
}
.project-card-title-block em {
    font-family: var(--font-serif);
    font-style: italic;
    font-weight: var(--weight-regular);
}

.project-card-summary {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin: 0 0 var(--space-4);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.velocity-line {
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    margin: 0 0 var(--space-5);
    color: var(--text-tertiary);
}
.velocity-line.velocity-danger { color: var(--danger); }
.velocity-line.velocity-warn   { color: oklch(58% 0.15 75); }
.velocity-line.velocity-ok     { color: var(--success); }
.velocity-line.velocity-quiet  { color: var(--text-quaternary); }

.project-card-foot { align-items: center; gap: var(--space-3); }
.project-card-foot .badge { flex-shrink: 0; }

.drift-actions { display: flex; gap: var(--space-3); }
.drift-actions .btn { flex: 1; justify-content: center; }

/* ---- Project detail header --------------------------------------------- */
.pd-head { flex-wrap: wrap; gap: var(--space-5); }
.pd-child-caption,
.pd-chips {
    font-size: var(--text-2xs);
    color: var(--text-tertiary);
    margin: var(--space-3) 0 0;
}
.pd-chips .sep { margin: 0 var(--space-3); color: var(--text-quaternary); }
.pd-child-caption { color: var(--c-purple); }

.pd-actions { flex-wrap: wrap; gap: var(--space-3); }

.pd-overflow { position: relative; }
.pd-overflow-menu {
    position: absolute;
    right: 0;
    top: calc(100% + var(--space-3));
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--space-3);
    min-width: 180px;
    z-index: 40;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}
.pd-overflow-menu a,
.pd-overflow-menu button {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    background: none;
    border: none;
    font: inherit;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    text-align: left;
}
.pd-overflow-menu a:hover,
.pd-overflow-menu button:hover { background: var(--bg-surface-2); color: var(--text-primary); }
.pd-overflow-menu .is-danger:hover { background: var(--danger-soft); color: var(--danger); }
.pd-overflow-menu svg { width: 14px; height: 14px; }

/* ---- Stake bar ---------------------------------------------------------- */
.stake-bar {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    padding: var(--space-4) 0;
    margin: 0 0 var(--space-6);
}
.stake-bar em { font-family: var(--font-serif); font-size: var(--text-md); }
.stake-label {
    font-weight: var(--weight-semibold);
    color: var(--text-primary);
}

/* ---- Modules ------------------------------------------------------------ */
.module {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}
.module-pinned { margin-bottom: var(--space-6); }

.module-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--border-subtle);
}
.module-title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--text-primary);
}
.module-body { padding: var(--space-6); }

.module-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-6);
}
@media (min-width: 720px) {
    .module-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
}

.module-empty {
    text-align: center;
    padding: var(--space-7) var(--space-5);
    color: var(--text-tertiary);
}
.module-empty h4 {
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--text-secondary);
    margin: 0 0 var(--space-2);
}
.module-empty h4 em { font-family: var(--font-serif); }
.module-empty p { font-size: var(--text-xs); margin: 0; }

.ai-pill {
    font-family: var(--font-mono);
    font-size: var(--text-3xs);
    text-transform: uppercase;
    letter-spacing: var(--track-wide);
    background: var(--c-purple-soft);
    color: var(--c-purple);
    padding: 2px var(--space-3);
    border-radius: var(--radius-full);
}

/* Cycle progress module */
.cycle-progress-grid {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-6);
    margin-bottom: var(--space-5);
}
.cycle-progress-foot {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3) var(--space-6);
    margin-top: var(--space-4);
    font-size: var(--text-2xs);
    color: var(--text-quaternary);
}
.cycle-family-rollup {
    font-size: var(--text-2xs);
    color: var(--c-purple);
    margin: var(--space-4) 0 0;
}

/* Tasks module */
.task-add-row { display: flex; gap: var(--space-3); margin-bottom: var(--space-5); }
.task-add-row input[type="text"] { flex: 1; min-width: 0; }
.task-add-row input[type="number"] { width: 64px; text-align: center; }
.milestone-head {
    font-size: var(--text-3xs);
    text-transform: uppercase;
    letter-spacing: var(--track-wider);
    color: var(--text-quaternary);
    margin: var(--space-6) 0 var(--space-3);
}

/* Stat tiles */
.stat-tiles {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
}
.stat-tile {
    background: var(--bg-surface-2);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    text-align: center;
}
.stat-num {
    font-size: var(--text-lg);
    color: var(--text-primary);
}

/* Family queue */
.family-mother-row,
.subproject-row {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    text-decoration: none;
    color: inherit;
}
.family-mother-row {
    background: var(--c-purple-soft);
    margin-bottom: var(--space-5);
}
.family-current {
    border-left: 2px solid var(--c-purple);
    padding-left: var(--space-5);
}
.family-section-head {
    font-size: var(--text-3xs);
    text-transform: uppercase;
    letter-spacing: var(--track-wider);
    color: var(--text-quaternary);
    margin-bottom: var(--space-3);
}
.family-legend {
    font-size: var(--text-2xs);
    color: var(--text-quaternary);
    margin: var(--space-6) 0 0;
}

/* Sub-projects */
.subproject-row { border: 1px solid var(--border-subtle); }
.subproject-row:hover { border-color: var(--border-default); }
.subproject-row.is-drift { border-left: 2px solid var(--danger); }
.subproject-main { flex: 1; min-width: 0; }
.subproject-title {
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    display: block;
    margin-bottom: var(--space-3);
}
.subproject-title em { font-family: var(--font-serif); font-weight: var(--weight-regular); }

/* Add module footer */
.add-module-foot {
    width: 100%;
    margin-top: var(--space-6);
    padding: var(--space-6);
    border: 1px dashed var(--border-default);
    border-radius: var(--radius-xl);
    background: none;
    color: var(--text-tertiary);
    font: inherit;
    font-size: var(--text-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
}
.add-module-foot:hover { color: var(--text-primary); border-color: var(--border-strong); }

/* ---- Drawer (Modules library) ------------------------------------------ */
.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: oklch(0% 0 0 / 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--duration-base) var(--ease-out);
    z-index: 75;
}
.drawer-backdrop.is-open { opacity: 1; pointer-events: auto; }

.drawer {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: 100%;
    max-width: 420px;
    background: var(--bg-surface);
    box-shadow: var(--shadow-lg);
    transform: translateX(100%);
    transition: transform var(--duration-base) var(--ease-out);
    z-index: 80;
    display: flex;
    flex-direction: column;
}
.drawer.is-open { transform: translateX(0); }
.drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-6);
    border-bottom: 1px solid var(--border-subtle);
}
.drawer-body { padding: var(--space-6); overflow-y: auto; }
.drawer-group-head {
    font-family: var(--font-mono);
    font-size: var(--text-3xs);
    text-transform: uppercase;
    letter-spacing: var(--track-wider);
    color: var(--text-quaternary);
    margin: var(--space-6) 0 var(--space-4);
}
.drawer-group-head:first-child { margin-top: 0; }

.module-row {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) 0;
    border-bottom: 1px solid var(--border-subtle);
}
.module-row.is-soon { opacity: 0.5; }
.module-row-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.module-row-name { font-size: var(--text-sm); font-weight: var(--weight-medium); }
.module-row-brief { font-size: var(--text-2xs); color: var(--text-tertiary); }
.module-row-badges { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-1); }

.ctx-badge {
    font-family: var(--font-mono);
    font-size: var(--text-3xs);
    text-transform: uppercase;
    letter-spacing: var(--track-wide);
    color: var(--text-quaternary);
    background: var(--bg-surface-3);
    border-radius: var(--radius-sm);
    padding: 1px var(--space-3);
}
.ctx-badge.ctx-pinned { background: var(--accent-soft); color: var(--text-secondary); }

/* Toggle switch */
.toggle-switch {
    flex-shrink: 0;
    width: 32px;
    height: 18px;
    border-radius: var(--radius-full);
    background: var(--bg-surface-3);
    border: none;
    cursor: pointer;
    position: relative;
    transition: background var(--duration-base) var(--ease-out);
}
.toggle-switch::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--bg-surface);
    box-shadow: var(--shadow-xs);
    transition: transform var(--duration-base) var(--ease-out);
}
.toggle-switch.is-on { background: var(--accent); }
.toggle-switch.is-on::after { transform: translateX(14px); }
.toggle-switch.is-disabled { opacity: 0.4; cursor: not-allowed; }

/* ---- Project form ------------------------------------------------------- */
.form-shell { max-width: 640px; margin: 0 auto; }
.project-form { display: flex; flex-direction: column; gap: var(--space-6); }

.form-section {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    padding: var(--space-7);
}
.form-section-title {
    font-size: var(--text-md);
    font-weight: var(--weight-semibold);
    margin: 0 0 var(--space-5);
}
.form-section-title em { font-family: var(--font-serif); font-weight: var(--weight-regular); }

.form-section.is-collapsible { padding: 0; }
.form-section-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-7);
    background: none;
    border: none;
    font: inherit;
    cursor: pointer;
}
.form-section-toggle .form-section-title { margin: 0; }
.collapse-chevron { transition: transform var(--duration-fast) var(--ease-out); }
.form-section.is-open .collapse-chevron { transform: rotate(90deg); }
.form-section-body { padding: 0 var(--space-7) var(--space-7); }

.field { margin-bottom: var(--space-5); }
.field:last-child { margin-bottom: 0; }
.field-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-5);
}
@media (min-width: 560px) {
    .field-grid { grid-template-columns: 1fr 1fr; }
}
.field-hint {
    font-size: var(--text-2xs);
    color: var(--text-quaternary);
    margin: var(--space-2) 0 0;
}

.hint-pill {
    display: inline-block;
    font-size: var(--text-2xs);
    background: var(--c-purple-soft);
    color: var(--c-purple);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    margin: 0 0 var(--space-5);
}

/* Pill toggle */
.pill-toggle { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.pill {
    flex: 1;
    min-width: 72px;
    padding: var(--space-4) var(--space-3);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-md);
    background: none;
    font: inherit;
    font-size: var(--text-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--duration-fast) var(--ease-out);
}
.pill:hover { border-color: var(--border-strong); }
.pill.is-active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--accent-fg);
}
.pill-glyph { font-family: var(--font-mono); }

/* Radio rows */
.radio-row {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4) 0;
    font-size: var(--text-sm);
}
.radio-row.is-disabled { opacity: 0.5; }

/* Sticky form footer (mobile) */
.form-foot {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-4);
    position: sticky;
    bottom: 0;
    background: var(--bg-canvas);
    padding: var(--space-5) 0;
    margin-top: var(--space-2);
}
.form-foot .btn { flex: 1; justify-content: center; }
@media (min-width: 560px) {
    .form-foot { position: static; padding: 0; }
    .form-foot .btn { flex: 0 0 auto; }
}

/* Touch targets — §7 mobile rule: 44px minimum on coarse pointers */
@media (pointer: coarse) {
    .toggle-switch { width: 44px; height: 26px; }
    .toggle-switch::after { width: 22px; height: 22px; }
    .toggle-switch.is-on::after { transform: translateX(18px); }
}


/* ==========================================================================
   23. PROJECT DETAIL — Phase 1.1 polish
   ========================================================================== */

/* ---- Header ------------------------------------------------------------- */
.pd-crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-2); }
.pd-crumb-parent { color: #534AB7; }
.pd-crumb-parent:hover { color: #3C3489; }
.pd-crumb-current { color: var(--text-primary); }
.pd-crumb-current em { font-family: var(--font-serif); font-style: italic; }

.pd-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin: var(--space-4) 0 0;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
}
.pd-chip-parent { color: #534AB7; }

.pd-actions { flex-wrap: wrap; gap: var(--space-3); align-items: center; }

/* Dot-pill badges */
.pill-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
}
.pill-badge-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.pill-badge--active { background: #EAF3DE; color: #27500A; }
.pill-badge--high   { background: #FCEBEB; color: #791F1F; }
.pill-badge--med    { background: #FAEEDA; color: #633806; }
.pill-badge--inbox  { background: #E6F1FB; color: #0C447C; }
.pill-badge--muted  { background: var(--bg-surface-3); color: var(--text-secondary); }

/* ---- Stake slip --------------------------------------------------------- */
.stake-slip {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    background: var(--bg-surface);
    border: 0.5px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: 12px 18px;
    margin-bottom: 10px;
}
.stake-slip-icon { color: var(--text-secondary); flex-shrink: 0; }
.stake-slip-eyebrow {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    flex-shrink: 0;
}
.stake-slip-text {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 15px;
    line-height: 1.4;
    color: var(--text-secondary);
    flex: 1;
    min-width: 0;
}
.stake-slip-edit { opacity: 0; flex-shrink: 0; }
.stake-slip:hover .stake-slip-edit { opacity: 1; }
@media (pointer: coarse) { .stake-slip-edit { opacity: 1; } }

/* ---- Cycle progress stat strip ----------------------------------------- */
.stat-strip {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-6);
    margin-bottom: var(--space-6);
}
@media (min-width: 620px) {
    .stat-strip { grid-template-columns: repeat(4, 1fr); }
}
.stat-cell { display: flex; flex-direction: column; gap: var(--space-3); }
.stat-big {
    font-family: var(--font-serif);
    font-size: 28px;
    line-height: 1;
    color: var(--text-primary);
}
.stat-big-sub {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    color: var(--text-tertiary);
}
.stat-vel { display: flex; align-items: baseline; gap: var(--space-3); }
.stat-vel-glyph { font-family: var(--font-serif); font-size: 28px; line-height: 1; }
.stat-vel-label { font-family: var(--font-sans); font-size: var(--text-base); color: var(--text-secondary); }
.stat-vel--ok .stat-vel-glyph    { color: #27500A; }
.stat-vel--warn .stat-vel-glyph  { color: #BA7517; }
.stat-vel--quiet .stat-vel-glyph { color: var(--text-quaternary); }

.cycle-progress-foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: var(--space-3) var(--space-6);
    margin-top: var(--space-4);
    font-size: 10px;
    color: var(--text-tertiary);
}
.cycle-family-rollup {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    color: #534AB7;
}

/* ---- Drag handle -------------------------------------------------------- */
.pd-drag-handle { cursor: grab; }
.pd-drag-handle svg:first-child { opacity: 0.4; }
.module.is-dragging { opacity: 0.5; }

/* ---- Tasks → cycles ----------------------------------------------------- */
.milestone-divider {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin: var(--space-6) 0 var(--space-3);
}
.milestone-divider:first-child { margin-top: 0; }
.milestone-divider-title {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
}
.milestone-divider-prog { font-size: 10px; color: var(--text-quaternary); }

.task-row.is-progress .task-status-icon,
.task-row.is-progress .task-title { color: #BA7517; }
.task-status-icon { color: var(--text-quaternary); flex-shrink: 0; }

.module-dashed-foot {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
    margin-top: var(--space-5);
    padding-top: var(--space-5);
    border-top: 1px dashed var(--border-default);
}
.link-purple { color: #534AB7; }
.link-purple:hover { color: #3C3489; }
.icon-purple { color: #534AB7; }

/* ---- Generate tasks proposal banner ------------------------------------ */
.proposal-banner {
    background: #EEEDFE;
    border-radius: var(--radius-lg);
    padding: var(--space-5);
}
.proposal-banner-eyebrow {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #534AB7;
    margin-bottom: var(--space-3);
}
.proposal-banner-text { font-size: var(--text-sm); color: #3C3489; margin: 0; }

/* ---- Notes & quick stats ----------------------------------------------- */
.stat-tiles { grid-template-columns: repeat(2, 1fr); }
.stat-tile { text-align: left; padding: 10px 12px; }
.stat-tile-num {
    font-family: var(--font-serif);
    font-size: 22px;
    line-height: 1.1;
    color: var(--text-primary);
    margin-top: var(--space-2);
}
.stat-tile-num--sm { font-size: var(--text-md); }
.stat-tile-unit {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-tertiary);
    margin-left: 2px;
}
.next-steps-block {
    margin-top: var(--space-6);
    padding-top: var(--space-5);
    border-top: 1px dashed var(--border-default);
}

/* ---- Family queue ------------------------------------------------------- */
.family-mother-row {
    background: #EEEDFE;
    margin-bottom: var(--space-5);
    color: #3C3489;
}
.family-mother-name { font-weight: var(--weight-medium); color: #3C3489; }
.family-mother-meta { font-size: 10px; color: #534AB7; margin-left: auto; }

.family-pred-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-2);
    background: var(--bg-surface-2);
    border: none;
    border-radius: var(--radius-md);
    padding: 8px 12px;
    margin-bottom: var(--space-5);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    cursor: pointer;
}
.family-pred-chevron { display: inline-flex; transition: transform var(--duration-fast) var(--ease-out); }
.family-pred-toggle.is-open .family-pred-chevron { transform: rotate(90deg); }
.family-pred-count { color: var(--text-quaternary); }
.family-pred-body { margin-bottom: var(--space-5); }
.family-pred-task { opacity: 0.85; }

.family-sib-head {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-tertiary);
    margin: var(--space-5) 0 var(--space-3);
}
.family-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.family-dot--before  { background: var(--text-quaternary); }
.family-dot--current { background: #534AB7; }
.family-dot--after   { background: var(--text-tertiary); }

.family-current-pill {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    background: #EEEDFE;
    color: #3C3489;
    border-radius: var(--radius-md);
    padding: 6px 12px;
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}
.family-current {
    border-left: 2px solid #534AB7;
    padding-left: 14px;
    margin: var(--space-3) 0 var(--space-5);
}
.family-current .task-row { border-color: transparent; }

.family-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin: var(--space-6) 0 0;
    font-size: 10px;
    color: var(--text-tertiary);
}
.family-legend span { display: inline-flex; align-items: center; gap: var(--space-2); }

/* ---- Add module footer -------------------------------------------------- */
.add-module-foot { flex-direction: column; gap: var(--space-2); padding: 14px; }
.add-module-foot-main { display: flex; align-items: center; gap: var(--space-3); }
.add-module-foot-list {
    font-size: 10px;
    color: var(--text-quaternary);
}

.drawer-hint {
    font-size: 10px;
    color: var(--text-tertiary);
    margin: 0 0 var(--space-5);
}

/* ---- Settings: unit terminology cards ---------------------------------- */
.unit-card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
}
@media (min-width: 560px) {
    .unit-card-grid { grid-template-columns: 1fr 1fr; }
}
.unit-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    text-align: left;
    padding: var(--space-6);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    background: none;
    font: inherit;
    cursor: pointer;
    transition: border-color var(--duration-fast) var(--ease-out),
                background var(--duration-fast) var(--ease-out);
}
.unit-card:hover { border-color: var(--border-default); }
.unit-card.is-active { border-color: #534AB7; background: #EEEDFE; }
.unit-card-head { display: flex; align-items: center; gap: var(--space-3); }
.unit-card-glyph { font-family: var(--font-mono); font-size: var(--text-lg); color: #534AB7; }
.unit-card-label { font-size: var(--text-md); font-weight: var(--weight-medium); color: var(--text-primary); }
.unit-card-caption { font-size: var(--text-xs); color: var(--text-tertiary); }
.unit-card-preview { font-size: 10px; color: var(--text-quaternary); }
.unit-card.is-active .unit-card-caption,
.unit-card.is-active .unit-card-preview { color: #3C3489; }
.unit-card-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin: var(--space-5) 0 0;
    font-size: 10px;
    color: var(--text-tertiary);
}
