/* ═══════════════════════════════════════════════════════════════════
   Green River Cabins — Platform
   Light + Dark themes — brand: navy + orange + forest green
   (palette sampled from greenrivercabins.com)
   ═══════════════════════════════════════════════════════════════════ */

:root {
    --font-sans: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-heading: 'Oswald', 'Roboto', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    /* Brand palette (greenrivercabins.com) */
    --brand-navy: #2d3748;
    --brand-navy-light: #3d4a5c;
    --brand-orange: #e8732a;
    --brand-orange-hover: #d4621e;
    --brand-orange-glow: rgba(232, 115, 42, 0.22);
    --brand-green: #2d6a4f;
    --brand-green-light: #40916c;
    --brand-cream: #f7f5f0;
    /* Legacy aliases (remove once downstream refs are migrated) */
    --brand-red: var(--brand-orange);
    --brand-red-light: var(--brand-orange-hover);
    --brand-red-glow: var(--brand-orange-glow);
    --radius: 10px;
    --radius-sm: 6px;
    --transition: 0.15s ease;
}

/* ── Light Theme ────────────────────────────────────────────────── */

[data-theme="light"] {
    --bg-body: var(--brand-cream);
    --bg-sidebar: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #f0eee8;
    --bg-hover: #efece5;
    --bg-active: #fcead9;
    --text-primary: var(--brand-navy);
    --text-secondary: #4a5568;
    --text-muted: #8a8a8a;
    --border: #dcd7cc;
    --border-light: #e8e4dc;
    --accent: var(--brand-orange);
    --accent-hover: var(--brand-orange-hover);
    --success: #16a34a;
    --warning: #d97706;
    --error: #dc2626;
    --danger: #dc2626;
    --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-modal: 0 20px 60px rgba(0,0,0,0.15);
    --sidebar-logo-filter: none;
    --particle-rgb: 232, 115, 42;
}

/* ── Dark Theme ─────────────────────────────────────────────────── */

[data-theme="dark"] {
    --bg-body: #171a21;
    --bg-sidebar: var(--brand-navy);
    --bg-card: #242c38;
    --bg-input: #2a3442;
    --bg-hover: var(--brand-navy-light);
    --bg-active: #3a2c1f;
    --text-primary: #eae4da;
    --text-secondary: #b9b4ab;
    --text-muted: #7a7568;
    --border: #3a4252;
    --border-light: #455065;
    --accent: var(--brand-orange);
    --accent-hover: var(--brand-orange-hover);
    --success: #4caf50;
    --warning: #f59e0b;
    --error: #ef4444;
    --danger: #dc2626;
    --shadow-card: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-modal: 0 20px 60px rgba(0,0,0,0.5);
    --sidebar-logo-filter: none;
    --particle-rgb: 232, 115, 42;
}

/* ── Reset ──────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
    font-family: var(--font-sans);
    background: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background var(--transition), color var(--transition);
}
a { color: var(--brand-red-light); text-decoration: none; }
a:hover { color: #c42a2a; }

/* ── Layout ─────────────────────────────────────────────────────── */

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

.sidebar {
    width: 250px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: background var(--transition);
    height: 100vh;
    position: sticky;
    top: 0;
}

.sidebar-header {
    padding: 20px 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 190px;
    flex-shrink: 0;
}

.sidebar-logo-img {
    max-height: 150px;
    max-width: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    filter: var(--sidebar-logo-filter);
}

.sidebar-nav { padding: 10px 0; flex: 1; overflow-y: auto; min-height: 0; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 18px;
    margin: 2px 10px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 400;
    transition: all var(--transition);
    border-radius: var(--radius-sm);
    border-left: none;
}
.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.nav-item.active {
    background: var(--bg-active);
    color: var(--brand-red);
    font-weight: 500;
}

.nav-svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.4; }
.nav-item.active .nav-svg { opacity: 1; color: var(--brand-red); }
.nav-item:hover .nav-svg { opacity: 0.7; }

.nav-section {
    padding: 22px 18px 8px;
    margin: 0 10px;
    font-size: 0.67rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.sidebar-footer {
    padding: 10px 14px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}
.sidebar-version {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-decoration: none;
    position: relative;
    text-align: center;
}
.sidebar-cl-dot {
    display: none;
    position: absolute;
    top: -3px;
    right: -9px;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 2px var(--bg-sidebar);
}

.sidebar-collapse-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    width: 100%;
    padding: 7px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-family: var(--font-sans);
    transition: all var(--transition);
}
.sidebar-collapse-btn:hover { border-color: var(--brand-red); color: var(--text-primary); }
.sidebar-collapse-icon { transition: transform var(--transition); flex-shrink: 0; }
.sidebar-collapse-label { letter-spacing: 0.02em; }

/* Collapsed sidebar — icons only */
html[data-sidebar-collapsed="true"] .sidebar { width: 68px; }
html[data-sidebar-collapsed="true"] .sidebar-header {
    height: 68px;
    padding: 10px;
}
html[data-sidebar-collapsed="true"] .sidebar-logo-img { max-height: 44px; }
html[data-sidebar-collapsed="true"] .nav-item {
    justify-content: center;
    gap: 0;
    padding: 11px 0;
    margin: 2px 8px;
}
html[data-sidebar-collapsed="true"] .nav-label { display: none; }
html[data-sidebar-collapsed="true"] .nav-section {
    padding: 0;
    margin: 12px 16px 8px;
    height: 1px;
    background: var(--border);
    color: transparent;
    font-size: 0;
    letter-spacing: 0;
    overflow: hidden;
}
html[data-sidebar-collapsed="true"] .sidebar-footer {
    padding: 10px 6px;
    gap: 10px;
}
html[data-sidebar-collapsed="true"] .sidebar-collapse-label { display: none; }
html[data-sidebar-collapsed="true"] .sidebar-collapse-btn { padding: 7px 0; }
html[data-sidebar-collapsed="true"] .sidebar-collapse-icon { transform: rotate(180deg); }

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

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 28px;
    height: 50px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-sidebar);
    transition: background var(--transition);
    flex-shrink: 0;
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-bug {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    transition: all 0.2s;
}
.topbar-bug:hover {
    color: var(--brand-red);
    background: var(--bg-hover);
}
.topbar-bug:hover svg {
    animation: bugWiggle 0.4s ease-in-out;
}
.topbar-link {
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}
.topbar-link:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}
.topbar-sep {
    display: inline-block;
    width: 1px;
    height: 18px;
    background: var(--border);
    margin: 0 4px;
}
@keyframes bugWiggle {
    0%, 100% { transform: rotate(0deg); }
    20% { transform: rotate(-12deg); }
    40% { transform: rotate(10deg); }
    60% { transform: rotate(-8deg); }
    80% { transform: rotate(5deg); }
}

.topbar-user { color: var(--text-secondary); font-size: 0.88rem; }
.topbar-logout { color: var(--text-muted); font-size: 0.82rem; }
.topbar-logout:hover { color: var(--error); }

/* Topbar quick-access: Production Board (marquee action) */
.topbar-quick {
    display: flex;
    align-items: stretch;
    gap: 2px;
    margin-right: 12px;
    position: relative;
}
.tb-quick-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px 6px 12px;
    background: linear-gradient(135deg, rgba(232,115,42,0.14) 0%, rgba(232,115,42,0.06) 100%);
    border: 1px solid rgba(232,115,42,0.35);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-heading);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
    box-shadow: 0 1px 0 rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.03);
}
.tb-quick-btn:hover {
    background: linear-gradient(135deg, rgba(232,115,42,0.22) 0%, rgba(232,115,42,0.10) 100%);
    border-color: var(--accent, #e8732a);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px -4px rgba(232,115,42,0.35), inset 0 1px 0 rgba(255,255,255,0.05);
}
.tb-quick-btn:active { transform: translateY(0); }
.tb-quick-active {
    background: linear-gradient(135deg, rgba(232,115,42,0.28) 0%, rgba(232,115,42,0.14) 100%);
    border-color: var(--accent, #e8732a);
    box-shadow: 0 0 0 1px rgba(232,115,42,0.25), inset 0 1px 0 rgba(255,255,255,0.05);
}
.tb-quick-icon { color: var(--accent, #e8732a); flex-shrink: 0; }
.tb-quick-btn:hover .tb-quick-icon circle { animation: tbQuickBlink 1.4s ease-in-out infinite; }
@keyframes tbQuickBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.tb-quick-pop {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    padding: 0 6px;
    color: var(--text-muted);
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--border);
    border-left: none;
    border-top-right-radius: var(--radius-sm);
    border-bottom-right-radius: var(--radius-sm);
    text-decoration: none;
    transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.tb-quick-pop:hover {
    color: var(--accent, #e8732a);
    background: rgba(232,115,42,0.10);
    border-color: rgba(232,115,42,0.35);
}
/* Merge the button + pop-out visual seam */
.tb-quick-btn { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: none; }

@media (max-width: 900px) {
    .tb-quick-btn span { display: none; }
    .tb-quick-btn { padding: 6px 10px; }
}

.breadcrumb-link { color: var(--text-muted); font-size: 0.88rem; }
.breadcrumb-link:hover { color: var(--text-primary); }
.breadcrumb-sep { color: var(--text-muted); margin: 0 6px; font-size: 0.88rem; }

.content { padding: 28px 32px; flex: 1; }

/* ── Theme Toggle ──────────────────────────────────────────────── */

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all var(--transition);
}
.theme-toggle:hover { border-color: var(--brand-red); color: var(--text-primary); }
.theme-toggle svg { width: 14px; height: 14px; }

/* ── Page Header ────────────────────────────────────────────────── */

.page-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
}
.page-header h2 {
    font-size: 1.5rem;
    font-weight: 500;
    font-family: var(--font-heading);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* ── Stats Grid ─────────────────────────────────────────────────── */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
    box-shadow: var(--shadow-card);
    border-left: 3px solid var(--brand-red);
    transition: all 0.2s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0,0,0,0.1); }

.stat-value {
    font-size: 1.9rem;
    font-weight: 800;
    font-family: var(--font-heading);
    line-height: 1.2;
}
.stat-label {
    color: var(--text-muted);
    margin-top: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.73rem;
}
.stat-connected { border-left-color: var(--success); }
.stat-connected .stat-value { color: var(--success); }
.stat-disconnected .stat-value { color: var(--text-muted); font-size: 1.3rem; }

/* ── Section ────────────────────────────────────────────────────── */

.section { margin-bottom: 28px; }
.section h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 14px;
    font-family: var(--font-heading);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Tables ─────────────────────────────────────────────────────── */

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}
.data-table th {
    text-align: left;
    padding: 12px 18px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: var(--bg-body);
    font-family: var(--font-heading);
}
.data-table td {
    padding: 12px 18px;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.data-table tr:last-child td { border-bottom: none; }
.clickable-row { cursor: pointer; transition: background var(--transition); }
.clickable-row:hover td { background: var(--bg-hover); }
.pagination-row { text-align: center; color: var(--text-muted); font-size: 0.88rem; }

/* ── Cards ──────────────────────────────────────────────────────── */

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}
.detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px 24px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-card);
    transition: all 0.2s ease;
}
.detail-card:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,0.08);
}
.detail-card h4 {
    font-size: 0.84rem;
    font-weight: 600;
    margin-bottom: 14px;
    color: var(--brand-red);
    font-family: var(--font-heading);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--text-muted); }

/* ── Badges ─────────────────────────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.badge-success { background: rgba(22, 163, 74, 0.12); color: var(--success); }
.badge-warning { background: rgba(217, 119, 6, 0.12); color: var(--warning); }
.badge-error { background: rgba(220, 38, 38, 0.12); color: var(--error); }
.badge-muted { background: rgba(140, 140, 140, 0.1); color: var(--text-muted); }

/* ── Buttons ────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-sans);
}
.btn-primary { background: var(--brand-red); color: #fff; }
.btn-primary:hover { background: var(--brand-red-light); color: #fff; transform: translateY(-1px); }
.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-hover); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 5px 12px; font-size: 0.78rem; }
.btn-full { width: 100%; }

/* ── Forms ──────────────────────────────────────────────────────── */

.form-group { margin-bottom: 18px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--text-secondary);
}
input[type="text"], input[type="email"], input[type="password"],
input[type="search"], textarea, select {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    transition: border var(--transition), box-shadow var(--transition);
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--brand-red);
    box-shadow: 0 0 0 3px var(--brand-red-glow);
}
::placeholder { color: var(--text-muted); }

/* ── Toolbar ────────────────────────────────────────────────────── */

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    gap: 14px;
}
.search-input { max-width: 340px; }
.toolbar-actions { display: flex; align-items: center; gap: 14px; }
.toggle-label {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
}

/* ── Tabs ───────────────────────────────────────────────────────── */

.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
}
.tab {
    padding: 10px 20px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    font-family: var(--font-heading);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: all var(--transition);
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--brand-red); border-bottom-color: var(--brand-red); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Integration Cards ──────────────────────────────────────────── */

.integration-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 18px;
    overflow: hidden;
    border-left: 4px solid var(--brand-red);
    box-shadow: var(--shadow-card);
    transition: box-shadow 0.2s ease;
}
.integration-card:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,0.08);
}
.integration-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.integration-header h3 {
    font-size: 1.05rem;
    margin-bottom: 4px;
    font-family: var(--font-heading);
    text-transform: uppercase;
}
.integration-body { padding: 20px 24px; }
.integration-actions { display: flex; gap: 14px; margin-top: 16px; }

/* ── Settings ───────────────────────────────────────────────────── */

.settings-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}
.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: none; }
.setting-info label { font-weight: 500; font-size: 0.9rem; }
.setting-desc { font-size: 0.78rem; color: var(--text-muted); margin-top: 3px; }

/* ── Activity ───────────────────────────────────────────────────── */

.activity-list {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-card);
}
.activity-item {
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}
.activity-item:hover { background: var(--bg-hover); }
.activity-item:last-child { border-bottom: none; }
.activity-summary { font-size: 0.9rem; }
.activity-meta {
    display: flex;
    gap: 18px;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── Login Page ─────────────────────────────────────────────────── */

.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 24px;
    background: var(--bg-body);
}
.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 48px 44px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-modal);
    border-top: 4px solid var(--brand-red);
}
.login-logo { display: block; max-width: 220px; margin: 0 auto 28px; }
.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    font-family: var(--font-heading);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.login-subtitle { text-align: center; color: var(--text-muted); margin: 10px 0 28px; font-size: 0.9rem; }
.login-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 24px 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}
.login-divider::before, .login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* ── Error Page ─────────────────────────────────────────────────── */

.error-page {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    text-align: center;
}
.error-page h1 {
    font-size: 4rem;
    font-weight: 700;
    color: var(--brand-red);
    font-family: var(--font-heading);
}
.error-page p { color: var(--text-secondary); margin: 14px 0 28px; }

/* ── Alerts ─────────────────────────────────────────────────────── */

.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-size: 0.9rem;
}
.alert-error {
    background: rgba(220, 38, 38, 0.08);
    color: var(--error);
    border: 1px solid rgba(220, 38, 38, 0.2);
}

/* ── Utilities ──────────────────────────────────────────────────── */

.text-muted { color: var(--text-muted); }
.text-mono { font-family: var(--font-mono); font-size: 0.84rem; }
.empty-state { color: var(--text-muted); font-style: italic; padding: 24px; text-align: center; font-size: 0.9rem; }
.loading { color: var(--text-muted); text-align: center; padding: 48px; }
.htmx-loading { opacity: 0.5; }

/* ── Sidebar footer ────────────────────────────────────────────── */

/* ── Topbar search trigger ─────────────────────────────────────── */

.topbar-center { flex: 1; max-width: 500px; margin: 0 28px; }

.search-trigger {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 8px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-muted);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-sans);
}
.search-trigger:hover { border-color: var(--brand-red); }
.search-trigger svg { opacity: 0.4; flex-shrink: 0; }
.search-trigger span { flex: 1; text-align: left; }
.search-trigger kbd {
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 0.65rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
}

/* ── Global Search Overlay ─────────────────────────────────────── */

.gs-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    justify-content: center;
    padding-top: 15vh;
    opacity: 0;
    transition: opacity 0.15s;
}
.gs-overlay.gs-open { opacity: 1; }

.gs-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
}

.gs-modal {
    position: relative;
    width: 540px;
    max-height: 65vh;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-modal);
    transform: translateY(-8px) scale(0.98);
    transition: transform 0.15s;
    overflow: hidden;
}
.gs-open .gs-modal { transform: translateY(0) scale(1); }

.gs-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.gs-search-icon { color: var(--text-muted); flex-shrink: 0; }
.gs-input-wrap input {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
}
.gs-input-wrap input::placeholder { color: var(--text-muted); }
.gs-esc {
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 0.65rem;
    font-family: var(--font-mono);
    color: var(--text-muted);
    cursor: pointer;
}
.gs-results {
    flex: 1;
    overflow-y: auto;
    max-height: min(50vh, 400px);
    padding: 6px 0;
}
.gs-group-header {
    padding: 8px 16px 4px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-family: var(--font-heading);
}
.gs-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 16px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.08s;
    cursor: pointer;
    border-radius: 0;
}
.gs-item:hover, .gs-item-active {
    background: var(--bg-active);
    color: var(--text-primary);
}
.gs-badge {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    flex-shrink: 0;
    font-family: var(--font-heading);
}
.gs-badge-client { background: rgba(139, 26, 26, 0.15); color: var(--brand-red-light); }
.gs-badge-contact { background: rgba(22, 163, 74, 0.1); color: var(--success); }
.gs-badge-invoice { background: rgba(217, 119, 6, 0.1); color: var(--warning); }
.gs-item-text { flex: 1; min-width: 0; }
.gs-item-title { display: block; font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-item-subtitle { display: block; font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gs-item-type { font-size: 0.65rem; color: var(--text-muted); flex-shrink: 0; }
.gs-empty-state { padding: 28px 16px; text-align: center; color: var(--text-muted); font-size: 0.88rem; }
.gs-footer {
    display: flex;
    gap: 16px;
    padding: 8px 16px;
    border-top: 1px solid var(--border);
    font-size: 0.7rem;
    color: var(--text-muted);
}
.gs-footer kbd {
    background: var(--bg-body);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 1px 5px;
    font-size: 0.6rem;
    font-family: var(--font-mono);
    margin-right: 2px;
}

/* ── Charges ───────────────────────────────────────────────────── */

.charge-actions { display: flex; gap: 8px; }
.charge-actions .btn { padding: 4px 10px; font-size: 0.75rem; }

/* ── Animations ────────────────────────────────────────────────── */

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}
.stat-card { animation: fadeInUp 0.3s ease-out both; }
.stat-card:nth-child(1) { animation-delay: 0.03s; }
.stat-card:nth-child(2) { animation-delay: 0.06s; }
.stat-card:nth-child(3) { animation-delay: 0.09s; }
.stat-card:nth-child(4) { animation-delay: 0.12s; }
.stat-card:nth-child(5) { animation-delay: 0.15s; }
.detail-card { animation: fadeInUp 0.25s ease-out both; }
.integration-card { animation: fadeInUp 0.25s ease-out both; }

/* ── Particle Canvas ──────────────────────────────────────────── */

#bg-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}
.app-layout {
    position: relative;
    z-index: 1;
}

/* ── Animated horizon line — topbar bottom ───────────────────── */

/* Horizon lines — animated GRC-palette glow under the topbar and the
   sidebar header. Thicker (3px) + faster sweep (7s) + soft drop-shadow
   so the motion reads at a glance; colors echo the navy-green-orange
   sunset-over-forest brand palette. */

.topbar {
    position: relative;
}
.topbar::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(45, 106, 79, 0.55) 18%,
        rgba(232, 115, 42, 0.95) 50%,
        rgba(45, 106, 79, 0.55) 82%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: horizonSweep 7s linear infinite;
    opacity: 0.85;
    filter: drop-shadow(0 0 6px rgba(232, 115, 42, 0.45));
    pointer-events: none;
}

@keyframes horizonSweep {
    to { background-position: -200% 0; }
}

/* Smooth page transitions */
.content {
    animation: fadeIn 0.2s ease-out;
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
