:root {
    --bg: #0b1220;
    --panel: #111a2e;
    --card: #0f1930;
    --text: #e8eefc;
    --muted: #a8b3cf;
    --line: #1f2a44;
    --btn: #2b6cff;
    --danger: #ff3b3b;
    --success: #18b35a;
}

/* Theme variants */
body.theme-dark-blue {
    --bg: #0b1220;
    --panel: #0b1430;
    --card: #0f1930;
    --text: #e8eefc;
    --muted: #a8b3cf;
    --line: #1f2a44;
    --btn: #2b6cff;
}

body.theme-dark {
    --bg: #0b0b0b;
    --panel: #121212;
    --card: #1c1c1e;
    --text: #ffffff;
    --muted: #8e8e93;
    --line: #38383a;
    --btn: #0a84ff;
}

body.theme-light {
    --bg: #f7f7f8;
    --panel: #ffffff;
    --card: #fdfdfd;
    --text: #111827;
    --muted: #72767e;
    --line: #737373;
    --btn: #0a84ff;

}


/* Logo Handling */
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--line);
}

/* When there IS a logo */
.brand.has-logo {
    padding: 14px 14px 18px 14px;
}

/* When there is NO logo — flatter, cleaner */
.brand.no-logo {
    padding: 10px 14px;
}

.brand-logo {
    max-height: 36px;
    width: auto;
}


* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.app {
    display: flex;
    min-height: 100vh;
}

/* ======================
   SIDEBAR
   ====================== */

.sidebar {
    width: 240px;
    padding: 18px;
    background: var(--panel);
    border-right: 1px solid var(--line);

    /* flex column so we can push settings link to the bottom */
    display: flex;
    flex-direction: column;
}

/* Desktop sticky sidebar: stays visible while main content scrolls */
@media (min-width: 991px) {
    .sidebar {
        position: sticky;
        top: 0;
        height: 100vh;
        overflow-y: auto;  /* sidebar scrolls if it gets too tall */
    }
}

.version-text {
    display: block;
    margin-top: 6px;
    opacity: .6;
    font-size: 11px;
    text-align: center;
  }

.update-available-form {
    margin-top: 8px;
    text-align: center;
}

.update-available-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    border-radius: 999px;               /* SUPER rounded rectangle */
    border: none;
    background: var(--btn);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    cursor: default;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.04),
                0 6px 16px rgba(0,0,0,0.45);
    transition:
        transform 80ms ease-out,
        box-shadow 80ms ease-out,
        background 150ms ease-out,
        opacity 120ms ease-out;
}

.update-available-help {
    margin-top: 6px;
    font-size: 11px;
    opacity: 0.7;
    text-align: left;
    word-break: break-word;
}

.update-available-help pre {
    margin: 4px 0 0;
    padding: 4px 6px;
    font-size: 10px;
    background: rgba(0,0,0,0.45);
    border-radius: 4px;
    overflow-x: auto;
}


.update-available-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(0,0,0,0.55);
    background: #3b7cff;
}

.update-available-pill:active {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(0,0,0,0.6);
    opacity: 0.9;
}

.update-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.update-modal.is-open {
    display: flex;
}

.update-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.update-modal-dialog {
    position: relative;
    max-width: 420px;
    width: 90%;
    background: #111827;
    border-radius: 12px;
    padding: 16px 18px 14px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.8);
    z-index: 1;
    font-size: 13px;
}

.update-modal-title {
    margin: 0 0 8px;
    font-size: 15px;
    font-weight: 600;
}

.update-modal-dialog pre {
    margin: 6px 0 10px;
    padding: 6px 8px;
    background: rgba(15, 23, 42, 0.9);
    border-radius: 6px;
    font-size: 11px;
    overflow-x: auto;
}

.update-modal-close-btn {
    margin-top: 4px;
    padding: 4px 10px;
    border-radius: 999px;
    border: none;
    font-size: 11px;
    cursor: pointer;
}


  

.brand {
    font-weight: 800;
    letter-spacing: .5px;
    margin-bottom: 18px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.nav-top {
    display: flex;
    flex-direction: column;
}

.nav-bottom {
    margin-top: auto; /* pushes this section to the bottom of sidebar */
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15); /* subtle separator */
    text-align: center;
}

.sidebar a {
    display: block;
    padding: 10px;
    margin: 6px 0;
    color: var(--text);
    text-decoration: none;
    border-radius: 10px;
}

.sidebar a:hover {
    background: rgba(255,255,255,.06);
}

/* ======================
   MAIN CONTENT
   ====================== */

.main {
    flex: 1;
    padding: 26px;
}

h1 {
    margin: 0 0 14px 0;
}

h2 {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: var(--muted);
}

/* ======================
   CARDS / LAYOUT
   ====================== */

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px;
    margin: 14px 0;
    box-shadow: 0 10px 30px rgba(0,0,0,.25);
}

.row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.col {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.grid3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
}

@media (max-width: 900px) {
    .grid2 {
        grid-template-columns: 1fr;
    }
}

/* ======================
   FORMS
   ====================== */

label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
}

input,
select {
    background: var(--panel);  
    border: 1px solid var(--line);
    color: var(--text);
    padding: 10px;
    border-radius: 10px;
    outline: none;
}

input:focus,
select:focus {
    border-color: var(--btn);
}

.btn {
    background: var(--btn);
    border: none;
    color: white;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.btn:hover {
    filter: brightness(1.05);
}

.btn.danger {
    background: var(--danger);
}

.btn.success {
    background: var(--success);
}

/* Special button color for Mutual Aid QR */
.btn.qr {
    background: #7c3aed;
}

/* ======================
   SEGMENTED CONTROL
   ====================== */

.segmented {
    display:flex;
    gap:8px;
    flex-wrap:wrap;
}

.segBtn {
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    font-weight: 600;
}

.segBtn:hover {
    filter: brightness(1.03);
}

.segBtn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* Ensure good contrast in modal segmented controls */
.modal .segBtn {
    color: var(--text);
}

/* ======================
   TABLES
   ====================== */

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    border-top: 1px solid var(--line);
    padding: 10px;
    text-align: left;
}

.table thead th {
    border-top: none;
    color: var(--muted);
    font-size: 12px;
}

/* ======================
   CHECKLIST BOX (reused)
   ====================== */

.groupsBox {
    margin-top: 10px;
    border: 1px solid var(--line);
    background: var(--panel);
    border-radius: 12px;
    padding: 10px;
    max-height: 360px;
    overflow: auto;
}

.groupItem {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: 10px;
    cursor: pointer;
    user-select: none;
}

.groupItem:hover {
    background: rgba(255,255,255,.06);
}

.groupItem input {
    margin: 0;
    width: 16px;
    height: 16px;
    flex: 0 0 auto;
}

.groupItem span {
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ======================
   MESSAGES
   ====================== */

.msg {
    margin-left: 10px;
}

.msg.ok {
    color: #5bff8a;
}

.msg.bad {
    color: #ff7a7a;
}

/* ======================
   MODALS
   ====================== */

.modalOverlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    z-index: 1000;
}

.modal {
    width: min(1100px, 96vw);
    max-height: 92vh;
    overflow: auto;
    border: 1px solid var(--line);
    background: var(--panel);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0,0,0,.45);
}

.modalHeader {
    position: sticky;
    top: 0;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    padding: 14px;
    display: flex;
    justify-content: space-between;
}

.modalBody {
    padding: 14px;
}

.noScroll {
    overflow: hidden;
}

/* =========================================================
   MOBILE SIDEBAR TOGGLE
   ========================================================= */

.sidebarToggle {
    display: none;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 1101;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--text);
    cursor: pointer;
    font-weight: 700;
}

.sidebarOverlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 1100;
}

@media (max-width: 990px) {

    .sidebarToggle {
        display: inline-flex;
        align-items: center;
        gap: 8px;
    }

    .sidebarOverlay {
        display: block;
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease;
    }

    .sidebar {
        display: flex !important;      /* keep flex so nav-bottom stays at bottom */
        flex-direction: column;
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 240px;
        transform: translateX(-105%);
        transition: transform .2s ease;
        z-index: 1102;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    body.sidebar-open .sidebarOverlay {
        opacity: 1;
        pointer-events: auto;
    }

    .main {
        padding-top: 64px;
    }
}

/* ======================
   SETTINGS PAGE HELPERS
   ====================== */

.settings-field {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.settings-label {
    font-weight: 600;
}

.settings-help {
    font-size: 0.8rem;
    opacity: 0.8;
}

/* ======================
   SETUP MY DEVICE
   ====================== */

.btn.tile {
    width: 100%;
    padding: 18px 16px;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    text-align: left;
}

.btn.tile .title {
    font-size: 16px;
    font-weight: 700;
}

.btn.tile .desc {
    font-size: 13px;
    font-weight: 500;
    opacity: 0.9;
    line-height: 1.25;
}

