/* ========================================================================= */
/* ========  SOS IT - Global Theme  (clean, professional, left-aligned)  === */
/* ========================================================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,400;0,500;0,600;0,700;1,400&family=Outfit:wght@600;700&display=swap');

/* -------------------------------------------------------------------------
   Design tokens
   ---------------------------------------------------------------------- */
:root {
    /* Brand */
    --primary: #c0392b;
    --primary-dark: #a93226;
    --primary-light: #fdf3f2;
    --primary-rgb: 192, 57, 43;

    /* Status */
    --success: #16a34a;
    --success-rgb: 22, 163, 74;
    --danger: #c0392b;
    --danger-rgb: 192, 57, 43;
    --warning: #b45309;
    --warning-rgb: 180, 83, 9;
    --info: #1d4ed8;
    --info-rgb: 29, 78, 216;

    /* Text */
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;

    /* Surfaces */
    --bg-color: #f3f4f6;
    --surface-color: #ffffff;
    --border-color: #e5e7eb;
    --border-strong: #d1d5db;

    /* Table */
    --thead-bg: #f9fafb;
    --thead-text: #6b7280;
    --row-hover-bg: #f9fafb;

    /* Layout */
    --sidebar-width-collapsed: 68px;
    --sidebar-width: var(--sidebar-width-collapsed);
    --topbar-height: 60px;
    --footer-height: 38px;
    --content-padding: 1.5rem;
    --content-padding-mobile: 1rem;

    /* Radius */
    --radius-sm: 0.25rem;
    --radius: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.625rem;
    --radius-xl: 0.75rem;
    --radius-2xl: 1rem;

    /* Shadows - subtle */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .05);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .04);
    --shadow: 0 4px 6px rgba(0, 0, 0, .06), 0 2px 4px rgba(0, 0, 0, .04);
    --shadow-md: 0 8px 16px rgba(0, 0, 0, .07), 0 4px 6px rgba(0, 0, 0, .04);
    --shadow-lg: 0 16px 32px rgba(0, 0, 0, .08), 0 8px 12px rgba(0, 0, 0, .04);

    /* Transition */
    --t: 150ms ease;
    --transition: 0.2s ease;

    /* Misc */
    --white: #fff;
    --black: #000;

    /* Public pages (machine/create, login) */
    --body-bg-light: #f0f2f5;
    --card-bg: rgba(255, 255, 255, 0.97);
    --input-bg: #f9fafb;
    --bg-image-opacity: 0.08;
    --secondary: #e74c3c;
    --secondary-rgb: 231, 76, 60;
}

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

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

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

a:hover {
    color: var(--primary-dark);
}

img {
    max-width: 100%;
    display: block;
}

/* -------------------------------------------------------------------------
   Utilities
   ---------------------------------------------------------------------- */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Typography helpers */
.text-muted {
    color: var(--text-muted) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

.font-medium {
    font-weight: 500;
}

.font-semibold {
    font-weight: 600;
}

.font-bold {
    font-weight: 700;
}

.small {
    font-size: 0.8125rem;
}

/* Layout helpers */
.d-flex {
    display: flex;
}

.d-inline-flex {
    display: inline-flex;
}

.align-items-center {
    align-items: center;
}

.justify-content-between {
    justify-content: space-between;
}

.flex-wrap {
    flex-wrap: wrap;
}

.gap-1 {
    gap: 0.25rem;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 0.75rem;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.mb-1 {
    margin-bottom: 0.25rem !important;
}

.mb-2 {
    margin-bottom: 0.5rem !important;
}

.mb-3 {
    margin-bottom: 0.75rem !important;
}

.mt-3 {
    margin-top: 0.75rem !important;
}

.mr-1 {
    margin-right: 0.25rem;
}

.align-self-center {
    align-self: center;
}

.text-right {
    text-align: right;
}

/* -------------------------------------------------------------------------
   Lucide Icon tokens
   ---------------------------------------------------------------------- */
.lucide-icon {
    width: 1.125rem;
    height: 1.125rem;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
    flex-shrink: 0;
    display: inline-block;
    vertical-align: middle;
}

.lucide-icon--sm {
    width: 0.9375rem;
    height: 0.9375rem;
}

.lucide-icon--md {
    width: 1.25rem;
    height: 1.25rem;
}

.lucide-icon--lg {
    width: 1.5rem;
    height: 1.5rem;
}

.lucide-icon--menu {
    width: 1.25rem;
    height: 1.25rem;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.lucide-icon.spin {
    animation: spin 0.8s linear infinite;
    transform-origin: center;
}

/* -------------------------------------------------------------------------
   App-icon style header badge (red square + white lucide icon)
   ---------------------------------------------------------------------- */
.h-icon {
    width: 28px;
    height: 28px;
    background: #dc2626;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #fff;
}

.h-icon svg,
.h-icon i {
    width: 16px;
    height: 16px;
    color: #fff !important;
    stroke: #fff !important;
}

/* -------------------------------------------------------------------------
   Buttons - clean, no shimmer, no exaggerated effects
   ---------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.45rem 1rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.4;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: background-color var(--t), border-color var(--t), color var(--t), box-shadow var(--t);
    user-select: none;
    -webkit-user-select: none;
    vertical-align: middle;
}

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

.btn:disabled,
.btn[disabled] {
    opacity: .55;
    cursor: not-allowed;
    pointer-events: none;
}

/* Primary */
.btn-primary {
    background: var(--primary);
    color: var(--white) !important;
    border-color: var(--primary);
    box-shadow: var(--shadow-xs);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    color: var(--white) !important;
    box-shadow: var(--shadow-sm);
}

/* Secondary / outline */
.btn-secondary,
.btn-outline {
    background: var(--surface-color);
    color: var(--text-primary);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-xs);
}

.btn-secondary:hover,
.btn-outline:hover {
    background: var(--bg-color);
    border-color: var(--primary);
    color: var(--primary);
}

/* Danger */
.btn-danger {
    background: var(--danger);
    color: var(--white) !important;
    border-color: var(--danger);
    box-shadow: var(--shadow-xs);
}

.btn-danger:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: var(--shadow-sm);
}

/* Sizes */
.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8125rem;
    border-radius: var(--radius);
}

.btn-lg {
    padding: 0.6rem 1.25rem;
    font-size: 0.9375rem;
    border-radius: var(--radius-lg);
}

/* Icon button (table actions) */
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem;
    border-radius: var(--radius);
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: color var(--t), background var(--t), border-color var(--t);
    line-height: 1;
}

.btn-icon:hover {
    background: var(--bg-color);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.btn-icon.btn-edit:hover {
    color: var(--info);
    background: #eff6ff;
    border-color: #bfdbfe;
}

.btn-icon.btn-delete:hover {
    color: var(--danger);
    background: #fef2f2;
    border-color: #fecaca;
}

.btn-icon .lucide-icon {
    width: 1rem;
    height: 1rem;
}

/* -------------------------------------------------------------------------
   Form controls - clean, professional
   ---------------------------------------------------------------------- */
.form-control,
select.form-control,
textarea.form-control {
    display: block;
    width: 100%;
    padding: 0.45rem 0.75rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--text-primary);
    background: var(--surface-color);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    transition: border-color var(--t), box-shadow var(--t);
    appearance: none;
    -webkit-appearance: none;
    line-height: 1.5;
}

.form-control:focus,
select.form-control:focus,
textarea.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .12);
    background: var(--surface-color);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control.is-invalid {
    border-color: var(--danger);
}

.form-control:disabled {
    background: var(--bg-color);
    color: var(--text-muted);
    cursor: not-allowed;
}

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.invalid-feedback {
    display: none;
    margin-top: 0.25rem;
    font-size: 0.78rem;
    color: var(--danger);
    font-weight: 500;
}

/* Sidebar - always expanded */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 220px;
    background: var(--surface-color);
    border-right: 1px solid var(--border-color);
    box-shadow: var(--shadow-xs);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Nav text always visible */
.sidebar .nav-link-text,
.sidebar .sidebar-slogan,
.sidebar .nav-group-title {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.875rem;
}

/* Logo / header */
.sidebar-header {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: 0.625rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    padding: 0 0.875rem;
}

.sidebar-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: 10px;
    background: #dc2626;
    color: #fff;
    transition: background var(--t), box-shadow var(--t);
    text-decoration: none;
}

.sidebar-logo:hover {
    background: #b91c1c;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25);
    color: #fff;
}

.sidebar-logo .lucide-icon,
.sidebar-logo .sidebar-logo-icon {
    width: 1rem;
    height: 1rem;
    color: inherit;
}

/* Brand name next to logo */
.sidebar-brand-name {
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    font-weight: 800;
    color: #dc2626;
    white-space: nowrap;
    letter-spacing: -0.02em;
}

/* Nav */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.sidebar-nav::-webkit-scrollbar {
    width: 0;
}

.sidebar .nav {
    list-style: none;
    padding: 0 0.5rem;
}

.sidebar .nav-item {
    margin-bottom: 2px;
}

.sidebar .nav-link {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.625rem;
    padding: 0.55rem 0.75rem;
    height: 2.5rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary) !important;
    transition: background var(--t), color var(--t);
    text-decoration: none;
}

.sidebar .nav-link .lucide-icon {
    color: inherit;
    width: 1.0625rem;
    height: 1.0625rem;
    flex-shrink: 0;
}

.sidebar .nav-link:hover {
    background: var(--bg-color);
    color: var(--text-primary) !important;
}

.sidebar .nav-link.active {
    background: var(--primary-light);
    color: var(--primary) !important;
}

.sidebar .nav-link.active .lucide-icon {
    color: var(--primary);
}

/* Section labels - always visible */
.sidebar .nav-section-label {
    list-style: none;
    padding: 0.75rem 0.875rem 0.25rem;
    font-size: 0.5625rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Platform / RSI items */
.sidebar .nav-item.sidebar-nav--platform .nav-link,
.sidebar .nav-item.sidebar-nav--rsi .nav-link {
    border-radius: var(--radius-md);
}





/* Sidebar footer */
.sidebar-footer {
    padding: 0.5rem 0.875rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.sidebar .countdown-display {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-muted);
    font-size: 0.6875rem;
    font-weight: 500;
    cursor: default;
}

.sidebar .countdown-display .lucide-icon {
    width: 0.8125rem;
    height: 0.8125rem;
}

.sidebar .countdown-value {
    min-width: 14px;
    text-align: right;
}

.sidebar .countdown-unit {
    font-size: 0.5625rem;
}

/* Overlay (mobile) */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .4);
    z-index: 1099;
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease, visibility 0s .2s;
}

/* Mobile toggle button */
.sidebar-toggle.mobile-only {
    display: none;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.35rem;
    cursor: pointer;
    border-radius: var(--radius);
}

.sidebar-toggle.mobile-only:hover {
    color: var(--primary);
    background: var(--bg-color);
}

.sidebar-toggle.mobile-only .lucide-icon {
    width: 1.25rem;
    height: 1.25rem;
}


/* -------------------------------------------------------------------------
   Fixed footer - always offset 220px on desktop
   ---------------------------------------------------------------------- */
.sos-footer {
    position: fixed;
    bottom: 0;
    left: 220px;
    right: 0;
    height: var(--footer-height);
    background: var(--surface-color);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    z-index: 999;
    padding: 0 var(--content-padding);
}

.sos-footer__brand {
    font-weight: 600;
    color: var(--text-secondary);
}

.sos-footer__version {
    font-family: ui-monospace, monospace;
    color: var(--text-muted);
}

.sos-footer__divider {
    color: var(--border-strong);
}

@media (max-width: 991.98px) {
    .sos-footer {
        left: 0 !important;
    }
}

/* -------------------------------------------------------------------------
   Main panel - always offset 220px on desktop
   ---------------------------------------------------------------------- */
.main-panel {
    position: relative;
    z-index: 1;
    margin-left: 220px;
    width: calc(100% - 220px);
    min-height: 100vh;
}

/* -------------------------------------------------------------------------
   Topbar - always offset 220px on desktop
   ---------------------------------------------------------------------- */
.top-bar {
    position: sticky;
    top: 0;
    margin-left: 220px;
    width: calc(100% - 220px);
    height: var(--topbar-height);
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 var(--content-padding);
    z-index: 1000;
    box-shadow: var(--shadow-xs);
    gap: 1rem;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: auto;
}

.top-bar-brand {
    display: flex;
    flex-direction: column;
}

.top-bar-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--text-primary) !important;
    line-height: 1.2;
    margin: 0;
    -webkit-text-fill-color: var(--text-primary) !important;
}

.top-bar-title-prefix {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: 0.5625rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.1rem;
}

.top-bar-tagline {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1;
    font-weight: 400;
}

/* Console topbar extras */
.top-bar-console-user {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

/* Console topbar variant - subtle left-border accent */
.top-bar--console {
    border-left: 3px solid var(--primary);
}

/* Console main panel - same layout, reduced side padding for wider tables */
.main-panel--console .content {
    padding-left: var(--content-padding);
    padding-right: var(--content-padding);
}

/* Search */
.search-container {
    position: relative;
}

.search-input {
    padding: 0.4rem 0.75rem 0.4rem 2rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-color);
    color: var(--text-primary);
    font-size: 0.8125rem;
    min-width: 180px;
    outline: none;
    transition: border-color var(--t), box-shadow var(--t);
}

.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), .1);
    background: var(--surface-color);
}

.search-icon {
    position: absolute;
    left: 0.625rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.search-container .lucide-icon.search-icon {
    width: 0.875rem;
    height: 0.875rem;
}

/* Notification */
.notification-badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.35rem;
    border-radius: 8px;
    transition: background 0.15s, color 0.15s;
}

.notification-badge.hidden {
    display: none;
}

.notification-badge .lucide-icon {
    width: 1.15rem;
    height: 1.15rem;
    transition: color 0.15s;
}

.notification-badge:hover {
    background: rgba(var(--primary-rgb), 0.06);
    color: var(--primary);
}

.notification-count {
    position: absolute;
    top: 1px;
    right: 0;
    background: var(--danger);
    color: var(--white);
    border-radius: 9999px;
    min-width: 15px;
    height: 15px;
    padding: 0 3px;
    font-size: 0.6rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--surface-color);
    animation: notifPulse 2s ease-in-out infinite;
}

.notification-count[data-count="0"] {
    display: none;
}

@keyframes notifPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Slogan (no typewriter - static) */
.top-bar-slogan {
    font-size: 0.6875rem;
    color: var(--text-secondary);
    font-weight: 400;
    margin-top: 0.1rem;
}

/* -------------------------------------------------------------------------
   Content area
   ---------------------------------------------------------------------- */
.content {
    padding: var(--topbar-height) var(--content-padding) calc(var(--footer-height) + 1rem);
}

/* -------------------------------------------------------------------------
   Responsive (mobile)
   ---------------------------------------------------------------------- */
@media (max-width: 991.98px) {

    /* Sidebar becomes slide-in drawer on mobile */
    .sidebar {
        transform: translateX(-100%);
        transition: transform .2s ease;
        width: 220px;
    }

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

    .sidebar.open~.sidebar-overlay {
        opacity: 1;
        visibility: visible;
        transition: opacity .2s ease;
    }

    /* Main panel / topbar go full-width on mobile */
    .main-panel {
        margin-left: 0 !important;
        width: 100% !important;
    }

    .top-bar {
        position: fixed;
        margin-left: 0 !important;
        width: 100% !important;
        padding: 0 var(--content-padding-mobile);
    }

    .sidebar-toggle.mobile-only {
        display: inline-flex !important;
    }

    .sidebar-toggle-btn {
        display: none !important;
    }

    .content {
        padding: var(--topbar-height) var(--content-padding-mobile) calc(var(--footer-height) + 1rem);
    }
}

@media (max-width: 576px) {
    .top-bar {
        padding: 0 0.75rem;
        gap: 0.5rem;
    }
    .top-bar-brand { display: none; }
    .top-bar-title { font-size: 0.9rem; }
    .search-input { min-width: 120px; font-size: 0.78rem; }
    .content { padding-left: 0.75rem; padding-right: 0.75rem; }
    .sos-footer { font-size: 0.68rem; gap: 0.4rem; padding: 0 0.75rem; }
    .btn { font-size: 0.8rem; padding: 0.4rem 0.75rem; }
    .btn-sm { font-size: 0.75rem; padding: 0.25rem 0.5rem; }
}

/* =========================================================================
   Buttons (global - applies to all authenticated pages)
   ===================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.45rem 1rem;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color var(--t), border-color var(--t), color var(--t), box-shadow var(--t);
    box-shadow: var(--shadow-xs);
}

.btn:disabled {
    opacity: .55;
    cursor: not-allowed;
    pointer-events: none;
}

.btn .lucide-icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

/* Sizes */
.btn-sm {
    padding: 0.3rem 0.7rem;
    font-size: 0.8125rem;
}

.btn-sm .lucide-icon {
    width: 0.875rem;
    height: 0.875rem;
}

.btn-icon {
    padding: 0.4rem;
}

.btn-icon .lucide-icon {
    margin: 0;
}

/* Variants */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

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

.btn-secondary {
    background: var(--surface-color);
    border-color: var(--border-strong);
    color: var(--text-secondary);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg-color);
    border-color: var(--text-muted);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.btn-danger:hover:not(:disabled) {
    background: #a93226;
    border-color: #a93226;
    color: #fff;
}

.btn-success {
    background: var(--success);
    border-color: var(--success);
    color: #fff;
}

.btn-success:hover:not(:disabled) {
    filter: brightness(.92);
}

.btn-warning {
    background: var(--warning);
    border-color: var(--warning);
    color: #fff;
}

.btn-warning:hover:not(:disabled) {
    filter: brightness(.92);
}

/* =========================================================================
   Admin Console pages (sos-admin__*)
   ===================================================================== */
.sos-admin {
    max-width: 1280px;
    padding-top: 1.75rem;
    padding-bottom: 2.5rem;
}

/* Header - left aligned */
.sos-admin__header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.sos-admin__title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.4375rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin: 0 0 0.25rem 0;
}

.sos-admin__subtitle {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Toolbar */
.sos-admin__toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.625rem;
    margin-bottom: 1.25rem;
}

.sos-admin__toolbar .form-control,
.sos-admin__toolbar select {
    min-width: 10rem;
}

/* Stat grid */
.sos-admin__stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.sos-admin__stat {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1rem 1.125rem;
    box-shadow: var(--shadow-xs);
}

.sos-admin__stat-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}

.sos-admin__stat-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.625rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

/* Card */
.sos-admin__card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xs);
    margin-bottom: 1.25rem;
    overflow: hidden;
}

/* KPI row - stat cards */
.sos-admin__kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.sos-admin__kpi {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--shadow-xs);
}

.sos-admin__kpi--blue {
    border-left-color: var(--info);
}

.sos-admin__kpi--orange {
    border-left-color: var(--warning);
}

.sos-admin__kpi--green {
    border-left-color: var(--success);
}

.sos-admin__kpi--red {
    border-left-color: var(--danger);
}

.sos-admin__kpi-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sos-admin__kpi--blue .sos-admin__kpi-icon {
    background: #eff6ff;
    color: var(--info);
}

.sos-admin__kpi--orange .sos-admin__kpi-icon {
    background: #fffbeb;
    color: var(--warning);
}

.sos-admin__kpi--green .sos-admin__kpi-icon {
    background: #f0fdf4;
    color: var(--success);
}

.sos-admin__kpi--red .sos-admin__kpi-icon {
    background: #fef2f2;
    color: var(--danger);
}

.sos-admin__kpi-icon .lucide-icon {
    width: 1.1rem;
    height: 1.1rem;
}

.sos-admin__kpi-body {
    display: flex;
    flex-direction: column;
    gap: .1rem;
}

.sos-admin__kpi-value {
    font-family: 'Outfit', sans-serif;
    font-size: 1.625rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

.sos-admin__kpi-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: .06em;
}

.sos-admin__card-head {
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--thead-bg);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sos-admin__card-title {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
}

.sos-admin__card-body {
    padding: 0;
}

/* Table */
.sos-admin__table-wrap {
    overflow-x: auto;
}

.sos-admin__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.sos-admin__table thead th {
    text-align: left;
    padding: 0.625rem 1.125rem;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--thead-text);
    background: var(--thead-bg);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.sos-admin__table tbody td {
    padding: 0.75rem 1.125rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

.sos-admin__table tbody tr:hover td {
    background: var(--row-hover-bg);
}

.sos-admin__table tbody tr:last-child td {
    border-bottom: none;
}

/* Admin form */
.sos-admin__form {
    padding: 1.125rem 1.25rem;
}

.sos-admin__form .form-group {
    margin-bottom: 0.875rem;
}

.sos-admin__form label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.sos-admin__form .form-control {
    border-radius: var(--radius-md);
}

.sos-admin__form code {
    font-size: 0.8em;
    background: var(--bg-color);
    padding: 0.1rem 0.35rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

/* Lists */
.sos-admin__list {
    margin: 0;
    padding: 0.75rem 1.25rem;
    list-style: none;
}

.sos-admin__list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

.sos-admin__list li:last-child {
    border-bottom: none;
}

/* Actions row */
.sos-admin__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.sos-admin__actions a {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
}

.sos-admin__actions a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Button overrides in sos-admin context */
.sos-admin .btn-primary,
.sos-admin .btn-secondary,
.sos-admin .btn-danger {
    border-radius: var(--radius-md);
}

/* Filter bar */
.sos-admin__filter-establishment {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    padding: 0.875rem 1.125rem;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xs);
}

.sos-admin__filter-establishment label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

/* Inline form */
.sos-admin__inline-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.sos-admin__inline-form .form-control {
    max-width: 16rem;
}

/* Link row */
.sos-admin__link-row a {
    font-weight: 600;
    color: var(--primary);
    margin-right: 0.75rem;
}

.sos-admin__link-row a:hover {
    color: var(--primary-dark);
}

/* =========================================================================
   Alert banners
   ===================================================================== */
.sos-admin-alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-size: 0.875rem;
    border: 1px solid transparent;
    border-left: 3px solid transparent;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    font-weight: 500;
}

.sos-admin-alert--success {
    background: #f0fdf4;
    border-color: #bbf7d0;
    border-left-color: var(--success);
    color: #166534;
}

.sos-admin-alert--danger {
    background: #fef2f2;
    border-color: #fecaca;
    border-left-color: var(--danger);
    color: #7f1d1d;
}

.sos-admin-alert--warning {
    background: #fffbeb;
    border-color: #fde68a;
    border-left-color: var(--warning);
    color: #78350f;
}

.sos-admin-alert--info {
    background: #eff6ff;
    border-color: #bfdbfe;
    border-left-color: var(--info);
    color: #1e3a8a;
}

/* =========================================================================
   Public page (login, machine form)
   ===================================================================== */
.sos-public-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: var(--bg-color);
}

.sos-public-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-md);
    padding: 2rem 1.75rem;
}

.sos-public-card__title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.3125rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.25rem 0;
}

.sos-public-card__meta {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.sos-public-card .form-control {
    border-radius: var(--radius-md);
}

.sos-public-card .btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    font-weight: 600;
    border-radius: var(--radius-md);
    padding: 0.55rem 1.25rem;
    width: 100%;
}

.sos-public-card .btn-primary:hover {
    background: var(--primary-dark);
}

.sos-public-card--centered {
    text-align: center;
}

/* =========================================================================
   Utilities - mono / badges / icon-links / establishment name
   ===================================================================== */
.sos-mono {
    font-family: ui-monospace, 'Cascadia Code', 'Segoe UI Mono', monospace;
    font-size: 0.8125rem;
    letter-spacing: 0.01em;
}

/* Badges - pill */
.sos-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.175rem 0.55rem;
    border-radius: 9999px;
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid transparent;
    line-height: 1.4;
}

.sos-badge--ok {
    background: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}

.sos-badge--off {
    background: var(--bg-color);
    color: var(--text-secondary);
    border-color: var(--border-color);
}

/* Icon links in tables */
.sos-icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    color: var(--text-secondary);
    transition: color var(--t), background var(--t), border-color var(--t);
}

.sos-icon-link:hover {
    color: var(--primary);
    background: var(--primary-light);
    border-color: rgba(var(--primary-rgb), .2);
}

.sos-icon-link .lucide-icon {
    width: 1rem;
    height: 1rem;
}

.sos-icon-link--primary {
    color: var(--primary);
}

.sos-icon-link--primary:hover {
    background: var(--primary-light);
}

.sos-establishment-name {
    font-weight: 600;
}

/* =========================================================================
   Pagination  (.sos-pagination)
   ===================================================================== */
.sos-pagination {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
}

.sos-pagination__info {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.sos-pagination__info strong {
    color: var(--text-primary);
    font-weight: 600;
}

.sos-pagination__list {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    list-style: none;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
}

.sos-pagination__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    text-decoration: none;
    transition: background var(--t), border-color var(--t), color var(--t);
    cursor: pointer;
    user-select: none;
    line-height: 1;
}

.sos-pagination__link:hover {
    background: var(--bg-color);
    border-color: var(--primary);
    color: var(--primary);
}

.sos-pagination__link--active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff !important;
    font-weight: 700;
    cursor: default;
}

.sos-pagination__link--nav {
    padding: 0 0.625rem;
    gap: 0.3rem;
}

.sos-pagination__link--ellipsis {
    border-color: transparent;
    background: transparent;
    cursor: default;
    color: var(--text-muted);
}

.sos-pagination__item.disabled .sos-pagination__link {
    opacity: .45;
    cursor: not-allowed;
    pointer-events: none;
}

@media (max-width: 480px) {
    .sos-pagination__list {
        gap: 0.15rem;
    }

    .sos-pagination__link {
        min-width: 1.75rem;
        height: 1.75rem;
        font-size: 0.75rem;
    }

    .sos-pagination__link--nav span {
        display: none;
    }
}

/* =========================================================================
   Public Forms (Login / Create SOS)  -- .sos-container, .sos-card, etc.
   ===================================================================== */
.sos-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 480px;
    padding: 1.5rem;
    margin: auto;
}

.sos-card {
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 2.25rem 2.5rem;
    border: 1px solid var(--border-color);
    position: relative;
    display: flex;
    flex-direction: column;
}

.sos-header {
    text-align: center;
    margin-bottom: 2rem;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo-wrapper {
    width: 60px;
    height: 60px;
    background: var(--primary);
    border-radius: var(--radius-lg);
    margin: 0 auto 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.sos-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.4rem;
}

.sos-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

.sos-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-top: 0;
    margin-bottom: 2rem;
}

.input-group {
    margin-bottom: 1.75rem;
    position: relative;
}

.input-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0.6rem;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
}

.input-field {
    position: relative;
}

.input-field .lucide-icon,
.input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary);
    z-index: 2;
    pointer-events: none;
    width: 18px;
    height: 18px;
}

.auth-input,
.auth-select {
    width: 100%;
    padding: 13px 16px 13px 44px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: border-color var(--t), box-shadow var(--t), background-color var(--t);
    appearance: none;
    line-height: normal;
}

.auth-input:focus,
.auth-select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--primary-rgb), 0.15);
    background: var(--surface-color);
}

.password-toggle {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
    display: flex;
    align-items: center;
}

.submit-btn {
    width: 100%;
    padding: 14px 20px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background var(--t);
}

.submit-btn:hover {
    background: var(--primary-dark);
}

.error-message {
    background: rgba(var(--danger-rgb), 0.08);
    border: 1px solid rgba(var(--danger-rgb), 0.2);
    color: var(--danger);
    padding: 13px 15px;
    border-radius: 8px;
    margin-bottom: 1.75rem;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 500;
}

/* =========================================================================
   Notification Popups (for SOS IT events)
   ===================================================================== */
.notification-container {
    position: fixed;
    bottom: 25px;
    right: 25px;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 90%;
    max-width: 400px;
}

.notification {
    display: flex;
    align-items: flex-start;
    background: var(--card-bg);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 1.2rem 1.5rem;
    border: 1px solid var(--border-color);
    border-left-width: 4px;
    position: relative;
    opacity: 0;
    transform: translateX(110%);
    transition: transform 0.4s ease, opacity 0.4s ease;
    overflow: hidden;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification.hide {
    opacity: 0;
    transform: scale(0.95);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.notification-icon {
    width: 24px;
    height: 24px;
    margin-right: 0.8rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.notification-content {
    flex-grow: 1;
}

.notification-title {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 0.2rem 0;
    color: var(--text-primary);
}

.notification-message {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
    margin: 0;
}

.notification-close {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 2px;
    transition: color var(--t);
}

.notification-close:hover {
    color: var(--danger);
}

.notification.online {
    border-left-color: var(--success);
}

.notification.online .notification-icon {
    color: var(--success);
}

.notification.offline {
    border-left-color: var(--danger);
}

.notification.offline .notification-icon {
    color: var(--danger);
}

.notification.warning {
    border-left-color: var(--warning);
}

.notification.warning .notification-icon {
    color: var(--warning);
}

@media (max-width: 600px) {
    .notification-container {
        left: 15px;
        right: 15px;
        bottom: 15px;
        width: auto;
        max-width: none;
    }
}
/* =========================================================================
   Sidebar Toggle (collapse / expand)
   ========================================================================= */

/* Toggle button in topbar */
.sidebar-toggle-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.4rem;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 0.5rem;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.sidebar-toggle-btn:hover {
    background: var(--bg-color);
    color: var(--primary);
    border-color: var(--border-color);
}

.sidebar-toggle-btn .lucide-icon {
    width: 1.125rem;
    height: 1.125rem;
}

/* Topbar role pill */
.topbar-role-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.topbar-user-name {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text-primary);
}

.topbar-user-section {
    border-left: 1px solid var(--border-color);
    padding-left: 1rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.topbar-user-card {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.topbar-avatar-img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-color);
    transition: border-color 0.2s;
}

.topbar-avatar-img:hover {
    border-color: var(--primary);
}

.topbar-avatar-fallback {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #b91c1c);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

/* Smooth transitions */
.sidebar {
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.main-panel,
.top-bar,
.sos-footer {
    transition: margin-left 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                width 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                left 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Collapsed state */
body.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
}

body.sidebar-collapsed .main-panel,
body.sidebar-collapsed .top-bar {
    margin-left: 0;
    width: 100%;
}

body.sidebar-collapsed .sos-footer {
    left: 0;
}

/* =========================================================================
   Toast notifications (Apple-style)
   ========================================================================= */

.sos-toast {
    position: fixed;
    top: calc(var(--topbar-height, 60px) + 0.75rem);
    right: 1.25rem;
    z-index: 10000;
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    min-width: 300px;
    max-width: 420px;
    padding: 0.875rem 1rem;
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.06);
    animation: toastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(12px);
}

.sos-toast.sos-toast--exiting {
    animation: toastSlideOut 0.3s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes toastSlideIn {
    from { opacity: 0; transform: translateX(100%) scale(0.95); }
    to   { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastSlideOut {
    from { opacity: 1; transform: translateX(0) scale(1); }
    to   { opacity: 0; transform: translateX(100%) scale(0.95); }
}

.sos-toast + .sos-toast { top: 5rem; }
.sos-toast + .sos-toast + .sos-toast { top: 8.75rem; }

.sos-toast__icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}

.sos-toast__icon i {
    width: 1.125rem;
    height: 1.125rem;
}

.sos-toast__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.sos-toast__text {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
}

.sos-toast__close {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0.2rem;
    border-radius: 6px;
    color: var(--text-muted);
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.sos-toast__close:hover {
    background: var(--bg-color);
    color: var(--text-primary);
}

.sos-toast__close i {
    width: 0.85rem;
    height: 0.85rem;
}

/* Toast accent borders */
.sos-toast--success { border-left: 3px solid #16a34a; }
.sos-toast--info    { border-left: 3px solid #3b82f6; }
.sos-toast--danger  { border-left: 3px solid #dc2626; }
.sos-toast--warning { border-left: 3px solid #f59e0b; }

/* =========================================================================
   Animated grid background (internal pages)
   ========================================================================= */
.bg-pattern-app {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-color: #f5f5f7;
    background-image:
        linear-gradient(rgba(0,0,0,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,0.02) 1px, transparent 1px);
    background-size: 50px 50px;
    background-position: 0 0;
    animation: bgGridMove 20s linear infinite;
}

@keyframes bgGridMove {
    0%   { background-position: 0 0; }
    100% { background-position: 50px 50px; }
}

[data-theme="dark"] .bg-pattern-app {
    background-color: var(--bg-color);
    background-image:
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
}

.main-panel .content {
    position: relative;
    z-index: 1;
}
