/* ═════════════════════════════════════════════════════════════════════════════
   style.css — UaMenu Dashboard — Dark Mode + Neon Glow
   ═════════════════════════════════════════════════════════════════════════════ */

/* ── CSS Variables ──────────────────────────────────────────────────────── */
:root {
    /* Dark Mode (default) */
    --bg-primary:      #0a0e17;
    --bg-secondary:    #111827;
    --bg-card:         #1a1f2e;
    --bg-card-hover:   #1f2639;
    --bg-input:        #151a28;
    --border:          #1e2d4a;
    --border-glow:     #2a3f6e;

    --text-primary:    #e2e8f0;
    --text-secondary:  #94a3b8;
    --text-muted:      #64748b;

    --accent:          #00F0FF;
    --accent2:         #7B2FFF;
    --accent-glow:     0 0 12px rgba(0, 240, 255, 0.3);

    --status-online:   #00ff88;
    --status-online-glow: 0 0 16px rgba(0, 255, 136, 0.5);
    --status-offline:  #ff3b3b;
    --status-offline-glow: 0 0 16px rgba(255, 59, 59, 0.5);
    --status-warning:  #ffb300;

    --radius-sm:       6px;
    --radius-md:       10px;
    --radius-lg:       14px;
    --radius-xl:       20px;

    --shadow-card:     0 4px 24px rgba(0, 0, 0, 0.3);
    --transition:      0.2s ease;

    --font-mono:       'JetBrains Mono', 'Consolas', monospace;
    --font-sans:       'Inter', -apple-system, sans-serif;

    /* Accent shade (light-mode text on gradient buttons) */
    --accent-btn-text: #ffffff;
}

/* ── Light Mode Overrides ──────────────────────────────────────────────── */
body.light {
    --bg-primary:      #f1f5f9;
    --bg-secondary:    #ffffff;
    --bg-card:         #ffffff;
    --bg-card-hover:   #f8fafc;
    --bg-input:        #ffffff;
    --border:          #cbd5e1;
    --border-glow:     #94a3b8;

    --text-primary:    #0f172a;
    --text-secondary:  #475569;
    --text-muted:      #94a3b8;

    --accent:          #0891b2;
    --accent2:         #7c3aed;
    --accent-glow:     0 0 12px rgba(8, 145, 178, 0.25);

    --status-online:        #059669;
    --status-online-glow:   0 0 12px rgba(5, 150, 105, 0.35);
    --status-offline:       #dc2626;
    --status-offline-glow:  0 0 12px rgba(220, 38, 38, 0.35);
    --status-warning:       #d97706;

    --shadow-card:     0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);

    --accent-btn-text: #ffffff;
}

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

html, body {
    height: 100%;
    font-family: var(--font-sans);
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
}

body {
    display: flex;
    flex-direction: column;
}

/* ── Screens ────────────────────────────────────────────────────────────── */
.screen {
    display: none;
    flex: 1;
    flex-direction: column;
}
.screen.active {
    display: flex;
}

/* ── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-glow); }

/* ═══════════════════════════════════════════════════════════════ LOGIN */
.login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    min-height: 100dvh;
    padding: clamp(1rem, 4vw, 2rem);
}

.lang-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem;
    background: rgba(17, 24, 39, 0.68);
    border: 1px solid var(--border);
    border-radius: 999px;
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(10px);
}

.lang-btn {
    min-width: 40px;
    padding: 0.4rem 0.65rem;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    cursor: pointer;
    transition: color var(--transition), border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.lang-btn:hover {
    color: var(--text-primary);
    border-color: rgba(0, 240, 255, 0.22);
}

.lang-btn.is-active {
    color: var(--bg-primary);
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.95), rgba(123, 47, 255, 0.92));
    box-shadow: var(--accent-glow);
}

.login-lang-switch {
    margin-bottom: 1.5rem;
}

.topbar-lang-switch {
    margin-right: 0.35rem;
}

body.light .lang-switch {
    background: rgba(255, 255, 255, 0.85);
}

body.light .lang-btn.is-active {
    color: #ffffff;
}

.login-brand {
    text-align: center;
    margin-bottom: 2.5rem;
}
.brand-icon { margin-bottom: 1rem; }
.login-brand h1 {
    font-size: 2rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.brand-sub {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

.login-form {
    width: 100%;
    max-width: 380px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-card);
}

@media (max-width: 480px) {
    .login-container {
        justify-content: center;
        padding: 0.9rem 0.85rem;
    }

    .login-lang-switch {
        margin-bottom: 0.9rem;
    }

    .brand-icon {
        margin-bottom: 0.7rem;
    }

    .brand-icon svg {
        width: 40px;
        height: 40px;
    }

    .login-brand {
        margin-bottom: 1.1rem;
    }

    .login-brand h1 {
        font-size: 1.65rem;
    }

    .brand-sub {
        font-size: 0.78rem;
        line-height: 1.35;
    }

    .login-form {
        max-width: 100%;
        padding: 1.15rem 1rem;
        border-radius: 12px;
    }

    .input-group {
        margin-bottom: 0.9rem;
    }

    .input-group label {
        font-size: 0.72rem;
        margin-bottom: 0.32rem;
    }

    .input-group input {
        padding: 0.62rem 0.85rem;
        font-size: 0.92rem;
    }

    .btn-primary {
        padding: 0.7rem 1rem;
    }
}

@media (max-height: 760px) {
    .login-container {
        justify-content: center;
        padding-top: 0.85rem;
        padding-bottom: 0.85rem;
    }

    .login-lang-switch {
        margin-bottom: 0.85rem;
    }

    .login-brand {
        margin-bottom: 1rem;
    }

    .brand-icon {
        margin-bottom: 0.65rem;
    }

    .login-brand h1 {
        font-size: 1.75rem;
    }

    .login-form {
        padding: 1.2rem 1rem;
    }

    .input-group {
        margin-bottom: 0.85rem;
    }
}

.input-group {
    margin-bottom: 1.25rem;
}
.input-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.input-group input {
    width: 100%;
    padding: 0.7rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: var(--font-sans);
    transition: border var(--transition), box-shadow var(--transition);
}
.input-group input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.1);
}
.input-group input::placeholder {
    color: var(--text-muted);
}

.login-error {
    background: rgba(255, 59, 59, 0.1);
    border: 1px solid rgba(255, 59, 59, 0.3);
    color: var(--status-offline);
    padding: 0.6rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity var(--transition), transform var(--transition), box-shadow var(--transition);
}
.btn-primary:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}
.btn-primary:active {
    transform: translateY(0);
}
.btn-glow {
    box-shadow: var(--accent-glow);
}
.btn-glow:hover {
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.5);
}

.btn-secondary {
    padding: 0.45rem 1rem;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all var(--transition);
}
.btn-secondary:hover {
    border-color: var(--border-glow);
    color: var(--text-primary);
}
.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.75rem; }
.btn-text {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}
.btn-text:hover {
    background: rgba(0, 240, 255, 0.08);
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
}
.icon-btn:hover {
    border-color: var(--border-glow);
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

/* ── Spinner ────────────────────────────────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
.spinner-large {
    width: 36px; height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 2rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Utility ────────────────────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ═══════════════════════════════════════════════════════════════ TOP BAR */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1.5rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    height: 56px;
    flex-shrink: 0;
}
.topbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.topbar-logo { flex-shrink: 0; }
.topbar-title {
    font-size: 1.1rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.topbar-badge {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
}
.badge-admin {
    background: rgba(123, 47, 255, 0.2);
    color: var(--accent2);
    border: 1px solid rgba(123, 47, 255, 0.4);
}
.badge-client {
    background: rgba(0, 240, 255, 0.1);
    color: var(--accent);
    border: 1px solid rgba(0, 240, 255, 0.3);
}

.topbar-center { display: flex; gap: 0.5rem; }
.topbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.user-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-right: 0.25rem;
}

/* ── Notification Badge ─────────────────────────────────────────────── */
.notif-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 18px;
    height: 18px;
    background: var(--status-offline);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    box-shadow: var(--status-offline-glow);
    animation: pulse-badge 2s infinite;
}
@keyframes pulse-badge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

/* ── Notifications Panel ────────────────────────────────────────────── */
.notif-panel {
    position: absolute;
    top: 64px;
    right: 1.5rem;
    width: 360px;
    max-height: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}
.notif-header h3 {
    font-size: 0.9rem;
    font-weight: 600;
}
.notif-list {
    overflow-y: auto;
    flex: 1;
    padding: 0.5rem;
}
.notif-item {
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    margin-bottom: 0.25rem;
    font-size: 0.8rem;
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}
.notif-item.warning {
    background: rgba(255, 179, 0, 0.08);
    border-left: 3px solid var(--status-warning);
}
.notif-item.critical {
    background: rgba(255, 59, 59, 0.08);
    border-left: 3px solid var(--status-offline);
}
.notif-item.info {
    background: rgba(0, 240, 255, 0.05);
    border-left: 3px solid var(--accent);
}
.notif-time {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.notif-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem 1rem;
    font-size: 0.85rem;
}

/* ═══════════════════════════════════════════════════════════════ MAIN CONTENT */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* ── Stats Row ──────────────────────────────────────────────────────── */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    text-align: center;
    transition: all var(--transition);
}
.stat-card:hover {
    border-color: var(--border-glow);
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}
.stat-value {
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}
.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.stat-online .stat-value {
    color: var(--status-online);
    text-shadow: var(--status-online-glow);
}
.stat-offline .stat-value {
    color: var(--status-offline);
    text-shadow: var(--status-offline-glow);
}

/* ── Section Header ─────────────────────────────────────────────────── */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.section-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}
.section-count {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ── Stores Grid ────────────────────────────────────────────────────── */
.stores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}
.loading-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

/* Store Card */
.store-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}
.store-card:hover {
    border-color: var(--border-glow);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}
.store-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
}

/* Neon Glow Status Indicators */
.store-card.status-online::before {
    background: var(--status-online);
    box-shadow: var(--status-online-glow);
}
.store-card.status-offline::before {
    background: var(--status-offline);
    box-shadow: var(--status-offline-glow);
}
.store-card.status-warning::before {
    background: var(--status-warning);
    box-shadow: 0 0 12px rgba(255, 179, 0, 0.4);
}

.store-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}
.store-name {
    font-size: 1rem;
    font-weight: 600;
}
.store-client {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

/* Status Dot */
.status-dot {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}
.status-dot::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
.status-dot.online::before {
    background: var(--status-online);
    box-shadow: var(--status-online-glow);
    animation: neon-pulse-online 2s infinite;
}
.status-dot.offline::before {
    background: var(--status-offline);
    box-shadow: var(--status-offline-glow);
    animation: neon-pulse-offline 1.5s infinite;
}
.status-dot.warning::before {
    background: var(--status-warning);
    box-shadow: 0 0 10px rgba(255, 179, 0, 0.5);
    animation: neon-pulse-warning 2s infinite;
}

@keyframes neon-pulse-online {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}
@keyframes neon-pulse-offline {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
@keyframes neon-pulse-warning {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.store-card-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    font-size: 0.8rem;
}
.store-detail-item {
    display: flex;
    flex-direction: column;
}
.store-detail-label {
    color: var(--text-muted);
    font-size: 0.68rem;
    text-transform: uppercase;
}
.store-detail-value {
    font-family: var(--font-mono);
    font-size: 0.85rem;
}
.store-detail-value.receipt-time {
    font-size: 0.78rem;
}

/* ── Logs Table ─────────────────────────────────────────────────────── */
.logs-table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    max-height: 360px;
    overflow-y: auto;
}
.logs-table {
    width: 100%;
    font-size: 0.78rem;
    border-collapse: collapse;
}
.logs-table thead {
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 1;
}
.logs-table th {
    padding: 0.6rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}
.logs-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid rgba(30, 45, 74, 0.5);
    font-family: var(--font-mono);
    font-size: 0.75rem;
}
.logs-table tr:hover td {
    background: rgba(0, 240, 255, 0.02);
}
.log-status {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 600;
    font-size: 0.7rem;
}
.log-status::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
}
.log-status.online::before { background: var(--status-online); }
.log-status.offline::before { background: var(--status-offline); }
.loading-cell {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem !important;
}

.auth-admin-grid {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
    gap: 1rem;
}

.auth-admin-card {
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: var(--radius-md);
    padding: 1rem;
}

.auth-admin-help {
    margin-bottom: 1rem;
    padding: 1rem 1.1rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(0, 240, 255, 0.16);
    background:
        linear-gradient(135deg, rgba(0, 240, 255, 0.08), rgba(37, 99, 235, 0.05)),
        rgba(255, 255, 255, 0.02);
}

.auth-admin-help strong {
    display: block;
    margin-bottom: 0.4rem;
    color: var(--text-primary);
}

.auth-admin-help p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.55;
}

.auth-admin-help p + p {
    margin-top: 0.55rem;
}

.section-header.compact {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.9rem;
}

.auth-user-form {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.auth-username-preview {
    padding: 0.85rem 0.95rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(148, 163, 184, 0.12);
    background: rgba(255, 255, 255, 0.03);
}

.auth-username-preview strong {
    display: block;
    margin-top: 0.35rem;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.95rem;
}

.auth-password-result {
    margin-top: 0.9rem;
    padding: 0.9rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(0, 240, 255, 0.18);
    background: rgba(0, 240, 255, 0.08);
}

.auth-password-message {
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.45;
}

.auth-password-value {
    margin-top: 0.5rem;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.95rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.auth-users-table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    max-height: 360px;
    overflow-y: auto;
}

.auth-users-table td:last-child {
    width: 150px;
}

/* ═══════════════════════════════════════════════════════════════ MODAL */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(4px);
}
.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 16px 48px rgba(0,0,0,0.5);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}
.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}
.modal-close {
    font-size: 1.5rem;
    width: 32px;
    height: 32px;
    border: none;
    color: var(--text-muted);
    background: none;
    cursor: pointer;
    border-radius: var(--radius-sm);
}
.modal-close:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}
.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

/* Modal Store Detail */
.modal-status-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
}
.modal-status-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
}
.modal-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.modal-detail-item {
    background: var(--bg-card);
    padding: 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}
.modal-detail-item .label {
    font-size: 0.68rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}
.modal-detail-item .value {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 600;
}
.modal-registers {
    margin-top: 1rem;
}
.modal-registers h3 {
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}
.register-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.register-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.75rem;
    font-family: var(--font-mono);
}
.register-chip.online {
    border-color: rgba(0, 255, 136, 0.3);
}
.register-chip.offline {
    border-color: rgba(255, 59, 59, 0.3);
}

/* ═══════════════════════════════════════════════════════════════ TOAST */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1.25rem;
    font-size: 0.85rem;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    animation: slideIn 0.3s ease;
    max-width: 360px;
}
.toast.success { border-left: 3px solid var(--status-online); }
.toast.error   { border-left: 3px solid var(--status-offline); }
.toast.info    { border-left: 3px solid var(--accent); }
@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ═══════════════════════════════════════════════════════════════ TAB NAVIGATION */
.tab-nav {
    display: flex;
    gap: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    flex-shrink: 0;
}
.tab-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font-sans);
}
.tab-btn:hover {
    color: var(--text-secondary);
    background: rgba(0,240,255,0.03);
}
.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}
.tab-btn svg {
    opacity: 0.7;
}
.tab-btn.active svg {
    opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════ CASSA SECTION */
.cassa-content.hidden { display: none; }
.cassa-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.cassa-controls-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.cassa-server-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.cassa-select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    font-family: var(--font-sans);
    cursor: pointer;
}
.cassa-select:focus {
    outline: none;
    border-color: var(--accent);
}

.cassa-summary {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}
.cassa-summary-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 1rem;
    font-size: 0.8rem;
}
.cassa-summary-item strong {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    color: var(--accent);
}

/* ── Filter Bar ─────────────────────────────────────────────────────── */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.5rem 0;
}
.filter-group {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}
.filter-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-right: 0.25rem;
}
.filter-btn {
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}
.filter-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.filter-btn.active {
    background: rgba(0,240,255,0.1);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
}
.filter-search {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.25rem 0.6rem;
    margin-left: auto;
    flex-shrink: 0;
}
.filter-search svg {
    color: var(--text-muted);
    flex-shrink: 0;
}
.filter-input {
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.78rem;
    font-family: inherit;
    outline: none;
    min-width: 140px;
    width: 100%;
}
.filter-input::placeholder {
    color: var(--text-muted);
}

/* ── Group status coloring ──────────────────────────────────────────── */
.cg-offline .cg-title {
    color: var(--status-offline);
}
.cg-offline .cg-header {
    border-left: 3px solid var(--status-offline);
}
.cg-shutdown .cg-title {
    color: #888;
}
.cg-shutdown .cg-header {
    border-left: 3px solid #666;
}


/* ═══════════════════════════════════════════════════════════════ CASSA GRID */
/* Parent group card — one per unique first-word prefix */
.cg-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.cg-card + .cg-card {
    margin-top: 0.25rem;
}

.cg-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 0.7rem;
    cursor: pointer;
    user-select: none;
    font-size: 0.85rem;
}
.cg-header:hover {
    background: var(--bg-card-hover);
}

.cg-title {
    font-weight: 700;
    font-size: 0.9rem;
    margin-right: auto;
}
.cg-badge {
    font-size: 0.6rem;
    padding: 0.08rem 0.45rem;
    background: rgba(0, 240, 255, 0.1);
    border: 1px solid rgba(0, 240, 255, 0.2);
    border-radius: 8px;
    color: var(--accent);
    font-weight: 600;
    flex-shrink: 0;
}
.cg-arrow {
    color: var(--text-muted);
    flex-shrink: 0;
    transition: transform 0.2s;
    margin-left: 0.2rem;
}
.cg-arrow.open {
    transform: rotate(90deg);
}

/* Body — grid of mini sub-cards */
.cg-body {
    border-top: 1px solid var(--border);
    display: none;
    padding: 0.5rem 0.6rem 0.6rem;
}
.cg-body.open {
    display: block;
}

.cg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.45rem;
}

/* Mini sub-card (e.g. "Magazin1" inside BEMOL) */
.cg-subcard {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.cg-subcard:hover {
    border-color: var(--border-glow);
}
.cg-sub-err {
    border-color: rgba(255, 59, 59, 0.25);
}

.cg-subtitle {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.3rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cg-badge-sm {
    font-size: 0.55rem;
    padding: 0.05rem 0.35rem;
    background: rgba(0, 240, 255, 0.08);
    border: 1px solid rgba(0, 240, 255, 0.15);
    border-radius: 6px;
    color: var(--accent);
    flex-shrink: 0;
    margin-left: auto;
}

/* Inner grid of registers — card-style with status indicator */
.cg-subgrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.4rem;
    padding: 0.5rem;
}

/* ── Individual Register Card ──────────────────────────────────────── */
.sreg {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    border: 1px solid var(--border);
    border-left-width: 3px;
    background: var(--bg-card);
    font-family: var(--font-mono);
    transition: all 0.2s;
}
.sreg:hover {
    border-color: var(--border-glow);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* Status dot */
.sdot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}
.sdot.sdot-on {
    background: var(--status-online);
    box-shadow: 0 0 6px var(--status-online-glow);
}
.sdot.sdot-down {
    background: #777;
    box-shadow: none;
}
.sdot.sdot-err {
    background: var(--status-offline);
    box-shadow: 0 0 8px var(--status-offline-glow);
    animation: dot-breathe 0.8s ease-in-out infinite;
}
@keyframes dot-breathe {
    0%, 100% { box-shadow: 0 0 4px var(--status-offline-glow); }
    50% { box-shadow: 0 0 14px var(--status-offline-glow), 0 0 28px rgba(255,59,59,0.3); }
}

/* Register content */
.sreg-name {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.78rem;
}
.sreg-schema {
    color: var(--text-muted);
    font-size: 0.62rem;
    padding: 0.08rem 0.4rem;
    background: rgba(0,240,255,0.06);
    border: 1px solid rgba(0,240,255,0.1);
    border-radius: 4px;
    text-transform: uppercase;
}
.sreg-sid {
    margin-left: auto;
    font-size: 0.62rem;
    color: var(--status-online);
    background: rgba(0,255,136,0.07);
    border: 1px solid rgba(0,255,136,0.15);
    border-radius: 4px;
    padding: 0.08rem 0.4rem;
    font-weight: 600;
}
.sreg-errmsg {
    width: 100%;
    margin-top: 0.2rem;
    color: var(--status-offline);
    font-size: 0.55rem;
}

/* Status border colors */
.sreg.sdot-on { border-left-color: var(--status-online) !important; }
.sreg.sdot-down { border-left-color: #666 !important; }
.sreg.sdot-err { border-left-color: var(--status-offline) !important; }
.sreg-down { opacity: 0.6; }
.sreg-down .sreg-name { color: #888; }
.sreg-err { background: rgba(255,59,59,0.04); }

/* ── Breathing card for offline (whole group) ── */
.store-card.status-offline {
    animation: alert-breathe 1s ease-in-out infinite !important;
}
@keyframes alert-breathe {
    0%, 100% { border-color: rgba(255, 59, 59, 0.15); box-shadow: 0 0 4px rgba(255, 59, 59, 0.1); }
    50% { border-color: rgba(255, 59, 59, 0.6); box-shadow: 0 0 16px rgba(255, 59, 59, 0.3); }
}

/* Cassa Error Section */
.cassa-errors {
    padding: 5px;
    background: var(--bg-card);
    border: 1px solid rgba(255, 59, 59, 0.2);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.cassa-error-count {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--status-offline);
}
.cassa-error-list {
    max-height: 200px;
    overflow-y: auto;
    font-size: 0.78rem;
}
.cassa-error-item {
    padding: 0.5rem 1rem;
    border-top: 1px solid rgba(255, 59, 59, 0.08);
    display: flex;
    gap: 0.75rem;
}
.cassa-error-db {
    font-family: var(--font-mono);
    color: var(--accent);
    min-width: 100px;
}
.cassa-error-msg {
    color: var(--status-offline);
}

/* ═══════════════════════════════════════════════════════════════ RESPONSIVE */
@media (max-width: 768px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    .stores-grid {
        grid-template-columns: 1fr;
    }
    .topbar {
        padding: 0.5rem 1rem;
    }
    .topbar-center, .topbar-badge {
        display: none;
    }
    .user-name {
        display: none;
    }
    .notif-panel {
        width: calc(100vw - 2rem);
        right: 1rem;
    }
}

/* Refresh for Stores / Cassa UX */
.workspace-panel {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at top right, rgba(0, 240, 255, 0.12), transparent 32%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent 70%),
        var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.15rem 1.2rem;
    box-shadow: var(--shadow-card);
}

.workspace-panel-head,
.section-copy {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.workspace-panel-head {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.section-eyebrow {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    border: 1px solid rgba(0, 240, 255, 0.18);
    background: rgba(0, 240, 255, 0.08);
    color: var(--accent);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.45;
    max-width: 58ch;
}

.section-header {
    margin-bottom: 0.8rem;
}

.filter-grid {
    display: grid;
    grid-template-columns: minmax(260px, 2fr) minmax(220px, 2fr) minmax(180px, 1fr) minmax(120px, 0.7fr);
    gap: 0.85rem;
    align-items: end;
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 0;
}

.filter-field-wide {
    min-width: 0;
}

.filter-field-search {
    min-width: 0;
}

.filter-label {
    margin-right: 0;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.filter-search {
    margin-left: 0;
    min-width: 0;
    width: 100%;
    padding: 0.55rem 0.7rem;
    border-radius: var(--radius-md);
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.filter-search:focus-within,
.filter-select:focus,
.cassa-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(0, 240, 255, 0.08);
}

.filter-input {
    min-width: 0;
    font-size: 0.85rem;
}

.filter-select,
.cassa-select {
    width: 100%;
    padding: 0.62rem 0.78rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    font: inherit;
}

.filter-group {
    gap: 0.45rem;
}

.filter-btn {
    padding: 0.38rem 0.72rem;
    border-radius: 999px;
    font-size: 0.76rem;
}

.filter-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    margin-top: 0.9rem;
}

.filter-insight {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(148, 163, 184, 0.14);
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.cassa-controls-right {
    flex-wrap: wrap;
    justify-content: flex-end;
}

.cassa-server-selector {
    min-width: 180px;
    align-items: stretch;
    flex-direction: column;
    gap: 0.35rem;
}

.cassa-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.75rem;
    margin-top: 0.2rem;
}

.cassa-summary-item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.85rem 0.95rem;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.025);
}

.cassa-summary-item span {
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cassa-summary-item strong {
    color: var(--text-primary);
    font-size: 1.25rem;
}

#stores-grid,
#cassa-groups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.cg-card + .cg-card {
    margin-top: 0;
}

.cg-card {
    border-radius: var(--radius-md);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.015), transparent 35%),
        var(--bg-card);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
}

.cg-header {
    gap: 0.55rem;
    padding: 0.8rem 0.95rem;
}

.cg-title {
    min-width: 0;
}

.cg-badge-soft {
    background: rgba(0, 240, 255, 0.05);
    border-color: rgba(0, 240, 255, 0.12);
}

.cg-badge-error {
    color: var(--status-offline);
    border-color: rgba(255, 59, 59, 0.28);
    background: rgba(255, 59, 59, 0.06);
}

.cg-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.75rem;
}

.cg-subcard {
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.012), transparent 42%), var(--bg-secondary);
}

.cg-subcard-alert {
    border-color: rgba(255, 59, 59, 0.26);
}

.cg-subcard-muted {
    border-color: rgba(148, 163, 184, 0.2);
}

.cg-subtitle {
    gap: 0.45rem;
    padding: 0.55rem 0.65rem;
}

.cg-subtitle > span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cg-badge-sm-error {
    color: var(--status-offline);
    border-color: rgba(255, 59, 59, 0.25);
    background: rgba(255, 59, 59, 0.06);
}

.cg-subgrid {
    grid-template-columns: 1fr;
    gap: 0.55rem;
    padding: 0.65rem;
}

.sreg {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
    padding: 0.6rem 0.7rem;
    border-radius: var(--radius-sm);
}

.sreg-name,
.sreg-schema,
.sreg-sid,
.sreg-errmsg {
    min-width: 0;
}

.sreg-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sreg-schema,
.sreg-sid {
    white-space: nowrap;
}

.sreg-errmsg {
    grid-column: 1 / -1;
    margin-top: 0.1rem;
    overflow-wrap: anywhere;
    line-height: 1.35;
}

.cassa-error-item {
    align-items: flex-start;
}

@media (max-width: 1100px) {
    .filter-grid {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }
}

@media (max-width: 768px) {
    .workspace-panel-head {
        flex-direction: column;
    }

    .filter-grid {
        grid-template-columns: 1fr;
    }

    .filter-meta {
        flex-direction: column;
    }

    #stores-grid,
    #cassa-groups {
        grid-template-columns: 1fr;
    }

    .sreg {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .sreg-schema,
    .sreg-sid {
        justify-self: start;
    }

    .sreg-sid {
        grid-column: 2 / 3;
    }
}

/* Store health cards */
.stores-health-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.stores-health-grid.is-grouped {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.store-connection-group {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
    padding: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: calc(var(--radius-lg) + 4px);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 46%),
        rgba(15, 23, 42, 0.34);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.store-connection-group::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    border-radius: inherit;
    background: linear-gradient(180deg, rgba(0, 240, 255, 0.78), rgba(123, 47, 255, 0.45));
    opacity: 0.85;
}

.store-connection-group-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding-left: 0.35rem;
}

.store-connection-group-head h3 {
    font-size: 1.05rem;
    line-height: 1.2;
}

.store-connection-group-label {
    display: inline-flex;
    margin-bottom: 0.3rem;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.store-connection-group-meta {
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-align: right;
    white-space: nowrap;
}

.store-connection-group-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

body.light .store-connection-group {
    background:
        linear-gradient(180deg, rgba(8, 145, 178, 0.05), transparent 42%),
        rgba(255, 255, 255, 0.88);
    border-color: rgba(148, 163, 184, 0.32);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.38rem 0.72rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1px solid transparent;
    white-space: nowrap;
}

.status-pill::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status-pill.online {
    color: var(--status-online);
    background: rgba(0, 255, 136, 0.08);
    border-color: rgba(0, 255, 136, 0.2);
}

.status-pill.online::before {
    background: var(--status-online);
    box-shadow: 0 0 12px rgba(0, 255, 136, 0.45);
}

.status-pill.working {
    color: #facc15;
    background: rgba(250, 204, 21, 0.1);
    border-color: rgba(250, 204, 21, 0.24);
}

.status-pill.working::before {
    background: #facc15;
    box-shadow: 0 0 12px rgba(250, 204, 21, 0.32);
}

.status-pill.shutdown {
    color: #cbd5e1;
    background: rgba(148, 163, 184, 0.08);
    border-color: rgba(148, 163, 184, 0.22);
}

.status-pill.shutdown::before {
    background: #94a3b8;
}

.status-pill.offline {
    color: var(--status-offline);
    background: rgba(255, 59, 59, 0.08);
    border-color: rgba(255, 59, 59, 0.22);
}

.status-pill.offline::before {
    background: var(--status-offline);
    animation: offline-alert-dot 0.7s ease-in-out infinite;
}

@keyframes offline-alert-dot {
    0%, 100% { box-shadow: 0 0 8px rgba(255, 59, 59, 0.35); transform: scale(1); }
    50% { box-shadow: 0 0 20px rgba(255, 59, 59, 0.7); transform: scale(1.14); }
}

.store-health-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    min-height: 220px;
    padding: 1rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background:
        radial-gradient(circle at top right, rgba(0, 240, 255, 0.08), transparent 28%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 48%),
        var(--bg-card);
    cursor: pointer;
    transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
    overflow: hidden;
}

.store-health-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-glow);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.24);
}

.store-health-card::after {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    border-radius: 999px;
}

.store-health-card.status-online::after {
    background: var(--status-online);
}

.store-health-card.status-shutdown::after {
    background: #94a3b8;
}

.store-health-card.status-offline::after {
    background: var(--status-offline);
    animation: offline-alert-bar 0.9s ease-in-out infinite;
}

@keyframes offline-alert-bar {
    0%, 100% { box-shadow: 0 0 8px rgba(255, 59, 59, 0.28); opacity: 0.9; }
    50% { box-shadow: 0 0 18px rgba(255, 59, 59, 0.68); opacity: 1; }
}

.store-health-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.8rem;
}

.store-health-header h3 {
    font-size: 1.02rem;
    line-height: 1.3;
}

.store-health-client {
    color: var(--text-muted);
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: 0.35rem;
}

.store-health-reason {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.45;
}

.store-health-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
}

.store-health-metrics span {
    padding: 0.65rem 0.75rem;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(148, 163, 184, 0.12);
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.store-health-metrics strong {
    display: block;
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 0.15rem;
}

.mini-register-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.mini-register-list.diagnostic-list,
.register-list.diagnostic-list {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 0.6rem;
}

.store-register-row {
    padding: 0.72rem 0.8rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(255, 255, 255, 0.03);
}

.store-register-row.online {
    border-color: rgba(0, 255, 136, 0.22);
    background: rgba(0, 255, 136, 0.05);
}

.store-register-row.shutdown {
    border-color: rgba(148, 163, 184, 0.2);
    background: rgba(148, 163, 184, 0.06);
}

.store-register-row.offline {
    border-color: rgba(255, 59, 59, 0.22);
    background: rgba(255, 59, 59, 0.06);
}

.store-register-row-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    margin-bottom: 0.45rem;
}

.store-register-name {
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.82rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.store-register-status {
    flex-shrink: 0;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.store-register-status.online {
    color: var(--status-online);
}

.store-register-status.shutdown {
    color: #cbd5e1;
}

.store-register-status.offline {
    color: var(--status-offline);
}

.store-register-meta {
    color: var(--text-secondary);
    font-size: 0.76rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.store-register-meta + .store-register-meta {
    margin-top: 0.24rem;
}

.store-register-meta strong {
    color: var(--text-primary);
}

.mini-register-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.34rem 0.6rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-family: var(--font-mono);
    border: 1px solid transparent;
}

.mini-register-item.online {
    color: var(--status-online);
    background: rgba(0, 255, 136, 0.08);
    border-color: rgba(0, 255, 136, 0.18);
}

.mini-register-item.shutdown {
    color: #cbd5e1;
    background: rgba(148, 163, 184, 0.08);
    border-color: rgba(148, 163, 184, 0.18);
}

.mini-register-item.offline {
    color: var(--status-offline);
    background: rgba(255, 59, 59, 0.08);
    border-color: rgba(255, 59, 59, 0.18);
}

.store-health-error {
    margin-top: auto;
    padding: 0.72rem 0.8rem;
    border-radius: var(--radius-md);
    background: rgba(255, 59, 59, 0.08);
    border: 1px solid rgba(255, 59, 59, 0.18);
    color: #fecaca;
    font-size: 0.78rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

/* Dense cassa client grid */
.cassa-stage {
    position: relative;
    overflow: visible;
}

.cassa-connections-grid,
.cassa-clients-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.9rem;
    align-items: start;
}

.connection-card {
    position: relative;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 44%), var(--bg-card);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.connection-card:hover,
.connection-card.is-open {
    transform: translateY(-2px);
    border-color: var(--border-glow);
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.22);
}

.connection-card.status-working {
    border-color: rgba(250, 204, 21, 0.24);
}

.connection-card.status-offline {
    border-color: rgba(255, 59, 59, 0.24);
}

.connection-card-trigger {
    width: 100%;
    padding: 0.95rem;
    background: transparent;
    border: none;
    color: inherit;
    text-align: left;
    cursor: pointer;
}

.connection-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.42rem;
    margin-top: 0.85rem;
}

.connection-preview-item {
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    max-width: 100%;
    padding: 0.34rem 0.52rem;
    border-radius: 999px;
    background: rgba(0, 240, 255, 0.05);
    border: 1px solid rgba(0, 240, 255, 0.12);
    color: var(--text-secondary);
    font-size: 0.7rem;
}

.connection-preview-item.status-working {
    border-color: rgba(250, 204, 21, 0.2);
    background: rgba(250, 204, 21, 0.08);
}

.connection-preview-item.status-shutdown {
    border-color: rgba(148, 163, 184, 0.2);
    background: rgba(148, 163, 184, 0.08);
}

.connection-preview-item.status-offline {
    border-color: rgba(255, 59, 59, 0.2);
    background: rgba(255, 59, 59, 0.08);
}

.connection-preview-name {
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.connection-preview-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.cassa-connection-flyout {
    position: fixed;
    top: 5vh;
    right: 2.5vw;
    left: auto;
    width: min(1560px, 90vw);
    height: 90vh;
    padding: 1.15rem;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-glow);
    background:
        radial-gradient(circle at top right, rgba(0, 240, 255, 0.08), transparent 28%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 38%),
        var(--bg-secondary);
    box-shadow: 0 28px 70px rgba(0, 0, 0, 0.52);
    overflow: auto;
    overscroll-behavior: contain;
    z-index: 240;
    backdrop-filter: blur(8px);
}

.connection-flyout-shell {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.connection-flyout-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.connection-flyout-head h3 {
    margin-top: 0.35rem;
    font-size: 1.25rem;
}

.connection-flyout-summary {
    margin-top: 0.45rem;
    color: var(--text-secondary);
    font-size: 0.84rem;
    line-height: 1.5;
}

.connection-flyout-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.inline-refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.connection-refresh-btn {
    min-height: 36px;
}

.store-refresh-btn {
    width: 34px;
    height: 34px;
    padding: 0;
    justify-content: center;
    border-radius: 10px;
}

.refresh-icon {
    flex-shrink: 0;
}

.refresh-icon.is-spinning {
    animation: refresh-spin 0.9s linear infinite;
}

@keyframes refresh-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.connection-flyout-summary-grid {
    margin-top: 0;
}

.connection-inner-filters {
    margin-bottom: 0;
}

.connection-inner-grid {
    align-items: start;
}

.cassa-errors.is-inline {
    margin-top: 0;
}

.client-card {
    position: relative;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 44%), var(--bg-card);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
    overflow: visible;
}

.client-card.is-open {
    z-index: 30;
}

.client-card-trigger {
    width: 100%;
    background: transparent;
    border: none;
    color: inherit;
    text-align: left;
    padding: 0.95rem;
    cursor: pointer;
}

.client-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.8rem;
}

.client-card-label {
    display: inline-block;
    margin-bottom: 0.3rem;
    color: var(--text-muted);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.client-card-head h3 {
    font-size: 1rem;
    line-height: 1.25;
}

.client-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.45rem;
}

.client-metrics span {
    padding: 0.55rem 0.6rem;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(148, 163, 184, 0.12);
    color: var(--text-secondary);
    font-size: 0.76rem;
}

.client-metrics strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: 0.15rem;
    font-size: 0.95rem;
}

.client-card-reason {
    margin-top: 0.85rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.45;
}

.client-store-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.85rem;
}

.client-store-preview-item,
.client-store-preview-more {
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    padding: 0.34rem 0.52rem;
    border-radius: 999px;
    background: rgba(0, 240, 255, 0.05);
    border: 1px solid rgba(0, 240, 255, 0.12);
    color: var(--text-secondary);
    font-size: 0.7rem;
}

.client-store-preview-item.status-working {
    border-color: rgba(250, 204, 21, 0.2);
    background: rgba(250, 204, 21, 0.08);
}

.client-store-preview-item.status-shutdown {
    border-color: rgba(148, 163, 184, 0.2);
    background: rgba(148, 163, 184, 0.08);
}

.client-store-preview-item.status-offline {
    border-color: rgba(255, 59, 59, 0.2);
    background: rgba(255, 59, 59, 0.08);
}

.client-store-preview-name {
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.client-store-preview-counts,
.client-store-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.client-store-counts {
    margin-bottom: 0.7rem;
}

.store-preview-count {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    padding: 0.18rem 0.38rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.store-preview-count.online {
    color: var(--status-online);
    background: rgba(0, 255, 136, 0.08);
    border-color: rgba(0, 255, 136, 0.18);
}

.store-preview-count.shutdown {
    color: #cbd5e1;
    background: rgba(148, 163, 184, 0.08);
    border-color: rgba(148, 163, 184, 0.18);
}

.store-preview-count.offline {
    color: var(--status-offline);
    background: rgba(255, 59, 59, 0.08);
    border-color: rgba(255, 59, 59, 0.18);
}

.store-preview-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}

.store-preview-count.online .store-preview-dot {
    background: var(--status-online);
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.4);
}

.store-preview-count.shutdown .store-preview-dot {
    background: #94a3b8;
}

.store-preview-count.offline .store-preview-dot {
    background: var(--status-offline);
    box-shadow: 0 0 10px rgba(255, 59, 59, 0.45);
}

.client-store-preview-more {
    color: var(--text-muted);
}

.client-card.status-offline {
    border-color: rgba(255, 59, 59, 0.25);
}

.client-card.status-working {
    border-color: rgba(250, 204, 21, 0.24);
}

.client-card.status-offline.is-open,
.client-card.status-offline:hover {
    box-shadow: 0 16px 34px rgba(255, 59, 59, 0.18);
}

.client-card.status-working.is-open,
.client-card.status-working:hover {
    box-shadow: 0 16px 34px rgba(250, 204, 21, 0.14);
}

.client-flyout {
    position: absolute;
    top: calc(100% + 0.75rem);
    left: 0;
    width: min(880px, 92vw);
    padding: 1rem;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-glow);
    background:
        radial-gradient(circle at top right, rgba(0, 240, 255, 0.08), transparent 28%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 38%),
        var(--bg-secondary);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42);
    max-height: min(72vh, 760px);
    overflow: auto;
    overscroll-behavior: contain;
    transform: translateX(var(--flyout-shift, 0px));
}

.client-flyout[data-placement="top"] {
    top: auto;
    bottom: 0;
}

.client-flyout-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.9rem;
}

.client-flyout-head h3 {
    margin-top: 0.35rem;
    font-size: 1.15rem;
}

.client-flyout-summary {
    margin-top: 0.45rem;
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.5;
}

.client-flyout-close {
    flex-shrink: 0;
}

.client-flyout-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 0.85rem;
}

.client-store-block {
    padding: 0.9rem;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(148, 163, 184, 0.15);
    background: rgba(255, 255, 255, 0.02);
}

.client-store-block.status-offline {
    border-color: rgba(255, 59, 59, 0.28);
}

.client-store-block.status-working {
    border-color: rgba(250, 204, 21, 0.24);
}

.client-store-block.status-shutdown {
    border-color: rgba(148, 163, 184, 0.22);
}

.client-store-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}

.client-store-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
}

.client-store-head p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.45;
    margin-top: 0.28rem;
}

.client-store-registers {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.client-register-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.58rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.72rem;
    font-family: var(--font-mono);
}

.client-register-chip.online {
    color: var(--status-online);
    background: rgba(0, 255, 136, 0.08);
    border-color: rgba(0, 255, 136, 0.18);
}

.client-register-chip.shutdown {
    color: #cbd5e1;
    background: rgba(148, 163, 184, 0.08);
    border-color: rgba(148, 163, 184, 0.18);
}

.client-register-chip.offline {
    color: var(--status-offline);
    background: rgba(255, 59, 59, 0.08);
    border-color: rgba(255, 59, 59, 0.18);
    animation: offline-alert-chip 0.8s ease-in-out infinite;
}

@keyframes offline-alert-chip {
    0%, 100% { box-shadow: 0 0 0 rgba(255, 59, 59, 0.15); }
    50% { box-shadow: 0 0 18px rgba(255, 59, 59, 0.25); }
}

.client-register-code {
    font-weight: 700;
}

.client-register-schema {
    opacity: 0.8;
    font-size: 0.68rem;
}

.client-store-error {
    margin-top: 0.75rem;
    padding: 0.65rem 0.72rem;
    border-radius: var(--radius-md);
    background: rgba(255, 59, 59, 0.08);
    border: 1px solid rgba(255, 59, 59, 0.18);
    color: #fecaca;
    font-size: 0.76rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.register-chip.shutdown {
    border-color: rgba(148, 163, 184, 0.28);
    color: #cbd5e1;
}

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

    .cassa-connection-flyout {
        right: 2vw;
        width: 92vw;
        height: 90vh;
    }

    .client-flyout {
        width: calc(100vw - 2.5rem);
        left: 50%;
        transform: translateX(-50%);
    }
}

@media (max-width: 768px) {
    .store-health-metrics,
    .client-metrics {
        grid-template-columns: 1fr 1fr;
    }

    .cassa-connection-flyout {
        top: 1.5vh;
        right: 1.5vw;
        width: 97vw;
        height: 97vh;
        max-height: none;
        padding: 0.9rem;
    }

    .connection-flyout-head {
        flex-direction: column;
        align-items: stretch;
    }

    .connection-flyout-actions {
        justify-content: space-between;
    }

    .client-flyout {
        position: relative;
        top: 0.8rem;
        bottom: auto;
        left: 0;
        width: 100%;
        transform: none;
    }

    .client-flyout-grid {
        grid-template-columns: 1fr;
    }
}
