/* ============================================
   STYLES.CSS — Luxury Recovery Design System
   Recovery Civilization R&D Office
   Inspired by: Aman, Six Senses, Hoshinoya
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;500;600;700&family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ── CSS Custom Properties ── */
:root {
    /* Colors — Luxury Dark Palette */
    --bg-primary: #080c14;
    --bg-secondary: #0d1420;
    --bg-tertiary: #131b2e;
    --bg-surface: rgba(255, 255, 255, 0.03);
    --bg-surface-hover: rgba(255, 255, 255, 0.06);
    --bg-surface-active: rgba(255, 255, 255, 0.08);

    /* Gold — Champagne Signature */
    --gold-50: #fdf8ef;
    --gold-100: #f5e6c8;
    --gold-200: #e8d5a3;
    --gold-300: #dcc07a;
    --gold-400: #c9a96e;
    --gold-500: #b8965a;
    --gold-600: #a07d45;
    --gold-primary: #c9a96e;
    --gold-glow: rgba(201, 169, 110, 0.15);
    --gold-border: rgba(201, 169, 110, 0.12);

    /* Emerald — Nature Recovery */
    --emerald-400: #3faa85;
    --emerald-500: #2d8a6e;
    --emerald-600: #1f7058;
    --emerald-glow: rgba(63, 170, 133, 0.15);

    /* Accent Colors per Pillar */
    --pillar-mobility: #c9a96e;
    --pillar-hospitality: #8b6eb8;
    --pillar-ritual: #b87a5e;
    --pillar-community: #5e8bb8;
    --pillar-architecture: #7eb85e;
    --pillar-store: #b85e7a;

    /* Status */
    --status-active: #3faa85;
    --status-planning: #c9a96e;
    --status-pending: #6b7280;
    --status-done: #2d8a6e;
    --status-risk: #c45e5e;

    /* Text */
    --text-primary: #f5f0e8;
    --text-secondary: #b8b0a0;
    --text-muted: #7a7268;
    --text-accent: #c9a96e;

    /* Borders */
    --border-subtle: rgba(201, 169, 110, 0.08);
    --border-default: rgba(201, 169, 110, 0.12);
    --border-strong: rgba(201, 169, 110, 0.25);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 16px 64px rgba(0, 0, 0, 0.6);
    --shadow-gold: 0 4px 20px rgba(201, 169, 110, 0.15);

    /* Glass */
    --glass-bg: rgba(13, 20, 32, 0.7);
    --glass-border: rgba(201, 169, 110, 0.1);
    --glass-blur: 20px;

    /* Spacing */
    --sidebar-width: 260px;
    --sidebar-collapsed: 72px;
    --header-height: 64px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    /* Typography */
    --font-display: 'Playfair Display', 'Georgia', serif;
    --font-body: 'Inter', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --transition-fast: 0.15s var(--ease-out);
    --transition-normal: 0.3s var(--ease-out);
    --transition-slow: 0.5s var(--ease-out);
}

/* ── Light Mode ── */
[data-theme="light"] {
    --bg-primary: #faf8f5;
    --bg-secondary: #f2efe9;
    --bg-tertiary: #eae5dc;
    --bg-surface: rgba(0, 0, 0, 0.03);
    --bg-surface-hover: rgba(0, 0, 0, 0.05);
    --bg-surface-active: rgba(0, 0, 0, 0.07);

    --gold-primary: #9a7b42;
    --gold-glow: rgba(154, 123, 66, 0.12);
    --gold-border: rgba(154, 123, 66, 0.15);

    --text-primary: #1a1612;
    --text-secondary: #5c5347;
    --text-muted: #9a9084;
    --text-accent: #9a7b42;

    --border-subtle: rgba(0, 0, 0, 0.06);
    --border-default: rgba(0, 0, 0, 0.1);
    --border-strong: rgba(0, 0, 0, 0.18);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 16px 64px rgba(0, 0, 0, 0.12);
    --shadow-gold: 0 4px 20px rgba(154, 123, 66, 0.12);

    --glass-bg: rgba(250, 248, 245, 0.85);
    --glass-border: rgba(154, 123, 66, 0.12);

    --status-active: #1f7058;
    --status-planning: #9a7b42;
    --status-done: #1f7058;
    --status-risk: #b03a3a;

    --pillar-mobility: #9a7b42;
    --pillar-hospitality: #6b4d99;
    --pillar-ritual: #995c3d;
    --pillar-community: #3d6b99;
    --pillar-architecture: #5c993d;
    --pillar-store: #993d5c;
}

[data-theme="light"] body::before {
    background:
        radial-gradient(ellipse at 20% 50%, rgba(154, 123, 66, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(31, 112, 88, 0.03) 0%, transparent 50%);
}

[data-theme="light"] .sidebar {
    background: linear-gradient(180deg, #f2efe9 0%, #faf8f5 100%);
    border-right-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .content-header {
    background: rgba(250, 248, 245, 0.9);
}

[data-theme="light"] .sso-overlay {
    background: #faf8f5;
}

[data-theme="light"] .sso-card {
    background: #f2efe9;
}

[data-theme="light"] .logo-icon img {
    filter: brightness(0.6) sepia(0.5);
}

[data-theme="light"] ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] ::selection {
    background: rgba(154, 123, 66, 0.2);
    color: #1a1612;
}

/* ── Theme Toggle Button ── */
.theme-toggle {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.05rem;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.theme-toggle:hover {
    border-color: var(--gold-border);
    color: var(--gold-primary);
    background: var(--bg-surface-hover);
}

/* ── Reset & Base ── */
*, *::before, *::after {
    margin: 0; padding: 0; box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow: hidden;
    line-height: 1.6;
}

/* Subtle texture overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(201, 169, 110, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(63, 170, 133, 0.02) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

::selection {
    background: rgba(201, 169, 110, 0.3);
    color: var(--text-primary);
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gold-border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold-400); }

a { color: var(--gold-primary); text-decoration: none; transition: color var(--transition-fast); }
a:hover { color: var(--gold-200); }

/* ── SIDEBAR ── */
.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0; top: 0;
    z-index: 100;
    transition: width var(--transition-normal);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.logo-icon {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
}

.logo-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(201, 169, 110, 0.3));
}

.logo-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.logo-title {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--gold-primary);
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.logo-subtitle {
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 500;
}

/* Navigation */
.nav-menu {
    list-style: none;
    padding: 12px 10px;
    flex: 1;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.88rem;
    font-weight: 500;
    transition: all var(--transition-normal);
    margin-bottom: 2px;
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--gold-primary);
    border-radius: 0 4px 4px 0;
    transform: scaleY(0);
    transition: transform var(--transition-normal);
}

.nav-item:hover {
    background: var(--bg-surface-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--bg-surface-active);
    color: var(--gold-primary);
}

.nav-item.active::before {
    transform: scaleY(1);
}

.nav-item svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
}

.nav-item.active svg,
.nav-item:hover svg {
    opacity: 1;
}

.nav-item span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Nav Section Labels */
.nav-section {
    padding: 16px 14px 6px;
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-subtle);
}

.user-info-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold-500), var(--emerald-500));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.user-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-primary);
}

.user-role {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-sso-logout {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    padding: 6px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-sso-logout:hover {
    border-color: var(--status-risk);
    color: var(--status-risk);
    background: rgba(196, 94, 94, 0.1);
}

/* ── MAIN CONTENT ── */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* Header */
.content-header {
    height: var(--header-height);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(8, 12, 20, 0.8);
    backdrop-filter: blur(var(--glass-blur));
    flex-shrink: 0;
}

.page-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: 0.3px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-time {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

/* Tab Content Area */
.content-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s var(--ease-out);
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ── CARDS — Luxury Glass ── */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--gold-border), transparent);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.card:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-default);
    box-shadow: var(--shadow-md);
}

.card:hover::before {
    opacity: 1;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-title {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ── DASHBOARD GRID ── */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all var(--transition-normal);
}

.stat-card:hover {
    border-color: var(--gold-border);
    box-shadow: var(--shadow-gold);
    transform: translateY(-2px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-icon.gold { background: rgba(201, 169, 110, 0.12); }
.stat-icon.emerald { background: rgba(63, 170, 133, 0.12); }
.stat-icon.purple { background: rgba(139, 110, 184, 0.12); }
.stat-icon.blue { background: rgba(94, 139, 184, 0.12); }

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
    font-family: var(--font-display);
}

.stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 500;
}

/* ── PILLAR CARDS ── */
.pillars-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.pillar-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all var(--transition-normal);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.pillar-card::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px;
    height: 100%;
    border-radius: 0 4px 4px 0;
}

.pillar-card[data-pillar="mobility"]::after { background: var(--pillar-mobility); }
.pillar-card[data-pillar="hospitality"]::after { background: var(--pillar-hospitality); }
.pillar-card[data-pillar="ritual"]::after { background: var(--pillar-ritual); }
.pillar-card[data-pillar="community"]::after { background: var(--pillar-community); }
.pillar-card[data-pillar="architecture"]::after { background: var(--pillar-architecture); }
.pillar-card[data-pillar="store"]::after { background: var(--pillar-store); }

.pillar-card:hover {
    background: var(--bg-surface-hover);
    border-color: var(--border-default);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.pillar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.pillar-name {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.pillar-status {
    font-size: 0.65rem;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pillar-status.active { background: rgba(63, 170, 133, 0.15); color: var(--status-active); }
.pillar-status.planning { background: rgba(201, 169, 110, 0.15); color: var(--status-planning); }
.pillar-status.pending { background: rgba(107, 114, 128, 0.15); color: var(--status-pending); }
.pillar-status.pilot { background: rgba(184, 94, 122, 0.15); color: var(--pillar-store); }

.pillar-desc {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
}

.pillar-projects {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pillar-project-tag {
    font-size: 0.68rem;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--bg-surface-active);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

/* ── SECTION HEADERS ── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.section-title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title::before {
    content: '';
    width: 3px;
    height: 20px;
    background: var(--gold-primary);
    border-radius: 2px;
}

/* ── BADGES ── */
.badge {
    font-size: 0.65rem;
    padding: 3px 8px;
    border-radius: 20px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-gold { background: rgba(201, 169, 110, 0.15); color: var(--gold-primary); }
.badge-emerald { background: rgba(63, 170, 133, 0.15); color: var(--emerald-400); }
.badge-red { background: rgba(196, 94, 94, 0.15); color: var(--status-risk); }

/* ── BUTTONS ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    outline: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gold-500), var(--gold-400));
    color: #080c14;
    box-shadow: 0 2px 12px rgba(201, 169, 110, 0.25);
}

.btn-primary:hover {
    box-shadow: 0 4px 20px rgba(201, 169, 110, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
}

.btn-secondary:hover {
    background: var(--bg-surface-hover);
    border-color: var(--gold-border);
}

/* ── TABLE ── */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-subtle);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

thead th {
    background: var(--bg-surface);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.7rem;
    border-bottom: 1px solid var(--border-subtle);
}

tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

tbody tr:hover {
    background: var(--bg-surface);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* ── DAILY BOARD ── */
.db-wrapper { max-width: 100%; }

.db-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.db-header h2 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    color: var(--text-primary);
}

.db-date-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.db-date-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    width: 30px; height: 30px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: all var(--transition-fast);
}

.db-date-btn:hover {
    border-color: var(--gold-border);
    color: var(--gold-primary);
}

.db-date-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
}

.db-today-badge {
    font-size: 0.6rem;
    background: rgba(201, 169, 110, 0.15);
    color: var(--gold-primary);
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
    margin-left: 6px;
}

.db-today-btn {
    background: var(--bg-surface);
    border: 1px solid var(--gold-border);
    color: var(--gold-primary);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 600;
    transition: all var(--transition-fast);
}

.db-header-stats {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.db-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
}

.db-stat-val {
    font-weight: 700;
    color: var(--text-primary);
}

.db-stat-lbl {
    color: var(--text-muted);
    font-size: 0.68rem;
}

.db-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.db-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-normal);
}

.db-card:hover {
    border-color: var(--border-default);
    box-shadow: var(--shadow-md);
}

.db-card-header {
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
}

.db-member-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.db-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.db-card-body { padding: 14px 16px; }

.db-section { margin-bottom: 12px; }

.db-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.db-time {
    font-size: 0.68rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.db-task-list, .db-result-list {
    list-style: none;
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.db-task-list li, .db-result-list li {
    padding: 3px 0;
    padding-left: 12px;
    position: relative;
}

.db-task-list li::before {
    content: '›';
    position: absolute;
    left: 0;
    color: var(--gold-primary);
    font-weight: bold;
}

.db-status {
    font-size: 0.65rem;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.db-active { background: rgba(63, 170, 133, 0.15); color: var(--status-active); }
.db-completed { background: rgba(45, 138, 110, 0.15); color: var(--status-done); }
.db-pending { background: rgba(107, 114, 128, 0.15); color: var(--status-pending); }

.db-no-session {
    text-align: center;
    padding: 20px 0;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.db-no-session span {
    font-size: 1.4rem;
    display: block;
    margin-bottom: 6px;
}

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

.db-empty-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.db-empty h3 {
    font-family: var(--font-display);
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.db-goals { font-size: 0.78rem; color: var(--text-secondary); font-style: italic; margin-bottom: 6px; }
.db-ws-badge { font-size: 0.65rem; background: var(--gold-glow); color: var(--gold-primary); padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.db-blockers { font-size: 0.75rem; color: var(--status-risk); margin-top: 8px; padding: 8px; background: rgba(196,94,94,0.08); border-radius: var(--radius-sm); }
.db-ai-metrics { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.db-ai-badge { font-size: 0.65rem; padding: 3px 8px; border-radius: 10px; background: rgba(201,169,110,0.1); color: var(--gold-primary); font-weight: 500; }

/* ── SSO OVERLAY ── */
.sso-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sso-card {
    max-width: 420px;
    width: 90%;
    padding: 48px 36px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl);
    text-align: center;
    box-shadow: var(--shadow-xl);
}

.sso-logo {
    width: 72px; height: 72px;
    margin: 0 auto 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold-500), var(--emerald-500));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    box-shadow: 0 0 30px rgba(201, 169, 110, 0.2);
}

.sso-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.sso-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 28px;
}

.sso-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 28px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-fast);
    border: none;
    font-family: var(--font-body);
}

.sso-btn-primary {
    background: linear-gradient(135deg, var(--gold-500), var(--gold-400));
    color: #080c14;
    box-shadow: var(--shadow-gold);
}

.sso-btn-primary:hover {
    box-shadow: 0 6px 24px rgba(201, 169, 110, 0.4);
    transform: translateY(-1px);
}

.sso-btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-default);
}

.sso-btn-secondary:hover {
    border-color: var(--gold-primary);
    color: var(--gold-primary);
}

.sso-loading-spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--gold-primary);
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: spin 0.8s linear infinite;
}

.sso-error-alert {
    margin-top: 12px;
    padding: 10px 14px;
    background: rgba(196, 94, 94, 0.1);
    border: 1px solid rgba(196, 94, 94, 0.2);
    border-radius: var(--radius-sm);
    color: var(--status-risk);
    font-size: 0.78rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── KNOWLEDGE GRAPH ── */
.kg-container {
    width: 100%;
    height: calc(100vh - var(--header-height) - 120px);
    min-height: 400px;
    background: var(--bg-primary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
}

.kg-controls {
    position: absolute;
    top: 12px; left: 12px;
    display: flex;
    gap: 8px;
    z-index: 10;
    flex-wrap: wrap;
}

.kg-control-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    backdrop-filter: blur(var(--glass-blur));
    transition: all var(--transition-fast);
    font-family: var(--font-body);
}

.kg-control-btn:hover,
.kg-control-btn.active {
    border-color: var(--gold-border);
    color: var(--gold-primary);
    background: rgba(201, 169, 110, 0.1);
}

.kg-search {
    position: absolute;
    top: 12px; right: 12px;
    z-index: 10;
}

.kg-search input {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    width: 200px;
    backdrop-filter: blur(var(--glass-blur));
    outline: none;
    font-family: var(--font-body);
    transition: all var(--transition-fast);
}

.kg-search input:focus {
    border-color: var(--gold-primary);
    box-shadow: 0 0 0 3px rgba(201, 169, 110, 0.1);
    width: 260px;
}

.kg-search input::placeholder {
    color: var(--text-muted);
}

.kg-detail-panel {
    position: absolute;
    bottom: 12px; right: 12px;
    width: 300px;
    max-height: 300px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 16px;
    backdrop-filter: blur(var(--glass-blur));
    z-index: 10;
    overflow-y: auto;
    display: none;
}

.kg-detail-panel h3 {
    font-family: var(--font-display);
    font-size: 0.95rem;
    color: var(--gold-primary);
    margin-bottom: 4px;
}

.kg-detail-panel .detail-type {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.kg-detail-panel .detail-body {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.kg-loader {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    z-index: 20;
    transition: opacity 0.3s;
}

.kg-loader-text {
    font-family: var(--font-display);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ── AI CHARACTER ── */
.ai-character-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
}

.ai-character {
    width: 90px; height: 90px;
    border-radius: 50%;
    background: #ffffff; /* White background as requested */
    border: 3px solid var(--gold-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    transition: all var(--transition-normal);
    animation: float-breathing 4s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

.ai-character:hover {
    transform: scale(1.08) translateY(-4px);
    box-shadow: 0 12px 40px rgba(201, 169, 110, 0.4);
    border-color: var(--gold-200);
}

.ai-character-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    /* Zoom 1.35 and translate down 15% to crop tight on head and shoulders */
    transform: scale(1.35) translateY(15%);
    transition: all 0.3s ease;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.1));
}

/* Talking state: bobbing and mouth overlay */
.ai-character.talking {
    animation: talking-bob 0.5s ease-in-out infinite alternate;
    border-color: var(--status-active);
    box-shadow: 0 0 20px var(--emerald-glow), 0 8px 32px rgba(0,0,0,0.3);
}

.ai-character.talking .ai-character-img {
    transform: scale(1.37) translateY(14%);
}

/* Thinking/loading state */
.ai-character.thinking {
    border-color: var(--gold-300);
    box-shadow: 0 0 15px var(--gold-glow);
}

.ai-character.thinking .ai-character-img {
    animation: thinking-tilt 1s ease-in-out infinite alternate;
}

/* Indicators */
.ai-status-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--status-active);
    border: 2px solid #ffffff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    z-index: 10;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
}

.ai-character.talking .ai-status-indicator {
    display: flex;
    background: var(--status-active);
    animation: pulse-glow 1.5s infinite;
}

.ai-character.thinking .ai-status-indicator {
    display: flex;
    background: var(--status-planning);
}

/* Animations */
@keyframes float-breathing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes talking-bob {
    0% { transform: translateY(-4px) scale(1); }
    100% { transform: translateY(-8px) scale(1.03); }
}

@keyframes thinking-tilt {
    0% { transform: scale(1.35) translateY(15%) rotate(-2deg); }
    100% { transform: scale(1.35) translateY(15%) rotate(2deg); }
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(63, 170, 133, 0.7); }
    70% { box-shadow: 0 0 0 6px rgba(63, 170, 133, 0); }
}


.ai-chat-panel {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 380px;
    max-height: 520px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    display: none;
    flex-direction: column;
    z-index: 999;
    overflow: hidden;
}

.ai-chat-panel.open {
    display: flex;
    animation: slideUp 0.3s var(--ease-out);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.ai-chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ai-chat-header h3 {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--gold-primary);
}

.ai-chat-close {
    background: none; border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.1rem;
    padding: 4px;
    transition: color var(--transition-fast);
}

.ai-chat-close:hover { color: var(--text-primary); }

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.ai-msg {
    max-width: 85%;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    line-height: 1.5;
}

.ai-msg.bot {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    align-self: flex-start;
}

.ai-msg.user {
    background: linear-gradient(135deg, rgba(201,169,110,0.15), rgba(63,170,133,0.1));
    border: 1px solid var(--gold-border);
    color: var(--text-primary);
    align-self: flex-end;
}

.ai-chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    gap: 8px;
}

.ai-chat-input {
    flex: 1;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 0.82rem;
    outline: none;
    font-family: var(--font-body);
    transition: border-color var(--transition-fast);
}

.ai-chat-input:focus {
    border-color: var(--gold-primary);
}

.ai-chat-send {
    background: linear-gradient(135deg, var(--gold-500), var(--gold-400));
    color: #080c14;
    border: none;
    width: 38px; height: 38px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.ai-chat-send:hover {
    box-shadow: var(--shadow-gold);
    transform: translateY(-1px);
}

/* ── INVESTMENT TRACKER ── */
.investment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* ── PARTNER CARDS ── */
.partner-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: all var(--transition-normal);
}

.partner-card:hover {
    border-color: var(--gold-border);
    box-shadow: var(--shadow-gold);
}

.partner-avatar {
    width: 48px; height: 48px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--gold-500), var(--gold-600));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 12px;
}

.partner-name {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.partner-role {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ── SLEEP TRANSPORT ── */
.st-timeline {
    display: flex;
    gap: 0;
    margin: 24px 0;
    position: relative;
}

.st-timeline::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0; right: 0;
    height: 2px;
    background: var(--border-subtle);
    transform: translateY(-50%);
}

.st-phase {
    flex: 1;
    text-align: center;
    position: relative;
    z-index: 1;
    padding: 0 8px;
}

.st-phase-dot {
    width: 16px; height: 16px;
    border-radius: 50%;
    margin: 0 auto 8px;
    border: 2px solid var(--border-default);
    background: var(--bg-primary);
    transition: all var(--transition-fast);
}

.st-phase.active .st-phase-dot {
    background: var(--gold-primary);
    border-color: var(--gold-primary);
    box-shadow: 0 0 12px rgba(201, 169, 110, 0.4);
}

.st-phase.done .st-phase-dot {
    background: var(--status-done);
    border-color: var(--status-done);
}

.st-phase-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
}

.st-phase.active .st-phase-label {
    color: var(--gold-primary);
    font-weight: 600;
}

/* ── MASTER PLAN / STRATEGIC HIERARCHY ── */
.hierarchy-layer {
    margin-bottom: 16px;
    padding: 16px 20px;
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    transition: all var(--transition-normal);
}

.hierarchy-layer:hover {
    border-color: var(--border-default);
}

.layer-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.layer-number {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: var(--gold-glow);
    color: var(--gold-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
}

.layer-title {
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.layer-content {
    padding-left: 40px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* ── TEAM ── */
.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.team-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    transition: all var(--transition-normal);
}

.team-card:hover {
    border-color: var(--gold-border);
    box-shadow: var(--shadow-gold);
    transform: translateY(-2px);
}

.team-avatar {
    width: 56px; height: 56px;
    border-radius: 50%;
    margin: 0 auto 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 700;
    color: white;
}

.team-name {
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.team-role {
    font-size: 0.72rem;
    color: var(--gold-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* ── CONTRACT REVIEW (AI LAW) ── */
.contract-review-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 16px;
}

.contract-text {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;
    max-height: 500px;
    overflow-y: auto;
    font-size: 0.82rem;
    line-height: 1.7;
    color: var(--text-secondary);
}

.contract-analysis {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 20px;
    max-height: 500px;
    overflow-y: auto;
}

.risk-item {
    padding: 10px 14px;
    margin-bottom: 8px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    line-height: 1.5;
}

.risk-high { background: rgba(196, 94, 94, 0.08); border-left: 3px solid var(--status-risk); }
.risk-medium { background: rgba(201, 169, 110, 0.08); border-left: 3px solid var(--gold-primary); }
.risk-low { background: rgba(63, 170, 133, 0.08); border-left: 3px solid var(--status-active); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
    .sidebar {
        width: var(--sidebar-collapsed);
    }

    .logo-text, .nav-item span, .nav-section, .user-details {
        display: none;
    }

    .main-content {
        margin-left: var(--sidebar-collapsed);
    }

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

    .contract-review-area {
        grid-template-columns: 1fr;
    }

    .ai-chat-panel {
        width: calc(100vw - 48px);
        right: 24px;
    }
}
