/* ==========================================================================
   Mesosapiens Dashboard — Design System
   Based on G2 Geo Minimal Bilingue variant
   ========================================================================== */

/* --- Google Fonts Import --- */
@import url('https://fonts.googleapis.com/css2?family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&family=Geist+Mono:wght@400;500;700&family=Figtree:wght@300;400;500;600;700;800&display=swap');

/* --- Design Tokens --- */
:root {
    /* Colors */
    --bg: #fbfbf9;
    --surface: #ffffff;
    --ink: #161619;
    --ink-soft: #3d3d44;
    --muted: #93939f;
    --border: #e8e8e4;
    --teal: #0a6b5c;
    --teal-hover: #085a4d;
    --teal-light: #e6f5f1;
    --coral: #e8553d;
    --coral-hover: #d4472f;
    --coral-light: #fef0ed;
    --navy: #1a2744;
    --navy-light: #e9ecf2;
    --green: #1a8c3e;
    --green-light: #e6f5eb;

    /* Typography */
    --font-serif: 'Libre Baskerville', Georgia, serif;
    --font-sans: 'Figtree', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'Geist Mono', 'SF Mono', Consolas, monospace;

    /* Spacing */
    --sp-xs: 0.25rem;
    --sp-sm: 0.5rem;
    --sp-md: 1rem;
    --sp-lg: 1.5rem;
    --sp-xl: 2rem;
    --sp-2xl: 3rem;
    --sp-3xl: 4rem;

    /* Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-pill: 100px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.08);

    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-collapsed: 64px;
    --topbar-height: 60px;

    /* Transitions */
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --transition: 0.2s var(--ease);
}

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

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--ink);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a {
    color: var(--teal);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: var(--teal-hover);
}

img {
    max-width: 100%;
    display: block;
}


/* ==========================================================================
   Layout: Sidebar + Main
   ========================================================================== */

.dashboard {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--navy);
    color: rgba(255, 255, 255, 0.85);
    display: flex;
    flex-direction: column;
    z-index: 50;
    transition: transform 0.3s var(--ease);
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: var(--sp-lg) var(--sp-xl);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    min-height: var(--topbar-height);
}

.sidebar-logo {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
}

.sidebar-wordmark {
    font-family: var(--font-serif);
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
}

.sidebar-nav {
    flex: 1;
    padding: var(--sp-md) 0;
}

.sidebar-section {
    padding: var(--sp-sm) var(--sp-xl);
}

.sidebar-section-title {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: rgba(255, 255, 255, 0.35);
    margin-bottom: var(--sp-sm);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.55rem var(--sp-xl);
    font-size: 0.875rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    border-radius: 0;
    transition: all var(--transition);
    position: relative;
}

.sidebar-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-link.active {
    color: #fff;
    background: rgba(10, 107, 92, 0.25);
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--teal);
    border-radius: 0 2px 2px 0;
}

.sidebar-link svg,
.sidebar-link .icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar-link.active svg,
.sidebar-link.active .icon {
    opacity: 1;
}

.sidebar-footer {
    padding: var(--sp-lg) var(--sp-xl);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
}

.sidebar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--teal);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    color: #fff;
    flex-shrink: 0;
}

/* --- Main Content Area --- */
.main {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    padding: var(--sp-xl) var(--sp-2xl);
    max-width: 1200px;
    width: 100%;
}


/* ==========================================================================
   Top Bar
   ========================================================================== */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--topbar-height);
    padding: 0 var(--sp-2xl);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 40;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: var(--sp-md);
}

.topbar-title {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ink);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--sp-md);
}

.topbar-burger {
    display: none;
    width: 40px;
    height: 40px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
}

.topbar-burger span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--ink);
    border-radius: 1px;
    transition: all 0.3s ease;
}


/* ==========================================================================
   Cards
   ========================================================================== */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--sp-xl);
    transition: box-shadow var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-flat {
    box-shadow: none;
}

.card-flat:hover {
    box-shadow: none;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--sp-lg);
}

.card-title {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--ink);
}

.card-subtitle {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: var(--sp-xs);
}

.card-body {
    font-size: 0.9rem;
    color: var(--ink-soft);
    line-height: 1.7;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: var(--sp-lg);
    padding-top: var(--sp-lg);
    border-top: 1px solid var(--border);
}

/* Stat Cards */
.card-stat {
    text-align: center;
    padding: var(--sp-xl);
}

.card-stat .stat-value {
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 700;
    color: var(--ink);
    line-height: 1.2;
}

.card-stat .stat-label {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: var(--sp-xs);
    font-weight: 500;
}

.card-stat .stat-change {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    margin-top: var(--sp-sm);
}

.card-stat .stat-change.up { color: var(--green); }
.card-stat .stat-change.down { color: var(--coral); }

/* Card Grid */
.card-grid {
    display: grid;
    gap: var(--sp-lg);
}

.card-grid-2 { grid-template-columns: repeat(2, 1fr); }
.card-grid-3 { grid-template-columns: repeat(3, 1fr); }
.card-grid-4 { grid-template-columns: repeat(4, 1fr); }


/* ==========================================================================
   Progress Bar
   ========================================================================== */

.progress {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: var(--radius-pill);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    border-radius: var(--radius-pill);
    background: var(--teal);
    transition: width 0.5s var(--ease);
}

.progress-bar.coral { background: var(--coral); }
.progress-bar.navy { background: var(--navy); }
.progress-bar.green { background: var(--green); }

.progress-label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: var(--sp-sm);
    font-size: 0.8rem;
}

.progress-label .label-text {
    font-weight: 600;
    color: var(--ink);
}

.progress-label .label-value {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--muted);
}

/* Hours remaining variant */
.hours-progress .progress {
    height: 10px;
}

.hours-progress .hours-info {
    display: flex;
    justify-content: space-between;
    margin-top: var(--sp-sm);
    font-size: 0.75rem;
    color: var(--muted);
}

.hours-progress .hours-remaining {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--ink);
}


/* ==========================================================================
   Tables
   ========================================================================== */

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

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

thead {
    background: var(--bg);
}

th {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    color: var(--ink-soft);
    vertical-align: middle;
}

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

tbody tr:hover {
    background: rgba(10, 107, 92, 0.02);
}

td.mono {
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

td.bold {
    font-weight: 600;
    color: var(--ink);
}

.table-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    font-size: 0.8rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
}


/* ==========================================================================
   Form Inputs
   ========================================================================== */

.form-group {
    margin-bottom: var(--sp-lg);
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: var(--sp-sm);
}

.form-label .required {
    color: var(--coral);
}

.form-hint {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: var(--sp-xs);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: var(--ink);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.65rem 0.9rem;
    transition: all var(--transition);
    outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px var(--teal-light);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--muted);
    font-weight: 300;
}

.form-input.error,
.form-textarea.error {
    border-color: var(--coral);
    box-shadow: 0 0 0 3px var(--coral-light);
}

.form-error {
    font-size: 0.75rem;
    color: var(--coral);
    margin-top: var(--sp-xs);
    font-weight: 500;
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2393939f' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.25rem;
    cursor: pointer;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
}

.form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--border);
    border-radius: 4px;
    accent-color: var(--teal);
    cursor: pointer;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-lg);
}


/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.5rem;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: var(--radius-pill);
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    line-height: 1.4;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Teal (primary) */
.btn-teal {
    background: var(--teal);
    color: #fff;
}

.btn-teal:hover {
    background: var(--teal-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(10, 107, 92, 0.2);
}

/* Coral (destructive / accent) */
.btn-coral {
    background: var(--coral);
    color: #fff;
}

.btn-coral:hover {
    background: var(--coral-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(232, 85, 61, 0.2);
}

/* Outline (secondary) */
.btn-outline {
    background: transparent;
    color: var(--ink);
    border: 1.5px solid var(--border);
}

.btn-outline:hover {
    border-color: var(--ink-soft);
    background: var(--bg);
}

/* Ghost */
.btn-ghost {
    background: transparent;
    color: var(--ink-soft);
    padding: 0.5rem 0.75rem;
}

.btn-ghost:hover {
    background: var(--bg);
    color: var(--ink);
}

/* Sizes */
.btn-sm {
    padding: 0.4rem 1rem;
    font-size: 0.78rem;
}

.btn-lg {
    padding: 0.8rem 2rem;
    font-size: 0.95rem;
}

/* Icon button */
.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-md);
}


/* ==========================================================================
   Status Badges
   ========================================================================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.7rem;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 600;
    border-radius: var(--radius-pill);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-green {
    background: var(--green-light);
    color: var(--green);
}

.badge-coral {
    background: var(--coral-light);
    color: var(--coral);
}

.badge-navy {
    background: var(--navy-light);
    color: var(--navy);
}

.badge-muted {
    background: var(--border);
    color: var(--muted);
}

.badge-teal {
    background: var(--teal-light);
    color: var(--teal);
}

/* Dot indicator */
.badge-dot::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}


/* ==========================================================================
   Chat Interface
   ========================================================================== */

.chat {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 600px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    overflow: hidden;
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-md) var(--sp-lg);
    border-bottom: 1px solid var(--border);
}

.chat-header-title {
    font-weight: 600;
    font-size: 0.9rem;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: var(--sp-lg);
    display: flex;
    flex-direction: column;
    gap: var(--sp-md);
}

.chat-bubble {
    max-width: 75%;
    padding: 0.7rem 1rem;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    line-height: 1.6;
    word-wrap: break-word;
}

.chat-bubble.incoming {
    align-self: flex-start;
    background: var(--bg);
    color: var(--ink);
    border-bottom-left-radius: 4px;
}

.chat-bubble.outgoing {
    align-self: flex-end;
    background: var(--teal);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-bubble .chat-time {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    margin-top: var(--sp-xs);
    opacity: 0.6;
}

.chat-bubble.outgoing .chat-time {
    text-align: right;
}

.chat-input-area {
    display: flex;
    align-items: center;
    gap: var(--sp-sm);
    padding: var(--sp-md) var(--sp-lg);
    border-top: 1px solid var(--border);
    background: var(--bg);
}

.chat-input {
    flex: 1;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    padding: 0.6rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: var(--surface);
    outline: none;
    transition: border-color var(--transition);
}

.chat-input:focus {
    border-color: var(--teal);
}

.chat-send {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--teal);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background var(--transition);
}

.chat-send:hover {
    background: var(--teal-hover);
}


/* ==========================================================================
   Gantt Chart Container
   ========================================================================== */

.gantt {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
}

.gantt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-md) var(--sp-lg);
    border-bottom: 1px solid var(--border);
}

.gantt-header-title {
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 1rem;
}

.gantt-timeline {
    display: grid;
    min-width: 800px;
}

.gantt-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    border-bottom: 1px solid var(--border);
    min-height: 44px;
    align-items: center;
}

.gantt-row:last-child {
    border-bottom: none;
}

.gantt-task-name {
    padding: 0.5rem 1rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--ink);
    border-right: 1px solid var(--border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gantt-bar-area {
    position: relative;
    padding: 0.4rem 0.5rem;
    height: 100%;
    display: flex;
    align-items: center;
}

.gantt-bar {
    height: 22px;
    border-radius: 4px;
    background: var(--teal);
    position: relative;
    min-width: 20px;
}

.gantt-bar.coral { background: var(--coral); }
.gantt-bar.navy { background: var(--navy); }
.gantt-bar.muted { background: var(--muted); opacity: 0.4; }

.gantt-bar-label {
    position: absolute;
    left: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
}


/* ==========================================================================
   Proposal Sections
   ========================================================================== */

.proposal-section {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    margin-bottom: var(--sp-lg);
    overflow: hidden;
}

.proposal-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-lg) var(--sp-xl);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    user-select: none;
    transition: background var(--transition);
}

.proposal-section-header:hover {
    background: var(--bg);
}

.proposal-section-title {
    font-family: var(--font-serif);
    font-size: 1rem;
    font-weight: 700;
}

.proposal-section-toggle {
    color: var(--muted);
    transition: transform var(--transition);
}

.proposal-section-toggle.open {
    transform: rotate(180deg);
}

.proposal-section-body {
    padding: var(--sp-xl);
}

.proposal-section-body p {
    font-size: 0.9rem;
    color: var(--ink-soft);
    line-height: 1.75;
    margin-bottom: var(--sp-md);
}

.proposal-section-body p:last-child {
    margin-bottom: 0;
}

/* Pricing Table */
.pricing-table {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-top: var(--sp-lg);
}

.pricing-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border);
}

.pricing-row:last-child {
    border-bottom: none;
}

.pricing-row.total {
    background: var(--bg);
    font-weight: 700;
    color: var(--ink);
}

.pricing-row .pricing-item {
    color: var(--ink-soft);
}

.pricing-row .pricing-amount {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--ink);
}


/* ==========================================================================
   Modal
   ========================================================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(22, 22, 25, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--sp-xl);
    opacity: 0;
    visibility: hidden;
    transition: all 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--surface);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px) scale(0.97);
    transition: transform 0.25s var(--ease);
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-lg) var(--sp-xl);
    border-bottom: 1px solid var(--border);
}

.modal-title {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    transition: all var(--transition);
}

.modal-close:hover {
    background: var(--bg);
    color: var(--ink);
}

.modal-body {
    padding: var(--sp-xl);
}

.modal-body p {
    font-size: 0.9rem;
    color: var(--ink-soft);
    line-height: 1.7;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--sp-sm);
    padding: var(--sp-lg) var(--sp-xl);
    border-top: 1px solid var(--border);
}


/* ==========================================================================
   Billing / Payment Section
   ========================================================================== */

.billing-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    overflow: hidden;
}

.billing-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--sp-lg) var(--sp-xl);
    border-bottom: 1px solid var(--border);
}

.billing-header-title {
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 1.05rem;
}

.billing-body {
    padding: var(--sp-xl);
}

.billing-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-lg);
    margin-bottom: var(--sp-xl);
}

.billing-summary-item {
    text-align: center;
    padding: var(--sp-lg);
    background: var(--bg);
    border-radius: var(--radius-md);
}

.billing-summary-value {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ink);
}

.billing-summary-label {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: var(--sp-xs);
}

.invoice-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.invoice-row:last-child {
    border-bottom: none;
}

.invoice-id {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--teal);
    font-weight: 500;
}

.invoice-amount {
    font-family: var(--font-mono);
    font-weight: 600;
}

.payment-method {
    display: flex;
    align-items: center;
    gap: var(--sp-md);
    padding: var(--sp-lg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-top: var(--sp-lg);
}

.payment-method-icon {
    width: 40px;
    height: 28px;
    background: var(--bg);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--muted);
}

.payment-method-details {
    flex: 1;
}

.payment-method-name {
    font-size: 0.85rem;
    font-weight: 600;
}

.payment-method-info {
    font-size: 0.75rem;
    color: var(--muted);
    font-family: var(--font-mono);
}


/* ==========================================================================
   Timeline Component
   ========================================================================== */

.timeline {
    position: relative;
    padding-left: var(--sp-xl);
}

.timeline::before {
    content: '';
    position: absolute;
    left: 7px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: var(--sp-xl);
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: calc(-1 * var(--sp-xl) + 1px);
    top: 4px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--teal);
    z-index: 1;
}

.timeline-dot.coral { border-color: var(--coral); }
.timeline-dot.navy { border-color: var(--navy); }
.timeline-dot.muted { border-color: var(--muted); }
.timeline-dot.green { border-color: var(--green); }

.timeline-dot.filled {
    background: var(--teal);
}

.timeline-dot.filled.coral { background: var(--coral); }
.timeline-dot.filled.green { background: var(--green); }

.timeline-date {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: var(--sp-xs);
}

.timeline-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: var(--sp-xs);
}

.timeline-desc {
    font-size: 0.82rem;
    color: var(--ink-soft);
    line-height: 1.6;
}


/* ==========================================================================
   Section Headers (page-level)
   ========================================================================== */

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--sp-xl);
}

.section-title {
    font-family: var(--font-serif);
    font-size: 1.35rem;
    font-weight: 700;
}

.section-label {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--teal);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: var(--sp-sm);
}

.section-label .line {
    width: 24px;
    height: 1.5px;
    background: var(--teal);
}


/* ==========================================================================
   Utility Classes
   ========================================================================== */

.text-teal { color: var(--teal); }
.text-coral { color: var(--coral); }
.text-navy { color: var(--navy); }
.text-muted { color: var(--muted); }
.text-green { color: var(--green); }
.text-ink { color: var(--ink); }

.bg-teal-light { background: var(--teal-light); }
.bg-coral-light { background: var(--coral-light); }
.bg-navy-light { background: var(--navy-light); }

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

.mt-sm { margin-top: var(--sp-sm); }
.mt-md { margin-top: var(--sp-md); }
.mt-lg { margin-top: var(--sp-lg); }
.mt-xl { margin-top: var(--sp-xl); }
.mt-2xl { margin-top: var(--sp-2xl); }

.mb-sm { margin-bottom: var(--sp-sm); }
.mb-md { margin-bottom: var(--sp-md); }
.mb-lg { margin-bottom: var(--sp-lg); }
.mb-xl { margin-bottom: var(--sp-xl); }
.mb-2xl { margin-bottom: var(--sp-2xl); }

.gap-sm { gap: var(--sp-sm); }
.gap-md { gap: var(--sp-md); }
.gap-lg { gap: var(--sp-lg); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }

.w-full { width: 100%; }
.hidden { display: none; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }


/* ==========================================================================
   Responsive — Mobile First Overrides
   ========================================================================== */

@media (max-width: 1024px) {
    .card-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .billing-summary {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    /* Sidebar: off-canvas on mobile */
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(22, 22, 25, 0.4);
        z-index: 45;
        opacity: 0;
        visibility: hidden;
        transition: all 0.25s ease;
    }

    .sidebar-backdrop.open {
        opacity: 1;
        visibility: visible;
    }

    .main {
        margin-left: 0;
    }

    .topbar-burger {
        display: flex;
    }

    .topbar {
        padding: 0 var(--sp-lg);
    }

    .main-content {
        padding: var(--sp-lg);
    }

    /* Card grids */
    .card-grid-2,
    .card-grid-3,
    .card-grid-4 {
        grid-template-columns: 1fr;
    }

    /* Form rows */
    .form-row {
        grid-template-columns: 1fr;
    }

    /* Billing summary */
    .billing-summary {
        grid-template-columns: 1fr;
    }

    /* Section header */
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--sp-md);
    }

    /* Chat */
    .chat-bubble {
        max-width: 85%;
    }

    /* Modal */
    .modal {
        max-width: 100%;
        margin: var(--sp-md);
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-footer .btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .topbar-title {
        font-size: 0.9rem;
    }

    .card {
        padding: var(--sp-lg);
    }

    .proposal-section-header {
        padding: var(--sp-md) var(--sp-lg);
    }

    .proposal-section-body {
        padding: var(--sp-lg);
    }

    .pricing-row {
        font-size: 0.8rem;
        padding: 0.6rem 0.75rem;
    }

    .btn {
        padding: 0.55rem 1.25rem;
        font-size: 0.8rem;
    }

    .gantt-row {
        grid-template-columns: 140px 1fr;
    }
}


/* ==========================================================================
   Animations
   ========================================================================== */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

.anim-fade {
    animation: fadeIn 0.4s var(--ease) both;
}

.anim-slide {
    animation: fadeSlideUp 0.5s var(--ease) both;
}

.anim-d1 { animation-delay: 0.1s; }
.anim-d2 { animation-delay: 0.2s; }
.anim-d3 { animation-delay: 0.3s; }
.anim-d4 { animation-delay: 0.4s; }
.anim-d5 { animation-delay: 0.5s; }


/* ==========================================================================
   Print
   ========================================================================== */

@media print {
    .sidebar,
    .topbar,
    .sidebar-backdrop,
    .chat-input-area,
    .modal-overlay {
        display: none !important;
    }

    .main {
        margin-left: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        break-inside: avoid;
    }
}
