/* ── FIX Bridge — Light Theme ─────────────────────────────────────────────── */

:root {
    --primary:       #3b82f6;
    --primary-light: #eff6ff;
    --primary-dark:  #2563eb;
    --success:       #10b981;
    --warning:       #f59e0b;
    --danger:        #ef4444;

    --text:          #111827;
    --text-muted:    #6b7280;
    --text-faint:    #9ca3af;

    --border:        #e5e7eb;
    --bg-page:       #f3f4f6;
    --bg-card:       #ffffff;
    --bg-header:     #f9fafb;
}

/* ── Base ─────────────────────────────────────────────────────────────────── */
*, body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}
body {
    background: var(--bg-page);
    color: var(--text);
    font-size: .9rem;
}

/* ── Page headings & card header text default to dark ────────────────────── */
h4, h5, h6 { color: var(--text); }
.card-header { color: var(--text); }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
}
.card-header {
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    padding: .7rem 1rem;
}
.card-body { color: var(--text); }

/* ── Tables ───────────────────────────────────────────────────────────────── */
.table {
    --bs-table-bg:           transparent;
    --bs-table-color:        var(--text);
    --bs-table-border-color: var(--border);
}
.table thead th {
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    padding: .6rem 1rem;
    white-space: nowrap;
}
.table td {
    padding: .6rem 1rem;
    vertical-align: middle;
    border-color: var(--border);
    font-size: .875rem;
    color: var(--text);
}
.table-hover tbody tr:hover { background: #f9fafb; }

/* ── Fix bg-dark badges → use neutral pill ───────────────────────────────── */
.badge.bg-dark {
    background: #f3f4f6 !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
    font-weight: 500;
}

/* ── Fix login form inputs ───────────────────────────────────────────────── */
.form-control.bg-dark {
    background: var(--bg-card) !important;
    color: var(--text) !important;
    border-color: var(--border) !important;
}
.form-control.bg-dark::placeholder { color: var(--text-faint); }
.form-control.border-secondary { border-color: var(--border) !important; }

/* ── Status badges ────────────────────────────────────────────────────────── */
.status-up   { color: var(--success); font-weight: 500; font-size: .85rem; }
.status-down { color: var(--danger);  font-weight: 500; font-size: .85rem; }

/* ── Metric cards ─────────────────────────────────────────────────────────── */
.metric-card { border-left: 3px solid; }
.metric-card.primary { border-color: var(--primary); }
.metric-card.success { border-color: var(--success); }
.metric-card.warning { border-color: var(--warning); }
.metric-card.danger  { border-color: var(--danger);  }
.metric-value { font-size: 1.8rem; font-weight: 700; line-height: 1; }
.metric-label { font-size: .72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; margin-top: .3rem; }

/* ── Live dot ─────────────────────────────────────────────────────────────── */
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.35} }
.live-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--success);
    display: inline-block;
    animation: pulse 2s infinite;
}

/* ── Log viewer ───────────────────────────────────────────────────────────── */
.log-INFO  { color: #374151; }
.log-WARN  { color: var(--warning); }
.log-ERROR { color: var(--danger); }
.log-DEBUG { color: var(--text-faint); }
.log-time  { color: var(--text-faint); font-family: 'Consolas', monospace; font-size: .8rem; }
.log-box {
    max-height: 520px;
    overflow-y: auto;
    font-size: .82rem;
    font-family: 'Consolas', 'Courier New', monospace;
    background: var(--bg-header);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 1rem;
    color: var(--text);
}

/* ── Price flash ──────────────────────────────────────────────────────────── */
@keyframes flash { 0%{background:rgba(16,185,129,.12)} 100%{background:transparent} }
.price-updated { animation: flash .6s ease-out; }

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
    width: 220px;
    min-height: 100vh;
    background: #fff;
    border-right: 1.5px solid #d1d5db;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    box-shadow: 2px 0 8px rgba(0,0,0,.04);
    position: relative;
}

/* Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.sidebar-logo {
    width: 34px; height: 34px;
    background: var(--primary);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1rem; flex-shrink: 0;
}
.sidebar-title    { font-size: .9rem; font-weight: 700; color: var(--text); line-height: 1.2; }
.sidebar-subtitle { font-size: .7rem; color: var(--text-faint); margin-top: 1px; }

/* Nav items */
.sidebar-nav {
    flex: 1; padding: .75rem .6rem;
    display: flex; flex-direction: column; gap: 2px;
}
.sidebar-link {
    display: flex; align-items: center; gap: .65rem;
    padding: .5rem .75rem; border-radius: 6px;
    font-size: .875rem; font-weight: 500;
    color: var(--text-muted); text-decoration: none;
    transition: background .12s, color .12s;
}
.sidebar-link .bi { font-size: .95rem; width: 18px; text-align: center; flex-shrink: 0; }
.sidebar-link:hover   { background: var(--bg-page); color: var(--text); }
.sidebar-link.active  { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.sidebar-link.active .bi { color: var(--primary); }

/* Profile details/summary */
.profile-details { position: relative; }
.profile-details > summary::-webkit-details-marker { display: none; }
.profile-details > summary::marker { display: none; }
.profile-details > summary { list-style: none; outline: none; -webkit-tap-highlight-color: transparent; }

.sidebar-profile {
    display: flex !important; align-items: center; gap: .6rem;
    padding: .75rem 1rem;
    border-top: 1px solid var(--border);
    background: #f9fafb;
    cursor: pointer; user-select: none;
    transition: background .12s;
    color: var(--text) !important;
}
.sidebar-profile:hover { background: #f3f4f6; }

.profile-avatar {
    width: 30px; height: 30px;
    background: var(--primary-light); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--primary); font-size: .9rem; flex-shrink: 0;
}
.profile-info { flex: 1; min-width: 0; }
.sidebar-profile .profile-name    { font-size: .78rem; font-weight: 600; color: var(--text) !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-profile .profile-role    { font-size: .66rem; color: var(--text-faint) !important; text-transform: capitalize; }
.sidebar-profile .profile-chevron { font-size: .7rem; color: var(--text-faint) !important; flex-shrink: 0; }

/* Profile popup menu */
.profile-menu {
    position: absolute;
    bottom: calc(100% + 4px);
    left: .6rem; right: .6rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    overflow: hidden;
    z-index: 200;
    padding: .35rem 0;
}
.pmenu-item {
    display: flex; align-items: center; gap: .6rem;
    padding: .55rem .9rem;
    font-size: .84rem; color: var(--text);
    text-decoration: none; cursor: pointer;
    transition: background .1s;
}
.pmenu-item .bi { font-size: .9rem; width: 16px; text-align: center; color: var(--text-muted); }
.pmenu-item:hover { background: #f9fafb; }
.pmenu-divider { height: 1px; background: #f3f4f6; margin: .3rem 0; }
.pmenu-danger      { color: #ef4444; }
.pmenu-danger .bi  { color: #ef4444; }
.pmenu-danger:hover { background: #fef2f2; }

/* ── Topbar ───────────────────────────────────────────────────────────────── */
.topbar {
    height: 44px;
    background: #fff;
    border-bottom: 1px solid #d1d5db;
    display: flex; align-items: center;
    padding: 0 1.25rem;
    flex-shrink: 0;
    gap: .75rem;
}
.topbar-left  { flex: 1; display: flex; align-items: center; gap: .75rem; }
.topbar-right { display: flex; align-items: center; gap: .75rem; }

.topbar-uptime {
    display: flex; align-items: center; gap: .2rem;
    padding: .08rem .3rem;
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: 4px;
}
.topbar-uptime-label {
    font-size: .5rem; text-transform: uppercase; letter-spacing: .05em;
    color: var(--text-faint); font-weight: 600;
}
.topbar-uptime-value {
    font-size: .62rem; font-weight: 600; color: var(--text);
    font-variant-numeric: tabular-nums;
}

/* ── Login card ───────────────────────────────────────────────────────────── */
.login-wrapper { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { max-width: 400px; width: 100%; }
.login-card .card-header { background: var(--primary); }
.login-card .card-header h4,
.login-card .card-header .text-white,
.login-card .card-header .text-secondary { color: #fff !important; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn-outline-secondary {
    color: var(--text-muted);
    border-color: var(--border);
}
.btn-outline-secondary:hover {
    background: var(--bg-page);
    color: var(--text);
    border-color: var(--border);
}

/* ── Form switch ──────────────────────────────────────────────────────────── */
.form-check-input:checked { background-color: var(--primary); border-color: var(--primary); }

/* ── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #d1d5db; }

/* ── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
    width: 220px;
    min-height: 100vh;
    background: #fff;
    border-right: 1.5px solid #d1d5db;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    box-shadow: 2px 0 8px rgba(0,0,0,.04);
    position: relative;
}

/* Brand */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.sidebar-logo {
    width: 34px; height: 34px;
    background: var(--primary);
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1rem; flex-shrink: 0;
}
.sidebar-title    { font-size: .9rem; font-weight: 700; color: var(--text); line-height: 1.2; }
.sidebar-subtitle { font-size: .7rem; color: var(--text-faint); margin-top: 1px; }

/* Nav items */
.sidebar-nav {
    flex: 1; padding: .75rem .6rem;
    display: flex; flex-direction: column; gap: 2px;
}
.sidebar-link {
    display: flex; align-items: center; gap: .65rem;
    padding: .5rem .75rem; border-radius: 6px;
    font-size: .875rem; font-weight: 500;
    color: var(--text-muted); text-decoration: none;
    transition: background .12s, color .12s;
}
.sidebar-link .bi { font-size: .95rem; width: 18px; text-align: center; flex-shrink: 0; }
.sidebar-link:hover   { background: var(--bg-page); color: var(--text); }
.sidebar-link.active  { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.sidebar-link.active .bi { color: var(--primary); }

/* Profile details/summary */
.profile-details { position: relative; }
.profile-details > summary::-webkit-details-marker { display: none; }
.profile-details > summary::marker { display: none; }
.profile-details > summary { list-style: none; outline: none; -webkit-tap-highlight-color: transparent; }

.sidebar-profile {
    display: flex !important; align-items: center; gap: .6rem;
    padding: .75rem 1rem;
    border-top: 1px solid var(--border);
    background: #f9fafb;
    cursor: pointer; user-select: none;
    transition: background .12s;
    color: var(--text) !important;
}
.sidebar-profile:hover { background: #f3f4f6; }

.profile-avatar {
    width: 30px; height: 30px;
    background: var(--primary-light); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: var(--primary); font-size: .9rem; flex-shrink: 0;
}
.profile-info { flex: 1; min-width: 0; }
.sidebar-profile .profile-name    { font-size: .78rem; font-weight: 600; color: var(--text) !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-profile .profile-role    { font-size: .66rem; color: var(--text-faint) !important; text-transform: capitalize; }
.sidebar-profile .profile-chevron { font-size: .7rem; color: var(--text-faint) !important; flex-shrink: 0; }

/* Profile popup menu */
.profile-menu {
    position: absolute;
    bottom: calc(100% + 4px);
    left: .6rem; right: .6rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
    overflow: hidden;
    z-index: 200;
    padding: .35rem 0;
}
.pmenu-item {
    display: flex; align-items: center; gap: .6rem;
    padding: .55rem .9rem;
    font-size: .84rem; color: var(--text);
    text-decoration: none; cursor: pointer;
    transition: background .1s;
}
.pmenu-item .bi { font-size: .9rem; width: 16px; text-align: center; color: var(--text-muted); }
.pmenu-item:hover { background: #f9fafb; }
.pmenu-divider { height: 1px; background: #f3f4f6; margin: .3rem 0; }
.pmenu-danger      { color: #ef4444; }
.pmenu-danger .bi  { color: #ef4444; }
.pmenu-danger:hover { background: #fef2f2; }

/* Nav group dropdown */
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::marker                 { display: none; }
.nav-group > summary { list-style: none; cursor: pointer; }
.nav-group-summary   { user-select: none; }

.nav-chevron {
    font-size: .62rem;
    color: #9ca3af;
    transition: transform .2s ease;
    flex-shrink: 0;
}
details.nav-group[open] .nav-chevron { transform: rotate(90deg); }

.nav-group-items {
    position: relative;
    margin-left: 1.15rem;
    padding-left: .75rem;
    padding-top: .15rem;
    padding-bottom: .15rem;
}
.nav-group-items::before {
    content: '';
    position: absolute;
    left: 0; top: 4px; bottom: 4px;
    width: 1.5px;
    background: #e5e7eb;
    border-radius: 2px;
}

.nav-sub-link {
    font-size: .83rem !important;
    padding: .3rem .6rem !important;
    color: #6b7280 !important;
    border-radius: 5px !important;
}
.nav-sub-link:hover  { color: #111827 !important; background: #f3f4f6 !important; }
.nav-sub-link.active { color: #2563eb !important; background: #eff6ff !important; font-weight: 600 !important; }

/* Sidebar footer */
.sidebar-footer {
    padding: .5rem 1.1rem;
    border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
}
.footer-version {
    font-size: .62rem; color: var(--text-faint);
}
