/* ============================================================
   TALLY — SaaS design system (2026 redesign)
   Fonts: Source Serif 4 / Inter / IBM Plex Mono  (unchanged)
   Palette: unchanged tokens (paper/teal/moss/rust/gold/ink)
   ============================================================ */

:root {
    --paper: #F3F5F4;
    --card: #FFFFFF;
    --ink: #17241F;
    --teal: #1D4E45;
    --teal-deep: #163B34;
    --teal-soft: #E7F0ED;
    --moss: #2F7D5C;
    --moss-soft: #E9F4EF;
    --rust: #B54B3B;
    --rust-soft: #F8ECEA;
    --gold: #B9852F;
    --gold-soft: #F7F0E1;
    --muted: #5C6B64;
    --line: #D8DED9;
    --line-soft: #E7EBE8;
    --focus: #1D4E45;
    --radius: 10px;
    --radius-sm: 7px;
    --shadow: 0 1px 2px rgba(23,36,31,.05), 0 4px 14px rgba(23,36,31,.05);
    --shadow-lift: 0 2px 4px rgba(23,36,31,.07), 0 10px 28px rgba(23,36,31,.09);
    --sidebar-w: 264px;
}

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

html, body {
    margin: 0;
    padding: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 14.5px;
    line-height: 1.55;
    min-height: 100%;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4, .serif {
    font-family: 'Source Serif 4', Georgia, serif;
    font-weight: 600;
    letter-spacing: -0.012em;
    margin: 0 0 .45em;
    color: var(--ink);
}
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }

.mono, .num, .u-mono, table td.num, table th.num {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

::selection { background: var(--teal); color: #fff; }

/* ============================================================
   UTILITIES
   ============================================================ */
.u-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.u-grid-2 { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.u-grid-3 { display: grid; gap: 16px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.u-stack { display: flex; flex-direction: column; gap: 12px; }
.u-cluster { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.u-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.u-mono { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }
.u-muted { color: var(--muted); }
.u-small { font-size: .82rem; }
.u-big { font-family: 'Source Serif 4', Georgia, serif; font-size: 1.7rem; font-weight: 600; letter-spacing: -.01em; }
.u-right { text-align: right; }
.u-full { width: 100%; }
.u-gap-l { gap: 20px; }
.u-gap-xl { gap: 28px; }
.u-scroll-x { overflow-x: auto; }

@media (max-width: 900px) {
    .u-grid-2, .u-grid-3 { grid-template-columns: 1fr; }
}

/* ============================================================
   TENANT APP SHELL
   ============================================================ */
.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    background: var(--paper);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    padding: 18px 14px;
    gap: 8px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.side-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 10px;
}
.brand-mark {
    width: 34px; height: 34px;
    border-radius: 9px;
    background: var(--teal);
    color: #fff;
    font-family: 'Source Serif 4', Georgia, serif;
    font-size: 1.15rem;
    font-weight: 600;
    display: grid;
    place-items: center;
    flex: none;
}
.brand-name { font-family: 'Source Serif 4', Georgia, serif; font-size: 1.12rem; font-weight: 600; line-height: 1.1; }
.brand-tag { font-size: .72rem; color: var(--muted); letter-spacing: .04em; }

.side-section { font-size: .68rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); padding: 12px 10px 4px; }

.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: var(--ink);
    font-size: .9rem;
    font-weight: 500;
    text-decoration: none;
    transition: background .12s ease, color .12s ease;
}
.side-nav a:hover { background: #fff; text-decoration: none; }
.side-nav a.active { background: var(--teal); color: #fff; }
.side-nav a svg { opacity: .75; flex: none; }
.side-nav a.active svg { opacity: 1; }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 12px; }
.plan-pill {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--teal-soft);
    border: 1px solid #CFE0DB;
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-size: .8rem;
}
.plan-pill .pill { background: var(--teal); color: #fff; }
.user-card {
    display: flex; align-items: center; gap: 10px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
}
.avatar {
    width: 30px; height: 30px; flex: none;
    border-radius: 50%;
    background: var(--ink);
    color: #fff;
    display: grid; place-items: center;
    font-size: .72rem; font-weight: 600;
}
.user-card .uc-name { font-size: .82rem; font-weight: 600; line-height: 1.2; }
.user-card .uc-mail { font-size: .72rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.user-card form button { all: unset; cursor: pointer; color: var(--muted); display: grid; place-items: center; padding: 4px; border-radius: 6px; }
.user-card form button:hover { color: var(--rust); background: var(--rust-soft); }

/* ---- Main / topbar / content ---- */
.main { background: #FDFDFC; display: flex; flex-direction: column; min-width: 0; }

.topbar {
    position: sticky; top: 0; z-index: 40;
    background: rgba(253,253,252,.92);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--line);
    min-height: 60px;
    padding: 10px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
.topbar-title { font-family: 'Source Serif 4', Georgia, serif; font-size: 1.18rem; font-weight: 600; display: flex; align-items: baseline; gap: 10px; }
.topbar-title .crumb-sub { font-family: 'Inter', sans-serif; font-size: .78rem; color: var(--muted); font-weight: 400; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hamburger { display: none; }

.content { padding: 24px 28px 48px; max-width: 1240px; width: 100%; margin: 0 auto; }

.site-footer { margin-top: 40px; padding-top: 14px; border-top: 1px solid var(--line-soft); color: var(--muted); font-size: .78rem; display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

@media (max-width: 960px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed; z-index: 90; left: 0; top: 0; bottom: 0;
        width: min(84vw, 300px);
        transform: translateX(-102%);
        transition: transform .18s ease;
        box-shadow: none;
        background: var(--paper);
    }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lift); }
    .side-scrim { position: fixed; inset: 0; background: rgba(23,36,31,.35); z-index: 80; }
    .hamburger {
        display: grid; place-items: center;
        width: 36px; height: 36px;
        border: 1px solid var(--line); border-radius: var(--radius-sm);
        background: #fff; cursor: pointer;
    }
    .content { padding: 18px 16px 40px; }
    .topbar { padding: 10px 16px; }
}

/* ============================================================
   ADMIN SHELL — dark left sidebar
   ============================================================ */
.admin-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    min-height: 100vh;
    background: var(--paper);
}

.admin-sidebar {
    background: var(--ink);
    color: #E8EEEA;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 18px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: thin;
}

.admin-side-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 12px;
}
.admin-side-brand .brand-mark { background: rgba(255,255,255,.14); }
.admin-side-brand .brand-name { color: #fff; }
.admin-side-brand .brand-tag { color: rgba(255,255,255,.5); }

.admin-side-section {
    font-size: .68rem; font-weight: 600;
    letter-spacing: .09em; text-transform: uppercase;
    color: rgba(255,255,255,.42);
    padding: 12px 10px 4px;
}

.admin-nav { display: flex; flex-direction: column; gap: 2px; }
.admin-nav a {
    display: flex; align-items: center; gap: 9px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,.78);
    font-size: .88rem; font-weight: 500;
    text-decoration: none;
    transition: background .12s ease, color .12s ease;
}
.admin-nav a:hover { color: #fff; background: rgba(255,255,255,.08); text-decoration: none; }
.admin-nav a.active { color: #fff; background: var(--teal); }
.admin-nav a svg { opacity: .7; flex: none; }
.admin-nav a.active svg { opacity: 1; }

.admin-side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 12px; }
.admin-user {
    display: flex; align-items: center; gap: 10px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.12);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
}
.admin-user .avatar { background: rgba(255,255,255,.16); }
.admin-user .uc-name { color: #fff; }
.admin-user .uc-mail { color: rgba(255,255,255,.55); overflow: hidden; text-overflow: ellipsis; }
.admin-user form button {
    all: unset; cursor: pointer;
    color: rgba(255,255,255,.65);
    display: grid; place-items: center;
    padding: 4px; border-radius: 6px;
}
.admin-user form button:hover { color: #fff; background: rgba(255,255,255,.12); }

.admin-main { background: #FDFDFC; display: flex; flex-direction: column; min-width: 0; }
.admin-topbar {
    position: sticky; top: 0; z-index: 40;
    background: rgba(253,253,252,.92);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--line);
    min-height: 60px;
    padding: 10px 28px;
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.admin-topbar-title { font-family: 'Source Serif 4', Georgia, serif; font-size: 1.18rem; font-weight: 600; }

.admin-body { width: 100%; max-width: 1240px; margin: 0 auto; padding: 24px 28px 56px; flex: 1; }

@media (max-width: 960px) {
    .admin-shell { grid-template-columns: 1fr; }
    .admin-sidebar {
        position: fixed; z-index: 90; left: 0; top: 0; bottom: 0;
        width: min(84vw, 300px);
        transform: translateX(-102%);
        transition: transform .18s ease;
    }
    .admin-sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lift); }
    .admin-body { padding: 18px 16px 48px; }
    .admin-topbar { padding: 10px 16px; }
}

/* ============================================================
   AUTH (guest) SHELL
   ============================================================ */
.auth-shell { display: grid; grid-template-columns: minmax(340px, 44%) 1fr; min-height: 100vh; }

.auth-panel {
    background: linear-gradient(160deg, var(--ink) 0%, var(--teal-deep) 62%, var(--teal) 100%);
    color: #fff;
    padding: 48px;
    display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
    position: relative;
    overflow: hidden;
}
.auth-panel::after {
    content: "";
    position: absolute; inset: auto -20% -34% -20%;
    height: 46%;
    background: repeating-linear-gradient(0deg, transparent 0 22px, rgba(255,255,255,.05) 22px 23px);
    transform: rotate(-3deg);
    pointer-events: none;
}
.auth-panel .brand-mark { background: rgba(255,255,255,.16); width: 40px; height: 40px; font-size: 1.3rem; }
.auth-panel h1 { color: #fff; font-size: 1.85rem; line-height: 1.22; max-width: 18ch; }
.auth-panel p { color: rgba(255,255,255,.82); max-width: 44ch; }
.auth-panel ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.auth-panel li { display: flex; gap: 10px; align-items: flex-start; color: rgba(255,255,255,.88); font-size: .92rem; }
.auth-panel li svg { flex: none; margin-top: 2px; color: #9DC3B8; }
.auth-panel .auth-panel-foot { color: rgba(255,255,255,.55); font-size: .78rem; position: relative; z-index: 1; }

.auth-main { display: grid; place-items: center; padding: 32px 20px; background: var(--paper); }
.auth-card {
    width: 100%; max-width: 420px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 30px 28px;
}
.auth-card h1 { font-size: 1.3rem; }
.auth-card .auth-sub { color: var(--muted); font-size: .9rem; margin: -0.3em 0 1.4em; }
.auth-card .auth-links { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line-soft); font-size: .85rem; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }

@media (max-width: 900px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-panel { display: none; }
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line-soft);
}
.card-title { font-family: 'Source Serif 4', Georgia, serif; font-size: 1.02rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-body { padding: 18px; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--line-soft); font-size: .82rem; color: var(--muted); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.card-body > :last-child, .card :last-child { margin-bottom: 0; }
.card.danger-card { border-color: #E5C6C0; }
.card.danger-card .card-title { color: var(--rust); }

/* ============================================================
   STATS
   ============================================================ */
.stat {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 14px 16px;
    display: flex; flex-direction: column; gap: 4px;
}
.stat-label { font-size: .74rem; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.stat-value { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; font-size: 1.45rem; font-weight: 500; color: var(--ink); line-height: 1.15; }
.stat-sub { font-size: .78rem; color: var(--muted); }
.stat-delta { font-size: .78rem; font-weight: 600; }
.stat-delta.pos { color: var(--moss); }
.stat-delta.neg { color: var(--rust); }
.stat.accent { border-left: 3px solid var(--teal); }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow-x: auto;
}
table.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.table th {
    text-align: left;
    font-size: .7rem; font-weight: 600;
    letter-spacing: .08em; text-transform: uppercase;
    color: var(--muted);
    background: #FAFBFA;
    padding: 10px 14px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
table.table td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
table.table tbody tr:last-child td { border-bottom: 0; }
table.table tbody tr:hover { background: #FAFCF9; }
table.table td.num, table.table th.num { text-align: right; font-family: 'IBM Plex Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.data th, table.data td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line-soft); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; align-items: center; white-space: nowrap; }
.table-empty { text-align: center; color: var(--muted); padding: 34px 14px !important; }

/* ============================================================
   FORMS
   ============================================================ */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 760px) { .form-grid { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 5px; }
.field > label { font-size: .8rem; font-weight: 600; color: var(--ink); }
.field-hint { font-size: .75rem; color: var(--muted); }
.field-error { font-size: .75rem; color: var(--rust); font-weight: 500; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } }

.input, .select, .textarea {
    width: 100%;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--ink);
    font: inherit;
    font-size: .9rem;
    padding: 8px 11px;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(29,78,69,.13);
}
.textarea { min-height: 120px; resize: vertical; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235C6B64' stroke-width='2.4'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: .88rem; }
.checkbox-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--teal); }
.field-label-caps { font-size: .7rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    color: var(--ink);
    font: inherit; font-size: .86rem; font-weight: 500;
    padding: 7px 14px;
    cursor: pointer;
    text-decoration: none;
    transition: background .12s ease, border-color .12s ease, color .12s ease, box-shadow .12s ease;
    white-space: nowrap;
}
.btn:hover { background: #F6F8F7; text-decoration: none; }
.btn svg { flex: none; }
.btn-primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-deep); border-color: var(--teal-deep); }
.btn-danger { background: var(--rust); border-color: var(--rust); color: #fff; }
.btn-danger:hover { background: #9E4032; border-color: #9E4032; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--teal); }
.btn-ghost:hover { background: var(--teal-soft); }
.btn-sm { font-size: .78rem; padding: 4px 10px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ============================================================
   BADGES / PILLS
   ============================================================ */
.badge {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 2px 9px;
    border-radius: 999px;
    font-size: .73rem; font-weight: 600;
    letter-spacing: .01em;
    white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge-ok, .badge-success { background: var(--moss-soft); color: var(--moss); }
.badge-warn, .badge-warning { background: var(--gold-soft); color: var(--gold); }
.badge-bad, .badge-danger { background: var(--rust-soft); color: var(--rust); }
.badge-neutral { background: #EDF0EE; color: var(--muted); }

.pill {
    display: inline-flex; align-items: center;
    padding: 2px 9px;
    border-radius: 999px;
    background: #EDF0EE;
    color: var(--muted);
    font-size: .73rem; font-weight: 600;
    white-space: nowrap;
}

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: .88rem;
    margin-bottom: 14px;
    border: 1px solid transparent;
}
.alert ul { margin: 0; padding-left: 1.1rem; }
.alert-success { background: var(--moss-soft); color: #1F5C41; border-color: #CDE4D8; }
.alert-error, .alert-danger { background: var(--rust-soft); color: #8E382B; border-color: #EBD2CD; }
.alert-warning { background: var(--gold-soft); color: #7A5A1E; border-color: #EBDCC0; }
.alert-info { background: #EAF1F7; color: #1F4E68; border-color: #D2E2EC; }

/* ============================================================
   BANNERS (impersonation / announcements)
   ============================================================ */
.banner-impersonate {
    background: var(--gold);
    color: #fff;
    padding: 9px 20px;
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    font-size: .85rem;
    flex-wrap: wrap;
}
.banner-impersonate form button {
    all: unset; cursor: pointer;
    background: #fff; color: var(--ink);
    border-radius: 7px; padding: 4px 12px;
    font-size: .8rem; font-weight: 600;
}
.banner-announce { padding: 10px 20px; font-size: .86rem; display: flex; align-items: baseline; gap: 10px; }
.banner-announce strong { font-size: .86rem; }
.banner-announce.info { background: #EAF1F7; color: #1F4E68; }
.banner-announce.success { background: var(--moss-soft); color: #1F5C41; }
.banner-announce.warning { background: var(--gold-soft); color: #7A5A1E; }
.banner-announce.danger { background: var(--rust-soft); color: #8E382B; }
.banner-announce button { all: unset; cursor: pointer; margin-left: auto; opacity: .65; font-size: .8rem; padding: 0 4px; }
.banner-announce button:hover { opacity: 1; }

/* legacy names kept working during sweep */
.impersonation-banner { background: var(--gold); color: #fff; border-radius: 8px; padding: .5rem .9rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.announcement-banner { border-radius: 8px; padding: .65rem .9rem; margin-bottom: 1rem; }
.announcement-banner.info { background: #EAF1F7; color: #1F4E68; }
.announcement-banner.success { background: var(--moss-soft); color: #1F5C41; }
.announcement-banner.warning { background: var(--gold-soft); color: #7A5A1E; }
.announcement-banner.danger { background: var(--rust-soft); color: #8E382B; }

/* ============================================================
   MISC COMPONENTS
   ============================================================ */
.empty {
    text-align: center;
    padding: 44px 20px;
    color: var(--muted);
    display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.empty-dot {
    width: 44px; height: 44px;
    border-radius: 50%;
    background: var(--teal-soft);
    color: var(--teal);
    display: grid; place-items: center;
    margin-bottom: 4px;
}
.empty-title { font-family: 'Source Serif 4', Georgia, serif; font-weight: 600; font-size: 1.02rem; color: var(--ink); }
.empty-text { font-size: .86rem; max-width: 40ch; }

.progress { height: 7px; border-radius: 999px; background: #EDF0EE; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 999px; background: var(--teal); }
.progress-bar.warn { background: var(--gold); }
.progress-bar.bad { background: var(--rust); }

.tabs { display: inline-flex; background: #EDF0EE; border-radius: 9px; padding: 3px; gap: 2px; }
.tab {
    border: 0; background: transparent; cursor: pointer;
    font: inherit; font-size: .8rem; font-weight: 500;
    color: var(--muted);
    padding: 5px 13px; border-radius: 7px;
    text-decoration: none;
}
.tab:hover { color: var(--ink); text-decoration: none; }
.tab.active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(23,36,31,.1); }

.dropdown { position: relative; display: inline-block; }
.dropdown-trigger { cursor: pointer; user-select: none; }
.dropdown-menu {
    position: absolute; right: 0; top: calc(100% + 6px);
    min-width: 200px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lift);
    padding: 6px;
    z-index: 70;
}
.dropdown-item {
    display: block;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: .86rem;
    color: var(--ink);
    text-decoration: none;
}
.dropdown-item:hover { background: var(--paper); text-decoration: none; }

.kv { display: flex; flex-direction: column; }
.kv-row { display: flex; justify-content: space-between; gap: 14px; padding: 8px 0; border-bottom: 1px dashed var(--line-soft); font-size: .88rem; }
.kv-row:last-child { border-bottom: 0; }
.kv-key { color: var(--muted); }
.kv-val { font-weight: 500; text-align: right; }
.kv-val.num { font-family: 'IBM Plex Mono', ui-monospace, monospace; font-variant-numeric: tabular-nums; }

.timeline { display: flex; flex-direction: column; }
.timeline-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: .88rem; }
.timeline-item:last-child { border-bottom: 0; }
.timeline-item .tl-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); flex: none; margin-top: 6px; }
.timeline-item.neg .tl-dot { background: var(--rust); }
.timeline-item.warn .tl-dot { background: var(--gold); }
.timeline-time { display: block; font-size: .74rem; color: var(--muted); }

.chart-box { position: relative; height: 280px; padding: 12px; }
.chart-box canvas { max-height: 100%; }

.code {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: .8rem;
    background: #EDF0EE;
    border-radius: 5px;
    padding: 1px 6px;
    white-space: nowrap;
}

.skeleton { height: 12px; border-radius: 6px; background: linear-gradient(90deg, #EDF0EE 25%, #F6F8F7 45%, #EDF0EE 65%); background-size: 200% 100%; animation: skeleton 1.3s infinite; }
@keyframes skeleton { to { background-position: -200% 0; } }

.crumbs { font-size: .78rem; color: var(--muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--teal); }

/* ============================================================
   RECEIPT TAPE (signature element)
   ============================================================ */
.tape {
    --tape-h: 120px;
    position: relative;
    padding: 16px 18px 24px;
}
.tape::after {
    content: "";
    position: absolute; left: 0; right: 0; bottom: -1px;
    height: 12px;
    background:
        linear-gradient(45deg, transparent 33.333%, var(--card) 33.333%, var(--card) 66.667%, transparent 66.667%),
        linear-gradient(-45deg, transparent 33.333%, var(--card) 33.333%, var(--card) 66.667%, transparent 66.667%);
    background-size: 14px 24px;
    background-position: 0 -12px;
    filter: drop-shadow(0 1px 0 var(--line));
}
.tape-row { display: flex; align-items: flex-end; gap: 5px; height: var(--tape-h); padding-top: 6px; }
.tape-bar {
    flex: 1;
    min-width: 6px;
    background: var(--teal-soft);
    border-radius: 4px 4px 0 0;
    position: relative;
    transition: background .12s ease;
}
.tape-bar.fill { background: var(--teal); }
.tape-bar.today { background: var(--gold); }
.tape-bar.neg { background: var(--rust-soft); }
.tape-bar.neg.fill { background: var(--rust); }
.tape-labels { display: flex; gap: 5px; margin-top: 6px; }
.tape-labels span { flex: 1; text-align: center; font-size: .66rem; color: var(--muted); }

/* ============================================================
   RECEIPT (billing document)
   ============================================================ */
.receipt {
    max-width: 560px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 30px 30px 38px;
    box-shadow: var(--shadow);
    font-size: .9rem;
}
.receipt h2 { text-align: center; }
.receipt .receipt-rule { border: 0; border-top: 1px dashed var(--line); margin: 16px 0; }
.receipt .kv-val { font-family: 'IBM Plex Mono', ui-monospace, monospace; }
.receipt .receipt-total { font-size: 1.05rem; font-weight: 600; }
@media print {
    body { background: #fff; }
    .sidebar, .topbar, .site-footer, .banner-impersonate, .banner-announce, .no-print { display: none !important; }
    .app-shell { display: block; }
    .receipt { border: 0; box-shadow: none; margin: 0; padding: 0; }
}

/* ============================================================
   LANDING PAGE
   ============================================================ */
.landing { background: #FBFCFB; }
.landing-nav {
    position: sticky; top: 0; z-index: 60;
    background: rgba(251,252,251,.92);
    backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--line-soft);
}
.landing-nav-inner {
    max-width: 1120px; margin: 0 auto;
    display: flex; align-items: center; gap: 18px;
    padding: 12px 22px;
}
.landing-nav .brand-name { font-size: 1.15rem; }
.landing-nav-links { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.landing-nav-links a { padding: 7px 12px; border-radius: 8px; font-size: .88rem; color: var(--ink); }
.landing-nav-links a:hover { background: var(--paper); text-decoration: none; }

.landing-hero { max-width: 1120px; margin: 0 auto; padding: 72px 22px 56px; display: grid; grid-template-columns: 1.1fr .9fr; gap: 44px; align-items: center; }
.landing-hero h1 { font-size: 2.6rem; line-height: 1.12; letter-spacing: -.015em; max-width: 16ch; }
.landing-hero .hero-sub { font-size: 1.05rem; color: var(--muted); max-width: 48ch; margin-bottom: 26px; }
.landing-hero .hero-ctas { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.landing-hero .btn { padding: 11px 22px; font-size: .95rem; }
.hero-note { font-size: .8rem; color: var(--muted); }

.mock-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow-lift);
    padding: 20px;
    display: flex; flex-direction: column; gap: 14px;
}
.mock-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.mock-stat { border: 1px solid var(--line-soft); border-radius: 9px; padding: 10px; }
.mock-stat .stat-label { font-size: .62rem; }
.mock-stat .stat-value { font-size: 1.05rem; }
.mock-rows { display: flex; flex-direction: column; gap: 8px; }
.mock-row { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; font-size: .8rem; border-bottom: 1px dashed var(--line-soft); padding-bottom: 8px; }
.mock-row:last-child { border-bottom: 0; padding-bottom: 0; }

.landing-section { max-width: 1120px; margin: 0 auto; padding: 64px 22px; }
.landing-section h2 { font-size: 1.75rem; text-align: center; }
.landing-section .section-sub { text-align: center; color: var(--muted); max-width: 56ch; margin: 0 auto 40px; }

.feature-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    display: flex; flex-direction: column; gap: 10px;
}
.feature-card .feature-icon {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: var(--teal-soft); color: var(--teal);
    display: grid; place-items: center;
}
.feature-card h3 { margin: 0; font-size: 1rem; }
.feature-card p { margin: 0; color: var(--muted); font-size: .88rem; }

.plan-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 26px 24px;
    display: flex; flex-direction: column; gap: 14px;
    position: relative;
}
.plan-card.featured { border: 2px solid var(--teal); box-shadow: var(--shadow-lift); }
.plan-card .plan-flag { position: absolute; top: -12px; left: 22px; background: var(--teal); color: #fff; font-size: .7rem; font-weight: 600; letter-spacing: .05em; padding: 3px 10px; border-radius: 999px; }
.plan-card .plan-price { display: flex; align-items: baseline; gap: 6px; }
.plan-card .plan-price .u-big { font-size: 2rem; }
.plan-card ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; font-size: .88rem; }
.plan-card li { display: flex; gap: 9px; align-items: flex-start; }
.plan-card li svg { color: var(--moss); flex: none; margin-top: 3px; }

.faq-item { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.faq-item button.faq-q {
    all: unset; cursor: pointer;
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    width: 100%; padding: 16px 18px;
    font-weight: 600; font-size: .94rem;
    box-sizing: border-box;
}
.faq-item .faq-a { padding: 0 18px 16px; color: var(--muted); font-size: .9rem; }

.testimonial-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.testimonial-card .t-quote { font-family: 'Source Serif 4', Georgia, serif; font-size: 1.02rem; line-height: 1.5; }
.testimonial-card .t-who { display: flex; align-items: center; gap: 10px; }

.cta-band { background: var(--teal); color: #fff; }
.cta-band .landing-section { padding: 56px 22px; }
.cta-band h2 { color: #fff; }
.cta-band p { color: rgba(255,255,255,.82); text-align: center; max-width: 52ch; margin: 0 auto 26px; }
.cta-band .btn { background: #fff; color: var(--teal); border-color: #fff; }
.cta-band .btn:hover { background: var(--paper); }

.landing-footer { border-top: 1px solid var(--line-soft); background: #fff; }
.landing-footer-inner { max-width: 1120px; margin: 0 auto; padding: 28px 22px; display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; font-size: .84rem; color: var(--muted); }

@media (max-width: 940px) {
    .landing-hero { grid-template-columns: 1fr; padding-top: 48px; }
    .landing-hero h1 { font-size: 2.1rem; }
}

/* ============================================================
   LEGACY ALIASES (kept green until sweep completes — do not use)
   ============================================================ */
table.data { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.data th, table.data td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line-soft); }

/* ============================================================
   PAGINATION + X-CLOAK (redesign additions)
   ============================================================ */
[x-cloak] { display: none !important; }

.pagination { display: flex; gap: 4px; list-style: none; margin: 16px 0 0; padding: 0; flex-wrap: wrap; }
.pagination li a,
.pagination li span {
    display: inline-grid; place-items: center;
    min-width: 32px; height: 32px; padding: 0 8px;
    border-radius: 7px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    font-size: .82rem;
    text-decoration: none;
}
.pagination li a:hover { background: var(--paper); text-decoration: none; }
.pagination li.active span { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 600; }
.pagination li.disabled span { color: var(--muted); opacity: .55; background: var(--paper); }


/* ============================================================
   INSTALLER WIZARD (inst-* — topbar stepper, single column)
   ============================================================ */
.inst-body { background: var(--paper); }
.inst-shell { min-height: 100vh; display: flex; flex-direction: column; }

.inst-topbar {
    background: var(--card);
    border-bottom: 1px solid var(--line);
    padding: 14px 28px;
    display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
}
.inst-brand { display: flex; align-items: center; gap: 10px; }
.inst-brand .brand-name { font-family: 'Source Serif 4', Georgia, serif; font-size: 1.1rem; font-weight: 600; line-height: 1.1; color: var(--ink); }
.inst-brand-tag { font-size: .7rem; color: var(--muted); letter-spacing: .04em; }
.inst-stepcount { margin-left: auto; white-space: nowrap; }

.inst-steps { display: flex; align-items: center; }
.inst-step {
    display: inline-flex; align-items: center; gap: 8px;
    position: relative;
    padding: 0 18px 0 0;
    color: var(--muted);
}
.inst-step:last-child { padding-right: 0; }
.inst-step:not(:last-child)::after {
    content: "";
    width: 18px; height: 1px;
    background: var(--line);
    margin-left: 18px;
    order: 2;
}
.inst-dot {
    width: 26px; height: 26px; flex: none;
    border-radius: 50%;
    display: inline-grid; place-items: center;
    font-family: 'IBM Plex Mono', monospace; font-size: .72rem;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--muted);
}
.inst-step-label { font-size: .82rem; font-weight: 500; white-space: nowrap; }
.inst-step.active .inst-dot { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 600; box-shadow: 0 0 0 3px rgba(29,78,69,.14); }
.inst-step.active .inst-step-label { color: var(--ink); font-weight: 600; }
.inst-step.done .inst-dot { background: var(--moss); border-color: var(--moss); color: #fff; }
.inst-step.done .inst-step-label { color: var(--moss); }

.inst-main {
    flex: 1;
    display: grid; place-items: center;
    padding: 44px 20px 28px;
}
.inst-card {
    width: 100%; max-width: 560px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 30px 30px 28px;
}
.inst-card h1.serif { font-size: 1.35rem; }
.inst-card .auth-sub { color: var(--muted); font-size: .9rem; margin: -0.3em 0 1.4em; }
.inst-foot {
    color: var(--muted);
    padding: 22px 0 4px;
    text-align: center;
    font-size: .72rem;
}

.inst-check {
    width: 18px; height: 18px; flex: none;
    border-radius: 50%;
    display: inline-grid; place-items: center;
}
.inst-check.ok { background: var(--moss-soft); color: var(--moss); }
.inst-check.bad { background: var(--rust-soft); color: var(--rust); }

@media (max-width: 860px) {
    .inst-step-label { display: none; }
    .inst-step { padding-right: 0; }
    .inst-step:not(:last-child)::after { margin-left: 10px; width: 14px; }
    .inst-topbar { padding: 12px 16px; gap: 12px; }
    .inst-card { padding: 22px 18px; }
}

/* Installer requirements rows (no-wrap label + truncated value) */
.inst-req-row {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 6px 0;
    border-bottom: 1px dashed var(--line-soft);
}
.inst-req-row:last-child { border-bottom: 0; }
.inst-req-label { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.inst-req-value {
    flex: none; max-width: 46%;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: var(--muted);
}
.inst-req-row.bad .inst-req-value { color: var(--rust); }

/* ============================================================
   RTL OVERRIDES ([dir="rtl"] — physical-direction fixes only)
   Grid/flex layouts (.app-shell, .admin-shell, .topbar, .side-nav,
   .plan-pill, .user-card, …) mirror automatically via direction,
   so only physical borders / offsets / alignments are corrected
   here. Numeric cells (.num) intentionally stay right-aligned —
   Latin digits read left-to-right even in Arabic.
   ============================================================ */
[dir="rtl"] .sidebar { border-right: 0; border-left: 1px solid var(--line); }
[dir="rtl"] .stat.accent { border-left: 0; border-right: 3px solid var(--teal); }
[dir="rtl"] .u-right { text-align: left; }
[dir="rtl"] .row-actions { justify-content: flex-start; }
[dir="rtl"] .kv-val:not(.num) { text-align: left; }
[dir="rtl"] table.table th, [dir="rtl"] table.table td,
[dir="rtl"] table.data th, [dir="rtl"] table.data td { text-align: right; }
[dir="rtl"] .select { background-position: left 10px center; padding-right: 11px; padding-left: 30px; }
[dir="rtl"] .dropdown-menu { right: auto; left: 0; }
[dir="rtl"] .alert ul { padding-left: 0; padding-right: 1.1rem; }
[dir="rtl"] .plan-card .plan-flag { left: auto; right: 22px; }
[dir="rtl"] .landing-nav-links { margin-left: 0; margin-right: auto; }

/* Off-canvas drawer slides in from the right edge in RTL. */
@media (max-width: 960px) {
    [dir="rtl"] .sidebar { left: auto; right: 0; transform: translateX(102%); }
    [dir="rtl"] .sidebar.open { transform: translateX(0); }
}


/* Sidebar quick language switcher */
.lang-switcher {
    display: inline-flex; align-items: center; gap: 6px;
    color: inherit;
}
.lang-switcher select {
    all: unset;
    cursor: pointer;
    font-size: .72rem; font-weight: 500;
    padding: 3px 6px; border-radius: 6px;
    color: inherit;
}
.lang-switcher select:hover { opacity: .75; }
.lang-switcher select option { color: #17241F; }
.admin-sidebar .lang-switcher { margin-top: 4px; }
