/**
 * Optlyx Client Portal
 * Premium Design System - Zinc Monochrome
 * Font: Plus Jakarta Sans
 */

/* Ensure HTML hidden attribute always works regardless of CSS display rules */
[hidden] {
    display: none !important;
}

/* === GOOGLE FONTS === */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

/* === CSS VARIABLES === */
:root {
    /* OpenAI Monochrome Palette */
    --bg-primary: #FAFAFA;
    --bg-secondary: #F4F4F5;
    --bg-tertiary: #E4E4E7;
    --bg-card: #FFFFFF;
    --bg-elevated: #FFFFFF;
    --bg-dark: #18181B;

    /* Text Colors - Zinc Scale */
    --text-primary: #18181B;
    --text-secondary: #3F3F46;
    --text-tertiary: #71717A;
    --text-muted: #A1A1AA;
    --text-inverse: #FFFFFF;

    /* Accent - Monochrome (no color) */
    --accent-primary: #18181B;
    --accent-secondary: #27272A;
    --accent-light: #F4F4F5;
    --accent-glow: rgba(24, 24, 27, 0.08);
    --accent-gradient: #18181B;

    /* Status Colors - Softer Tones */
    --status-success: #10B981;
    --status-success-bg: #ECFDF5;
    --status-warning: #F59E0B;
    --status-warning-bg: #FFFBEB;
    --status-error: #EF4444;
    --status-error-bg: #FEF2F2;
    --status-info: #71717A;
    --status-info-bg: #F4F4F5;

    /* Borders - Subtle & Clean */
    --border-light: #E4E4E7;
    --border-medium: #D4D4D8;
    --border-dark: #A1A1AA;
    --border-accent: rgba(24, 24, 27, 0.1);

    /* Premium Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
    --shadow-solid: 0 0 0 1px rgba(0, 0, 0, 0.04), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-glow: 0 0 20px rgba(24, 24, 27, 0.06);
    --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.05), 0 4px 16px rgba(0, 0, 0, 0.04);

    /* Font */
    --font-display: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    --font-body: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;

    /* Spacing */
    --safe-bottom: env(safe-area-inset-bottom, 0px);

    /* Border Radius - Rounder & Friendlier */
    --radius-sm: 10px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-2xl: 24px;
    --radius-full: 9999px;

    /* 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.25s var(--ease-out);
    --transition-slow: 0.4s var(--ease-out);
}

/* === RESET === */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}

/* Headings use Jakarta Sans Bold */
h1,
h2,
h3 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.02em;
}

h4,
h5,
h6 {
    font-family: var(--font-body);
    font-weight: 600;
    letter-spacing: -0.01em;
}

.hidden {
    display: none !important;
}

/* === LOADING SCREEN - Premium Animated === */
.loading-screen {
    position: fixed;
    inset: 0;
    background: #FAFAF9;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
    overflow: hidden;
}

.loading-screen.hidden {
    opacity: 0;
    transform: scale(1.02);
    pointer-events: none;
}

/* Animated gradient background */
.loading-gradient-bg {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 30% 20%, rgba(24, 24, 27, 0.02) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(24, 24, 27, 0.015) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(24, 24, 27, 0.01) 0%, transparent 60%);
    animation: gradientPulse 4s ease-in-out infinite alternate;
    z-index: 0;
}

@keyframes gradientPulse {
    0% {
        opacity: 0.7;
        transform: scale(1);
    }

    100% {
        opacity: 1;
        transform: scale(1.1);
    }
}

.loading-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 32px;
}

.loading-logo-container {
    position: relative;
}

.loading-logo {
    height: 56px;
    position: relative;
    z-index: 2;
    animation: logoFloat 3s ease-in-out infinite;
}

.loading-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 60px;
    background: radial-gradient(ellipse, rgba(24, 24, 27, 0.08) 0%, transparent 70%);
    filter: blur(20px);
    animation: glowPulse 2s ease-in-out infinite;
    z-index: 1;
}

@keyframes logoFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-6px);
    }
}

@keyframes glowPulse {

    0%,
    100% {
        opacity: 0.4;
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        opacity: 0.8;
        transform: translate(-50%, -50%) scale(1.2);
    }
}

/* Bouncing dots */
.loading-dots {
    display: flex;
    gap: 8px;
}

.loading-dots span {
    width: 10px;
    height: 10px;
    background: var(--text-primary);
    border-radius: 50%;
    animation: dotBounce 1.4s ease-in-out infinite;
    box-shadow: 0 2px 8px rgba(24, 24, 27, 0.2);
}

.loading-dots span:nth-child(1) {
    animation-delay: 0s;
}

.loading-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dotBounce {

    0%,
    80%,
    100% {
        transform: translateY(0) scale(1);
        opacity: 0.7;
    }

    40% {
        transform: translateY(-12px) scale(1.1);
        opacity: 1;
    }
}

.loading-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-tertiary);
    letter-spacing: 0.06em;
    text-transform: uppercase;
    animation: textFade 2s ease-in-out infinite;
}

@keyframes textFade {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

/* === APP CONTAINER === */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out);
}

.app-container.visible {
    opacity: 1;
    transform: translateY(0);
}

/* === HEADER === */
.app-header {
    height: 68px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    flex-shrink: 0;
    box-shadow: var(--shadow-xs);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    height: 38px;
    width: 38px;
    object-fit: contain;
}

.brand-label {
    font-family: var(--font-display);
    font-size: 12px;
    font-weight: 700;
    color: var(--text-tertiary);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    padding: 5px 14px 5px 5px;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-solid);
}

.user-avatar {
    width: 30px;
    height: 30px;
    background: var(--text-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.user-pill span {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-icon-soft {
    width: 38px;
    height: 38px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-soft i {
    width: 20px;
    height: 20px;
}

/* Desktop nav - hidden on mobile */
.desktop-nav {
    display: none;
}

/* === MAIN === */
.app-main {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.view {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: calc(100px + var(--safe-bottom));
    opacity: 0;
    transform: translateY(6px);
    pointer-events: none;
    transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out);
}

.view.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Scrollbar - Minimal */
.view::-webkit-scrollbar {
    width: 6px;
}

.view::-webkit-scrollbar-track {
    background: transparent;
}

.view::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: var(--radius-full);
}

/* === WELCOME CARD === */
.welcome-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: 28px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    box-shadow: var(--shadow-card);
    animation: cardEnter 0.5s var(--ease-out) forwards;
    opacity: 0;
    transform: translateY(10px);
    position: relative;
    overflow: hidden;
}

.welcome-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: #27272A;
}

@keyframes cardEnter {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.welcome-greeting {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-tertiary);
    margin-bottom: 6px;
    letter-spacing: 0.02em;
}

.welcome-card h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.date-badge {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--accent-light);
    padding: 10px 16px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-accent);
}

/* === ACTION BUTTONS === */
.action-buttons-container {
    display: flex;
    gap: 14px;
    margin-bottom: 28px;
    animation: cardEnter 0.5s var(--ease-out) 0.05s forwards;
    opacity: 0;
}

.action-buttons-container .btn-scan {
    margin-bottom: 0;
    flex: 1;
}

.action-buttons-container .btn-secondary {
    flex: 1;
    margin-bottom: 0 !important;
    height: auto !important;
}

/* === PRIMARY SCAN BUTTON - Gradient Style === */
.btn-scan {
    width: 100%;
    background: var(--text-primary);
    border: none;
    color: white;
    padding: 16px 24px;
    border-radius: var(--radius-full);
    font-size: 15px;
    font-family: var(--font-body);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    box-shadow: var(--shadow-md), 0 4px 12px rgba(24, 24, 27, 0.15);
    position: relative;
    overflow: hidden;
    transition: all 0.25s var(--ease-out);
}

.btn-scan:hover {
    background: #27272A;
    box-shadow: var(--shadow-lg), 0 8px 20px rgba(24, 24, 27, 0.2);
}

.btn-scan:active {
    opacity: 0.9;
}

.btn-scan::before {
    content: '';
    position: absolute;
    inset: 0;
    background: transparent;
    pointer-events: none;
}

.btn-scan i {
    width: 20px;
    height: 20px;
}

/* === KPI CARDS === */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 18px;
    box-shadow: var(--shadow-solid);
    position: relative;
    overflow: hidden;
    animation: kpiEnter 0.5s var(--ease-out) forwards;
    opacity: 0;
    transform: translateY(10px);
}

.kpi-card:nth-child(1) {
    animation-delay: 0.1s;
}

.kpi-card:nth-child(2) {
    animation-delay: 0.15s;
}

.kpi-card:nth-child(3) {
    animation-delay: 0.2s;
}

.kpi-card:nth-child(4) {
    animation-delay: 0.25s;
}

@keyframes kpiEnter {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Minimal Top Accent */
.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--border-light);
}

.kpi-card:nth-child(1)::before,
.kpi-card:nth-child(2)::before,
.kpi-card:nth-child(3)::before,
.kpi-card:nth-child(4)::before {
    background: var(--border-light);
}

/* No colored corner glows in monochrome */
.kpi-card::after {
    display: none;
}

.kpi-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.kpi-value {
    font-family: var(--font-display);
    font-size: 36px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 4px;
}

.kpi-trend {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

/* === CHARTS ROW === */
.charts-row {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 14px;
}

.charts-row .cashflow-card {
    margin-bottom: 0;
    flex: 1;
    min-width: 0;
}

/* === CASHFLOW CHART CARD === */
.cashflow-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 14px;
    box-shadow: var(--shadow-solid);
}

.cashflow-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}

.cashflow-card-titles {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cashflow-card-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.cashflow-card-subtitle {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.cashflow-legend {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.cashflow-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
}

.cashflow-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
    flex-shrink: 0;
}

.cashflow-legend-dot.income {
    background: #14B8A6;
}

.cashflow-legend-dot.expense {
    background: #F87171;
}

.cashflow-legend-dot.docs-studio {
    background: #818CF8;
}

.cashflow-legend-dot.docs-client {
    background: #94A3B8;
}

.cashflow-chart-wrap {
    height: 160px;
    position: relative;
    margin-bottom: 16px;
}

.cashflow-chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

.cashflow-totals {
    display: flex;
    align-items: center;
    gap: 0;
    padding-top: 14px;
    border-top: 1px solid var(--border-light);
}

.cashflow-total-item {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cashflow-total-arrow {
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
}

.cashflow-total-arrow.income {
    color: #14B8A6;
}

.cashflow-total-arrow.expense {
    color: #F87171;
}

.cashflow-total-divider {
    width: 1px;
    height: 32px;
    background: var(--border-light);
    margin: 0 16px;
    flex-shrink: 0;
}

.cashflow-total-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 2px;
}

.cashflow-total-value {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.cashflow-total-value.income {
    color: #0F9488;
}

.cashflow-total-value.expense {
    color: #DC2626;
}

.cashflow-total-arrow.docs-studio,
.cashflow-total-value.docs-studio {
    color: #6366F1;
}

.cashflow-total-arrow.docs-client,
.cashflow-total-value.docs-client {
    color: #64748B;
}

/* ─── Prima Nota — settings-style card system ─── */
.pn-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e8e3db;
}

.pn-page-title {
    font-size: 15px;
    font-weight: 700;
    color: #1c1917;
    letter-spacing: -0.03em;
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 0 3px;
}

.pn-page-sub {
    font-size: 12px;
    color: #78716c;
    margin: 0;
}

.pn-kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.pn-kpi-card {
    background: #ffffff;
    border: 1px solid #e8e3db;
    border-radius: 14px;
    padding: 14px 14px 12px;
    transition: border-color 0.15s ease;
}

.pn-kpi-card:hover {
    border-color: #d6d0c6;
}

.pn-kpi-label {
    font-size: 10px;
    font-weight: 700;
    color: #a8a29e;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin-bottom: 5px;
}

.pn-kpi-value {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1;
    color: #1c1917;
}

.pn-kpi-sub {
    font-size: 10px;
    color: #a8a29e;
    margin-top: 4px;
}

/* === SDI INTEGRATION CARD (settings-style) === */
.sdi-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #ffffff;
    border: 1px solid #e8e3db;
    border-left: 3px solid #6366f1;
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 14px;
    transition: border-color 0.15s ease, box-shadow 0.15s;
}

.sdi-card:hover {
    border-color: #d6d0c6;
    border-left-color: #4f46e5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.sdi-card-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.sdi-card-icon {
    width: 36px;
    height: 36px;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6366f1;
    flex-shrink: 0;
}

.sdi-card-title {
    font-size: 13px;
    font-weight: 700;
    color: #1c1917;
    margin-bottom: 2px;
}

.sdi-card-desc {
    font-size: 11px;
    color: #78716c;
    line-height: 1.4;
}

.sdi-card-desc strong {
    color: #4f46e5;
    font-family: monospace;
    font-size: 10.5px;
    letter-spacing: 0.03em;
}

.sdi-sync-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #292524;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
    flex-shrink: 0;
}

.sdi-sync-btn:hover {
    background: #44403c;
}

.sdi-sync-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.filter-chip-sdi {
    background: rgba(99, 102, 241, 0.08) !important;
    color: #6366F1 !important;
    border-color: rgba(99, 102, 241, 0.25) !important;
}

.filter-chip-sdi.active {
    background: #6366F1 !important;
    color: white !important;
}

/* Action buttons row */
.pn-action-row {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
}

.pn-btn-primary {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: #292524;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, transform 0.12s;
    letter-spacing: -0.01em;
}

.pn-btn-primary:hover {
    background: #44403c;
    transform: translateY(-1px);
}

.pn-btn-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
    border: 1px solid #e8e3db;
    border-radius: 12px;
    cursor: pointer;
    color: #78716c;
    flex-shrink: 0;
    transition: border-color 0.15s;
}

.pn-btn-icon:hover {
    border-color: #d6d0c6;
    color: #1c1917;
}

/* Batch banner */
.pn-batch-card {
    background: #ffffff;
    border: 1px solid #e8e3db;
    border-left: 3px solid #6366f1;
    border-radius: 14px;
    padding: 14px 18px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.pn-batch-title {
    font-size: 13px;
    font-weight: 700;
    color: #1c1917;
    margin: 0 0 2px;
}

.pn-batch-sub {
    font-size: 11px;
    color: #a8a29e;
    margin: 0;
}

.pn-batch-btn {
    padding: 9px 16px;
    background: #292524;
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.15s;
}

.pn-batch-btn:hover {
    background: #44403c;
}

/* ─── Quick-Add Bar ─── */
.pn-quick-add {
    background: #ffffff;
    border: 1px solid #e8e3db;
    border-radius: 16px;
    padding: 14px 16px 12px;
    margin-bottom: 14px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.pn-quick-type-row {
    display: flex;
    background: #f4f3f0;
    border-radius: 10px;
    padding: 3px;
    margin-bottom: 12px;
    gap: 3px;
}

.pn-quick-type {
    flex: 1;
    padding: 7px 10px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    background: transparent;
    color: #78716c;
    text-align: center;
    font-family: inherit;
}

.pn-quick-type.active.expense {
    background: #fff;
    color: #dc2626;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.pn-quick-type.active.income {
    background: #fff;
    color: #16a34a;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.pn-quick-amount-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1.5px solid #e8e3db;
    border-radius: 13px;
    padding: 6px 16px;
    background: #faf9f7;
    margin-bottom: 10px;
    transition: border-color 0.15s, background 0.15s;
}

.pn-quick-amount-wrap:focus-within {
    border-color: #6366f1;
    background: #fff;
}

.pn-quick-eur {
    font-size: 22px;
    font-weight: 700;
    color: #c8c4be;
    flex-shrink: 0;
    line-height: 1;
}

.pn-quick-amount {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 28px;
    font-weight: 700;
    color: #1c1917;
    outline: none;
    font-variant-numeric: tabular-nums;
    min-width: 0;
    letter-spacing: -0.02em;
    font-family: inherit;
}

.pn-quick-amount::placeholder {
    color: #d6d3d1;
}

.pn-quick-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.pn-quick-desc {
    flex: 1;
    border: 1.5px solid #e8e3db;
    border-radius: 10px;
    padding: 9px 12px;
    font-size: 13px;
    color: #1c1917;
    background: #faf9f7;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
    min-width: 0;
    font-family: inherit;
}

.pn-quick-desc:focus {
    border-color: #6366f1;
    background: #fff;
}

.pn-quick-save {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #292524;
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, transform 0.1s;
}

.pn-quick-save:hover {
    background: #44403c;
    transform: scale(1.05);
}

.pn-quick-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pn-quick-scan {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border-radius: 8px;
    background: #f4f3f0;
    border: none;
    font-size: 11px;
    font-weight: 600;
    color: #78716c;
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
}

.pn-quick-scan:hover {
    background: #e8e3db;
}

.pn-quick-more {
    font-size: 11px;
    font-weight: 600;
    color: #a8a29e;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 0;
    transition: color 0.15s;
    font-family: inherit;
}

.pn-quick-more:hover {
    color: #6366f1;
}

/* ─── Month group with totals ─── */
.pn-month-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.pn-month-totals {
    display: flex;
    align-items: center;
    gap: 6px;
}

.pn-month-total-item {
    font-size: 11px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.pn-month-total-item.income {
    color: #16a34a;
}

.pn-month-total-item.expense {
    color: #dc2626;
}

.pn-month-total-sep {
    font-size: 11px;
    color: #d6d3d1;
}

/* ─── Category chips (in modal) ─── */
.pn-cat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 7px;
    margin-bottom: 4px;
}

.pn-cat-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 9px 4px 7px;
    border: 1.5px solid #e8e3db;
    border-radius: 11px;
    background: #fff;
    cursor: pointer;
    transition: all 0.15s;
    text-align: center;
}

.pn-cat-chip:hover {
    border-color: #d6d0c6;
    background: #faf9f7;
}

.pn-cat-chip.selected {
    border-color: var(--cat-color);
    background: var(--cat-bg);
}

.pn-cat-chip-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--cat-bg, #f4f3f0);
    color: var(--cat-color, #78716c);
    flex-shrink: 0;
    transition: all 0.15s;
}

.pn-cat-chip.selected .pn-cat-chip-icon {
    background: var(--cat-color);
    color: #fff;
}

.pn-cat-chip-label {
    font-size: 9px;
    font-weight: 700;
    color: #78716c;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    line-height: 1.2;
}

.pn-cat-chip.selected .pn-cat-chip-label {
    color: var(--cat-color);
}

/* ─── Payment chips (in modal) ─── */
.pn-pay-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 7px;
}

.pn-pay-chip {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 9px 4px 7px;
    border: 1.5px solid #e8e3db;
    border-radius: 11px;
    background: #fff;
    cursor: pointer;
    transition: all 0.15s;
    font-size: 9px;
    font-weight: 700;
    color: #78716c;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-family: inherit;
}

.pn-pay-chip:hover {
    border-color: #d6d0c6;
    background: #faf9f7;
}

.pn-pay-chip .pay-icon {
    font-size: 18px;
}

.pn-pay-chip.selected {
    border-color: #292524;
    background: #292524;
    color: #fff;
}

/* ─── Shared modal input ─── */
.pn-modal-input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #e8e3db;
    border-radius: 11px;
    font-size: 14px;
    color: #1c1917;
    background: #faf9f7;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
    box-sizing: border-box;
    font-family: inherit;
}

.pn-modal-input:focus {
    border-color: #6366f1;
    background: #fff;
}

/* ─── Detail modal stat cells ─── */
.pn-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 16px;
}

.pn-detail-cell {
    padding: 12px 14px;
    background: #faf9f7;
    border: 1px solid #e8e3db;
    border-radius: 12px;
}

.pn-detail-cell-label {
    font-size: 10px;
    font-weight: 700;
    color: #a8a29e;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 3px;
}

.pn-detail-cell-value {
    font-size: 14px;
    font-weight: 600;
    color: #1c1917;
}

/* Entries list */
.pn-month-group {
    margin-bottom: 20px;
}

.pn-month-label {
    font-size: 10px;
    font-weight: 700;
    color: #a8a29e;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 8px 2px;
}

.pn-entry-card {
    background: #ffffff;
    border: 1px solid #e8e3db;
    border-radius: 12px;
    padding: 13px 16px 12px 19px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    position: relative;
    overflow: hidden;
}

.pn-entry-card:hover {
    border-color: #d6d0c6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.pn-entry-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
}

.pn-entry-card.income::before {
    background: #22c55e;
}

.pn-entry-card.expense::before {
    background: #ef4444;
}

.pn-entry-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    gap: 8px;
}

.pn-entry-desc {
    font-size: 12px;
    font-weight: 600;
    color: #1c1917;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.pn-entry-amount {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.pn-entry-amount.income {
    color: #16a34a;
}

.pn-entry-amount.expense {
    color: #dc2626;
}

.pn-entry-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.pn-entry-date {
    font-size: 11px;
    color: #a8a29e;
}

.pn-badge {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 999px;
}

.pn-badge-draft {
    background: #f1f5f9;
    color: #64748b;
}

.pn-badge-submitted {
    background: #fef3c7;
    color: #d97706;
}

.pn-badge-approved {
    background: #dcfce7;
    color: #16a34a;
}

.pn-badge-rejected {
    background: #fef2f2;
    color: #dc2626;
}

.pn-badge-posted {
    background: #dbeafe;
    color: #2563eb;
}

.pn-badge-category {
    background: #f8f7f5;
    color: #78716c;
    border: 1px solid #e8e3db;
}

.pn-badge-sdi {
    background: #eef2ff;
    color: #6366f1;
}

.pn-badge-ai {
    background: #eff6ff;
    color: #3b82f6;
}

/* === SECTION PANELS === */
.section-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    margin-bottom: 14px;
    overflow: hidden;
    box-shadow: var(--shadow-solid);
    animation: panelEnter 0.5s var(--ease-out) forwards;
    opacity: 0;
    transform: translateY(10px);
}

.section-panel:nth-of-type(1) {
    animation-delay: 0.3s;
}

.section-panel:nth-of-type(2) {
    animation-delay: 0.35s;
}

.section-panel:nth-of-type(3) {
    animation-delay: 0.4s;
}

@keyframes panelEnter {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-secondary);
}

.panel-icon {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-icon i {
    width: 17px;
    height: 17px;
}

.panel-icon.blue {
    background: var(--status-info-bg);
    color: var(--status-info);
}

.panel-icon.amber,
.panel-icon.purple {
    background: #FEF3C7;
    color: #D97706;
}

.panel-icon.red {
    background: var(--status-error-bg);
    color: var(--status-error);
}

/* Scadenze Panel */
.scadenze-panel {
    border-color: #FDE68A;
    background: #FFFBEB;
}

.scadenze-panel .panel-header {
    background: transparent;
    border-color: #FDE68A;
}

.scadenze-content .card-item {
    border-left: 3px solid var(--accent-primary);
    background: var(--bg-card);
}

.scadenze-content .card-item .countdown {
    font-size: 10px;
    font-weight: 700;
    padding: 5px 10px;
    border-radius: var(--radius-full);
    background: var(--status-warning-bg);
    color: var(--status-warning);
    letter-spacing: 0.02em;
}

.scadenze-content .card-item .countdown.urgent {
    background: var(--status-error-bg);
    color: var(--status-error);
}

.scadenze-content .card-item .countdown.ok {
    background: var(--status-success-bg);
    color: var(--status-success);
}

/* === NEWSLETTER PANEL - Il Bollettino === */
.newsletter-panel {
    border-color: #E5E7EB;
    background: #FAFAFA;
    position: relative;
    overflow: hidden;
}

.newsletter-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: #27272A;
}

.newsletter-header {
    background: transparent;
    border-color: #E5E7EB;
    flex-wrap: wrap;
}

.newsletter-title-box {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.newsletter-title-box .panel-title {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.newsletter-subtitle {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.newsletter-content {
    padding: 12px;
}

/* News Article Card */
.news-article {
    display: flex;
    flex-direction: column;
    padding: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    transition: all 0.2s var(--ease-out);
    cursor: pointer;
    position: relative;
}

.news-article:hover {
    border-color: var(--text-primary);
    box-shadow: var(--shadow-md);
}

.news-article:last-child {
    margin-bottom: 0;
}

.news-date {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 8px;
}

.news-headline {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.news-excerpt {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
}

.news-category {
    font-size: 10px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.news-category.fiscale {
    background: #EFF6FF;
    color: #2563EB;
}

.news-category.normativa {
    background: #FEF3C7;
    color: #D97706;
}

.news-category.importante {
    background: #FEE2E2;
    color: #DC2626;
}

.news-category.info {
    background: #F0FDF4;
    color: #16A34A;
}

.news-read-more {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.news-read-more i {
    width: 12px;
    height: 12px;
}

/* Featured News (first article) */
.news-article.featured {
    background: #F9FAFB;
    border: 2px solid var(--text-primary);
    padding: 20px;
}

.news-article.featured .news-headline {
    font-size: 20px;
}

.news-article.featured::after {
    content: '★ IN EVIDENZA';
    position: absolute;
    top: 12px;
    right: 12px;
    font-size: 9px;
    font-weight: 700;
    color: var(--text-primary);
    background: #F3F4F6;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    letter-spacing: 0.1em;
}

.panel-title {
    flex: 1;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.badge-count {
    font-size: 10px;
    font-weight: 700;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    padding: 4px 9px;
    border-radius: var(--radius-full);
}

.badge-count.warning {
    background: var(--status-warning-bg);
    color: var(--status-warning);
}

.badge-count.danger {
    background: var(--status-error-bg);
    color: var(--status-error);
}

.panel-content {
    padding: 6px;
}

/* === EMPTY STATE === */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 36px 20px;
    color: var(--text-muted);
}

.empty-state i {
    width: 28px;
    height: 28px;
    margin-bottom: 10px;
    opacity: 0.4;
}

.empty-state span {
    font-size: 13px;
    font-weight: 500;
}

/* === CARD ITEMS === */
.card-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    cursor: pointer;
    border-left: 3px solid transparent;
    background: transparent;
}

.card-item.selected {
    background: var(--status-success-bg);
    border-left-color: var(--status-success);
}

.card-item-content {
    flex: 1;
    min-width: 0;
}

.card-item-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-item-meta {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-item-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 4px 9px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    flex-shrink: 0;
}

.card-item-badge.new {
    background: var(--status-info-bg);
    color: var(--status-info);
}

.card-item-badge.pending {
    background: var(--status-warning-bg);
    color: var(--status-warning);
}

.card-item-badge.urgent {
    background: var(--status-error-bg);
    color: var(--status-error);
}

/* === CHAT VIEW - PREMIUM DESIGN === */
.chat-view {
    display: flex;
    flex-direction: column;
    padding: 0 !important;
    transform: none !important;
    background: #F8F8F7;
}

.chat-header-bar {
    padding: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.chat-header-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
}

.chat-header-actions {
    display: flex;
    gap: 8px;
}

.header-action-btn {
    width: 40px;
    height: 40px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-action-btn i {
    width: 18px;
    height: 18px;
}

/* Services Bar */
.chat-services-bar {
    display: flex;
    gap: 8px;
    padding: 0 24px 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.chat-services-bar::-webkit-scrollbar {
    display: none;
}

.service-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
}

.service-chip i {
    width: 14px;
    height: 14px;
}

.service-chip.ai-chip {
    background: #FEF3C7;
    border-color: #FCD34D;
    color: #B45309;
}

.service-chip.ai-chip i {
    color: #D97706;
}

.chat-recipient {
    display: flex;
    align-items: center;
    gap: 16px;
}

.recipient-avatar {
    width: 52px;
    height: 52px;
    background: #18181B;
    color: white;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(24, 24, 27, 0.15);
    position: relative;
}

.avatar-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 14px;
    height: 14px;
    background: var(--status-success);
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 0 8px var(--status-success);
}

.recipient-info h3 {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.status-online {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--status-success);
}

.status-online .dot {
    width: 8px;
    height: 8px;
    background: var(--status-success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--status-success);
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 0 8px var(--status-success);
    }

    50% {
        opacity: 0.7;
        transform: scale(0.9);
        box-shadow: 0 0 4px var(--status-success);
    }
}

/* === CHAT STREAM === */
.chat-stream {
    flex: 1;
    overflow-y: auto;
    padding: 32px 24px;
    background: transparent;
    scroll-behavior: smooth;
}

/* Chat Welcome State */
.chat-empty,
.chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 40px 24px;
}

.chat-welcome-icon,
.chat-empty i {
    width: 80px;
    height: 80px;
    background: var(--bg-tertiary);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
}

.chat-welcome-icon i,
.chat-empty i {
    width: 36px;
    height: 36px;
    color: var(--text-muted);
    opacity: 0.6;
}

.chat-empty>i {
    width: 80px;
    height: 80px;
    background: var(--bg-tertiary);
    border-radius: 24px;
    padding: 22px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-md);
    color: var(--text-muted);
    opacity: 1;
}

.chat-welcome h3,
.chat-empty h4 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.chat-welcome p,
.chat-empty p {
    font-size: 14px;
    color: var(--text-tertiary);
    max-width: 280px;
    line-height: 1.5;
    margin-bottom: 28px;
}

/* Quick Start Grid */
.quick-start-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    max-width: 340px;
    width: 100%;
    margin-top: 8px;
}

.quick-start-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    cursor: pointer;
    font-family: inherit;
    box-shadow: var(--shadow-sm);
}

.quick-start-card:active {
    transform: scale(0.98);
    background: var(--bg-secondary);
}

.quick-start-card i {
    width: 28px;
    height: 28px;
    color: var(--text-primary);
}

.quick-start-card span {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
}

/* Composer Attachments Group */
.composer-attachments {
    display: flex;
    gap: 8px;
}

/* Chat Date Separator */
.chat-date {
    text-align: center;
    margin: 28px 0 20px;
    position: relative;
}

.chat-date::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: var(--border-light);
}

.chat-date span {
    position: relative;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    background: var(--bg-primary);
    padding: 6px 16px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-light);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Chat Bubbles - Premium Style */
.chat-bubble-wrapper {
    display: flex;
    margin-bottom: 16px;
    padding: 0 4px;
    animation: bubbleSlide 0.35s var(--ease-out) forwards;
}

@keyframes bubbleSlide {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.chat-bubble-wrapper.incoming {
    justify-content: flex-start;
}

.chat-bubble-wrapper.outgoing {
    justify-content: flex-end;
}

.chat-bubble {
    max-width: 75%;
    padding: 14px 18px;
    border-radius: 20px;
    font-size: 15px;
    line-height: 1.55;
    position: relative;
}

/* Incoming Messages - Studio */
.chat-bubble-wrapper.incoming .chat-bubble {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04), 0 0 0 1px rgba(0, 0, 0, 0.02);
    color: var(--text-primary);
}

/* Outgoing Messages - Client - Monochrome */
.chat-bubble-wrapper.outgoing .chat-bubble {
    background: var(--text-primary);
    color: white;
    border-bottom-right-radius: 6px;
    box-shadow: 0 4px 14px rgba(24, 24, 27, 0.15);
}

.chat-bubble-sender {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-tertiary);
    margin-bottom: 6px;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* Outgoing sender label - white for visibility */
.chat-bubble-sender.outgoing-sender {
    color: rgba(255, 255, 255, 0.9);
}

.chat-bubble-text {
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-bubble-time {
    font-size: 11px;
    opacity: 0.5;
    text-align: right;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

.chat-bubble-time i {
    width: 14px;
    height: 14px;
}

/* === CHAT COMPOSER - Premium === */
.chat-composer {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding: 20px 24px;
    padding-bottom: calc(20px + var(--safe-bottom) + 72px);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    flex-shrink: 0;
}

.btn-attach {
    width: 48px;
    height: 48px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s ease;
}

.btn-attach:active {
    background: var(--bg-tertiary);
}

.btn-attach i {
    width: 22px;
    height: 22px;
}

.input-field {
    flex: 1;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 14px 20px;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.input-field:focus-within {
    border-color: var(--text-primary);
    background: var(--bg-card);
    box-shadow: 0 0 0 4px rgba(24, 24, 27, 0.06);
}

.input-field textarea {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    outline: none;
    max-height: 120px;
    color: var(--text-primary);
    line-height: 1.5;
}

.input-field textarea::placeholder {
    color: var(--text-muted);
}

.btn-send {
    width: 48px;
    height: 48px;
    background: #18181B;
    border: none;
    border-radius: 14px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(24, 24, 27, 0.2);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-send:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(24, 24, 27, 0.2);
}

.btn-send i {
    width: 20px;
    height: 20px;
}

/* === BOTTOM NAV - Premium Solid Design === */
.bottom-nav {
    position: fixed;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    height: 56px;
    padding: 0 6px;
    padding-bottom: 0;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    z-index: 100;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.06), 0 0 0 0.5px rgba(0, 0, 0, 0.04);
    width: auto;
    max-width: calc(100% - 24px);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 8px 10px;
    background: transparent;
    border: none;
    border-radius: 12px;
    color: rgba(0, 0, 0, 0.35);
    cursor: pointer;
    position: relative;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.nav-item:hover {
    color: rgba(0, 0, 0, 0.55);
    background: rgba(0, 0, 0, 0.03);
}

.nav-item i {
    width: 20px;
    height: 20px;
    stroke-width: 1.8;
}

.nav-item span:not(.nav-badge) {
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.nav-item.active {
    background: rgba(0, 0, 0, 0.06);
    color: rgba(0, 0, 0, 0.85);
}

/* Remove the top line indicator */
.nav-item.active::before {
    display: none;
}

/* AI nav item — mobile */
.nav-item.nav-ai {
    color: #7c3aed;
}

.nav-item.nav-ai.active {
    color: #6d28d9;
    background: rgba(124, 58, 237, .08);
}

.nav-badge {
    position: absolute;
    top: 2px;
    right: calc(50% - 20px);
    min-width: 16px;
    height: 16px;
    background: #EF4444;
    color: white;
    font-size: 9px;
    font-weight: 700;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid rgba(255, 255, 255, 0.9);
}

/* === MODAL === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(24, 24, 27, 0.4);
    backdrop-filter: blur(8px);
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: overlayIn 0.3s var(--ease-out);
}

@keyframes overlayIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-overlay.hidden {
    display: none;
}

.modal-panel {
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    background: var(--bg-card);
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    overflow: hidden;
    animation: modalSlide 0.4s var(--ease-out);
    box-shadow: var(--shadow-xl);
}

@keyframes modalSlide {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 24px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-secondary);
}

.modal-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
}

.modal-header h2 i {
    width: 20px;
    height: 20px;
    color: var(--accent-primary);
}

.about-modal-header {
    background: var(--bg-secondary);
}

.modal-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-title-group i {
    width: 20px;
    height: 20px;
    color: var(--accent-primary);
}

.btn-close-pill {
    width: 34px;
    height: 34px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close-pill i {
    width: 16px;
    height: 16px;
}

/* === SCANNER === */
.scanner-state {
    display: none;
    padding: 24px;
}

.scanner-state.active {
    display: block;
}

.camera-box {
    position: relative;
    aspect-ratio: 4/3;
    background: var(--text-primary);
    border-radius: var(--radius-xl);
    overflow: hidden;
    margin-bottom: 24px;
    box-shadow: var(--shadow-lg);
}

.camera-box video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.camera-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.5);
}

.camera-placeholder i {
    width: 44px;
    height: 44px;
    margin-bottom: 14px;
}

.camera-placeholder p {
    font-size: 13px;
}

.camera-frame {
    position: absolute;
    inset: 18px;
    pointer-events: none;
}

.corner {
    position: absolute;
    width: 22px;
    height: 22px;
    border-color: var(--accent-primary);
    border-style: solid;
    border-width: 3px;
}

.corner.tl {
    top: 0;
    left: 0;
    border-right: none;
    border-bottom: none;
    border-radius: 4px 0 0 0;
}

.corner.tr {
    top: 0;
    right: 0;
    border-left: none;
    border-bottom: none;
    border-radius: 0 4px 0 0;
}

.corner.bl {
    bottom: 0;
    left: 0;
    border-right: none;
    border-top: none;
    border-radius: 0 0 0 4px;
}

.corner.br {
    bottom: 0;
    right: 0;
    border-left: none;
    border-top: none;
    border-radius: 0 0 4px 0;
}

.capture-btn {
    width: 68px;
    height: 68px;
    background: var(--text-primary);
    border: none;
    border-radius: 50%;
    margin: 0 auto 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
}

.capture-ring {
    width: 52px;
    height: 52px;
    border: 4px solid white;
    border-radius: 50%;
}

.scanner-hint {
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-tertiary);
}

/* Analyzing State */
#scanner-analyzing {
    text-align: center;
    padding: 56px 24px;
}

.analyzing-anim {
    width: 90px;
    height: 90px;
    margin: 0 auto 28px;
    position: relative;
}

.analyzing-anim::before,
.analyzing-anim::after {
    content: '';
    position: absolute;
    inset: -10px;
    border: 2px solid var(--text-primary);
    border-radius: 50%;
    opacity: 0;
    animation: ringExpand 2s ease-out infinite;
}

.analyzing-anim::after {
    animation-delay: 0.6s;
}

@keyframes ringExpand {
    0% {
        transform: scale(0.6);
        opacity: 0.5;
    }

    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

.anim-circle {
    width: 90px;
    height: 90px;
    background: var(--text-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    box-shadow: var(--shadow-lg);
    animation: breathe 2s ease-in-out infinite;
}

@keyframes breathe {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.04);
    }
}

.anim-circle i {
    width: 40px;
    height: 40px;
    color: white;
}

#scanner-analyzing h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

#scanner-analyzing p {
    font-size: 13px;
    color: var(--text-tertiary);
}

/* Result */
.preview-box {
    aspect-ratio: 4/3;
    background: var(--bg-tertiary);
    border-radius: var(--radius-xl);
    overflow: hidden;
    border: 1px solid var(--border-light);
    margin-bottom: 18px;
}

.preview-box img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.quality-box {
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    margin-bottom: 18px;
}

.quality-box.success {
    background: var(--status-success-bg);
    border: 1px solid var(--status-success);
}

.quality-box.warning {
    background: var(--status-warning-bg);
    border: 1px solid var(--status-warning);
}

.quality-box.error {
    background: var(--status-error-bg);
    border: 1px solid var(--status-error);
}

.quality-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.quality-header i {
    width: 18px;
    height: 18px;
}

.quality-header strong {
    font-size: 13px;
    font-weight: 600;
}

.quality-box.success .quality-header {
    color: var(--status-success);
}

.quality-box.warning .quality-header {
    color: var(--status-warning);
}

.quality-box.error .quality-header {
    color: var(--status-error);
}

.quality-box p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: 26px;
}

/* Quality Feedback (Scanner AI Result) */
.quality-feedback {
    padding: 14px 18px;
    border-radius: var(--radius-lg);
    margin-bottom: 18px;
}

.quality-feedback.good {
    background: var(--status-success-bg);
    border: 1px solid var(--status-success);
}

.quality-feedback.warning {
    background: var(--status-warning-bg);
    border: 1px solid var(--status-warning);
}

.quality-feedback.error {
    background: var(--status-error-bg);
    border: 1px solid var(--status-error);
}

.quality-feedback-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.quality-feedback-header i {
    width: 20px;
    height: 20px;
}

.quality-feedback.good .quality-feedback-header {
    color: var(--status-success);
}

.quality-feedback.good .quality-feedback-header i {
    color: var(--accent-primary);
}

.quality-feedback.warning .quality-feedback-header {
    color: var(--status-warning);
}

.quality-feedback-header strong {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.ai-analysis-details {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.ai-analysis-details strong {
    color: var(--text-primary);
    font-weight: 600;
}

.quality-feedback p {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.action-row {
    display: flex;
    gap: 12px;
}

.btn-secondary,
.btn-primary {
    flex: 1;
    padding: 12px 18px;
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-family: var(--font-body);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
}

.btn-secondary {
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    color: var(--text-secondary);
}

.btn-primary {
    background: var(--text-primary);
    border: none;
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary i,
.btn-primary i {
    width: 18px;
    height: 18px;
}

.btn-primary.full {
    width: 100%;
}

/* Error State */
#scanner-error {
    text-align: center;
    padding: 44px 24px;
}

.error-icon {
    width: 68px;
    height: 68px;
    background: var(--status-error-bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 18px;
}

.error-icon i {
    width: 30px;
    height: 30px;
    color: var(--status-error);
}

#scanner-error h3 {
    font-size: 17px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

#scanner-error p {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-bottom: 22px;
}

/* === SETTINGS MODAL === */
.settings-content {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
}

.settings-section {
    margin-bottom: 26px;
}

.settings-section:last-child {
    margin-bottom: 0;
}

.settings-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.settings-form-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.settings-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.settings-input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    outline: none;
}

.settings-input:focus {
    border-color: var(--text-primary);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px rgba(24, 24, 27, 0.06);
}

.settings-input::placeholder {
    color: var(--text-muted);
}

.settings-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
}

.settings-toggle input[type="checkbox"] {
    width: 44px;
    height: 24px;
    appearance: none;
    background: var(--border-medium);
    border-radius: var(--radius-full);
    position: relative;
    cursor: pointer;
}

.settings-toggle input[type="checkbox"]::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.2s var(--ease-out);
    box-shadow: var(--shadow-sm);
}

.settings-toggle input[type="checkbox"]:checked {
    background: var(--text-primary);
}

.settings-toggle input[type="checkbox"]:checked::before {
    transform: translateX(20px);
}

/* Settings Divider */
.settings-divider {
    height: 1px;
    background: var(--border-light);
    margin: 24px 0 16px;
}

/* Settings Link Buttons */
.settings-link-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-primary);
    cursor: pointer;
    margin-bottom: 10px;
}

.settings-link-btn i {
    width: 20px;
    height: 20px;
    color: var(--text-tertiary);
}

.settings-link-btn .chevron {
    margin-left: auto;
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.settings-link-btn span {
    flex: 1;
    text-align: left;
}

.settings-link-btn.logout-btn {
    background: var(--status-error-bg);
    border-color: transparent;
    color: var(--status-error);
    margin-bottom: 0;
}

.settings-link-btn.logout-btn i {
    color: var(--status-error);
}

/* === ABOUT MODAL === */
.about-content {
    padding: 28px 24px;
    max-height: 65vh;
    overflow-y: auto;
}

.about-hero {
    text-align: center;
    margin-bottom: 28px;
    padding-bottom: 28px;
    border-bottom: 1px solid var(--border-light);
}

.about-logo {
    height: 44px;
    margin-bottom: 14px;
}

.about-tagline {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.6;
    max-width: 300px;
    margin: 0 auto;
}

.trust-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 28px;
}

.trust-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
}

.trust-badge i {
    width: 14px;
    height: 14px;
    color: var(--status-success);
}

.about-section {
    display: flex;
    gap: 14px;
    margin-bottom: 22px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--border-light);
}

.about-section:last-of-type {
    border-bottom: none;
}

.about-section-icon {
    width: 40px;
    height: 40px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.about-section-icon i {
    width: 20px;
    height: 20px;
    color: var(--accent-primary);
}

.about-section-content h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.about-section-content p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.about-section-content strong {
    color: var(--text-primary);
}

.about-footer {
    text-align: center;
    padding-top: 22px;
    border-top: 1px solid var(--border-light);
}

.about-footer p {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-bottom: 6px;
}

.about-footer a {
    color: var(--accent-primary);
    text-decoration: none;
    font-weight: 600;
}

.about-version {
    font-size: 11px;
    color: var(--text-muted) !important;
}

/* === DESKTOP RESPONSIVE === */

/* Tablet */
@media (min-width: 768px) {
    .app-main {
        padding: 32px;
    }

    .view {
        padding: 32px;
        max-width: 680px;
        margin: 0 auto;
    }

    .welcome-card {
        padding: 32px 36px;
    }

    .welcome-card h1 {
        font-size: 32px;
    }

    .kpi-value {
        font-size: 44px;
    }

    .bottom-nav {
        max-width: 360px;
    }

    .modal-panel {
        border-radius: var(--radius-2xl);
        margin-bottom: 32px;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .app-container {
        flex-direction: row;
        height: 100vh;
    }

    /* Sidebar - Dark Vercel Style (matching studio) */
    .app-header {
        flex-direction: column;
        width: 80px;
        min-width: 80px;
        height: 100vh;
        padding: 0;
        border: none;
        border-right: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: 0;
        flex-shrink: 0;
        justify-content: flex-start;
        gap: 0;
        background: #000000;
        position: sticky;
        top: 0;
        left: 0;
        box-shadow: none;
        align-items: center;
        overflow: hidden;
    }

    .header-brand {
        width: 100%;
        padding: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        height: 64px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .brand-label {
        display: none;
    }

    .brand-icon {
        height: 32px;
        width: 32px;
    }

    /* Desktop Navigation - Dark Vercel Style */
    .desktop-nav {
        display: flex;
        flex-direction: column;
        width: 100%;
        gap: 0;
        flex: 1;
        overflow-y: auto;
        padding: 12px 0;
    }

    .desktop-nav-btn {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 0.875rem 0;
        width: 100%;
        background: transparent;
        border: none;
        border-radius: 0;
        color: rgba(255, 255, 255, 0.6);
        font-size: 9px;
        font-weight: 600;
        font-family: var(--font-body);
        cursor: pointer;
        text-align: center;
        position: relative;
        transition: all 0.15s ease;
        text-transform: uppercase;
        letter-spacing: 0.04em;
    }

    .desktop-nav-btn:hover {
        background: rgba(255, 255, 255, 0.08);
        color: rgba(255, 255, 255, 0.9);
    }

    .desktop-nav-btn i {
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }

    .desktop-nav-btn>span:not(.nav-badge) {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 64px;
    }

    .desktop-nav-btn.active {
        background: transparent;
        color: #ffffff;
        font-weight: 600;
    }

    .desktop-nav-btn.active::before {
        content: '';
        position: absolute;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        width: 3px;
        height: 24px;
        background: #ffffff;
        border-radius: 0 3px 3px 0;
    }

    .desktop-nav-btn .nav-badge {
        position: absolute;
        top: 8px;
        right: 12px;
        margin-left: 0;
        min-width: 16px;
        height: 16px;
        font-size: 9px;
        padding: 0 4px;
    }

    /* AI nav item — desktop sidebar */
    .desktop-nav-btn.desktop-nav-ai {
        color: rgba(167, 139, 250, .85);
    }

    .desktop-nav-btn.desktop-nav-ai:hover {
        color: #c4b5fd;
        background: rgba(167, 139, 250, .1);
    }

    .desktop-nav-btn.desktop-nav-ai.active {
        color: #c4b5fd;
    }

    .desktop-nav-btn.desktop-nav-ai.active::before {
        background: #a78bfa;
    }

    .nav-divider {
        display: none;
    }

    .header-actions {
        flex-direction: column;
        width: 100%;
        gap: 8px;
        margin-top: auto;
        padding: 12px 0;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        align-items: center;
    }

    .user-pill {
        width: 36px;
        height: 36px;
        padding: 0;
        border-radius: 50%;
        justify-content: center;
        background: rgba(255, 255, 255, 0.15);
        border: none;
        box-shadow: none;
    }

    .user-pill>span {
        display: none;
    }

    .user-avatar {
        width: 36px;
        height: 36px;
        font-size: 12px;
        background: transparent;
        color: white;
    }

    .btn-icon-soft {
        width: 36px;
        height: 36px;
        color: rgba(255, 255, 255, 0.6);
        border-radius: 8px;
    }

    .btn-icon-soft:hover {
        background: rgba(255, 255, 255, 0.08);
        color: rgba(255, 255, 255, 0.9);
    }

    /* Charts side by side on desktop */
    .charts-row {
        flex-direction: row;
    }

    /* Hide mobile nav */
    .bottom-nav {
        display: none;
    }

    /* Main content */
    .app-main {
        flex: 1;
        padding: 0;
    }

    .view {
        padding: 40px;
        padding-bottom: 40px;
        max-width: 760px;
        margin: 0 auto;
    }

    /* Chat view - full width on desktop */
    .view.chat-view {
        max-width: 100%;
        padding: 0;
        margin: 0;
    }

    /* Modal centered on desktop */
    .modal-overlay {
        align-items: center;
    }

    .modal-panel {
        border-radius: var(--radius-2xl);
        margin: 0;
    }
}

/* Large Desktop */
@media (min-width: 1280px) {
    .view {
        max-width: 860px;
        padding: 48px 56px;
    }

    .kpi-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .welcome-card h1 {
        font-size: 36px;
    }

    .kpi-value {
        font-size: 48px;
    }
}

/* === SCADENZE & DOCUMENTI MODALS === */
.scadenze-modal,
/* === DOCUMENTI MODAL — Jakarta/Zinc Bottom-Sheet === */

.documenti-modal {
    max-height: 85vh;
    width: 100%;
    max-width: 480px;
    border-radius: 20px 20px 0 0;
    overflow: hidden;
    animation: doc-sheet-up .4s cubic-bezier(.16,1,.3,1) both;
}

@media (min-width: 768px) {
    .documenti-modal {
        border-radius: 16px;
        animation: doc-fade-scale .35s cubic-bezier(.16,1,.3,1) both;
    }
}

@keyframes doc-sheet-up {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes doc-fade-scale {
    from { transform: scale(.96) translateY(8px); opacity: 0; }
    to { transform: scale(1) translateY(0); opacity: 1; }
}

.scadenze-modal .modal-header,
.documenti-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 22px;
    border-bottom: 1px solid #E4E4E7;
    background: rgba(250,250,250,.85);
    -webkit-backdrop-filter: blur(16px) saturate(1.6);
    backdrop-filter: blur(16px) saturate(1.6);
    position: sticky;
    top: 0;
    z-index: 2;
}

.modal-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-title-group i {
    width: 20px;
    height: 20px;
    color: #3F3F46;
}

.modal-title-group h2 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 17px;
    font-weight: 700;
    color: #18181B;
    margin: 0;
    letter-spacing: -.01em;
}

.scadenze-modal .modal-body,
.documenti-modal .modal-body {
    padding: 16px 18px 24px;
    max-height: calc(85vh - 62px);
    overflow-y: auto;
    background: #FAFAFA;
}

.scadenze-list,
.documenti-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 56px 24px;
    color: #A1A1AA;
}

.loading-spinner i {
    width: 28px;
    height: 28px;
    margin-bottom: 14px;
    color: #71717A;
}

.loading-spinner i.spin {
    animation: spin .9s cubic-bezier(.4,0,.2,1) infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.loading-spinner p {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 13px;
    color: #A1A1AA;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 56px 24px;
    text-align: center;
}

.empty-state i {
    width: 40px;
    height: 40px;
    color: #D4D4D8;
    margin-bottom: 14px;
    stroke-width: 1.5;
}

.empty-state h3 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: #3F3F46;
    margin-bottom: 6px;
}

.empty-state p {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 13px;
    color: #A1A1AA;
    line-height: 1.5;
}

.documenti-modal .modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F4F4F5;
    border: 1px solid #E4E4E7;
    border-radius: 10px;
    color: #71717A;
    cursor: pointer;
    padding: 0;
    transition: background .15s ease, color .15s ease;
}

.documenti-modal .modal-close:active {
    background: #E4E4E7;
    color: #18181B;
}

.documenti-modal .modal-close i {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

.scadenza-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    box-shadow: var(--shadow-solid);
}

.scadenza-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.scadenza-title {
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.scadenza-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.scadenza-badge.urgent {
    background: var(--status-error-bg);
    color: var(--status-error);
}

.scadenza-badge.soon {
    background: var(--status-warning-bg);
    color: var(--status-warning);
}

.scadenza-badge.normal {
    background: var(--status-success-bg);
    color: var(--status-success);
}

.scadenza-date {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.scadenza-date i {
    width: 14px;
    height: 14px;
    color: var(--text-tertiary);
}

.scadenza-description {
    font-size: 13px;
    color: var(--text-tertiary);
    line-height: 1.5;
}

/* — Document card rows — */

.documento-card {
    background: #FFFFFF;
    border: 1px solid #E4E4E7;
    border-radius: 12px;
    padding: 14px 16px;
    box-shadow: 0 1px 2px rgba(0,0,0,.04);
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: box-shadow .2s cubic-bezier(.16,1,.3,1),
                border-color .2s cubic-bezier(.16,1,.3,1);
    animation: doc-card-in .35s cubic-bezier(.16,1,.3,1) both;
}

.documento-card:active {
    box-shadow: 0 0 0 3px rgba(24,24,27,.06);
    border-color: #D4D4D8;
}

@keyframes doc-card-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.documenti-list .documento-card:nth-child(1) { animation-delay: 0s; }
.documenti-list .documento-card:nth-child(2) { animation-delay: .04s; }
.documenti-list .documento-card:nth-child(3) { animation-delay: .08s; }
.documenti-list .documento-card:nth-child(4) { animation-delay: .12s; }
.documenti-list .documento-card:nth-child(5) { animation-delay: .16s; }
.documenti-list .documento-card:nth-child(n+6) { animation-delay: .2s; }

.documento-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.documento-icon.pdf {
    background: #FEE2E2;
    color: #DC2626;
}

.documento-icon.image {
    background: #DCFCE7;
    color: #16A34A;
}

.documento-icon.doc {
    background: #DBEAFE;
    color: #2563EB;
}

.documento-icon.excel {
    background: #D1FAE5;
    color: #059669;
}

.documento-icon.generic {
    background: #F4F4F5;
    color: #71717A;
}

.documento-icon i {
    width: 20px;
    height: 20px;
    stroke-width: 1.8;
}

.documento-info {
    flex: 1;
    min-width: 0;
}

.documento-name {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 13.5px;
    font-weight: 600;
    color: #18181B;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -.01em;
}

.documento-meta {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 11.5px;
    color: #A1A1AA;
    display: flex;
    gap: 6px;
    align-items: center;
}

.documento-meta span + span::before {
    content: '\00B7';
    margin-right: 6px;
    color: #D4D4D8;
}

.documento-action {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: #F4F4F5;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #71717A;
    flex-shrink: 0;
    transition: background .15s ease, color .15s ease;
}

.documento-action:active {
    background: #E4E4E7;
    color: #18181B;
}

.documento-action i {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

/* === ENHANCED CHAT MESSAGES === */

/* Message Actions Menu */
.message-actions {
    position: absolute;
    top: -10px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    background: var(--bg-primary);
    padding: 4px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-light);
}

.chat-bubble-wrapper:hover .message-actions,
.chat-bubble-wrapper:active .message-actions {
    opacity: 1;
    visibility: visible;
}

.chat-bubble {
    position: relative;
}

.action-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-tertiary);
    transition: all 0.15s ease;
}

.action-btn:active {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.action-btn.delete:active {
    background: var(--status-error-bg);
    color: var(--status-error);
}

.action-btn i {
    width: 14px;
    height: 14px;
}

/* Chat Bubble Footer */
.chat-bubble-footer {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}

.chat-bubble-status {
    display: flex;
    align-items: center;
}

.chat-bubble-status i {
    width: 14px;
    height: 14px;
}

.chat-bubble-status.read i {
    color: var(--accent-primary);
}

.chat-edited {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
    margin-left: 6px;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

/* Chat input editing mode */
#chat-input.editing {
    border-color: var(--accent-primary);
    background: var(--accent-light);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

/* Chat Attachments */
.chat-attachment {
    margin-bottom: 8px;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
}

.chat-attachment.image {
    position: relative;
    max-width: 280px;
}

.chat-attachment.image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--radius-md);
}

.attachment-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.chat-attachment.image:active .attachment-overlay {
    opacity: 1;
}

.attachment-overlay i {
    width: 32px;
    height: 32px;
    color: white;
}

.chat-attachment.file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
}

.attachment-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.attachment-icon.pdf {
    background: #E53E3E;
    color: white;
}

.attachment-icon.image {
    background: #38A169;
    color: white;
}

.attachment-icon.doc {
    background: #3182CE;
    color: white;
}

.attachment-icon.excel {
    background: #48BB78;
    color: white;
}

.attachment-icon.generic {
    background: #A0AEC0;
    color: white;
}

.attachment-icon i {
    width: 20px;
    height: 20px;
}

.attachment-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.attachment-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.attachment-action {
    font-size: 11px;
    color: var(--accent-primary);
}

/* Image Preview Overlay */
.image-preview-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.image-preview-container {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.image-preview-container img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: var(--radius-lg);
}

.image-preview-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
}

.image-preview-actions {
    display: flex;
    justify-content: center;
    margin-top: 16px;
}

.btn-preview-action {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: white;
    color: var(--text-primary);
    border-radius: var(--radius-full);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}

/* Upload Preview Modal */
.upload-preview-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.upload-preview-modal {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.upload-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
}

.upload-preview-header h3 {
    font-family: var(--font-display);
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.upload-preview-content {
    padding: 20px;
    display: flex;
    justify-content: center;
}

.upload-preview-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius-md);
    object-fit: contain;
}

.upload-preview-file {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    width: 100%;
}

.upload-preview-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.upload-preview-icon.pdf {
    background: #E53E3E;
    color: white;
}

.upload-preview-icon.image {
    background: #38A169;
    color: white;
}

.upload-preview-icon.doc {
    background: #3182CE;
    color: white;
}

.upload-preview-icon.excel {
    background: #48BB78;
    color: white;
}

.upload-preview-icon.generic {
    background: #A0AEC0;
    color: white;
}

.upload-preview-icon i {
    width: 28px;
    height: 28px;
}

.upload-preview-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.upload-preview-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upload-preview-size {
    font-size: 12px;
    color: var(--text-tertiary);
}

.upload-preview-options {
    padding: 0 20px 16px;
}

.upload-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    cursor: pointer;
    margin-bottom: 12px;
}

.upload-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent-primary);
}

.option-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
}

.option-icon i {
    width: 18px;
    height: 18px;
}

.upload-option span:last-child {
    flex: 1;
    font-size: 14px;
    color: var(--text-secondary);
}

.upload-caption-wrapper {
    margin-top: 8px;
}

.upload-caption-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    font-size: 14px;
    color: var(--text-primary);
}

.upload-caption-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.upload-preview-actions {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-light);
}

.upload-preview-actions .btn-secondary,
.upload-preview-actions .btn-primary {
    flex: 1;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    border: none;
}

.upload-preview-actions .btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.upload-preview-actions .btn-primary {
    background: var(--accent-primary);
    color: white;
}

.upload-preview-actions .btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Toast Notifications */
.toast-notification {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--text-primary);
    color: white;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-lg);
    z-index: 99999;
    animation: toastIn 0.3s ease;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.toast-notification i {
    width: 18px;
    height: 18px;
}

.toast-notification.success {
    background: var(--status-success);
}

.toast-notification.error {
    background: var(--status-error);
}

.toast-notification.info {
    background: var(--accent-primary);
}

/* Editing State */
#chat-input.editing {
    border-color: var(--accent-primary);
    background: rgba(217, 119, 6, 0.05);
}

/* Quick Start Grid in Welcome */
.chat-welcome .quick-start-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 20px;
}

.chat-welcome .quick-start-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: transform 0.15s ease;
}

.chat-welcome .quick-start-card:active {
    transform: scale(0.97);
}

.chat-welcome .quick-start-card i {
    width: 24px;
    height: 24px;
    color: var(--accent-primary);
}

.chat-welcome .quick-start-card span {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* === SCADENZE & DOCUMENTI PREMIUM CARDS === */

/* Card item icon container */
.card-item-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: var(--accent-light);
    border: 1px solid rgba(217, 119, 6, 0.15);
}

.card-item-icon i {
    width: 18px;
    height: 18px;
    color: var(--accent-primary);
}

/* Task items with warm styling */
.card-item.task {
    background: rgba(254, 243, 199, 0.4);
    border: 1px solid rgba(217, 119, 6, 0.15);
    border-radius: 14px;
    margin-bottom: 10px;
    padding: 14px 16px;
    gap: 14px;
}

.card-item.task:hover {
    background: rgba(254, 243, 199, 0.6);
}

/* Deadline items */
.card-item.deadline {
    background: rgba(254, 243, 199, 0.4);
    border: 1px solid rgba(217, 119, 6, 0.15);
    border-radius: 14px;
    margin-bottom: 10px;
    padding: 14px 16px;
    gap: 14px;
}

/* Document request items with purple accent */
.card-item.doc-request {
    background: rgba(139, 92, 246, 0.06);
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: 14px;
    margin-bottom: 10px;
    padding: 14px 16px;
    flex-wrap: wrap;
}

.card-item.doc-request:hover {
    background: rgba(139, 92, 246, 0.1);
}

.card-item.doc-request .card-item-icon {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.2);
}

.card-item.doc-request .card-item-icon i {
    color: #8B5CF6;
}

/* Card actions container */
.card-item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* F24 Approve / FEA Sign buttons */
.btn-approve {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border: none;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
    white-space: nowrap;
}

.btn-approve.btn-fes {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.25);
}
.btn-approve.btn-fes:hover {
    background: rgba(16, 185, 129, 0.25);
}

.btn-approve.btn-fea {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.25);
}
.btn-approve.btn-fea:hover {
    background: rgba(59, 130, 246, 0.25);
}

.btn-approve:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Upload button styling */
.btn-upload-doc {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.25);
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-body);
    color: #7C3AED;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
}

.btn-upload-doc:hover {
    background: rgba(139, 92, 246, 0.2);
}

.btn-upload-doc:active {
    opacity: 0.9;
}

.btn-upload-doc i {
    width: 16px;
    height: 16px;
}

/* Complete task button */
.btn-complete-task {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    background: rgba(217, 119, 6, 0.12);
    border: 1px solid rgba(217, 119, 6, 0.25);
    border-radius: 9px;
    color: var(--accent-primary);
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
}

.btn-complete-task:hover {
    background: rgba(217, 119, 6, 0.2);
}

.btn-complete-task:active {
    opacity: 0.9;
}

.btn-complete-task i {
    width: 16px;
    height: 16px;
}

/* Priority badge */
.priority-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-left: 8px;
}

.priority-badge.high {
    background: var(--status-error-bg);
    color: var(--status-error);
}

/* Countdown badges */
.countdown {
    font-size: 10px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 8px;
    white-space: nowrap;
    background: var(--status-success-bg);
    color: var(--status-success);
}

.countdown.urgent {
    background: var(--status-error-bg);
    color: var(--status-error);
    animation: pulseUrgent 2s ease-in-out infinite;
}

@keyframes pulseUrgent {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.countdown.ok {
    background: var(--status-success-bg);
    color: var(--status-success);
}

/* Rejection reason styling */
.rejection-reason {
    color: var(--status-error) !important;
    font-style: italic;
    background: var(--status-error-bg);
    padding: 6px 10px;
    border-radius: 8px;
    margin-top: 8px;
}

/* Scadenze section styling */
.scadenze-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin-bottom: 8px;
}

.scadenze-section-header .section-icon {
    width: 32px;
    height: 32px;
    background: var(--accent-light);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scadenze-section-header .section-icon i {
    width: 16px;
    height: 16px;
    color: var(--accent-primary);
}

.scadenze-section-header h4 {
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.scadenze-section-header .section-count {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    background: var(--accent-light);
    color: var(--accent-primary);
    border-radius: 10px;
}

/* Documenti section header */
.documenti-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    margin-bottom: 8px;
}

.documenti-section-header .section-icon {
    width: 32px;
    height: 32px;
    background: rgba(139, 92, 246, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.documenti-section-header .section-icon i {
    width: 16px;
    height: 16px;
    color: #8B5CF6;
}

.documenti-section-header h4 {
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.documenti-section-header .section-count {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    background: rgba(139, 92, 246, 0.1);
    color: #8B5CF6;
    border-radius: 10px;
}

/* === DOCUMENTS ARCHIVE - Solid Premium Cards === */

.docs-archive-view {
    padding: 20px 16px 100px;
    background: var(--bg-primary);
}

.archive-header {
    margin-bottom: 24px;
    padding: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.archive-header h2 {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.archive-header h2 i {
    width: 24px;
    height: 24px;
    color: var(--text-primary);
}

.archive-subtitle {
    font-size: 14px;
    color: var(--text-tertiary);
}

/* Filter Chips - Solid Style */
.archive-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
}

.archive-filters::-webkit-scrollbar {
    display: none;
}

.filter-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.filter-chip i {
    width: 16px;
    height: 16px;
    color: var(--text-tertiary);
}

.filter-chip.active {
    background: var(--text-primary);
    color: white;
    border-color: var(--text-primary);
    box-shadow: 0 2px 6px rgba(24, 24, 27, 0.2);
}

.filter-chip.active i {
    color: white;
}

/* Documents List Container */
.archive-timeline {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.timeline-group {
    margin-bottom: 8px;
}

/* Period Label */
.timeline-period {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 16px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    display: inline-block;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

/* Documents list */
.timeline-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Hide old timeline elements */
.timeline-items::before {
    display: none;
}

.timeline-item {
    cursor: pointer;
}

.timeline-dot {
    display: none;
}

/* SOLID DOCUMENT CARD - Matches HTML structure from clientApp.js */
.timeline-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 18px 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    max-width: 100%;
    box-sizing: border-box;
}

/* No hover effects - maintain same appearance */
.timeline-card:hover,
.timeline-item:hover .timeline-card {
    background: var(--bg-card);
    border-color: var(--border-light);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transform: none;
}

/* Card Header Row: icon | name | badge */
.timeline-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 8px;
    min-width: 0;
    overflow: hidden;
}

/* File Icon */
.timeline-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: #F3F4F6;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    flex-shrink: 0;
}

.timeline-icon i {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
}

/* File Name */
.timeline-name {
    flex: 1;
    min-width: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Source Badge */
.timeline-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 6px 10px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
    background: #F3F4F6;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}

.timeline-badge.source-studio {
    background: #F3F4F6;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}

.timeline-badge.source-client {
    background: #F3F4F6;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}

/* Description */
.timeline-desc {
    font-size: 13px;
    color: var(--text-tertiary);
    line-height: 1.4;
    margin-bottom: 12px;
    padding-left: 58px;
}

/* Meta Row: date | download button */
.timeline-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-left: 58px;
}

.timeline-meta>span:first-child {
    font-size: 12px;
    color: var(--text-quaternary);
}

/* Download Button - Prominent */
.timeline-download {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    width: 36px;
    height: 36px;
    background: #18181B;
    border-radius: 8px;
    color: white !important;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(24, 24, 27, 0.15);
}

.timeline-download i,
.timeline-download svg {
    width: 16px !important;
    height: 16px !important;
    color: white !important;
    stroke: white !important;
}

/* Empty state in archive */
.archive-timeline .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.archive-timeline .empty-state i {
    width: 48px;
    height: 48px;
    color: var(--border-medium);
    margin-bottom: 16px;
}

.archive-timeline .empty-state p {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.archive-timeline .empty-hint {
    font-size: 13px;
    color: var(--text-quaternary);
}

/* Loading state */
.archive-timeline .loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 60px 20px;
    color: var(--text-tertiary);
}

.archive-timeline .loading-spinner i {
    width: 28px;
    height: 28px;
}

.archive-timeline .loading-spinner span {
    font-size: 14px;
}

/* === DOCUMENT PREVIEW MODAL — Jakarta/Zinc === */

.doc-preview-modal {
    display: flex;
    flex-direction: column;
    background: #FFFFFF;
    width: 100%;
    height: 100%;
    max-width: 100vw;
    max-height: 100vh;
    animation: doc-preview-in .35s cubic-bezier(.16,1,.3,1) both;
}

@keyframes doc-preview-in {
    from { opacity: 0; transform: scale(.97); }
    to { opacity: 1; transform: scale(1); }
}

@media (min-width: 768px) {
    .doc-preview-modal {
        width: 90vw;
        height: 88vh;
        max-width: 1100px;
        border-radius: 16px;
        overflow: hidden;
        box-shadow: 0 24px 48px -12px rgba(0,0,0,.18),
                    0 0 0 1px rgba(0,0,0,.05);
    }
}

.doc-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: rgba(250,250,250,.88);
    -webkit-backdrop-filter: blur(16px) saturate(1.6);
    backdrop-filter: blur(16px) saturate(1.6);
    border-bottom: 1px solid #E4E4E7;
    flex-shrink: 0;
}

.doc-preview-title {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.doc-preview-title i {
    width: 18px;
    height: 18px;
    color: #71717A;
    flex-shrink: 0;
    stroke-width: 1.8;
}

.doc-preview-title span {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 14px;
    font-weight: 650;
    color: #18181B;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -.01em;
}

.doc-preview-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.btn-preview-download {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #18181B;
    color: #FAFAFA;
    border-radius: 10px;
    text-decoration: none;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: .01em;
    transition: opacity .15s ease;
}

.btn-preview-download:active {
    opacity: .8;
}

.btn-preview-download i {
    width: 14px;
    height: 14px;
    stroke-width: 2.2;
}

.btn-preview-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    background: #F4F4F5;
    border: 1px solid #E4E4E7;
    border-radius: 10px;
    color: #71717A;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.btn-preview-close:active {
    background: #E4E4E7;
    color: #18181B;
}

.btn-preview-close i {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

.doc-preview-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #F4F4F5;
    overflow: hidden;
    position: relative;
}

.doc-preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.doc-preview-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 4px;
}

.preview-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    color: #A1A1AA;
}

.preview-loader i {
    width: 28px;
    height: 28px;
    color: #71717A;
}

.preview-loader span {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 13px;
    color: #A1A1AA;
}

.preview-unsupported {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 48px 32px;
    text-align: center;
}

.preview-unsupported i {
    width: 40px;
    height: 40px;
    color: #D4D4D8;
    stroke-width: 1.5;
}

.preview-unsupported p {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 14px;
    color: #71717A;
    line-height: 1.5;
}

.preview-unsupported .btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: #18181B;
    color: #FAFAFA;
    border-radius: 10px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    letter-spacing: .01em;
}

.preview-unsupported .btn-primary:active {
    opacity: .8;
}

/* ================================================
   DOCUMENTS ARCHIVE - Premium Timeline Design
   ================================================ */

.docs-archive-view {
    padding: 24px 20px !important;
}

/* Archive Header */
.archive-header {
    text-align: center;
    padding: 28px 20px;
    margin-bottom: 24px;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

.archive-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: #18181B;
}

.archive-header h2 {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.archive-header h2 i {
    width: 28px;
    height: 28px;
    color: var(--accent-primary);
}

.archive-subtitle {
    font-size: 14px;
    color: var(--text-tertiary);
    margin: 0;
}

/* Filter Chips - Pill Style */
.archive-filters {
    display: flex;
    gap: 10px;
    margin-bottom: 28px;
    padding: 6px;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    border: 1px solid var(--border-light);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.filter-chip {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s var(--ease-out);
    white-space: nowrap;
}

.filter-chip i {
    width: 16px;
    height: 16px;
}

.filter-chip:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.filter-chip.active {
    background: var(--bg-card);
    color: var(--accent-primary);
    box-shadow: var(--shadow-sm);
}

/* Timeline Container */
.archive-timeline {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* Timeline Group */
.timeline-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Period Header (Month/Year) */
.timeline-period {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 8px 16px;
    background: var(--accent-light);
    border-radius: var(--radius-full);
    width: fit-content;
    border: 1px solid var(--border-accent);
}

/* Timeline Items Container */
.timeline-items {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-left: 16px;
    border-left: 3px solid var(--border-light);
    margin-left: 12px;
}

/* Single Timeline Item */
.timeline-item {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    cursor: pointer;
    position: relative;
    margin-left: -28px;
}

/* Timeline Dot */
.timeline-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 3px solid var(--border-medium);
    flex-shrink: 0;
    margin-top: 18px;
    transition: all 0.2s var(--ease-out);
    z-index: 1;
}

.timeline-dot.source-studio {
    border-color: var(--accent-primary);
    background: var(--accent-light);
}

.timeline-dot.source-client {
    border-color: var(--status-success);
    background: var(--status-success-bg);
}

.timeline-item:hover .timeline-dot {
    border-width: 4px;
}

/* Timeline Card */
.timeline-card {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 16px 18px;
    box-shadow: var(--shadow-sm);
    transition: all 0.25s var(--ease-out);
}

.timeline-item:hover .timeline-card {
    border-color: var(--border-accent);
    box-shadow: var(--shadow-md);
}

/* Card Header */
.timeline-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.timeline-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-light);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.timeline-icon i {
    width: 18px;
    height: 18px;
    color: var(--accent-primary);
}

.timeline-name {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Source Badge */
.timeline-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.timeline-badge.source-studio {
    background: var(--accent-light);
    color: var(--accent-primary);
}

.timeline-badge.source-client {
    background: var(--status-success-bg);
    color: var(--status-success);
}

/* Description */
.timeline-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0 0 10px 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Meta Row */
.timeline-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}

.timeline-download {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-secondary);
    transition: all 0.2s var(--ease-out);
}

.timeline-download i {
    width: 14px;
    height: 14px;
    color: var(--text-tertiary);
}

.timeline-item:hover .timeline-download {
    background: var(--accent-primary);
}

.timeline-item:hover .timeline-download i {
    color: white;
}

/* Empty State */
.docs-archive-view .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 30px;
    text-align: center;
    background: var(--bg-card);
    border: 2px dashed var(--border-light);
    border-radius: var(--radius-xl);
}

.docs-archive-view .empty-state i {
    width: 56px;
    height: 56px;
    color: var(--accent-primary);
    margin-bottom: 16px;
    opacity: 0.6;
}

.docs-archive-view .empty-state p {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.empty-hint {
    font-size: 14px;
    color: var(--text-tertiary);
}

/* Loading Spinner */
.docs-archive-view .loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 60px 20px;
    color: var(--text-tertiary);
}

.docs-archive-view .loading-spinner i {
    width: 32px;
    height: 32px;
    color: var(--accent-primary);
}

/* === PIPELINE STATUS TRACKER === */
.pipeline-panel {
    border-color: rgba(99, 102, 241, 0.12);
    background: #fafaff;
}

.pipeline-panel .panel-header {
    background: transparent;
    border-color: rgba(99, 102, 241, 0.08);
}

.pipeline-tracker {
    padding: 4px 0;
}

.pipeline-dots-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    padding: 0 4px;
}

/* Grey track line behind dots */
.pipeline-track {
    position: absolute;
    top: 50%;
    left: 16px;
    right: 16px;
    height: 2px;
    background: #e2e8f0;
    transform: translateY(-50%);
    border-radius: 1px;
}

/* Filled portion of track */
.pipeline-track-fill {
    position: absolute;
    top: 50%;
    left: 16px;
    height: 2px;
    background: #6366f1;
    transform: translateY(-50%);
    border-radius: 1px;
    transition: width 0.4s ease;
}

/* Dot base */
.pipeline-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

/* Completed dot */
.pipeline-dot.completed {
    background: #6366f1;
    border-color: #6366f1;
}

/* Active dot */
.pipeline-dot.active {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    animation: dotPulse 2s ease-in-out infinite;
}

.pipeline-dot.active::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6366f1;
}

@keyframes dotPulse {

    0%,
    100% {
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    }

    50% {
        box-shadow: 0 0 0 6px rgba(99, 102, 241, 0.08);
    }
}

/* Labels row */
.pipeline-labels-row {
    display: flex;
    justify-content: space-between;
    padding: 6px 0 0;
}

.pipeline-label {
    font-size: 9px;
    font-weight: 500;
    color: #94a3b8;
    text-align: center;
    flex: 1;
    line-height: 1.2;
}

.pipeline-label.active {
    color: #4f46e5;
    font-weight: 600;
}

.pipeline-desc {
    text-align: center;
    background: rgba(99, 102, 241, 0.04);
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(99, 102, 241, 0.08);
}

.pipeline-updated {
    text-align: center;
}

/* ===============================================
   SMART DOCUMENT CHECKLIST
   =============================================== */

.checklist-view {
    padding: 20px;
}

.checklist-header {
    margin-bottom: 20px;
    animation: cardEnter 0.4s var(--ease-out) forwards;
    opacity: 0;
}

.checklist-header-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 6px;
}

.checklist-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    color: var(--text-primary);
}

.checklist-header h2 i {
    width: 22px;
    height: 22px;
    color: var(--text-tertiary);
}

.checklist-subtitle {
    font-size: 13px;
    color: var(--text-tertiary);
    font-weight: 400;
}

/* Progress Card */
.checklist-progress-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-solid);
    animation: cardEnter 0.4s var(--ease-out) 0.05s forwards;
    opacity: 0;
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.progress-pct {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 14px;
}

.progress-bar-track {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--text-primary);
    border-radius: var(--radius-full);
    transition: width 0.6s var(--ease-out);
    position: relative;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.15) 50%, transparent 100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

/* Checklists Container */
.checklists-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.checklist-empty {
    margin-top: 40px;
}

/* Single Checklist Group */
.checklist-group {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-solid);
    animation: panelEnter 0.4s var(--ease-out) forwards;
    opacity: 0;
}

.checklist-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-secondary);
    cursor: pointer;
    transition: background var(--transition-fast);
}

.checklist-group-header:hover {
    background: var(--bg-tertiary);
}

.checklist-group-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.checklist-group-title {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.checklist-group-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 11px;
    color: var(--text-muted);
}

.checklist-group-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.checklist-mini-progress {
    width: 48px;
    height: 5px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.checklist-mini-progress-fill {
    height: 100%;
    background: var(--status-success);
    border-radius: var(--radius-full);
    transition: width 0.4s var(--ease-out);
}

.checklist-group-count {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    background: var(--bg-tertiary);
    padding: 3px 10px;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.checklist-group-chevron {
    color: var(--text-muted);
    transition: transform var(--transition-fast);
}

.checklist-group-chevron i {
    width: 18px;
    height: 18px;
}

.checklist-group.collapsed .checklist-group-chevron {
    transform: rotate(-90deg);
}

.checklist-group.collapsed .checklist-items {
    display: none;
}

/* Deadline Badge */
.deadline-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    background: var(--bg-tertiary);
    color: var(--text-tertiary);
}

.deadline-badge.urgent {
    background: var(--status-error-bg);
    color: var(--status-error);
}

.deadline-badge.soon {
    background: var(--status-warning-bg);
    color: var(--status-warning);
}

.deadline-badge.ok {
    background: var(--status-success-bg);
    color: var(--status-success);
}

/* Checklist Items */
.checklist-items {
    padding: 4px 0;
}

.checklist-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
    transition: background var(--transition-fast);
}

.checklist-item:last-child {
    border-bottom: none;
}

.checklist-item:hover {
    background: var(--bg-secondary);
}

/* Status Indicator */
.checklist-status-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

.checklist-status-icon i {
    width: 16px;
    height: 16px;
}

.checklist-status-icon.pending {
    background: var(--bg-tertiary);
    color: var(--text-muted);
    border: 2px dashed var(--border-medium);
}

.checklist-status-icon.uploaded {
    background: #EFF6FF;
    color: #3B82F6;
    border: 2px solid #BFDBFE;
}

.checklist-status-icon.approved {
    background: var(--status-success-bg);
    color: var(--status-success);
    border: 2px solid #A7F3D0;
}

.checklist-status-icon.rejected {
    background: var(--status-error-bg);
    color: var(--status-error);
    border: 2px solid #FECACA;
}

/* Item Content */
.checklist-item-content {
    flex: 1;
    min-width: 0;
}

.checklist-item-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.checklist-item-desc {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
}

.checklist-item-status-text {
    font-size: 11px;
    font-weight: 600;
    margin-top: 4px;
}

.checklist-item-status-text.uploaded {
    color: #3B82F6;
}

.checklist-item-status-text.approved {
    color: var(--status-success);
}

.checklist-item-status-text.rejected {
    color: var(--status-error);
}

/* Item Actions */
.checklist-item-action {
    flex-shrink: 0;
}

.btn-checklist-upload {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--text-primary);
    color: white;
    border: none;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-checklist-upload i {
    width: 14px;
    height: 14px;
}

.btn-checklist-upload:hover {
    background: #27272A;
    box-shadow: var(--shadow-sm);
}

.btn-checklist-upload.reupload {
    background: var(--status-error-bg);
    color: var(--status-error);
}

.btn-checklist-upload.reupload:hover {
    background: #FEE2E2;
}

.btn-checklist-view {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--status-success-bg);
    color: var(--status-success);
    border: none;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-body);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-checklist-view i {
    width: 14px;
    height: 14px;
}

.btn-checklist-view:hover {
    background: #D1FAE5;
}

/* Rejection note */
.rejection-note {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    margin-top: 6px;
    padding: 8px 10px;
    background: var(--status-error-bg);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--status-error);
    line-height: 1.4;
}

.rejection-note i {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    margin-top: 1px;
}

/* Upload Modal for Checklist */
.checklist-upload-modal {
    max-width: 440px;
    width: calc(100% - 32px);
}

/* Responsive */
@media (max-width: 768px) {
    .checklist-item {
        flex-wrap: wrap;
        gap: 10px;
    }

    .checklist-item-action {
        width: 100%;
    }

    .btn-checklist-upload,
    .btn-checklist-view {
        width: 100%;
        justify-content: center;
        padding: 10px;
    }
}

/* ====================================
   TESORERIA — Treasury Dashboard
   ==================================== */

.treasury-kpi-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.treasury-kpi-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px 16px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.treasury-kpi-card.kpi-accent {
    background: #fafafa;
    border-color: #d4d4d8;
}

.treasury-kpi-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
}

.treasury-kpi-value {
    font-size: 22px;
    font-weight: 800;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
}

.treasury-kpi-sub {
    font-size: 11px;
    color: #94a3b8;
}

.treasury-duo-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.treasury-section-title {
    font-size: 13px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.treasury-amount {
    font-size: 24px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 12px;
    font-variant-numeric: tabular-nums;
}

/* Aging bars */
.aging-bar-track {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    background: #f1f5f9;
    margin-bottom: 8px;
}

.aging-bar-seg {
    min-width: 4px;
    transition: width 0.3s ease;
}

.aging-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.aging-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #64748b;
}

.aging-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* Aging pills for open items */
.aging-pill {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 4px;
}

.aging-ok {
    background: #dcfce7;
    color: #16a34a;
}

.aging-late {
    background: #fef3c7;
    color: #d97706;
}

.aging-warn {
    background: #fed7aa;
    color: #ea580c;
}

.aging-critical {
    background: #fee2e2;
    color: #dc2626;
}

/* Monthly Chart */
.chart-bars-container {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 140px;
    padding: 0 4px;
    margin-bottom: 8px;
}

.chart-bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.chart-bar-pair {
    display: flex;
    gap: 2px;
    align-items: flex-end;
    width: 100%;
    height: 120px;
}

.chart-bar {
    flex: 1;
    border-radius: 3px 3px 0 0;
    min-height: 2px;
    transition: height 0.4s ease;
}

.chart-bar-revenue {
    background: #6366f1;
}

.chart-bar-cost {
    background: #e2e8f0;
}

.chart-label {
    font-size: 10px;
    color: #94a3b8;
    font-weight: 500;
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 4px;
}

/* Treasury list items */
.treasury-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f1f5f9;
}

.treasury-list-item:last-child {
    border-bottom: none;
}

.treasury-list-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.treasury-list-primary {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.treasury-list-secondary {
    font-size: 11px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 6px;
}

.treasury-list-amount {
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    margin-left: 12px;
}

/* Responsive */
@media (max-width: 640px) {
    .treasury-kpi-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .treasury-kpi-card {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 14px 16px;
    }

    .treasury-kpi-value {
        font-size: 18px;
    }

    .treasury-duo-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .chart-bars-container {
        height: 100px;
    }
}

/* ─── Fisco Chat Entry Card ──────────────────────────────────────────────── */
.pn-fisco-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: linear-gradient(135deg, #faf5ff 0%, #eff6ff 100%);
    border: 1px solid #ddd6fe;
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 14px;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
    -webkit-tap-highlight-color: transparent;
}

.pn-fisco-card:hover {
    border-color: #c4b5fd;
    box-shadow: 0 4px 16px rgba(99, 102, 241, .12);
    transform: translateY(-1px);
}

.pn-fisco-card:active {
    transform: translateY(0);
}

.pn-fisco-card.used {
    background: #fafaf9;
    border-color: #e8e3db;
    cursor: default;
}

.pn-fisco-card.used:hover {
    transform: none;
    box-shadow: none;
}

.pn-fisco-card-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.pn-fisco-card-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(99, 102, 241, .3);
}

.pn-fisco-card.used .pn-fisco-card-icon {
    background: #e8e3db;
    box-shadow: none;
}

.pn-fisco-card-title {
    font-size: 12px;
    font-weight: 700;
    color: #1c1917;
    letter-spacing: -.01em;
    margin-bottom: 2px;
}

.pn-fisco-card-sub {
    font-size: 11px;
    color: #78716c;
}

.pn-fisco-card-cta {
    padding: 7px 14px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: #fff;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(99, 102, 241, .3);
}

.pn-fisco-card.used .pn-fisco-card-cta {
    background: #e8e3db;
    color: #a8a29e;
    box-shadow: none;
}

/* ─── Fisco Chat — dedicated view ─────────────────────────────────────────── */
.view.fisco-view {
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.fisco-view-header {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 13px 16px 11px;
    border-bottom: 1px solid #e8e3db;
    flex-shrink: 0;
    background: #ffffff;
}

.fisco-view-back {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: #f5f4f2;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #78716c;
    transition: background 0.15s;
    flex-shrink: 0;
}

.fisco-view-back:hover {
    background: #e8e3db;
}

.fisco-view-avatar {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.fisco-view-title {
    font-size: 13px;
    font-weight: 700;
    color: #1c1917;
    letter-spacing: -0.02em;
}

.fisco-view-sub {
    font-size: 10px;
    color: #a8a29e;
    margin-top: 1px;
}

.fisco-view-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
    background: #fafaf9;
}

.fisco-msg {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    max-width: 88%;
}

.fisco-msg.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.fisco-msg-bubble {
    padding: 9px 12px;
    border-radius: 14px;
    font-size: 12.5px;
    line-height: 1.55;
    color: #1c1917;
    background: #f5f4f2;
    border: 1px solid #e8e3db;
}

.fisco-msg.user .fisco-msg-bubble {
    background: #292524;
    color: #ffffff;
    border-color: #292524;
    border-radius: 14px 14px 4px 14px;
}

.fisco-msg.ai .fisco-msg-bubble {
    border-radius: 14px 14px 14px 4px;
}

.fisco-msg-icon {
    width: 26px;
    height: 26px;
    border-radius: 8px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    margin-top: 2px;
}

.fisco-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 9px 13px;
    border-radius: 14px 14px 14px 4px;
    background: #f5f4f2;
    border: 1px solid #e8e3db;
    width: fit-content;
}

.fisco-typing span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #a8a29e;
    animation: fisco-bounce 1.2s ease-in-out infinite;
}

.fisco-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.fisco-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes fisco-bounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-5px);
    }
}

.fisco-chips {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    padding: 9px 16px 7px;
    flex-shrink: 0;
    background: #ffffff;
    border-top: 1px solid #f0ece8;
}

.fisco-chip {
    padding: 5px 11px;
    border-radius: 20px;
    background: #f5f4f2;
    border: 1px solid #e8e3db;
    font-size: 11px;
    font-weight: 500;
    color: #44403c;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, border-color 0.15s;
}

.fisco-chip:hover {
    background: #e8e3db;
    border-color: #d6d0c6;
}

.fisco-chat-input-row {
    display: flex;
    gap: 9px;
    align-items: flex-end;
    padding: 10px 14px 16px;
    border-top: 1px solid #e8e3db;
    flex-shrink: 0;
    background: #ffffff;
}

.fisco-chat-input {
    flex: 1;
    padding: 10px 13px;
    border: 1px solid #e8e3db;
    border-radius: 12px;
    font-size: 13px;
    outline: none;
    resize: none;
    line-height: 1.4;
    max-height: 90px;
    overflow-y: auto;
    color: #1c1917;
    background: #fafaf9;
    font-family: inherit;
    transition: border-color 0.15s;
}

.fisco-chat-input:focus {
    border-color: #6366f1;
    background: #fff;
}

.fisco-chat-input::placeholder {
    color: #a8a29e;
}

.fisco-chat-send {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    background: #292524;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, transform 0.12s;
}

.fisco-chat-send:hover {
    background: #44403c;
    transform: translateY(-1px);
}

.fisco-chat-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.fisco-quota-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 18px 18px;
    border-top: 1px solid #e8e3db;
    flex-shrink: 0;
    background: #fafaf9;
}

.fisco-quota-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    flex-shrink: 0;
}

.fisco-quota-title {
    margin: 0 0 2px;
    font-size: 12px;
    font-weight: 600;
    color: #1c1917;
}

.fisco-quota-sub {
    margin: 0;
    font-size: 10.5px;
    color: #a8a29e;
}


/* ============================================
   APPUNTAMENTI — Client Portal (Jakarta/Zinc)
   ============================================ */

/* ── Entrance animation ── */
@keyframes apptCardEnter {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes apptPulse {
    0%, 100% { opacity: .35; }
    50%      { opacity: .8; }
}

/* ── Section header (frosted glass, matches chat-header-bar) ── */
.cl-appt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 20px 24px 16px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    position: sticky;
    top: 0;
    z-index: 10;
}

.cl-appt-header-text {
    flex: 1;
    min-width: 0;
}

.cl-appt-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary, #18181B);
    margin: 0 0 2px;
    letter-spacing: -0.01em;
}

.cl-appt-sub {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 13px;
    color: var(--text-tertiary, #71717A);
    margin: 0;
    font-weight: 400;
}

/* ── Month nav ── */
.cl-appt-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.cl-appt-nav-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-light, #E4E4E7);
    border-radius: 10px;
    background: var(--bg-card, #fff);
    color: var(--text-secondary, #3F3F46);
    cursor: pointer;
    transition: all .15s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
}

.cl-appt-nav-btn:hover {
    background: var(--bg-secondary, #F4F4F5);
    border-color: var(--border-medium, #D4D4D8);
}

.cl-appt-nav-btn:active {
    transform: scale(0.94);
}

.cl-appt-nav-btn i {
    width: 15px;
    height: 15px;
}

.cl-appt-month-label {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary, #18181B);
    white-space: nowrap;
    text-transform: capitalize;
    min-width: 120px;
    text-align: center;
}

/* ── Mini month calendar ── */
.cl-appt-cal-wrap {
    margin: 16px 20px;
    border: 1px solid var(--border-light, #E4E4E7);
    border-radius: 14px;
    overflow: hidden;
    background: var(--bg-card, #fff);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 4px 16px rgba(0, 0, 0, 0.04);
    animation: apptCardEnter 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.cl-appt-cal-days-hdr {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--bg-secondary, #F4F4F5);
    border-bottom: 1px solid var(--border-light, #E4E4E7);
}

.cl-appt-cal-day-name {
    padding: 8px 2px;
    text-align: center;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted, #A1A1AA);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.cl-appt-cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.cl-appt-cal-cell {
    min-height: 36px;
    padding: 4px 2px;
    text-align: center;
    position: relative;
}

.cl-appt-cal-cell.cl-other-month .cl-appt-day-num {
    color: var(--text-muted, #A1A1AA);
    opacity: 0.5;
}

.cl-appt-cal-cell.cl-today .cl-appt-day-num {
    background: var(--text-primary, #18181B);
    color: #fff;
    border-radius: 50%;
    font-weight: 700;
    box-shadow: 0 2px 6px rgba(24, 24, 27, 0.25);
}

.cl-appt-day-num {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary, #3F3F46);
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    border-radius: 50%;
    transition: background .12s, color .12s;
}

/* ── Loading / empty states (matches chat-welcome) ── */
.appt-client-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 48px 24px;
    text-align: center;
    color: var(--text-tertiary, #71717A);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 14px;
    line-height: 1.6;
}

.appt-client-state p {
    margin: 0;
    max-width: 260px;
}

.cl-appt-empty-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary, #F4F4F5);
    border-radius: 16px;
    color: var(--text-muted, #A1A1AA);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07);
}

.cl-appt-empty-icon svg {
    width: 24px;
    height: 24px;
}

.client-spinner {
    width: 24px;
    height: 24px;
    border: 2.5px solid var(--border-light, #E4E4E7);
    border-top-color: var(--text-primary, #18181B);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* ── Section label (above cards) ── */
.appt-section-label {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted, #A1A1AA);
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: 0 20px;
    margin: 4px 0 10px;
}

/* ── Booking cards container ── */
#appt-client-cards {
    padding: 0 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ── Booking card (matches inbox quick-start-card style) ── */
.appt-booking-card {
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-light, #E4E4E7);
    border-radius: 14px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 4px 16px rgba(0, 0, 0, 0.04);
    transition: border-color .2s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow .2s cubic-bezier(0.16, 1, 0.3, 1);
    animation: apptCardEnter 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.appt-booking-card:nth-child(2) { animation-delay: .06s; }
.appt-booking-card:nth-child(3) { animation-delay: .12s; }
.appt-booking-card:nth-child(4) { animation-delay: .18s; }
.appt-booking-card:nth-child(5) { animation-delay: .24s; }

.appt-booking-card:hover {
    border-color: var(--border-medium, #D4D4D8);
}

.appt-booking-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
}

.appt-booking-card-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--bg-secondary, #F4F4F5);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--text-primary, #18181B);
}

.appt-booking-card-icon i {
    width: 20px;
    height: 20px;
}

.appt-booking-card-info {
    flex: 1;
    min-width: 0;
}

.appt-booking-card-name {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #18181B);
    margin: 0 0 2px;
    line-height: 1.3;
}

.appt-booking-card-desc {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 13px;
    color: var(--text-tertiary, #71717A);
    margin: 0;
    line-height: 1.4;
}

/* ── Badges (pill style, matches service-chip) ── */
.appt-booking-card-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.appt-client-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.appt-client-badge.fiscal   { background: #EFF6FF; color: #1D4ED8; }
.appt-client-badge.labor    { background: #F0FDF4; color: #166534; }
.appt-client-badge.finance  { background: #FFFBEB; color: #92400E; }
.appt-client-badge.general  { background: var(--bg-secondary, #F4F4F5); color: var(--text-tertiary, #71717A); }
.appt-client-badge.remote   { background: #ECFDF5; color: #065F46; }
.appt-client-badge.in-person { background: #F5F3FF; color: #6D28D9; }
.appt-client-badge.virtual  { background: #ECFDF5; color: #065F46; }
.appt-client-badge.custom   { background: #FEF3C7; color: #92400E; }
.appt-client-badge.both     { background: var(--bg-secondary, #F4F4F5); color: var(--text-tertiary, #71717A); }

/* ── Action buttons (matches inbox btn-send / btn-attach) ── */
.appt-booking-card-actions {
    display: flex;
    gap: 8px;
}

.appt-book-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 10px 18px;
    border-radius: 12px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all .15s cubic-bezier(0.16, 1, 0.3, 1);
    text-decoration: none;
    flex: 1;
    justify-content: center;
    min-width: 0;
}

.appt-book-btn:active {
    transform: scale(0.97);
}

.appt-book-btn-primary {
    background: var(--text-primary, #18181B);
    color: #fff;
    box-shadow: 0 2px 8px rgba(24, 24, 27, 0.18);
}

.appt-book-btn-primary:hover {
    background: #27272A;
    box-shadow: 0 4px 12px rgba(24, 24, 27, 0.22);
}

.appt-book-btn-secondary {
    background: var(--bg-secondary, #F4F4F5);
    color: var(--text-secondary, #3F3F46);
    border: 1px solid var(--border-light, #E4E4E7);
}

.appt-book-btn-secondary:hover {
    background: var(--bg-tertiary, #E4E4E7);
    border-color: var(--border-medium, #D4D4D8);
}

.appt-book-btn i {
    width: 15px;
    height: 15px;
}

/* ── Booking embed modal ── */
.booking-embed-content {
    background: var(--bg-card, #fff);
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 760px;
    height: 88vh;
    max-height: 720px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-xl, 0 20px 25px -5px rgba(0,0,0,.1));
    animation: modalSlide 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.booking-embed-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    background: var(--bg-secondary, #F4F4F5);
    border-bottom: 1px solid var(--border-light, #E4E4E7);
    flex-shrink: 0;
}

.booking-embed-title {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary, #18181B);
}

.booking-embed-actions {
    display: flex;
    gap: 6px;
}

.booking-embed-actions .btn-icon-soft {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card, #fff);
    border: 1px solid var(--border-light, #E4E4E7);
    color: var(--text-tertiary, #71717A);
    cursor: pointer;
    transition: all .12s;
}

.booking-embed-actions .btn-icon-soft:hover {
    background: var(--bg-tertiary, #E4E4E7);
    color: var(--text-primary, #18181B);
}

.booking-embed-body {
    flex: 1;
    overflow: hidden;
    position: relative;
    background: #fff;
}

/* ── Booking embed fallback ── */
.booking-embed-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 48px 32px;
    text-align: center;
    height: 100%;
}

.booking-embed-fallback p {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 14px;
    color: var(--text-tertiary, #71717A);
    line-height: 1.6;
    margin: 0;
    max-width: 300px;
}

.booking-embed-fallback .appt-book-btn-primary {
    flex: none;
    padding: 12px 24px;
    font-size: 14px;
}

/* ── Slot picker modal (bottom sheet) ── */
.slot-picker-panel {
    background: var(--bg-card, #fff);
    border-radius: 20px 20px 0 0;
    max-width: 480px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 0;
    box-shadow: var(--shadow-xl, 0 20px 25px -5px rgba(0,0,0,.1));
    animation: modalSlide 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.slot-picker-header {
    padding: 22px 24px;
    border-bottom: 1px solid var(--border-light, #E4E4E7);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.slot-picker-header h3 {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary, #18181B);
}

.slot-picker-header p {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 13px;
    color: var(--text-tertiary, #71717A);
    margin: 4px 0 0;
}

.slot-picker-close {
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--bg-secondary, #F4F4F5);
    border: 1px solid var(--border-light, #E4E4E7);
    color: var(--text-tertiary, #71717A);
    cursor: pointer;
    font-size: 18px;
    transition: all .12s;
}

.slot-picker-close:hover {
    background: var(--bg-tertiary, #E4E4E7);
    color: var(--text-primary, #18181B);
}

.slot-picker-body {
    padding: 20px 24px 28px;
}

.slot-picker-label {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary, #71717A);
    display: block;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.slot-picker-date-input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-light, #E4E4E7);
    border-radius: 12px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 14px;
    color: var(--text-primary, #18181B);
    background: var(--bg-card, #fff);
    box-sizing: border-box;
    transition: border-color .15s, box-shadow .15s;
    -webkit-appearance: none;
}

.slot-picker-date-input:focus {
    outline: none;
    border-color: var(--text-primary, #18181B);
    box-shadow: 0 0 0 4px rgba(24, 24, 27, 0.06);
}

.slot-picker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

/* ── Slot buttons ── */
.slot-btn {
    padding: 11px 8px;
    border: 1.5px solid var(--border-light, #E4E4E7);
    border-radius: 10px;
    background: var(--bg-card, #fff);
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary, #3F3F46);
    cursor: pointer;
    transition: all .15s cubic-bezier(0.16, 1, 0.3, 1);
    text-align: center;
}

.slot-btn:hover {
    border-color: var(--text-primary, #18181B);
    color: var(--text-primary, #18181B);
    background: var(--bg-secondary, #F4F4F5);
}

.slot-btn:active {
    transform: scale(0.96);
}

.slot-btn.selected {
    border-color: var(--text-primary, #18181B);
    background: var(--text-primary, #18181B);
    color: #fff;
    box-shadow: 0 2px 8px rgba(24, 24, 27, 0.2);
}

.slot-picker-empty {
    text-align: center;
    padding: 24px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 14px;
    color: var(--text-tertiary, #71717A);
}

.slot-picker-loading {
    text-align: center;
    padding: 24px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 14px;
    color: var(--text-tertiary, #71717A);
}

/* ── Responsive ── */
@media (max-width: 480px) {
    .cl-appt-header {
        padding: 16px 16px 12px;
        flex-wrap: wrap;
    }

    .cl-appt-cal-wrap {
        margin: 12px 16px;
    }

    #appt-client-cards {
        padding: 0 16px 20px;
    }

    .appt-booking-card {
        padding: 14px;
    }

    .appt-booking-card-actions {
        flex-direction: column;
    }

    .booking-embed-content {
        border-radius: 0;
        height: 100%;
        max-height: 100%;
    }
}

@media (min-width: 768px) {
    .booking-embed-content {
        border-radius: 16px;
        margin: auto;
    }

    .slot-picker-panel {
        border-radius: 16px;
        margin: auto;
    }
}

/* ===========================================
   ARCHIVE UPLOAD LINKS - Notion-style cards
   =========================================== */
.upload-links-panel {
    margin-bottom: 22px;
    padding: 14px;
    border: 1px solid #e7e5e4;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #fafaf9 100%);
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.03);
}

.upload-links-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ece7e2;
}

.upload-links-head h3 {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 14px;
    font-weight: 650;
    color: #1f2937;
}

.upload-links-head h3 i {
    width: 16px;
    height: 16px;
    color: #6b7280;
}

.upload-links-head p {
    margin: 0;
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
}

.upload-links-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.upload-link-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid #ebe8e5;
    border-radius: 10px;
    background: #ffffff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.upload-link-card:hover {
    border-color: #d6d3d1;
    box-shadow: 0 3px 12px rgba(17, 24, 39, 0.06);
    transform: translateY(-1px);
}

.upload-link-card-left {
    min-width: 0;
    flex: 1;
}

.upload-link-card-title {
    font-size: 14px;
    font-weight: 620;
    color: #111827;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upload-link-card-meta {
    margin-top: 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.upload-link-card-meta span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #6b7280;
}

.upload-link-card-meta i {
    width: 13px;
    height: 13px;
}

.upload-link-card-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid #d6d3d1;
    border-radius: 9px;
    background: #f8fafc;
    color: #111827;
    font-size: 12px;
    font-weight: 600;
    padding: 8px 12px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.upload-link-card-btn:hover {
    background: #111827;
    border-color: #111827;
    color: #ffffff;
}

.upload-link-card-btn i {
    width: 14px;
    height: 14px;
}

@media (max-width: 640px) {
    .upload-links-head {
        flex-direction: column;
        gap: 4px;
    }

    .upload-links-head p {
        white-space: normal;
    }

    .upload-link-card {
        align-items: flex-start;
    }
}
