/* ═══════════════════════════════════════════════════════════
   HindSight 20/10 — Design System
   Forest & Lime colour scheme · Century Gothic typography
   Version 1.0 · April 2026
═══════════════════════════════════════════════════════════ */

/* ── IMPORTS ─────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;1,400&display=swap');

/* ── CSS VARIABLES ───────────────────────────────────────── */
:root {
    /* Colours */
    --forest:          #1C3832;
    --forest-mid:      #2E5E50;
    --forest-light:    #3D7A68;
    --lime:            #8FD14F;
    --lime-dark:       #5FA828;
    --lime-light:      #B8E882;
    --paper:           #F2F9EE;
    --paper-warm:      #E4F2DC;
    --paper-mid:       #D0E8C4;
    --white:           #FFFFFF;
    --ink:             #0F2420;
    --ink-mid:         #2C4A3E;
    --ink-light:       #5A7A6E;
    --danger:          #C0392B;
    --danger-light:    #FDEAEA;
    --success:         #1a7a4a;
    --success-light:   #E6F5ED;
    --warning:         #B8960C;
    --warning-light:   #FFF8E1;

    /* Typography */
    --font-sans:       'Century Gothic', 'Trebuchet MS', 'Gill Sans', sans-serif;
    --font-serif:      'Playfair Display', Georgia, serif;
    --font-mono:       'Courier New', monospace;

    /* Sizing */
    --sidebar-width:   220px;
    --topbar-height:   56px;
    --border-radius:   8px;
    --border-radius-lg: 12px;
}

/* ── RESET ───────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body {
    font-family: var(--font-sans);
    background: var(--paper);
    color: var(--ink);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ── LAYOUT ──────────────────────────────────────────────── */
.app-wrapper {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin-left: var(--sidebar-width);
}

.page-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: var(--paper);
}

/* ── SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--forest);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-logo {
    padding: 18px 16px 14px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.sidebar-logo-text {
    font-family: var(--font-sans);
    font-size: 17px;
    font-weight: 500;
    color: var(--white);
    letter-spacing: -0.3px;
    text-decoration: none;
    display: block;
}

.sidebar-logo-text span { color: var(--lime); }

.sidebar-logo-sub {
    font-size: 9px;
    color: rgba(255,255,255,0.25);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-top: 2px;
}

.sidebar-user {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
}

.sidebar-user:hover { background: rgba(255,255,255,0.05); }

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--lime);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 500;
    color: var(--forest);
    flex-shrink: 0;
}

.user-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-plan {
    font-size: 9px;
    color: rgba(255,255,255,0.35);
    margin-top: 1px;
}

.sidebar-nav { flex: 1; padding: 8px 0; }

.nav-group-label {
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.2);
    padding: 12px 16px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    cursor: pointer;
    transition: background 0.15s;
    border-left: 2px solid transparent;
    color: rgba(255,255,255,0.55);
    font-size: 12px;
    text-decoration: none;
}

.nav-item:hover {
    background: rgba(255,255,255,0.05);
    color: rgba(255,255,255,0.85);
}

.nav-item.active {
    background: rgba(143,209,79,0.1);
    border-left-color: var(--lime);
    color: var(--white);
}

.nav-item svg { width: 14px; height: 14px; flex-shrink: 0; }

.nav-badge {
    margin-left: auto;
    background: var(--lime);
    color: var(--forest);
    font-size: 9px;
    font-weight: 500;
    padding: 1px 6px;
    border-radius: 10px;
}

.sidebar-bottom {
    padding: 12px 16px;
    border-top: 1px solid rgba(255,255,255,0.07);
}

/* ── TOPBAR ──────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-height);
    background: var(--white);
    border-bottom: 1px solid rgba(28,56,50,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    flex-shrink: 0;
}

.topbar-title {
    font-family: var(--font-serif);
    font-size: 18px;
    color: var(--forest);
    letter-spacing: -0.3px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ── BUTTONS ─────────────────────────────────────────────── */
.btn {
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 500;
    padding: 8px 18px;
    border-radius: var(--border-radius);
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    line-height: 1;
}

.btn-primary { background: var(--lime); color: var(--forest); }
.btn-primary:hover { background: var(--lime-dark); color: var(--white); }

.btn-dark { background: var(--forest); color: var(--white); }
.btn-dark:hover { background: var(--forest-mid); }

.btn-outline {
    background: none;
    border: 1.5px solid rgba(28,56,50,0.15);
    color: var(--ink-mid);
}
.btn-outline:hover { background: var(--paper); border-color: rgba(28,56,50,0.3); }

.btn-danger { background: var(--danger-light); color: var(--danger); border: 1px solid rgba(192,57,43,0.2); }
.btn-danger:hover { background: var(--danger); color: var(--white); }

.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }
.btn-full { width: 100%; justify-content: center; }

/* ── CARDS ───────────────────────────────────────────────── */
.card {
    background: var(--white);
    border: 0.5px solid rgba(28,56,50,0.1);
    border-radius: var(--border-radius-lg);
    padding: 20px;
}

.card-sm { padding: 14px 16px; }
.card-title { font-size: 14px; font-weight: 500; color: var(--ink); margin-bottom: 4px; }
.card-desc { font-size: 12px; color: var(--ink-light); line-height: 1.6; }

/* ── METRIC CARDS ────────────────────────────────────────── */
.metric-card {
    background: var(--white);
    border: 0.5px solid rgba(28,56,50,0.08);
    border-radius: 10px;
    padding: 14px 16px;
}

.metric-value {
    font-family: var(--font-serif);
    font-size: 28px;
    color: var(--forest);
    line-height: 1;
}

.metric-value.danger { color: var(--danger); }
.metric-value.success { color: var(--success); }
.metric-label { font-size: 11px; color: var(--ink-light); margin-top: 4px; }
.metric-change { font-size: 10px; margin-top: 6px; font-weight: 500; }
.metric-change.up { color: var(--success); }
.metric-change.down { color: var(--danger); }

/* ── QUICK ACTION CARDS ──────────────────────────────────── */
.qa-card {
    background: var(--white);
    border: 0.5px solid rgba(28,56,50,0.08);
    border-radius: var(--border-radius-lg);
    padding: 18px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    text-decoration: none;
    color: inherit;
}

.qa-card:hover {
    border-color: var(--lime);
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(28,56,50,0.08);
}

.qa-card.teal { border-left: 3px solid var(--forest-light); }
.qa-card.lime { border-left: 3px solid var(--lime); }

.qa-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.qa-icon.forest { background: var(--paper-warm); }
.qa-icon.lime { background: var(--warning-light); }
.qa-title { font-size: 13px; font-weight: 500; color: var(--forest); margin-bottom: 3px; }
.qa-desc { font-size: 11px; color: var(--ink-light); line-height: 1.5; }

/* ── TABLES ──────────────────────────────────────────────── */
.table-wrap {
    background: var(--white);
    border: 0.5px solid rgba(28,56,50,0.1);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.table-header {
    padding: 14px 16px;
    border-bottom: 0.5px solid rgba(28,56,50,0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-header-title { font-size: 13px; font-weight: 500; color: var(--ink); }

table { width: 100%; border-collapse: collapse; }

th {
    font-size: 10px;
    font-weight: 500;
    color: var(--ink-light);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 10px 16px;
    text-align: left;
    border-bottom: 0.5px solid rgba(28,56,50,0.06);
    background: var(--paper);
    white-space: nowrap;
}

td {
    padding: 10px 16px;
    border-bottom: 0.5px solid rgba(28,56,50,0.04);
    font-size: 12px;
    color: var(--ink-mid);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--paper); }

/* ── BADGES ──────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 20px;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info { background: var(--paper-warm); color: var(--lime-dark); }
.badge-gray { background: var(--paper-warm); color: var(--ink-light); }

/* ── FORMS ───────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--ink-mid);
    margin-bottom: 5px;
    display: block;
    letter-spacing: 0.02em;
}

.form-hint { font-size: 11px; color: var(--ink-light); margin-top: 4px; }
.form-error { font-size: 11px; color: var(--danger); margin-top: 4px; }

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid rgba(28,56,50,0.15);
    border-radius: var(--border-radius);
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--ink);
    background: var(--white);
    transition: border 0.15s;
    outline: none;
}

.form-control:focus { border-color: var(--forest-light); }
.form-control:disabled { background: var(--paper); color: var(--ink-light); }
.form-control.auto-filled { background: var(--paper-warm); border-color: var(--lime); }

.form-select {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid rgba(28,56,50,0.15);
    border-radius: var(--border-radius);
    font-family: var(--font-sans);
    font-size: 13px;
    color: var(--ink);
    background: var(--white);
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235A7A6E' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.form-select:focus { border-color: var(--forest-light); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ── WIZARD STEPS ────────────────────────────────────────── */
.wizard-steps {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 24px;
}

.wizard-step { display: flex; align-items: center; gap: 8px; flex: 1; }

.step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 500;
    flex-shrink: 0;
}

.step-num.done { background: var(--forest-light); color: var(--white); }
.step-num.active { background: var(--forest); color: var(--lime); }
.step-num.pending { background: var(--paper-warm); color: var(--ink-light); }

.step-label { font-size: 11px; font-weight: 500; }
.step-label.active { color: var(--forest); }
.step-label.done { color: var(--forest-light); }
.step-label.pending { color: var(--ink-light); }

.step-line { flex: 1; height: 1px; background: rgba(28,56,50,0.1); margin: 0 8px; }
.step-line.done { background: var(--forest-light); }

/* ── PEER SELECTOR ───────────────────────────────────────── */
.peer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.peer-card {
    border: 0.5px solid rgba(28,56,50,0.1);
    border-radius: 8px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.peer-card:hover { border-color: var(--forest-light); background: var(--paper); }

.peer-card.selected {
    border-color: var(--lime-dark);
    background: var(--paper-warm);
}

.peer-check {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    border: 1.5px solid rgba(28,56,50,0.2);
    flex-shrink: 0;
    margin-top: 1px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.peer-card.selected .peer-check {
    background: var(--lime-dark);
    border-color: var(--lime-dark);
    color: white;
    font-size: 10px;
}

.peer-name { font-size: 12px; font-weight: 500; color: var(--ink); }
.peer-meta { font-size: 10px; color: var(--ink-light); margin-top: 2px; }

/* ── PEER COUNTER ────────────────────────────────────────── */
.peer-counter {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--paper);
    border-radius: 8px;
    margin-bottom: 12px;
}

.peer-counter-bar {
    flex: 1;
    height: 4px;
    background: var(--paper-mid);
    border-radius: 2px;
    overflow: hidden;
}

.peer-counter-fill {
    height: 100%;
    background: var(--lime-dark);
    border-radius: 2px;
    transition: width 0.3s;
}

.peer-counter-text { font-size: 11px; font-weight: 500; color: var(--ink-mid); white-space: nowrap; }

/* ── ALERTS ──────────────────────────────────────────────── */
.alert {
    border-radius: 8px;
    padding: 12px 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
    font-size: 12px;
}

.alert-success { background: var(--success-light); color: var(--success); border: 0.5px solid rgba(26,122,74,0.2); }
.alert-danger { background: var(--danger-light); color: var(--danger); border: 0.5px solid rgba(192,57,43,0.2); }
.alert-warning { background: var(--warning-light); color: var(--warning); border: 0.5px solid rgba(184,150,12,0.2); }
.alert-info { background: var(--paper-warm); color: var(--lime-dark); border: 0.5px solid var(--lime); }

/* ── TABS ────────────────────────────────────────────────── */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid rgba(28,56,50,0.08);
    margin-bottom: 20px;
}

.tab {
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 500;
    color: var(--ink-light);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
    text-decoration: none;
}

.tab:hover { color: var(--ink); }
.tab.active { color: var(--forest); border-bottom-color: var(--lime-dark); }

/* ── CHATBOT FAB ─────────────────────────────────────────── */
.chatbot-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--forest);
    color: var(--white);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(28,56,50,0.3);
    z-index: 50;
    transition: all 0.2s;
}

.chatbot-fab:hover { background: var(--lime-dark); transform: scale(1.05); }

.chatbot-panel {
    position: fixed;
    bottom: 80px;
    right: 24px;
    width: 320px;
    background: var(--white);
    border: 0.5px solid rgba(28,56,50,0.1);
    border-radius: 16px;
    box-shadow: 0 8px 40px rgba(28,56,50,0.15);
    z-index: 50;
    display: none;
    flex-direction: column;
    overflow: hidden;
    max-height: 400px;
}

.chatbot-panel.open { display: flex; }

.chat-header {
    background: var(--forest);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-header-title { font-size: 13px; font-weight: 500; color: var(--white); }
.chat-header-sub { font-size: 10px; color: rgba(255,255,255,0.4); }
.chat-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--lime); }

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 180px;
}

.chat-msg-user { display: flex; justify-content: flex-end; }
.chat-msg-bot { display: flex; gap: 6px; align-items: flex-start; }

.chat-bubble {
    max-width: 85%;
    padding: 8px 11px;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.5;
}

.chat-bubble-user {
    background: var(--forest);
    color: var(--white);
    border-radius: 10px 10px 2px 10px;
}

.chat-bubble-bot {
    background: var(--paper);
    color: var(--ink-mid);
    border-radius: 10px 10px 10px 2px;
}

.chat-bot-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--lime);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 500;
    color: var(--forest);
    flex-shrink: 0;
    margin-top: 2px;
}

.chat-input-row {
    padding: 10px;
    border-top: 0.5px solid rgba(28,56,50,0.06);
    display: flex;
    gap: 6px;
}

.chat-input {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid rgba(28,56,50,0.12);
    border-radius: 7px;
    font-size: 12px;
    font-family: var(--font-sans);
    outline: none;
}

.chat-input:focus { border-color: var(--forest-light); }
.chat-send { background: var(--forest); border: none; border-radius: 7px; padding: 7px 12px; color: var(--white); font-size: 12px; cursor: pointer; }

/* ── PAYMENT ─────────────────────────────────────────────── */
.stripe-field {
    background: var(--paper);
    border: 1px solid rgba(28,56,50,0.12);
    border-radius: 7px;
    padding: 10px 12px;
    font-size: 13px;
    color: var(--ink-light);
    min-height: 40px;
}

.order-summary {
    background: var(--paper);
    border-radius: 10px;
    padding: 16px;
}

.order-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 0.5px solid rgba(28,56,50,0.06);
    font-size: 12px;
}

.order-row:last-child { border-bottom: none; font-weight: 500; font-size: 14px; }
.order-label { color: var(--ink-light); }

.secure-badge {
    font-size: 10px;
    color: var(--ink-light);
    background: var(--white);
    border: 0.5px solid rgba(28,56,50,0.08);
    padding: 3px 8px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

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

.section-title {
    font-family: var(--font-serif);
    font-size: 20px;
    color: var(--forest);
    letter-spacing: -0.3px;
}

.section-sub { font-size: 12px; color: var(--ink-light); margin-top: 2px; }

/* ── DIVIDER ─────────────────────────────────────────────── */
.divider { border: none; border-top: 0.5px solid rgba(28,56,50,0.08); margin: 16px 0; }

/* ── GRIDS ───────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

/* ── LOGIN PAGE ──────────────────────────────────────────── */
.auth-page {
    min-height: 100vh;
    background: var(--forest);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.auth-card {
    background: var(--white);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.auth-logo {
    font-family: var(--font-sans);
    font-size: 20px;
    font-weight: 500;
    color: var(--forest);
    margin-bottom: 4px;
}

.auth-logo span { color: var(--lime-dark); }
.auth-tagline { font-size: 11px; color: var(--ink-light); margin-bottom: 28px; }
.auth-title { font-size: 18px; font-weight: 500; color: var(--forest); margin-bottom: 4px; }
.auth-sub { font-size: 12px; color: var(--ink-light); margin-bottom: 24px; }

/* ── UTILITIES ───────────────────────────────────────────── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--ink-light); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.font-serif { font-family: var(--font-serif); }
.fw-500 { font-weight: 500; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.w-full { width: 100%; }
