/* ═══════════════════════════════════════════════════════
   TRUCount Pro — Application Shell Styles
   ═══════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary:       #1a56db;
    --primary-hover:  #1444b0;
    --primary-light:  #e8effc;
    --bg:            #f1f5f9;
    --surface:       #ffffff;
    --text:          #1f2937;
    --text-muted:    #6b7280;
    --text-light:    #94a3b8;
    --border:        #e2e8f0;
    --danger:        #dc2626;
    --success:       #16a34a;
    --warning:       #f59e0b;
    --radius:        8px;
    --radius-sm:     6px;
    --shadow-sm:     0 1px 2px rgba(0,0,0,.05);
    --shadow:        0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-lg:     0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
    --transition:    0.15s ease;

    /* Form controls (match auth/login fields app-wide) */
    --form-control-padding-y: 12px;
    --form-control-padding-x: 14px;
    --form-control-min-height: 44px;
    --form-control-border: #94a3b8;

    /* Layout */
    --sidebar-width:  260px;
    --sidebar-bg:     #0f172a;
    --sidebar-text:   #cbd5e1;
    --sidebar-hover:  #1e293b;
    --sidebar-active: #1a56db;
    --header-height:  64px;

    /* Table headers */
    --table-head-bg:     #e2e8f0;
    --table-head-text:   #334155;
    --table-head-border: #94a3b8;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ── App Layout (sidebar + header + content) ────────── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    overflow-y: auto;
    z-index: 100;
    transition: transform var(--transition);
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--header-height);
    min-height: var(--header-height);
    max-height: var(--header-height);
    padding: 10px 16px;
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--surface);
    overflow: hidden;
    box-sizing: border-box;
}

.sidebar-logo {
    max-height: 100%;
    max-width: 100%;
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
}

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

.sidebar-group-label {
    padding: 16px 20px 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #475569;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 14px;
    transition: all var(--transition);
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: #fff;
}

.sidebar-link.active {
    background: rgba(26,86,219,.15);
    color: #fff;
    border-left-color: var(--sidebar-active);
}

.sidebar-link svg {
    flex-shrink: 0;
    opacity: .7;
}

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

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

/* ── Header ──────────────────────────────────────────── */
.app-header {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--header-height);
    min-height: var(--header-height);
    max-height: var(--header-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-sizing: border-box;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    cursor: pointer;
    color: var(--text);
    font-size: 18px;
    line-height: 1;
}

.header-page-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* ── Account Dropdown ────────────────────────────────── */
.account-dropdown {
    position: relative;
}

.account-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 14px;
    color: var(--text);
    transition: all var(--transition);
}

.account-trigger:hover {
    background: var(--bg);
    border-color: #cbd5e1;
}

.account-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
}

.account-info {
    text-align: left;
    line-height: 1.3;
}

.account-name {
    font-weight: 500;
    font-size: 13px;
}

.account-role {
    font-size: 11px;
    color: var(--text-muted);
}

.account-chevron {
    transition: transform var(--transition);
}

.account-dropdown.open .account-chevron {
    transform: rotate(180deg);
}

.account-menu {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: 220px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 6px 0;
    z-index: 200;
}

.account-dropdown.open .account-menu {
    display: block;
}

.account-menu-link {
    display: block;
    padding: 8px 16px;
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    transition: background var(--transition);
}

.account-menu-link:hover {
    background: var(--bg);
    color: var(--primary);
}

.account-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

.account-menu-link.danger {
    color: var(--danger);
}

.account-menu-link.danger:hover {
    background: #fef2f2;
}

/* ── Content Area ────────────────────────────────────── */
.app-content {
    flex: 1;
    padding: 28px 32px;
}

.content-header {
    margin-bottom: 24px;
}

.content-header h1 {
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.content-header p {
    color: var(--text-muted);
    font-size: 14px;
}

/* ── Cards ───────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

/* ── Alerts / Flash Messages ─────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 14px;
}
.alert-danger  { background: #fef2f2; color: var(--danger);  border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }
.alert-warning { background: #fffbeb; color: #92400e;        border: 1px solid #fde68a; }
.alert-info    { background: #eff6ff; color: var(--primary);  border: 1px solid #bfdbfe; }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    line-height: 1.4;
}
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e2e8f0; }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm        { padding: 6px 14px; font-size: 13px; }
.btn-block     { width: 100%; }

.btn-link {
    display: inline;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-weight: 500;
    color: var(--primary);
    text-decoration: underline;
    cursor: pointer;
}

.btn-link:hover {
    color: var(--primary-hover);
}

/* ── Forms ───────────────────────────────────────────── */
button, input, select, textarea {
    font-family: inherit;
}

fieldset { border: 0; padding: 0; margin: 0; }

legend {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    padding: 0;
    margin-bottom: 12px;
}

.form-group { margin-bottom: 18px; }

.form-group label,
.form-label {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

/* Checkbox/radio rows keep label + control inline */
.form-group label:has(input[type="checkbox"]),
.form-group label:has(input[type="radio"]) {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    cursor: pointer;
}

/* Base look for every text-like control, classed or not */
.form-input,
input[type="text"],
input[type="search"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input:not([type]),
select,
textarea {
    padding: var(--form-control-padding-y) var(--form-control-padding-x);
    border: 1px solid var(--form-control-border);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    line-height: 1.45;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:hover:not(:disabled):not([readonly]),
input[type="text"]:hover:not(:disabled):not([readonly]),
input[type="search"]:hover:not(:disabled):not([readonly]),
input[type="email"]:hover:not(:disabled):not([readonly]),
input[type="password"]:hover:not(:disabled):not([readonly]),
input[type="number"]:hover:not(:disabled):not([readonly]),
input[type="url"]:hover:not(:disabled):not([readonly]),
input[type="tel"]:hover:not(:disabled):not([readonly]),
input[type="date"]:hover:not(:disabled):not([readonly]),
input[type="time"]:hover:not(:disabled):not([readonly]),
input[type="datetime-local"]:hover:not(:disabled):not([readonly]),
input:not([type]):hover:not(:disabled):not([readonly]),
select:hover:not(:disabled),
textarea:hover:not(:disabled):not([readonly]) {
    border-color: #64748b;
}

/* Single-line controls — comfortable tap/click target (login page sizing) */
.form-input,
input[type="text"],
input[type="search"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input:not([type]),
select:not([multiple]) {
    min-height: var(--form-control-min-height);
}

/* Controls stretch to their container inside forms */
.form-input,
.form-group input:not([type="checkbox"]):not([type="radio"]),
.form-group select,
.form-group textarea,
.arf-field input:not([type="checkbox"]):not([type="radio"]),
.arf-field select,
.arf-field textarea,
.alerts-form label input:not([type="checkbox"]):not([type="radio"]),
.alerts-form label select,
.alerts-form label textarea {
    width: 100%;
    box-sizing: border-box;
}

textarea {
    resize: vertical;
    min-height: calc(var(--form-control-min-height) * 2);
    line-height: 1.5;
}

select:not([multiple]) {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%236b7280' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 38px;
}

.form-input:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,86,219,.12);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-light);
}

input:disabled,
select:disabled,
textarea:disabled,
input[readonly] {
    background: var(--bg);
    color: var(--text-muted);
    cursor: not-allowed;
}

input[type="checkbox"],
input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

.form-hint,
.help-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 5px;
    line-height: 1.5;
}

/* Two-column responsive field layout (used on edit/create forms) */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px 20px;
}
.form-grid .form-group { margin-bottom: 0; }

/* Button row at the bottom of a form */
.form-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    padding-top: 8px;
}

/* Grouped section of fields inside a form */
.form-section { margin-bottom: 24px; }

/* Panel-style sections (multi-section create/edit forms) */
.form-section-panel {
    padding: 18px 20px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
}
.form-section-panel legend { margin-bottom: 4px; }
.form-section-intro {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0 0 16px;
    line-height: 1.55;
    max-width: 72ch;
}
.form-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.form-checkbox-list label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 0;
}
.form-checkbox-list .checkbox-caption {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 2px;
    line-height: 1.45;
}
.form-legacy {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px dashed var(--border);
    font-size: 13px;
    color: var(--text-muted);
}
.form-legacy summary {
    cursor: pointer;
    font-weight: 500;
    color: var(--text-muted);
    user-select: none;
}
.form-legacy[open] summary { margin-bottom: 12px; }
.alert-rule-form .form-actions {
    margin-top: 4px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* Required / optional label marks */
.required-mark { color: var(--danger); font-weight: 600; }
.optional-mark { color: var(--text-muted); font-weight: 400; font-size: 12px; }

/* Step indicator strip at the top of multi-step forms */
.form-steps {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 20px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text-muted);
}
.form-steps .form-step.active { color: var(--text); }
.form-steps .form-step-arrow { color: var(--text-light); }

/* Compact controls inside data tables (mapping rows, admin grids) */
.data-table input:not([type="checkbox"]):not([type="radio"]),
.data-table select {
    width: 100%;
    min-width: 64px;
    min-height: auto;
    padding: 8px 10px;
    font-size: 12.5px;
}
.data-table select:not([multiple]) {
    padding-right: 26px;
    background-position: right 8px center;
}

/* Data tables (listing pages, measurement editors) */
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th,
.data-table td {
    padding: 9px 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}
.data-table thead th {
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--table-head-text);
    background: var(--table-head-bg);
    border-bottom: 2px solid var(--table-head-border);
    white-space: nowrap;
}
.data-table tbody tr:hover td { background: #f8fafc; }

/* ── Auth Layout (centered cards) ────────────────────── */
.auth-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: var(--bg);
}

.auth-container {
    width: 100%;
    max-width: 420px;
}

.auth-brand {
    text-align: center;
    margin-bottom: 32px;
}

.auth-brand h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.auth-brand p {
    color: var(--text-muted);
    font-size: 15px;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-muted);
}

.auth-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.auth-logo {
    max-width: 220px;
    height: auto;
    margin-bottom: 8px;
}

.auth-container--wide {
    max-width: 520px;
}

.auth-intro {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.auth-footer--stacked {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
}

.auth-footer--legal {
    margin-top: 8px;
    font-size: 12px;
}

.btn-text-link {
    font-size: 13px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
    font-weight: 400;
}

/* ── TOTP / 2FA setup ────────────────────────────────── */
.totp-steps {
    padding-left: 22px;
    margin: 0;
    font-size: 14px;
    line-height: 1.7;
}

.totp-step {
    margin-bottom: 18px;
}

.totp-step:last-child {
    margin-bottom: 0;
}

.totp-step-detail {
    color: var(--text-muted);
    margin-top: 4px;
    font-size: 13px;
}

.totp-setup-row {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    align-items: stretch;
    margin-top: 12px;
}

.totp-qr-wrap {
    display: flex;
    justify-content: center;
    margin-top: 10px;
}

.totp-qr-box {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    background: #fff;
    line-height: 0;
    min-width: 216px;
    min-height: 216px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.totp-secret-panel {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    background: #f8fafc;
    flex: 1;
    min-width: 260px;
    margin-top: 10px;
}

.totp-setup-row .totp-secret-panel {
    margin-top: 0;
}

.totp-secret-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-light);
    margin-bottom: 6px;
}

.totp-secret-value {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 15px;
    letter-spacing: 2px;
    word-break: break-all;
    user-select: all;
}

.totp-secret-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.totp-secret-note {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 10px;
}

.totp-code-input {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    letter-spacing: 4px;
    text-align: center;
    font-size: 20px;
}

.totp-code-input--plain {
    letter-spacing: 2px;
    text-align: left;
    font-size: 14px;
}

.totp-code-form {
    margin-top: 10px;
}

.totp-code-form .form-group {
    max-width: 240px;
}

.form-group--narrow {
    max-width: 240px;
}

/* ── Callouts, card headings, code blocks ───────────── */
.callout {
    font-size: 13px;
    color: var(--text-muted);
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin-bottom: 16px;
    line-height: 1.6;
}

.callout strong {
    color: var(--text);
}

.callout--warning {
    background: #fef3c7;
    border-color: #fde68a;
    color: #92400e;
}

.callout--warning strong {
    color: #92400e;
}

.mt-key-hint {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    line-height: 1.4;
    color: var(--danger, #b91c1c);
    max-width: 160px;
}

.mt-key-input.is-invalid {
    border-color: var(--danger, #dc2626);
}

.code-block {
    background: #f3f4f6;
    padding: 12px;
    border-radius: var(--radius);
    overflow: auto;
    font-size: 13px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.card-heading {
    font-size: 17px;
    font-weight: 600;
    margin: 0 0 6px;
}

.card-lead {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0 0 14px;
}

/* ── Recovery codes ──────────────────────────────────── */
.recovery-codes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px 16px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 14px;
}

.recovery-codes-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.form-checkbox-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
    cursor: pointer;
}

.form-checkbox-row input {
    margin-top: 3px;
}

/* ── Error / Status Pages ────────────────────────────── */
.error-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
}

.error-page .error-code {
    font-size: 72px;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 8px;
}

.error-page p {
    color: var(--text-muted);
    margin-bottom: 24px;
    font-size: 16px;
}

.error-page a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.error-page a:hover {
    text-decoration: underline;
}

/* ── Dev Tools Banner ────────────────────────────────── */
.dev-banner {
    background: #fef3c7;
    border: 1px solid #fde68a;
    color: #92400e;
    padding: 8px 16px;
    font-size: 13px;
    text-align: center;
    font-weight: 500;
}

.dev-banner a {
    color: #92400e;
    text-decoration: underline;
}

/* ── Role Badge ──────────────────────────────────────── */
.role-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.5;
}
.role-badge.super-admin    { background: #fef2f2; color: #dc2626; }
.role-badge.installer-admin { background: #eff6ff; color: #1a56db; }
.role-badge.customer-admin  { background: #f0fdf4; color: #16a34a; }
.role-badge.readonly        { background: #f1f5f9; color: #475569; }
.role-badge.installer       { background: #eff6ff; color: #1a56db; }
.role-badge.company         { background: #f0fdf4; color: #16a34a; }
.role-badge.user            { background: #f1f5f9; color: #475569; }

/* ── Deliverable List (on placeholder pages) ─────────── */
.deliverable-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 8px 24px;
}

.deliverable-list li {
    position: relative;
    padding: 8px 12px 8px 28px;
    font-size: 14px;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    line-height: 1.4;
}

.deliverable-list li::before {
    content: "";
    position: absolute;
    left: 6px;
    top: 50%;
    width: 14px;
    height: 14px;
    margin-top: -7px;
    border: 1.5px solid var(--border);
    border-radius: 3px;
    background: var(--surface);
}

/* ── Placeholder Page Content ────────────────────────── */
.placeholder-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    text-align: center;
    color: var(--text-muted);
}

.placeholder-content .placeholder-icon {
    width: 64px;
    height: 64px;
    background: var(--bg);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.placeholder-content .placeholder-icon svg {
    width: 28px;
    height: 28px;
    color: var(--text-light);
}

.placeholder-content p {
    font-size: 14px;
}

/* ── Utilities ───────────────────────────────────────── */
.text-center  { text-align: center; }
.text-muted   { color: var(--text-muted); }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-0 { margin-bottom: 0; }
.m-0  { margin: 0; }

/* ── Responsive ──────────────────────────────────────── */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 90;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .sidebar-overlay.open {
        display: block;
    }

    .app-main {
        margin-left: 0;
    }

    .sidebar-toggle {
        display: block;
    }

    .app-content {
        padding: 20px 16px;
    }

    .account-info {
        display: none;
    }
}

@media (max-width: 480px) {
    .auth-container {
        max-width: 100%;
    }

    .card {
        padding: 16px;
    }
}

/* ── Admin tables (feature switches, role grid, account overrides) ─── */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.admin-table th,
.admin-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: middle;
}

.admin-table th {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--table-head-text);
    background: var(--table-head-bg);
    border-bottom: 2px solid var(--table-head-border);
}

.admin-table tr:hover td {
    background: #f8fafc;
}

.admin-table input[type="text"],
.admin-table input[type="number"],
.admin-table select {
    width: 100%;
    min-height: auto;
    padding: 6px 8px;
    border: 1px solid var(--form-control-border, #94a3b8);
    border-radius: var(--radius-sm);
    font-size: 13px;
}

.admin-table select:not([multiple]) {
    padding-right: 26px;
    background-position: right 8px center;
}

.admin-table input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.admin-section-heading {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--text-light);
    margin: 24px 0 10px;
}

.admin-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.admin-toolbar select {
    padding: 8px 34px 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    min-width: 220px;
}

.page-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.filter-bar {
    margin-bottom: 16px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: end;
}

.search-bar input[type="search"] {
    min-width: 240px;
}

.form-display-inline {
    display: inline;
}

/* Pill toggle (label inside admin tables) */
.pill-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
}
.pill-toggle.on  { background: #f0fdf4; color: var(--success); }
.pill-toggle.off { background: #fef2f2; color: var(--danger); }

.pill-toggle.dev {
    background: #fef3c7;
    color: #92400e;
}

/* Inline forms used for single-row toggles */
.inline-form {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
}
.inline-form button {
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    font: inherit;
    color: inherit;
}

/* ── Session guard modals ─────────────────────────────── */
.session-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.session-modal.is-open {
    display: flex;
}

.session-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
}

.session-modal--blocking .session-modal__backdrop {
    background: rgba(15, 23, 42, 0.65);
}

.session-modal__panel {
    position: relative;
    width: min(100%, 420px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 24px;
}

.session-modal__title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 8px;
}

.session-modal__text {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 20px;
}

.session-modal__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
