/* ==========================================================================
   MONITO DESIGN SYSTEM — COMPONENT LAYER
   --------------------------------------------------------------------------
   Requires monito-ds.tokens.css to be loaded first.

   Framework-agnostic: nothing here depends on Bootstrap. §11 re-tints
   Bootstrap if it happens to be present, and is inert if it is not.

   Every colour, radius and shadow below resolves through a token, so this
   file is theme-agnostic: it is never duplicated for dark mode.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. BASE
   -------------------------------------------------------------------------- */

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

body {
    margin: 0;
    min-height: 100vh;
    overflow-x: hidden;
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-main);
    font-weight: 600;
    letter-spacing: 0;
}

a { color: var(--primary-color); text-decoration: none; transition: var(--ease-ctrl); }

/* Tabular numerals. Put .mono on EVERY metric: without it, proportional
   digits make a column of numbers jitter as values update. */
.mono {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em;
}

/* One visible focus ring for the whole product. */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: var(--radius-xs);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* --------------------------------------------------------------------------
   2. APP SHELL — fixed sidebar + fixed top bar + offset content
   -------------------------------------------------------------------------- */

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1000;
    width: var(--sidebar-width);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--hairline);   /* the edge — not a shadow */
    box-shadow: var(--shadow-sm);
    transition: var(--ease-pane);
}

.main-content {
    margin-left: var(--sidebar-width);
    padding: calc(var(--header-height) + 20px) 2rem 2rem;
    min-height: 100vh;
}

.app-footer { margin-left: var(--sidebar-width); }

/* The ONE legitimate use of backdrop blur in this system: a translucent bar
   that page content physically scrolls beneath. Never blur a static panel. */
.top-navbar {
    position: fixed;
    top: 0;
    right: 0;
    left: var(--sidebar-width);
    z-index: 900;
    height: var(--header-height);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--hairline);
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 3rem;
    color: var(--primary-color);
    font-size: 1.5rem;
    font-weight: 700;
}

/* --- Sidebar navigation --- */
.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.85rem 1rem;
    margin-bottom: 0.5rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-weight: 500;
    transition: var(--ease-ctrl);
}

.nav-link i { font-size: 1.2rem; }

.nav-link:hover {
    background: var(--primary-soft);
    color: var(--primary-color);
    transform: translateX(4px);   /* the only playful motion in the shell */
}

.nav-link.active {
    background: var(--primary-color);
    color: #fff;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--primary-color) 30%, transparent);
}

.sidebar-section {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--hairline);
}

.sidebar-section-title {
    color: var(--text-muted);
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
}

/* --- Top-bar search --- */
.topbar-search {
    flex: 1;
    max-width: 440px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 12px;
    background: var(--surface-2);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-md);
    color: var(--text-light);
    transition: border-color 0.15s ease, background 0.15s ease;
}

/* Focus lifts the field from "recessed" to "active surface". */
.topbar-search:focus-within {
    border-color: var(--primary-color);
    background: var(--bg-card);
}

.topbar-search input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text-main);
    font: inherit;
    font-size: 0.88rem;
}

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

.topbar-kbd {
    flex: 0 0 auto;
    padding: 1px 6px;
    background: var(--bg-card);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-xs);
    color: var(--text-light);
    font-family: var(--mono);
    font-size: 0.66rem;
}

/* --- User chip --- */
.user-profile-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: var(--ease-ctrl);
}

.user-profile-btn:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.user-avatar {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: #fff;
    font-weight: 700;
}

/* --------------------------------------------------------------------------
   3. PANEL — .board
   The workhorse container. Hairline border + 16px radius + whisper shadow.
   overflow:hidden lets child rows run edge-to-edge and still be clipped by
   the radius, so no child ever needs its own corner rounding.
   -------------------------------------------------------------------------- */

.board {
    background: var(--bg-card);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.board-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 18px;
    border-bottom: 1px solid var(--hairline);
}

.board-head h3 { margin: 0; font-size: 0.95rem; font-weight: 700; }

.board-head .count {
    padding: 2px 9px;
    background: var(--surface-2);
    border-radius: var(--radius-pill);
    color: var(--text-light);
    font-size: 0.72rem;
    font-weight: 600;
}

/* Only for free-form content. Rows/lists attach directly to .board instead,
   so their hover state can bleed to the panel edge. */
.board-body { padding: 16px 18px; }

.board-legend {
    margin-left: auto;
    display: flex;
    gap: 14px;
    color: var(--text-light);
    font-size: 0.72rem;
}

.board-legend i.lg {
    display: inline-block;
    width: 9px;
    height: 9px;
    margin-right: 4px;
    border-radius: var(--radius-bar);
}

.board-legend i.up   { background: var(--up); }
.board-legend i.warn { background: var(--warn); }
.board-legend i.down { background: var(--down); }

/* --------------------------------------------------------------------------
   4. STATUS-REACTIVE CONTAINERS — the signature move
   A neutral panel that grows a 4px coloured rail (and, at the top severity,
   a gradient wash) from a single state class. The panel itself never
   changes shape, so the page does not reflow when status flips.
   -------------------------------------------------------------------------- */

.status-strip,
.detail-hero {
    position: relative;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
}

.status-strip { display: flex; align-items: center; gap: 16px; padding: 16px 20px; }

/* The rail. ::before means zero extra markup and no layout cost. */
.status-strip::before,
.detail-hero::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--idle);
}

.status-strip.ok::before     { background: var(--up); }
.status-strip.warn::before   { background: var(--warn); }
.status-strip.danger::before { background: var(--down); }

.detail-hero.up::before      { background: var(--up); }
.detail-hero.down::before    { background: var(--down); }
.detail-hero.paused::before,
.detail-hero.pending::before { background: var(--idle); }

/* Reserved for the worst state only. Fades to the plain card by 45% so the
   tint never reaches the text. Escalation, used sparingly, stays legible. */
.detail-hero.down { background: linear-gradient(90deg, var(--down-soft), var(--bg-card) 45%); }

/* Rounded-square icon tile. Soft background + ink glyph = the triad in use. */
.strip-icon {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: var(--idle-soft);
    color: var(--text-muted);
    font-size: 22px;
}

.status-strip.ok .strip-icon     { background: var(--up-soft);   color: var(--up-ink); }
.status-strip.warn .strip-icon   { background: var(--warn-soft); color: var(--warn-ink); }
.status-strip.danger .strip-icon { background: var(--down-soft); color: var(--down-ink); }

.strip-main { flex: 1; min-width: 0; }
.strip-main h2 { margin: 0; font-size: 1.05rem; font-weight: 700; }
.strip-main p  { margin: 2px 0 0; color: var(--text-muted); font-size: 0.82rem; }
.strip-chips { display: flex; gap: 8px; flex-wrap: wrap; }

/* --- Detail hero interior --- */
.detail-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 18px;
    padding: 18px 22px;
}

.dh-left { min-width: 0; }
.detail-hero h1 { margin: 10px 0 2px; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.dh-url  { color: var(--text-muted); font-size: 0.85rem; word-break: break-all; }
.dh-meta { margin-top: 8px; display: flex; gap: 14px; flex-wrap: wrap; color: var(--text-light); font-size: 0.78rem; }
.dh-meta b { color: var(--text-muted); font-weight: 600; }
.dh-actions { flex: 0 0 auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* --------------------------------------------------------------------------
   5. KPI ROW
   -------------------------------------------------------------------------- */

.kpi-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }

.kpi {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-lg);   /* 12px — one step tighter than panels */
    box-shadow: var(--shadow-sm);
}

.kpi .k-top   { display: flex; align-items: center; justify-content: space-between; }
.kpi .k-label { color: var(--text-muted); font-size: 0.78rem; font-weight: 500; }
.kpi .k-ic    { color: var(--text-light); font-size: 0.95rem; }

/* Tight tracking on big numerals. Without -0.03em, 1.65rem digits look loose. */
.kpi .k-val { font-size: 1.65rem; font-weight: 700; line-height: 1; letter-spacing: -0.03em; }

/* Units ride along at 0.85rem/--text-light so "412 ms" reads as one value,
   not two words. */
.kpi .k-val small { color: var(--text-light); font-size: 0.85rem; font-weight: 600; }

/* A KPI value is coloured ONLY when it is the number that is wrong. */
.kpi .k-val.up   { color: var(--up-ink); }
.kpi .k-val.down { color: var(--down-ink); }
.kpi .k-val.warn { color: var(--warn-ink); }

.kpi .k-sub { color: var(--text-light); font-size: 0.72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.track { height: 5px; border-radius: var(--radius-bar); background: var(--surface-2); overflow: hidden; }
.track > i { display: block; height: 100%; border-radius: var(--radius-bar); background: var(--up); }

@media (max-width: 1200px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width:  640px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }

/* --------------------------------------------------------------------------
   6. UPTIME BARS — the identity element
   Flex + flex:1 per bar means N bars always fill the width exactly; no
   width maths, no media queries. Swap the tick meaning (days → builds →
   deploys) and this ports to any dashboard unchanged.
   -------------------------------------------------------------------------- */

.uptime-bars { display: flex; align-items: stretch; gap: 2px; height: 28px; }

.uptime-bars .ubar {
    flex: 1;
    min-width: 2px;
    border-radius: var(--radius-bar);
    background: var(--up);
}

.uptime-bars .ubar.warn { background: var(--warn); }
.uptime-bars .ubar.down { background: var(--down); }
.uptime-bars .ubar.none { background: var(--surface-2); }   /* no data ≠ failure */

.uptime-bars.lg { height: 40px; gap: 3px; }
.uptime-bars.lg .ubar { border-radius: 3px; }

.bars-foot {
    display: flex;
    justify-content: space-between;
    margin-top: 5px;
    color: var(--text-light);
    font-size: 0.68rem;
}

.bars-foot b { color: var(--up-ink); font-weight: 700; }
.bars-foot b.down { color: var(--down-ink); }

/* --------------------------------------------------------------------------
   7. DATA ROW — .mrow
   A whole table row that is one <a>. Fixed grid columns keep every row's
   numbers aligned into readable columns without a <table>.
   -------------------------------------------------------------------------- */

.mrow {
    display: grid;
    grid-template-columns: minmax(180px, 1.3fr) minmax(220px, 2fr) 92px 104px 26px;
    align-items: center;
    gap: 16px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--hairline);
    color: var(--text-main);
    text-decoration: none;
    transition: var(--ease-row);
}

.mrow:last-child { border-bottom: 0; }   /* never double up on the panel edge */
.mrow:hover { background: var(--surface-2); }

.m-id { display: flex; align-items: center; gap: 11px; min-width: 0; }

.m-id .st {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-md);
    background: var(--idle-soft);
    color: var(--text-light);
    font-size: 1.05rem;
}

.m-id .st.up   { background: var(--up-soft);   color: var(--up-ink); }
.m-id .st.down { background: var(--down-soft); color: var(--down-ink); }

.m-name { min-width: 0; }
.m-name .d { display: block; font-size: 0.9rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-name .meta { color: var(--text-light); font-size: 0.72rem; }

.m-resp { text-align: right; }
.m-resp .v { font-size: 0.9rem; font-weight: 600; }
.m-resp .l { color: var(--text-light); font-size: 0.68rem; }
.m-resp.off .v { color: var(--text-light); }   /* no reading ≠ a bad reading */

.m-ssl { display: flex; justify-content: flex-end; }

/* The affordance is ambient: grey until the row is hovered. */
.m-go { text-align: right; color: var(--text-light); font-size: 1.1rem; }
.mrow:hover .m-go { color: var(--primary-color); }

@media (max-width: 820px) {
    .mrow { grid-template-columns: 1fr 1fr; gap: 10px 14px; }
    .m-bars { grid-column: 1 / -1; }
    .m-go { display: none; }
}

/* --------------------------------------------------------------------------
   8. CHIPS, PILLS, BADGES, DOTS
   -------------------------------------------------------------------------- */

/* Pill — fully round, for a single authoritative state. */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 28px;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-pill);
    background: var(--idle-soft);
    color: var(--idle-ink);
    font-size: 0.85rem;
    font-weight: 700;
}

.status-pill.up   { background: var(--up-soft);   color: var(--up-ink); }
.status-pill.down { background: var(--down-soft); color: var(--down-ink); }
.status-pill.big  { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

/* Metric chip — a countable fact ("3 výpadky"). */
.mchip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 600;
}

.mchip i { font-size: 0.9rem; }
.mchip.up   { background: var(--up-soft);   color: var(--up-ink); }
.mchip.warn { background: var(--warn-soft); color: var(--warn-ink); }
.mchip.down { background: var(--down-soft); color: var(--down-ink); }

/* Data chip — softly rounded, for a value with a unit. */
.ssl-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.ssl-chip i { font-size: 0.82rem; }
.ssl-chip.warn { background: var(--warn-soft); color: var(--warn-ink); }
.ssl-chip.down { background: var(--down-soft); color: var(--down-ink); }
.ssl-chip.none { color: var(--text-light); }

.badge-mini { padding: 1px 6px; border-radius: var(--radius-xs); font-size: 0.66rem; font-weight: 700; }
.badge-mini.down { background: var(--down-soft); color: var(--down-ink); }
.badge-mini.warn { background: var(--warn-soft); color: var(--warn-ink); }

/* Dot — the smallest status atom. */
.status-dot {
    flex: 0 0 10px;
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--idle);
}

.status-dot.up { background: var(--up); }

/* The ONLY looping animation in the system. Reserved for "down, right now".
   An expanding box-shadow ring costs no layout. If everything pulses,
   nothing is urgent. */
.status-dot.down {
    background: var(--down);
    animation: ds-pulse 1.4s infinite;
}

@keyframes ds-pulse {
      0% { box-shadow: 0 0 0 0   color-mix(in srgb, var(--down) 45%, transparent); }
     70% { box-shadow: 0 0 0 8px transparent; }
    100% { box-shadow: 0 0 0 0   transparent; }
}

/* --------------------------------------------------------------------------
   9. LISTS — incident feed & attention list
   -------------------------------------------------------------------------- */

.feed-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: start;
    padding: 12px 18px;
    border-bottom: 1px solid var(--hairline);
    color: var(--text-main);
    text-decoration: none;
}

.feed-item:last-child { border-bottom: 0; }
.feed-item:hover { background: var(--surface-2); }

.feed-item .sev { width: 9px; height: 9px; margin-top: 5px; border-radius: 50%; background: var(--idle); }
.feed-item .sev.critical { background: var(--down); }
.feed-item .sev.warning  { background: var(--warn); }
.feed-item .sev.info     { background: var(--primary-color); }   /* accent = neutral news */

.feed-txt { min-width: 0; }
.feed-txt .d   { display: block; font-size: 0.84rem; }
.feed-txt .dom { color: var(--primary-color); }
.feed-txt .sub { color: var(--text-light); font-size: 0.72rem; }
.feed-t { color: var(--text-light); font-size: 0.72rem; white-space: nowrap; }

/* Inset list: 6px padding on the wrapper + 10px radius on items, so hover
   reads as a floating pill INSIDE the panel rather than a full-bleed row.
   Use it when items are actions; use .mrow/.feed-item when they are records. */
.attention { padding: 6px; }

.att-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: var(--text-main);
    text-decoration: none;
}

.att-item:hover { background: var(--surface-2); }

.att-ic {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-md);
    font-size: 1rem;
}

.att-ic.down { background: var(--down-soft); color: var(--down-ink); }
.att-ic.warn { background: var(--warn-soft); color: var(--warn-ink); }

.att-item .a-main { flex: 1; min-width: 0; }
.att-item .a-main b { display: block; font-size: 0.84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-item .a-main .s { color: var(--text-light); font-size: 0.72rem; }
.att-item .a-btn { color: var(--primary-color); font-size: 0.75rem; font-weight: 600; white-space: nowrap; }

/* --------------------------------------------------------------------------
   10. CONTROLS
   -------------------------------------------------------------------------- */

/* Segmented control. The GROUP is recessed (surface-2); the ACTIVE segment
   is raised back to card level with a shadow. Selection = elevation, so it
   survives both themes without a border. */
.seg {
    display: inline-flex;
    gap: 2px;
    padding: 3px;
    border-radius: 9px;
    background: var(--surface-2);
}

.seg-btn {
    padding: 5px 13px;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
}

.seg-btn.active {
    background: var(--bg-card);
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
}

/* Empty state. Dashed hairline = "something belongs here", vs the solid
   hairline of a real panel. */
.empty-state {
    min-height: 180px;
    display: grid;
    place-items: center;
    text-align: center;
    padding: 1rem;
    border: 1px dashed color-mix(in srgb, var(--hairline) 70%, transparent);
    border-radius: var(--radius-xl);
    color: var(--text-muted);
}

.empty-state.compact { min-height: 100px; }
.empty-state i { display: block; margin-bottom: 0.5rem; font-size: 1.8rem; }

.settings-help {
    padding: 10px 12px;
    background: var(--surface-2);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Destructive area: a red-tinted hairline, NOT a red fill. The border
   carries the warning; the content stays readable. */
.danger-zone { border-color: color-mix(in srgb, var(--down) 35%, var(--hairline)); }
.danger-zone .board-head h3 { color: var(--down-ink); }

/* --------------------------------------------------------------------------
   11. FORMS & BUTTONS
   Standalone definitions. If Bootstrap 5.3 is present it already styles
   .btn/.form-control, and the --bs-* overrides below simply re-tint it.
   -------------------------------------------------------------------------- */

.ds-input, .form-control, .form-select {
    width: 100%;
    padding: 9px 12px;
    background: var(--bg-card);
    border: 1px solid var(--hairline);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    font: inherit;
    font-size: 0.9rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.ds-input:focus, .form-control:focus, .form-select:focus {
    outline: 0;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-soft);   /* halo, not a glow */
}

.ds-input::placeholder, .form-control::placeholder { color: var(--text-light); }

.ds-label, .form-label {
    display: block;
    margin-bottom: 5px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.form-text { color: var(--text-light); font-size: 0.78rem; }

.ds-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--ease-ctrl);
}

.ds-btn-primary { background: var(--primary-color); border-color: var(--primary-color); color: #fff; }
.ds-btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }

.ds-btn-outline { background: transparent; border-color: var(--hairline); color: var(--text-main); }
.ds-btn-outline:hover { background: var(--surface-2); }

.ds-btn-block { width: 100%; }

/* Bootstrap re-tint (inert without Bootstrap). */
.btn-primary {
    --bs-btn-bg: var(--primary-color);
    --bs-btn-border-color: var(--primary-color);
    --bs-btn-hover-bg: var(--primary-dark);
    --bs-btn-hover-border-color: var(--primary-dark);
    --bs-btn-active-bg: var(--primary-dark);
    --bs-btn-active-border-color: var(--primary-dark);
    --bs-btn-disabled-bg: var(--primary-color);
    --bs-btn-disabled-border-color: var(--primary-color);
}

.btn-outline-primary {
    --bs-btn-color: var(--primary-color);
    --bs-btn-border-color: var(--primary-color);
    --bs-btn-hover-bg: var(--primary-color);
    --bs-btn-hover-border-color: var(--primary-color);
    --bs-btn-active-bg: var(--primary-color);
    --bs-btn-active-border-color: var(--primary-color);
}

/* --------------------------------------------------------------------------
   12. AUTH — split screen (login / register)
   Left: saturated brand panel, the only place gradients live.
   Right: the app's real surface, so signing in is visually continuous with
   the dashboard behind it.
   -------------------------------------------------------------------------- */

.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }

.auth-aside {
    position: relative;
    overflow: hidden;
    /* Caps the decorative panel at the viewport so its content can never
       force the grid row taller than the screen and drag the form column
       off-centre. */
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 28px;
    padding: 44px 48px;
    background: linear-gradient(160deg, #4a44c9 0%, #6d67f0 55%, #8f7bff 100%);
    color: #fff;
}

/* Off-canvas radial glow: 460px circle pulled 170px past the corner, so only
   the falloff is visible. This is the ONE decorative blur in the system —
   it sits behind content and never touches an edge. */
.aa-glow {
    position: absolute;
    top: -170px;
    right: -170px;
    width: 460px;
    height: 460px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.22), transparent 68%);
    pointer-events: none;
}

/* Lift content above the glow — but do NOT set position on .aa-glow itself:
   equal specificity + later source order would override its absolute
   positioning, dropping it into flow and inflating the panel height. */
.auth-aside > *:not(.aa-glow) { position: relative; z-index: 1; }

.aa-brand { display: inline-flex; align-items: center; gap: 9px; color: #fff; font-size: 1.35rem; font-weight: 700; letter-spacing: -0.02em; }
.aa-brand i { font-size: 1.4rem; }

.aa-body h1 { margin: 0 0 12px; font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; text-wrap: balance; }
.aa-body > p { margin: 0 0 26px; max-width: 42ch; color: rgba(255, 255, 255, 0.82); font-size: 1rem; line-height: 1.55; }

.aa-features { list-style: none; margin: 0 0 30px; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.aa-features li { display: flex; align-items: center; gap: 11px; color: rgba(255, 255, 255, 0.92); font-size: 0.92rem; }
.aa-features i { color: #9dffce; font-size: 1.05rem; }

/* On the saturated panel the app's tokens would disappear, so this block
   carries its own brightened literals. It is the documented exception. */
.aa-demo {
    max-width: 360px;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 14px;
}

.aa-demo-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 0.85rem; font-weight: 600; }
.aa-dot { width: 9px; height: 9px; border-radius: 50%; background: #5ff0b0; box-shadow: 0 0 0 3px rgba(95, 240, 176, 0.25); }
.aa-demo-pct { margin-left: auto; font-family: var(--mono); font-variant-numeric: tabular-nums; color: #c9ffe4; }
.aa-demo .uptime-bars { height: 26px; }
.aa-demo .ubar { background: rgba(255, 255, 255, 0.30); }
.aa-demo .ubar.up   { background: #5ff0b0; }
.aa-demo .ubar.warn { background: #ffd76b; }
.aa-foot { color: rgba(255, 255, 255, 0.7); font-size: 0.8rem; }

/* min-height:100vh keeps the form centred against the VIEWPORT even if the
   grid row is shorter or taller than the screen. */
.auth-main {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 22px;
    background: var(--bg-body);
}

/* No card, no border, no shadow. The form sits directly on the page — one
   less box, and it makes the split feel intentional rather than a modal. */
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { margin: 0 0 4px; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.02em; }
.auth-card .auth-sub { margin: 0 0 22px; color: var(--text-muted); font-size: 0.9rem; }

.auth-alt { margin-top: 20px; text-align: center; color: var(--text-muted); font-size: 0.88rem; }
.auth-alt a { color: var(--primary-color); font-weight: 600; }

.auth-honeypot { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

.auth-mini-brand { display: none; }

@media (max-width: 1080px) {
    .aa-glow { width: 340px; height: 340px; top: -120px; right: -120px; }
}

/* Below 860px the brand panel is dropped entirely rather than stacked —
   it is decoration, and on a phone it would just push the form below the
   fold. Its identity is replaced by a one-line brand above the form. */
@media (max-width: 860px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-aside { display: none; }
    .auth-mini-brand {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        margin-bottom: 20px;
        color: var(--primary-color);
        font-size: 1.2rem;
        font-weight: 700;
    }
    .auth-mini-brand i { font-size: 1.3rem; }
}

/* --------------------------------------------------------------------------
   13. SHELL RESPONSIVE — sidebar becomes a drawer
   -------------------------------------------------------------------------- */

@media (max-width: 991px) {
    .sidebar { transform: translateX(-100%); box-shadow: 5px 0 15px rgba(0, 0, 0, 0.1); }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; padding-top: 100px; }
    .app-footer { margin-left: 0; }
    .top-navbar { left: 0; }
}

/* Scrim for the mobile drawer — the second and last legitimate blur. */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 999;                 /* under the sidebar (1000), over everything else */
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.sidebar-backdrop.show { opacity: 1; pointer-events: auto; }
