/* Montra theme -- tokens matched directly from real Rebecca screenshots.
   Colors are read off the screenshots as closely as possible; nudge the
   --accent/--accent-dim pair first if the live app needs an exact brand hex. */

@font-face {
    font-family: "Vazirmatn";
    src: url("../fonts/Vazirmatn-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Vazirmatn";
    src: url("../fonts/Vazirmatn-Medium.woff2") format("woff2");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Vazirmatn";
    src: url("../fonts/Vazirmatn-SemiBold.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Vazirmatn";
    src: url("../fonts/Vazirmatn-Bold.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Vazirmatn";
    src: url("../fonts/Vazirmatn-ExtraBold.woff2") format("woff2");
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg: #000000;
    --surface: #1c1c1e;
    --surface-2: #232325;
    --input-bg: #141416;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.14);

    --text: #f2f2f3;
    --text-muted: #9a9a9e;
    --text-faint: #6c6c70;

    --accent: #e31c5f;       /* FAB, active nav, primary brand */
    --accent-dim: #7d1636;   /* login button -- same family, lower key */
    --accent-text: #ffffff;

    --status-active: #34c759;
    --status-onhold: #8b5cf6;
    --status-limited: #ef4444;
    --status-expired: #f43f5e;
    --status-online: #14b8a6;
    --status-neutral: #8a8a8e;

    --pill-onhold-bg: #4d4a2a;
    --pill-active-bg: #1f4430;
    --pill-total-bg: #2c2c2e;
    --pill-expired-bg: #4a2230;
    --pill-limited-bg: #4a3a20;
    --pill-data-bg: #1e3a52;
    --pill-online-bg: #16413c;

    --radius-lg: 20px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --radius-pill: 999px;

    --font: "Vazirmatn", "Segoe UI", Tahoma, sans-serif;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    direction: rtl;
}

body {
    min-height: 100vh;
    padding-bottom: 84px; /* leave room for the fixed bottom nav */
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
}

/* ---------- Top bar ---------- */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-4);
}

.topbar-icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
}

.topbar-crumb {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-muted);
    font-size: 15px;
    font-weight: 500;
}

.topbar-crumb .current {
    color: var(--text);
}

/* ---------- Card ---------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    margin: 0 var(--space-4) var(--space-4);
}

/* ---------- Login page ---------- */

.login-page {
    display: flex;
    justify-content: center;
    padding-top: 12vh;
}

.login-card {
    width: 100%;
    max-width: 420px;
}

.login-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-5);
}

.login-header-icons {
    display: flex;
    gap: var(--space-3);
    color: var(--text-muted);
}

.login-wordmark {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 20px;
    font-weight: 700;
}

.login-logo {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-title {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 var(--space-2);
}

.login-subtitle {
    color: var(--text-muted);
    margin: 0 0 var(--space-5);
    font-size: 14px;
}

.field-label {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: var(--space-2);
    display: block;
}

.field-input-wrap {
    position: relative;
    margin-bottom: var(--space-4);
}

.field-input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text);
    padding: 16px var(--space-4);
    padding-left: 44px;
    font-size: 15px;
    font-family: inherit;
}

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

.field-icon {
    position: absolute;
    left: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-faint);
}

.btn-primary {
    width: 100%;
    background: var(--accent-dim);
    color: var(--accent-text);
    border: none;
    border-radius: var(--radius-md);
    padding: 16px;
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    cursor: pointer;
}

.btn-primary:hover {
    filter: brightness(1.1);
}

/* ---------- Stat pills ---------- */

.pill-row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-bottom: var(--space-3);
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.pill-onhold { background: var(--pill-onhold-bg); color: #d7d38a; }
.pill-active { background: var(--pill-active-bg); color: #6fe3a0; }
.pill-total { background: var(--pill-total-bg); color: var(--text-muted); }
.pill-expired { background: var(--pill-expired-bg); color: #ff9fb2; }
.pill-limited { background: var(--pill-limited-bg); color: #f0c987; }
.pill-data { background: var(--pill-data-bg); color: #7ec4f0; }
.pill-online { background: var(--pill-online-bg); color: #5fd8c9; }

/* ---------- Auto-refresh row ---------- */

.refresh-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--text-muted);
    font-size: 13px;
    padding: var(--space-2) 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-4);
}

/* ---------- Search / action row ---------- */

.action-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.fab {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: none;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.icon-btn-round {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--border-strong);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.search-input-wrap {
    position: relative;
    flex: 1;
}

.search-input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    color: var(--text);
    padding: 12px 44px 12px var(--space-4);
    font-size: 14px;
    font-family: inherit;
}

.search-icon {
    position: absolute;
    right: var(--space-4);
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-faint);
}

/* ---------- List header ---------- */

.list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-4);
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: var(--space-2);
}

.list-header-left {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* ---------- User row ---------- */

.user-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    margin: 0 var(--space-4) var(--space-3);
}

.user-row-menu-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 0 var(--space-2);
}

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

.progress-track {
    height: 3px;
    background: var(--border);
    border-radius: var(--radius-pill);
    overflow: hidden;
    margin-bottom: var(--space-2);
}

.progress-fill {
    height: 100%;
    background: var(--status-active);
    border-radius: var(--radius-pill);
}

.progress-fill.full {
    background: var(--status-limited);
}

.user-row-stats {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 13px;
    color: var(--text-muted);
}

.user-row-pct {
    font-weight: 700;
}

.user-row-pct.full { color: var(--status-limited); }
.user-row-pct.normal { color: var(--status-active); }

.user-row-main {
    text-align: right;
    flex: 1;
}

.user-row-username {
    font-weight: 700;
    font-size: 15px;
    direction: ltr;
    display: block;
    text-align: right;
}

.user-row-status {
    font-size: 13px;
    font-weight: 600;
    margin-top: 2px;
}

.status-active-text { color: var(--status-active); }
.status-onhold-text { color: var(--status-onhold); }
.status-limited-text { color: var(--status-limited); }
.status-expired-text { color: var(--status-expired); }

.user-row-checkbox {
    width: 20px;
    height: 20px;
    border-radius: 5px;
    border: 1.5px solid var(--border-strong);
    background: transparent;
}

/* ---------- Bottom nav ---------- */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-around;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: var(--space-3) var(--space-2);
    z-index: 20;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: var(--text-muted);
    background: none;
    border: none;
}

.bottom-nav-item.active {
    color: var(--accent);
}

/* ---------- Context menu (action sheet) ---------- */

.context-menu-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 30;
    display: none;
}

.context-menu-backdrop.open {
    display: block;
}

.context-menu {
    position: absolute;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    min-width: 260px;
    padding: var(--space-2) 0;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
}

.context-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: 14px var(--space-4);
    font-size: 14px;
    color: var(--text);
    background: none;
    border: none;
    width: 100%;
    text-align: right;
    cursor: pointer;
}

.context-menu-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.context-menu-item .icon {
    color: var(--text-muted);
}

.context-menu-item.danger .icon,
.context-menu-item.danger .label {
    color: var(--status-limited);
}

/* ================= Desktop layout ================= */
/* Shown at >=1024px; mobile card layout above stays for narrow viewports. */

.app-shell {
    display: none;
}

@media (min-width: 1024px) {
    body {
        padding-bottom: 0;
    }
    .bottom-nav,
    .mobile-only {
        display: none !important;
    }
    .app-shell {
        display: flex;
        min-height: 100vh;
    }
}

.sidebar {
    width: 240px;
    min-width: 240px;
    background: var(--bg);
    border-left: 1px solid var(--border);
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-2) var(--space-5);
    font-size: 20px;
    font-weight: 700;
}

.sidebar-section-label {
    color: var(--text-faint);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: var(--space-3) var(--space-2) var(--space-1);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 10px var(--space-2);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
    border-right: 2px solid transparent;
}

.sidebar-link.active {
    color: var(--text);
    background: var(--surface);
    border-right-color: var(--accent);
}

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

.topbar-desktop {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-5);
    border-bottom: 1px solid var(--border);
}

.topbar-desktop-right {
    display: flex;
    align-items: center;
}
.topbar-desktop-right > * {
    margin-right: var(--space-2);
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.content-area {
    padding: var(--space-5);
}

/* ---------- Data table ---------- */

.panel-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.panel-title {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
}

.btn-accent {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.data-table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.data-table-toolbar {
    display: flex;
    align-items: center;
    padding: var(--space-4);
    border-bottom: 1px solid var(--border);
}
.data-table-toolbar > * {
    margin-left: var(--space-2);
}
.data-table-toolbar .search-input-wrap {
    flex: 1;
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

table.data-table th {
    text-align: right;
    color: var(--text-muted);
    font-weight: 600;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

table.data-table td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    white-space: nowrap;
}

table.data-table tr:last-child td {
    border-bottom: none;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    margin-left: 6px;
}
.dot-online { background: var(--status-active); }
.dot-offline { background: var(--text-faint); }

.cell-username {
    font-weight: 700;
    direction: ltr;
    display: block;
    text-align: right;
}
.cell-subtext {
    color: var(--text-faint);
    font-size: 12px;
}

.cell-traffic-bar {
    width: 120px;
    height: 4px;
    background: var(--border);
    border-radius: var(--radius-pill);
    overflow: hidden;
    margin-bottom: 4px;
}
.cell-traffic-fill {
    height: 100%;
    background: var(--status-active);
}
.cell-traffic-fill.full {
    background: var(--status-limited);
}

.cell-expiry-active { color: var(--text); font-weight: 700; }
.cell-expiry-expired { color: var(--status-limited); font-weight: 700; }

.row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}
.row-actions > * {
    margin-left: var(--space-2);
}
.row-icon-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    display: inline-flex;
}
.row-icon-btn:hover {
    color: var(--text);
}

/* ---------- Modal ---------- */

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    display: none;
    z-index: 10000;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
    box-sizing: border-box;
}
.modal-backdrop.open {
    display: block;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 16px;
    width: 100%;
    max-width: 560px;
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin: 0 auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
    box-sizing: border-box;
}

.modal form {
    display: flex;
    flex-direction: column;
    min-height: 0;
    flex: 1 1 auto;
    max-height: calc(100vh - 32px);
    overflow: hidden;
}

.modal-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    flex: 0 0 auto;
}

.modal-header-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
}

.modal-title {
    font-size: 16px;
    font-weight: 700;
    flex: 1 1 auto;
    min-width: 0;
    color: var(--text);
    line-height: 1.3;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 6px 8px;
    border-radius: 8px;
    flex-shrink: 0;
}
.modal-close:hover {
    background: rgba(127,127,127,0.12);
    color: var(--text);
}

.modal-tabs {
    display: flex;
    gap: 20px;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
    flex: 0 0 auto;
}

.modal-tab {
    padding: 12px 0;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 14px;
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    cursor: pointer;
    font-family: inherit;
}
.modal-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1 1 auto;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}
.form-row > * {
    flex: 1;
    min-width: 0;
}

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

.form-hint {
    color: var(--text-faint);
    font-size: 12px;
    margin-top: 4px;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 26px;
    border-radius: var(--radius-pill);
    background: var(--input-bg);
    border: 1px solid var(--border-strong);
    cursor: pointer;
    display: inline-block;
}
.toggle-switch.on {
    background: var(--accent);
}
.toggle-switch-knob {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    transition: right 0.15s;
}
.toggle-switch.on .toggle-switch-knob {
    right: 20px;
}

.collapsible-section {
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 16px;
}
.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
}
.collapsible-body {
    padding: 0 16px 16px;
}

.modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-top: 1px solid var(--border);
    flex: 0 0 auto;
    background: var(--surface);
}
.modal-footer-left {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border-strong);
    color: var(--text);
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.btn-danger-solid {
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
}

@media (max-width: 640px) {
    .modal-backdrop { padding: 8px; }
    .modal {
        max-height: calc(100vh - 16px);
        max-width: 100%;
    }
    .modal form { max-height: calc(100vh - 16px); }
    .modal-body { padding: 16px; }
    .form-row { flex-direction: column; gap: 0; }
    .modal-footer { flex-wrap: wrap; }
}

/* ================= Light theme ================= */
/* Toggled via <html data-theme="light">, set by theme-toggle.js and
   persisted in localStorage. Overrides the same custom properties the
   dark (default) theme uses, so every component below adapts automatically
   without needing its own light/dark variant. */

html[data-theme="light"] {
    --bg: #f4f4f6;
    --surface: #ffffff;
    --surface-2: #f0f0f2;
    --input-bg: #f4f4f6;
    --border: rgba(0, 0, 0, 0.08);
    --border-strong: rgba(0, 0, 0, 0.16);

    --text: #16161a;
    --text-muted: #55555c;
    --text-faint: #85858c;

    --pill-onhold-bg: #f4ecc9;
    --pill-active-bg: #d9f2e3;
    --pill-total-bg: #ececef;
    --pill-expired-bg: #fbdde3;
    --pill-limited-bg: #f7e6c9;
    --pill-data-bg: #dceefa;
    --pill-online-bg: #d7f3ee;
}

html[data-theme="light"] .pill-onhold { color: #7a6a12; }
html[data-theme="light"] .pill-active { color: #146c3d; }
html[data-theme="light"] .pill-total { color: var(--text-muted); }
html[data-theme="light"] .pill-expired { color: #a3123a; }
html[data-theme="light"] .pill-limited { color: #8a5e0a; }
html[data-theme="light"] .pill-data { color: #0f5f96; }
html[data-theme="light"] .pill-online { color: #0d7d6c; }

html[data-theme="light"] .modal-backdrop,
html[data-theme="light"] .context-menu-backdrop {
    background: rgba(0, 0, 0, 0.35);
}


/* ---- Overlay toast (top of page, auto-hide) ---- */
.montra-toast-host {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(520px, calc(100% - 24px));
    pointer-events: none;
}
.montra-toast {
    pointer-events: auto;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 13px;
    line-height: 1.5;
    box-shadow: 0 8px 28px rgba(0,0,0,0.35);
    border: 1px solid var(--border-strong);
    background: var(--surface);
    color: var(--text);
    animation: montraToastIn 0.28s ease-out;
}
.montra-toast.is-error {
    background: #2a1218;
    border-color: rgba(255, 90, 110, 0.45);
    color: #ffc9d2;
}
.montra-toast.is-ok {
    background: #122a1c;
    border-color: rgba(80, 200, 140, 0.4);
    color: #c9ffe0;
}
.montra-toast.is-hiding {
    animation: montraToastOut 0.35s ease-in forwards;
}
@keyframes montraToastIn {
    from { opacity: 0; transform: translateY(-12px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes montraToastOut {
    to { opacity: 0; transform: translateY(-10px); }
}
html[data-theme="light"] .montra-toast.is-error {
    background: #ffe8ec;
    color: #8a1530;
}
html[data-theme="light"] .montra-toast.is-ok {
    background: #e6f8ee;
    color: #146c3d;
}

/* Confirm / info dialog */
.montra-dialog-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10050;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}
.montra-dialog-backdrop.is-open {
    opacity: 1;
    visibility: visible;
}
.montra-dialog {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
    padding: 22px 22px 18px;
    transform: translateY(10px) scale(0.98);
    transition: transform 0.22s ease;
}
.montra-dialog-backdrop.is-open .montra-dialog {
    transform: translateY(0) scale(1);
}
.montra-dialog-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
    background: rgba(227, 28, 95, 0.12);
    color: var(--accent);
}
.montra-dialog-icon.is-info {
    background: rgba(20, 184, 166, 0.12);
    color: var(--status-online);
}
.montra-dialog-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 8px;
    color: var(--text);
}
.montra-dialog-body {
    font-size: 13.5px;
    line-height: 1.7;
    color: var(--text-muted);
    margin: 0 0 20px;
    white-space: pre-wrap;
}
.montra-dialog-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}
.montra-dialog-actions .btn-ghost,
.montra-dialog-actions .btn-danger-solid,
.montra-dialog-actions .btn-accent {
    min-width: 96px;
    padding: 10px 16px;
    font-size: 13px;
}
.pill.is-filter.active-filter{outline:1px solid var(--accent);box-shadow:0 0 0 1px var(--accent);}

/* Brand mark */
.brand-mark {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: linear-gradient(135deg, #e31c5f, #ff6b9d);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 15px;
    flex-shrink: 0;
}

/* Login fix - no overlapping icons inside inputs */
.login-input {
    padding-left: 16px !important;
    padding-right: 16px !important;
}
.login-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.login-wordmark {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 18px;
}
.login-card {
    width: 100%;
    max-width: 420px;
    padding: 28px 24px;
}
.form-group { margin-bottom: 14px; }

/* Mobile sidebar drawer */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 90;
}
.sidebar-backdrop.is-open { display: block; }
@media (max-width: 1023px) {
    .sidebar {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        z-index: 100;
        transform: translateX(105%);
        transition: transform 0.25s ease;
        box-shadow: -8px 0 32px rgba(0,0,0,0.4);
    }
    .sidebar.is-open { transform: translateX(0); }
    .mobile-menu-btn { display: inline-flex !important; }
}
@media (min-width: 1024px) {
    .mobile-menu-btn { display: none !important; }
    .sidebar-backdrop { display: none !important; }
}

/* Compact table like Rebecca */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-align: right;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    vertical-align: middle;
}
.data-table tr:hover td { background: rgba(255,255,255,0.02); }
.row-actions { display: flex; gap: 4px; align-items: center; }
.row-icon-btn {
    width: 32px; height: 32px;
    border-radius: 8px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.row-icon-btn:hover {
    background: var(--surface-2, rgba(255,255,255,0.06));
    color: var(--text);
    border-color: var(--border);
}

/* Scale-friendly layout */
html { -webkit-text-size-adjust: 100%; }
body { min-width: 0; overflow-x: hidden; }
.main-column { min-width: 0; }
.data-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Bottom nav as links */
a.bottom-nav-item {
    text-decoration: none;
    color: inherit;
}

.refresh-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.chip-btn {
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font: inherit;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 999px;
}
.chip-btn:hover { color: var(--text); border-color: var(--border-strong); }
.refresh-select-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
}
.refresh-select {
    background: transparent;
    border: 0;
    color: var(--text);
    font: inherit;
    font-size: 12px;
    outline: none;
    cursor: pointer;
}
