/* ─────────────────────────────────────────────
   MyApps — Portal CSS
   Mobile-first. Dark mode default.
   Light mode via [data-theme="light"] on <html>.
───────────────────────────────────────────── */

/* ── Reset & base ────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* Brand */
    --sidebar:       #0A1F38;
    --sidebar-mid:   #0F2D52;
    --sidebar-light: #163D6E;
    --accent:        #0D7377;
    --accent-hover:  #14919B;

    /* Dark mode (default) */
    --bg:            #0d1829;
    --bg-card:       #0F2D52;
    --bg-card-alt:   #163D6E;
    --bg-input:      rgba(255,255,255,0.06);
    --border:        rgba(255,255,255,0.09);
    --border-input:  rgba(255,255,255,0.13);
    --text:          #ffffff;
    --text-2:        rgba(255,255,255,0.45);
    --text-3:        rgba(255,255,255,0.25);
    --card-name:     #ffffff;
    --card-desc:     rgba(255,255,255,0.42);
    --topbar-bg:     #0A1F38;
    --topbar-border: rgba(255,255,255,0.07);
    --pill-bg:       rgba(255,255,255,0.08);
    --pill-border:   rgba(255,255,255,0.12);
    --pill-text:     rgba(255,255,255,0.65);
    --nav-text:      rgba(255,255,255,0.5);
    --nav-active:    #ffffff;
    --search-bg:     rgba(255,255,255,0.06);
    --search-border: rgba(255,255,255,0.10);
    --search-text:   rgba(255,255,255,0.28);
    --section-label: rgba(255,255,255,0.28);
    --toast-shadow:  rgba(0,0,0,0.4);

    /* Typography */
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

    /* Layout */
    --sidebar-w:     200px;
    --topbar-h:      52px;
    --bottomnav-h:   58px;
    --radius-card:   12px;
    --radius-btn:    8px;
    --radius-input:  8px;
    --transition:    0.18s ease;
}

/* ── Light mode overrides ────────────────────── */
[data-theme="light"] {
    --bg:            #f0f4f8;
    --bg-card:       #ffffff;
    --bg-card-alt:   #e8f0fb;
    --bg-input:      #ffffff;
    --border:        rgba(0,0,0,0.12);
    --border-input:  rgba(0,0,0,0.20);
    --text:          #0A1F38;
    --text-2:        #3a5272;
    --text-3:        #6b8299;
    --card-name:     #0A1F38;
    --card-desc:     #3a5272;
    --topbar-bg:     #0A1F38;
    --topbar-border: rgba(255,255,255,0.07);
    --pill-bg:       rgba(255,255,255,0.10);
    --pill-border:   rgba(255,255,255,0.15);
    --pill-text:     rgba(255,255,255,0.7);
    --nav-text:      rgba(255,255,255,0.5);
    --nav-active:    #ffffff;
    --search-bg:     #ffffff;
    --search-border: rgba(0,0,0,0.18);
    --search-text:   #6b8299;
    --section-label: #3a5272;
    --toast-shadow:  rgba(0,0,0,0.15);
}

/* ── Base ────────────────────────────────────── */
html, body {
    height: 100%;
    font-family: var(--font);
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background var(--transition), color var(--transition);
}

a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; font-family: var(--font); }

/* ── App shell ───────────────────────────────── */
.app-shell {
    display: flex;
    height: 100dvh;
    overflow: hidden;
}

/* ── Sidebar (desktop only) ──────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    z-index: 10;
}

.sb-header {
    padding: 20px 16px 0;
}

.sb-logo-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}

.sb-logo {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.sb-appname {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    letter-spacing: -0.01em;
}

.sb-accent-bar {
    height: 2px;
    background: var(--accent);
    margin: 0 16px 20px;
    opacity: 0.5;
    border-radius: 1px;
}

.sb-nav {
    flex: 1;
    padding: 0 10px;
}

.sb-section {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.28);
    padding: 0 6px;
    margin-bottom: 6px;
}

.sb-item {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    color: var(--nav-text);
    padding: 8px 8px;
    border-radius: 7px;
    margin-bottom: 2px;
    transition: background var(--transition), color var(--transition);
    text-decoration: none;
    border-left: 2px solid transparent;
}

.sb-item:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

.sb-item.active {
    color: var(--nav-active);
    background: rgba(255,255,255,0.08);
    border-left-color: var(--accent);
    padding-left: 6px;
}

.sb-item .sb-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.sb-bottom {
    padding: 14px 16px;
    border-top: 0.5px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sb-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sb-avatar {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

.sb-username {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100px;
}

.theme-btn {
    background: none;
    border: none;
    font-size: 16px;
    opacity: 0.55;
    padding: 4px;
    border-radius: 6px;
    transition: opacity var(--transition);
    flex-shrink: 0;
}
.theme-btn:hover { opacity: 1; }

/* ── Main area ───────────────────────────────── */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ── Topbar ──────────────────────────────────── */
.topbar {
    height: var(--topbar-h);
    background: var(--topbar-bg);
    border-bottom: 0.5px solid var(--topbar-border);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 12px;
    flex-shrink: 0;
    z-index: 5;
}

.topbar-title {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    flex: 1;
    letter-spacing: -0.01em;
}

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

.topbar-theme-btn {
    background: none;
    border: none;
    font-size: 17px;
    opacity: 0.6;
    padding: 4px;
    border-radius: 6px;
    transition: opacity var(--transition);
    cursor: pointer;
}
.topbar-theme-btn:hover { opacity: 1; }

.user-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--pill-bg);
    border: 0.5px solid var(--pill-border);
    border-radius: 20px;
    padding: 4px 10px 4px 6px;
}

.user-pill-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: #fff;
    flex-shrink: 0;
}

.user-pill-name {
    font-size: 12px;
    color: var(--pill-text);
    white-space: nowrap;
}

/* ── Page content ────────────────────────────── */
.page-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px 24px 24px;
    padding-bottom: calc(24px + var(--bottomnav-h));   /* clearance for mobile bottom nav */
}

/* ── Home page ───────────────────────────────── */
.home-greeting {
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.home-subgreeting {
    font-size: 13px;
    color: var(--text-2);
    margin-bottom: 22px;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--search-bg);
    border: 0.5px solid var(--search-border);
    border-radius: 10px;
    padding: 11px 14px;
    margin-bottom: 28px;
    transition: border-color var(--transition);
}

.search-bar:focus-within {
    border-color: var(--accent);
}

.search-icon {
    font-size: 15px;
    color: var(--text-3);
    flex-shrink: 0;
}

.search-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    font-size: 14px;
    font-family: var(--font);
    color: var(--text);
}

.search-input::placeholder { color: var(--search-text); }

.apps-section-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--section-label);
    margin-bottom: 12px;
}

/* ── App cards grid ──────────────────────────── */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.app-card {
    border-radius: var(--radius-card);
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: 110px;
    text-decoration: none;
    transition: transform var(--transition), opacity var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.app-card:hover {
    transform: translateY(-2px);
    opacity: 0.92;
}

.app-card:active {
    transform: translateY(0);
    opacity: 0.8;
}

.app-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.app-card-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--card-name);
    margin-bottom: 3px;
}

.app-card-desc {
    font-size: 11px;
    color: var(--card-desc);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-2);
}
.empty-state-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.5; }
.empty-state-title { font-size: 15px; font-weight: 500; margin-bottom: 6px; color: var(--text); }
.empty-state-sub { font-size: 13px; }

/* ── Settings page ───────────────────────────── */
.settings-section {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    border: 0.5px solid var(--border);
    margin-bottom: 16px;
    overflow: hidden;
}

[data-theme="light"] .settings-section {
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.settings-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-2);
    padding: 14px 16px 10px;
    border-bottom: 0.5px solid var(--border);
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    gap: 12px;
    border-bottom: 0.5px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }

.settings-row-label {
    font-size: 13px;
    color: var(--text);
}

.settings-row-sub {
    font-size: 11px;
    color: var(--text-2);
    margin-top: 2px;
}

.settings-select {
    background: var(--bg-input);
    border: 0.5px solid var(--border-input);
    border-radius: 7px;
    color: var(--text);
    font-size: 13px;
    font-family: var(--font);
    padding: 7px 10px;
    outline: none;
    cursor: pointer;
    min-width: 120px;
}

.settings-input {
    background: var(--bg-input);
    border: 0.5px solid var(--border-input);
    border-radius: 7px;
    color: var(--text);
    font-size: 13px;
    font-family: var(--font);
    padding: 8px 12px;
    outline: none;
    width: 100%;
    transition: border-color var(--transition);
}
.settings-input:focus { border-color: var(--accent); }

.settings-input-wrap {
    flex: 1;
    max-width: 240px;
}

/* ── Buttons ─────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    border-radius: var(--radius-btn);
    font-size: 13px;
    font-weight: 500;
    font-family: var(--font);
    padding: 9px 18px;
    cursor: pointer;
    transition: opacity var(--transition), transform var(--transition);
    text-decoration: none;
    white-space: nowrap;
}
.btn:hover { opacity: 0.88; }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: default; }

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-ghost {
    background: transparent;
    border: 0.5px solid var(--border-input);
    color: var(--text);
}

.btn-danger {
    background: #c0392b;
    color: #fff;
}

.btn-full { width: 100%; }
.btn-sm { padding: 6px 13px; font-size: 12px; }

/* ── Login page ──────────────────────────────── */
.login-page {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sidebar);
    padding: 24px;
}

.login-card {
    background: rgba(255,255,255,0.04);
    border: 0.5px solid rgba(255,255,255,0.1);
    border-radius: 16px;
    padding: 36px 32px;
    width: 100%;
    max-width: 360px;
}

.login-logo-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 18px;
}

.login-logo {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
}

.login-title {
    text-align: center;
    font-size: 20px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 4px;
    letter-spacing: -0.02em;
}

.login-tagline {
    text-align: center;
    font-size: 13px;
    color: rgba(255,255,255,0.38);
    margin-bottom: 28px;
}

.login-field {
    margin-bottom: 12px;
}

.login-label {
    display: block;
    font-size: 12px;
    color: rgba(255,255,255,0.5);
    margin-bottom: 6px;
}

.login-input {
    width: 100%;
    background: rgba(255,255,255,0.07);
    border: 0.5px solid rgba(255,255,255,0.13);
    border-radius: var(--radius-input);
    color: #fff;
    font-size: 14px;
    font-family: var(--font);
    padding: 11px 14px;
    outline: none;
    transition: border-color var(--transition);
}
.login-input:focus { border-color: var(--accent); }
.login-input::placeholder { color: rgba(255,255,255,0.22); }

.login-btn {
    width: 100%;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-btn);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font);
    padding: 12px;
    margin-top: 8px;
    cursor: pointer;
    transition: background var(--transition), opacity var(--transition);
    letter-spacing: 0.01em;
}
.login-btn:hover { background: var(--accent-hover); }
.login-btn:disabled { opacity: 0.5; cursor: default; }

.login-error {
    background: rgba(192,57,43,0.18);
    border: 0.5px solid rgba(192,57,43,0.4);
    border-radius: 7px;
    color: #ff8a7a;
    font-size: 12px;
    padding: 10px 12px;
    margin-top: 12px;
    display: none;
}
.login-error.visible { display: block; }

/* ── Bottom navigation (mobile) ──────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bottomnav-h);
    background: var(--sidebar);
    border-top: 0.5px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 20;
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

.bn-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    flex: 1;
    padding: 6px 0;
    text-decoration: none;
    opacity: 0.42;
    transition: opacity var(--transition);
    cursor: pointer;
    background: none;
    border: none;
    font-family: var(--font);
}
.bn-item:hover, .bn-item.active { opacity: 1; }

.bn-icon { font-size: 20px; }

.bn-label {
    font-size: 9px;
    color: #fff;
    letter-spacing: 0.02em;
}
.bn-item.active .bn-label { color: var(--accent); }

.bn-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent);
    margin-top: 1px;
}

/* ── Toast ───────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: calc(var(--bottomnav-h) + 12px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: #1e2d3d;
    border: 0.5px solid rgba(255,255,255,0.12);
    color: #fff;
    font-size: 13px;
    padding: 10px 18px;
    border-radius: 20px;
    box-shadow: 0 4px 20px var(--toast-shadow);
    opacity: 1;
    transition: opacity 0.4s ease;
    white-space: nowrap;
}
.toast.success { border-color: rgba(13,115,119,0.6); }
.toast.error   { border-color: rgba(192,57,43,0.6); color: #ff8a7a; }
.toast.fade-out { opacity: 0; }

/* ── Spinner ─────────────────────────────────── */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255,255,255,0.15);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Page transitions ────────────────────────── */
.page-fade-in {
    animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── Responsive — desktop ────────────────────── */
@media (min-width: 768px) {
    .sidebar { display: flex; }
    .bottom-nav { display: none; }
    .page-content { padding-bottom: 24px; }
    .apps-grid { grid-template-columns: repeat(3, 1fr); }
    .topbar-title { display: none; }   /* app name in sidebar on desktop */
}

@media (min-width: 1100px) {
    .apps-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ── Responsive — mobile ─────────────────────── */
@media (max-width: 767px) {
    .sidebar { display: none; }
    .bottom-nav { display: flex; }
    .page-content { padding: 16px 16px; padding-bottom: calc(16px + var(--bottomnav-h)); }
    .home-greeting { font-size: 18px; }
    .login-card { padding: 28px 22px; }
}

/* ── PWA safe area ───────────────────────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .bottom-nav {
        padding-bottom: env(safe-area-inset-bottom);
        height: calc(var(--bottomnav-h) + env(safe-area-inset-bottom));
    }
    .page-content {
        padding-bottom: calc(24px + var(--bottomnav-h) + env(safe-area-inset-bottom));
    }
}

/* ── Reduced motion ──────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* =====================================================
   USERS PAGE -- Expandable rows
   ===================================================== */

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.page-header-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
}

.page-header-sub {
    font-size: 12px;
    color: var(--text-2);
    margin-top: 2px;
}
[data-theme="light"] .page-header-sub  { color: #3a5272; }
[data-theme="light"] .page-header-title { color: #0A1F38; }
[data-theme="light"] .settings-block-title { color: #0A1F38; }
[data-theme="light"] .settings-block-sub   { color: #3a5272; }
[data-theme="light"] .settings-row-label   { color: #0A1F38; }
[data-theme="light"] .home-greeting        { color: #0A1F38; }
[data-theme="light"] .home-subgreeting     { color: #3a5272; }
[data-theme="light"] .apps-section-label   { color: #3a5272; }

/* Users list */
.users-list {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    border: 0.5px solid var(--border);
    overflow: hidden;
}

[data-theme="light"] .users-list {
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.user-row {
    border-bottom: 0.5px solid var(--border);
}
.user-row:last-child { border-bottom: none; }

.user-row-main {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    transition: background var(--transition);
    user-select: none;
}
.user-row-main:hover { background: rgba(255,255,255,0.03); }
[data-theme="light"] .user-row-main:hover { background: rgba(0,0,0,0.04); }
[data-theme="light"] .user-row-name { color: #0A1F38; }
[data-theme="light"] .user-row-sub  { color: #3a5272; }
[data-theme="light"] .user-chevron  { color: #3a5272; }
[data-theme="light"] .user-row { border-color: rgba(0,0,0,0.10); }
[data-theme="light"] .users-list { box-shadow: 0 1px 6px rgba(0,0,0,0.10); }
[data-theme="light"] .btn-xs { border-color: rgba(0,0,0,0.22); color: #0A1F38; }
[data-theme="light"] .btn-xs-primary { border-color: #0a5c5f; color: #0a5c5f; background: #d4f0ed; }
[data-theme="light"] .btn-xs-warning { border-color: #7a5000; color: #7a5000; background: #faebd4; }
[data-theme="light"] .btn-xs-danger  { border-color: #7a1212; color: #7a1212; background: #fad4d4; }

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

.user-row-info { flex: 1; min-width: 0; }

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

.user-row-sub {
    font-size: 11px;
    color: var(--text-2);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-row-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.user-chevron {
    font-size: 14px;
    color: var(--text-3);
    transition: transform 0.2s ease;
    line-height: 1;
}
.user-row.open .user-chevron { transform: rotate(180deg); }

/* Badge */
.badge {
    font-size: 10px;
    font-weight: 500;
    padding: 3px 9px;
    border-radius: 20px;
    white-space: nowrap;
}
.badge-active   { background: rgba(13,115,119,0.18); color: #45C4B0; }
.badge-inactive { background: rgba(255,255,255,0.08); color: var(--text-2); }
[data-theme="light"] .badge-active   { background: #b8e8da; color: #053328; }
[data-theme="light"] .badge-inactive { background: #ccc9c0; color: #2a2a28; }

/* Expanded detail area */
.user-row-detail {
    display: none;
    padding: 14px 16px 14px 64px;
    background: rgba(0,0,0,0.12);
    border-top: 0.5px solid var(--border);
    animation: slideDown 0.18s ease;
}
[data-theme="light"] .user-row-detail { background: #e2e9f2; border-top-color: rgba(0,0,0,0.10); }
.user-row.open .user-row-detail { display: block; }

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.user-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 20px;
    margin-bottom: 14px;
}

.user-detail-field { }
.user-detail-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-3);
    margin-bottom: 2px;
}
[data-theme="light"] .user-detail-label { color: #3a5272; font-weight: 600; }
[data-theme="light"] .user-detail-val   { color: #0A1F38; }
.user-detail-val {
    font-size: 12px;
    color: var(--text);
    font-weight: 500;
}

.user-detail-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-xs {
    font-size: 11px;
    padding: 5px 12px;
    border-radius: 6px;
    border: 0.5px solid var(--border-input);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    font-family: var(--font);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    transition: opacity var(--transition);
}
.btn-xs:hover { opacity: 0.75; }
.btn-xs-primary { border-color: var(--accent); color: var(--accent); }
.btn-xs-warning { border-color: #C8871A; color: #C8871A; }
.btn-xs-danger  { border-color: #c0392b; color: #c0392b; }

/* =====================================================
   SLIDE PANEL -- Add / Edit user
   ===================================================== */

.panel-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.panel-overlay.open {
    opacity: 1;
    pointer-events: all;
}

.slide-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: 420px;
    background: var(--sidebar);
    z-index: 101;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    overflow: hidden;
}
.slide-panel.open { transform: translateX(0); }

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 0.5px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

.panel-title {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}

.panel-close {
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    font-size: 20px;
    cursor: pointer;
    padding: 2px;
    line-height: 1;
    transition: color var(--transition);
}
.panel-close:hover { color: #fff; }

.panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.panel-field {
    margin-bottom: 16px;
}

.panel-label {
    display: block;
    font-size: 11px;
    color: rgba(255,255,255,0.5);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.panel-input {
    width: 100%;
    background: rgba(255,255,255,0.07);
    border: 0.5px solid rgba(255,255,255,0.13);
    border-radius: var(--radius-input);
    color: #fff;
    font-size: 13px;
    font-family: var(--font);
    padding: 10px 13px;
    outline: none;
    transition: border-color var(--transition);
}
.panel-input:focus { border-color: var(--accent); }
.panel-input::placeholder { color: rgba(255,255,255,0.2); }

.panel-select {
    width: 100%;
    background: rgba(255,255,255,0.07);
    border: 0.5px solid rgba(255,255,255,0.13);
    border-radius: var(--radius-input);
    color: #fff;
    font-size: 13px;
    font-family: var(--font);
    padding: 10px 13px;
    outline: none;
    cursor: pointer;
}

.panel-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.panel-section-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: rgba(255,255,255,0.3);
    margin: 20px 0 10px;
    padding-bottom: 6px;
    border-bottom: 0.5px solid rgba(255,255,255,0.08);
}

.panel-checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 0.5px solid rgba(255,255,255,0.06);
}
.panel-checkbox-row:last-child { border-bottom: none; }

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

.panel-checkbox-label {
    font-size: 13px;
    color: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    flex: 1;
}

.panel-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0;
}
.panel-toggle-label {
    font-size: 13px;
    color: rgba(255,255,255,0.8);
}

.panel-footer {
    padding: 16px 20px;
    border-top: 0.5px solid rgba(255,255,255,0.1);
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.panel-btn-save {
    flex: 1;
    background: var(--accent);
    border: none;
    border-radius: var(--radius-btn);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    font-family: var(--font);
    padding: 11px;
    cursor: pointer;
    transition: background var(--transition);
}
.panel-btn-save:hover { background: var(--accent-hover); }
.panel-btn-save:disabled { opacity: 0.5; cursor: default; }

.panel-btn-cancel {
    background: rgba(255,255,255,0.08);
    border: 0.5px solid rgba(255,255,255,0.15);
    border-radius: var(--radius-btn);
    color: rgba(255,255,255,0.7);
    font-size: 13px;
    font-family: var(--font);
    padding: 11px 18px;
    cursor: pointer;
}

/* =====================================================
   SETTINGS -- Sectioned layout
   ===================================================== */

.settings-page { max-width: 560px; }

.settings-block {
    margin-bottom: 24px;
}

.settings-block-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 0.5px solid var(--border);
}

.settings-block-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: rgba(13,115,119,0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    color: var(--accent);
    flex-shrink: 0;
}

.settings-block-titles { flex: 1; }

.settings-block-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.settings-block-sub {
    font-size: 11px;
    color: var(--text-2);
    margin-top: 1px;
}

.settings-card {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    border: 0.5px solid var(--border);
    overflow: hidden;
}
[data-theme="light"] .settings-card {
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 16px;
    gap: 12px;
    border-bottom: 0.5px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }

.settings-row-left { flex: 1; min-width: 0; }
.settings-row-label { font-size: 13px; color: var(--text); }
.settings-row-sub   { font-size: 11px; color: var(--text-2); margin-top: 2px; }

.settings-input {
    background: var(--bg-input);
    border: 0.5px solid var(--border-input);
    border-radius: 7px;
    color: var(--text);
    font-size: 13px;
    font-family: var(--font);
    padding: 8px 12px;
    outline: none;
    min-width: 180px;
    transition: border-color var(--transition);
}
.settings-input:focus { border-color: var(--accent); }

.settings-select {
    background: var(--bg-input);
    border: 0.5px solid var(--border-input);
    border-radius: 7px;
    color: var(--text);
    font-size: 13px;
    font-family: var(--font);
    padding: 8px 10px;
    outline: none;
    cursor: pointer;
    min-width: 140px;
}

.settings-block-footer {
    padding-top: 10px;
    display: flex;
    justify-content: flex-end;
}

.settings-full-col {
    padding: 14px 16px;
    border-bottom: 0.5px solid var(--border);
}
.settings-full-col:last-child { border-bottom: none; }

.settings-full-col .settings-input {
    width: 100%;
    min-width: unset;
    margin-top: 6px;
}

/* =====================================================
   UTILITY
   ===================================================== */

/* Show only on mobile (hidden on desktop) */
.mobile-only { display: flex; }
@media (min-width: 768px) { .mobile-only { display: none !important; } }

/* Theme button -- ensure icon is always visible */
.topbar-theme-btn,
.theme-btn {
    font-size: 18px;
    min-width: 32px;
    min-height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.topbar-theme-btn i,
.theme-btn i {
    font-size: 18px;
    line-height: 1;
}

/* Topbar on desktop -- no user pill needed (sidebar has it) */
@media (min-width: 768px) {
    .topbar { justify-content: flex-end; }
    .topbar-title { display: none; }
}

/* =====================================================
   ICON SYMBOLS -- no external font needed
   ===================================================== */
.sb-icon, .bn-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    display: inline-block;
}
.bn-icon { font-size: 20px; display: block; }
.theme-btn, .topbar-theme-btn { font-size: 18px; }
