/* (c) 2026 Andrej Popovic */
:root {
    --bg-color: #f3f4f6;
    --panel-bg: rgba(255, 255, 255, 0.85);
    --panel-border: rgba(0, 0, 0, 0.1);
    --primary: #374151;
    --primary-hover: #111827;
    --text-main: #111827;
    --text-muted: #6b7280;
    --error: #dc2626;
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --input-bg: #ffffff;
    --input-focus: rgba(55, 65, 81, 0.15);
    --card-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --font-stack: 'Outfit', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-stack);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: stretch;
    overflow-x: hidden;
    position: relative;
}

/* Background Effects */
#noise-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    opacity: 0.04;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    z-index: 0;
    opacity: 0.5;
}

.blob-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(55, 65, 81, 0.1) 0%, rgba(255, 255, 255, 0) 70%);
    top: -200px;
    left: -100px;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(0, 0, 0, 0.05) 0%, rgba(255, 255, 255, 0) 70%);
    bottom: -150px;
    right: -100px;
}



/* Base Layout */
.app-container {
    width: 100%;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: stretch;
    position: relative;
    z-index: 2;
    padding: 0;
    box-sizing: border-box;
    overflow: hidden;
}

@media (max-width: 480px) {
    .app-container {
        padding: 0;
        align-items: flex-start;
    }
}

.loader {
    font-size: 1.2rem;
    color: var(--text-muted);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }
}

/* Glass Panels */
.glass-panel {
    background: var(--panel-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--panel-border);
    border-radius: 0;
    padding: 3rem;
    width: 100%;
    max-width: 460px;
    box-shadow: var(--card-shadow);
}

@media (max-width: 480px) {
    .glass-panel {
        padding: 1.75rem 1.25rem;
        border-radius: 0;
    }
}

/* Animation utilities */
.slide-up {
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.fade-in {
    animation: fadeIn 0.4s ease forwards;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Layout Utilities */
.flex { display: flex; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-end { display: flex; justify-content: flex-end; align-items: center; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 1.5rem; }
.gap-4 { gap: 1.5rem; }

/* Typography & Layout */
.logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.logo-container.vertical {
    flex-direction: column;
    text-align: center;
    padding: 0.25rem 0 1.5rem 0;
}

.logo-container svg {
    color: var(--primary);
}

h1 {
    font-size: 1.8rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Forms */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem; /* Reduced from 1.25rem */
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group input:not([type="checkbox"]):not([type="radio"]),
.input-group textarea {
    width: 100%;
}

.input-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-group.inline {
    flex-direction: row !important;
    align-items: center;
    gap: 1.5rem;
}

.input-group.inline label {
    margin-bottom: 0 !important;
    min-width: 140px;
    flex-shrink: 0;
}

input {
    background: var(--input-bg);
    border: 1px solid var(--panel-border);
    border-radius: 0;
    padding: 0.85rem 1rem;
    color: var(--text-main);
    font-family: var(--font-stack);
    font-size: 1rem;
    transition: all 0.2s ease;
    outline: none;
}

input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--input-focus);
}

.form-select {
    background: var(--input-bg);
    border: 1px solid var(--panel-border);
    border-radius: 0.75rem;
    padding: 0.85rem 1rem;
    color: var(--text-main);
    font-family: var(--font-stack);
    font-size: 1rem;
    transition: all 0.2s ease;
    outline: none;
    width: 100%;
    cursor: pointer;
}

.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--input-focus);
}

.input-error-flash {
    border-color: var(--error) !important;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.15) !important;
    animation: errorShake 0.4s ease;
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    20%       { transform: translateX(-6px); }
    60%       { transform: translateX(6px); }
    80%       { transform: translateX(-3px); }
}

.form-select option {
    background-color: #ffffff;
    color: #111827;
}

.form-select option:checked {
    background-color: var(--primary);
    color: #ffffff;
}

button:disabled, .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
}

.btn {
    padding: 0.85rem 1.5rem;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    font-family: var(--font-stack);
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0;
}

.danger-btn {
    background: #ef4444;
    color: white;
    border: none;
}

.danger-btn:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
    color: white;
}

.danger-btn:active {
    transform: translateY(0);
}

.primary-btn {
    background: var(--primary);
    color: white;
}

.primary-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.secondary-btn {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-main);
    border: 1px solid var(--panel-border);
}

.secondary-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.text-btn {
    background: transparent;
    color: var(--text-muted);
}

.text-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.05);
}

.hidden {
    display: none !important;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

.error-msg {
    color: var(--error);
    font-size: 0.9rem;
    margin-top: 1rem;
    text-align: center;
    min-height: 1.5em;
}

/* Setup Specific */
.qr-container {
    background: #fff;
    padding: 1rem;
    border-radius: 0;
    text-align: center;
    color: #000;
    margin-top: 1.5rem;
}

.qr-container p {
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

#qr-image {
    max-width: 180px;
    height: auto;
    display: inline-block;
}

/* Dashboard Layout */
.dashboard-layout {
    width: 100%;
    height: 100%;
    display: flex;
    gap: 0;
    align-items: stretch;
    overflow: hidden;
}

#btn-hamburger {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 100;
    background: var(--panel-bg);
    backdrop-filter: blur(8px);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 0.5rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: left 0.3s ease;
}

#btn-hamburger:hover {
    background: rgba(255, 255, 255, 0.95);
}

.sidebar {
    width: 280px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    padding: 4.5rem 1.5rem 2rem 1.5rem;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    background: var(--panel-bg);
    border-right: 1px solid var(--panel-border);
    transition: transform 0.3s ease;
}

.sidebar.nav-hidden {
    transform: translateX(-100%);
}

.sidebar .logo-container.small h2 {
    font-size: 1.4rem;
}

.sidebar .logo-container.small {
    margin-bottom: 2rem;
}

.dash-menu {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 2rem;
    flex-grow: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: 0;
    transition: all 0.2s;
    font-weight: 400;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
}

.menu-item.active {
    background: var(--input-focus);
    color: var(--primary);
    font-weight: 600;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--panel-border);
}

.apk-qr-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.apk-qr-container img {
    width: 100px;
    height: 100px;
    border-radius: 0;
    background: white;
    padding: 3px;
    display: block;
}

/* Sidebar adjustments for limited height screens */
@media (max-height: 680px) and (min-width: 769px) {
    .sidebar {
        width: 340px;
        padding: 1rem 1.5rem;
    }
    .logo-container.vertical {
        flex-direction: row;
        text-align: left;
        padding: 0.5rem 0;
        gap: 1rem;
        margin-bottom: 1rem;
    }
    .logo-container.vertical svg {
        width: 32px;
        height: 32px;
    }
    .logo-container.vertical h2 {
        font-size: 1.2rem;
    }
    .dash-menu {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.4rem;
        margin-top: 0;
    }
    .menu-item {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
    .sidebar-footer {
        padding-top: 0.5rem;
        margin-top: 0.5rem;
    }
    .apk-qr-container {
        flex-direction: row;
        align-items: center;
        gap: 0.75rem;
        margin-bottom: 0.5rem;
    }
    .apk-qr-container img {
        width: 50px;
        height: 50px;
    }
    .sidebar h5 {
        display: none; /* Hide copyright on very short screens to save space */
    }
}


.apk-qr-container small {
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    line-height: 1.4;
}

.apk-qr-container a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.apk-qr-container a:hover {
    text-decoration: underline;
}


.dash-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    max-width: none;
    overflow: auto;
    height: 100%;
    box-sizing: border-box;
    margin-left: 280px;
    padding: 4.5rem 2rem 2rem 2rem;
    transition: margin-left 0.3s ease;
    background: var(--bg-color);
}

.dash-content.nav-hidden {
    margin-left: 0;
}


/* ── Responsive: mobile/tablet anchoring ── */
@media (max-width: 768px) {
    body {
        height: 100vh;
        overflow: hidden;
    }

    .app-container {
        height: 100vh;
        padding: 0;
    }

    .dashboard-layout {
        flex-direction: row;
        height: 100vh;
        gap: 0;
    }

    .sidebar {
        width: 80%;
        max-width: 320px;
        transform: translateX(0);
        padding: 4.5rem 1rem 1rem 1rem;
        box-shadow: 4px 0 15px rgba(0,0,0,0.1);
        background: var(--input-bg);
    }

    .dash-content {
        margin-left: 0 !important;
        padding: 4.5rem 1rem 1rem 1rem;
        height: 100vh;
        overflow: auto;
    }

    .logo-container.vertical {
        flex-direction: row;
        padding: 0;
        margin-bottom: 0.5rem;
        text-align: left;
    }

    .logo-container.vertical svg {
        width: 32px;
        height: 32px;
    }

    .sidebar-footer {
        display: none; /* Hide footer items on mobile sidebar to maximize content space */
    }
}

/* ── Responsive: phone (480px) ── */
@media (max-width: 480px) {
    .view-header.flex-between {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
}

.view-header {
    margin-bottom: 2rem;
}

.view-header h2 {
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
}

.view-header p {
    color: var(--text-muted);
}

.empty-state {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--text-muted);
    border: 1px dashed var(--panel-border);
    border-radius: 0;
    background: rgba(0, 0, 0, 0.02);
}

/* Data Tables */
.view-body {
    overflow-x: auto;
    overflow-y: auto;
    flex: 1 1 0;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-top: 1rem;
    color: var(--text-light);
    min-width: 480px;
    /* ensures horizontal scroll on phones */
}

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.data-table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background 0.2s;
}

.data-table th.sortable:hover {
    background: rgba(0, 0, 0, 0.05);
}

.sort-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 4px;
    vertical-align: middle;
    opacity: 0.5;
}

.sortable.asc .sort-indicator::after {
    content: '↑';
}

.sortable.desc .sort-indicator::after {
    content: '↓';
}

.data-table tbody tr {
    transition: background 0.2s ease;
}

.data-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.02);
}

.text-right {
    text-align: right !important;
}

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-backdrop.show {
    display: flex;
}

.modal-panel {
    width: 100%;
    max-width: 500px;
    padding: 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
}

@media (max-width: 540px) {
    .modal-backdrop {
        align-items: flex-end;
    }

    .modal-panel {
        max-width: 100%;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        padding: 1.75rem 1.25rem;
    }
}

/* Custom Large Modal */
.modal-panel--large {
    max-width: 80vw !important;
    width: 80vw !important;
    height: 80vh !important;
    display: flex;
    flex-direction: column;
}

@media (max-width: 768px) {
    .modal-panel--large {
        max-width: 95vw !important;
        width: 95vw !important;
        height: 90vh !important;
    }
}

.modal-panel--responsive {
    width: 40% !important;
    max-width: 800px !important;
    max-height: 90vh !important;
    height: auto !important;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    padding: 2rem !important;
    border-radius: 0 !important;
}

/* Import Setup Grid */
.import-setup-container {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--panel-border);
    border-radius: 0;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.3);
}

.import-setup-header {
    display: flex;
    background: rgba(0, 0, 0, 0.05);
    border-bottom: 1px solid var(--panel-border);
    font-weight: 600;
    color: var(--text-main);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.import-setup-body {
    display: flex;
    flex-direction: column;
}

.import-setup-row {
    display: flex;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    transition: background 0.2s;
}

.import-setup-row:last-child {
    border-bottom: none;
}

.import-setup-row:hover {
    background: rgba(0, 0, 0, 0.01);
}

.header-col, .row-col {
    padding: 1rem 1.25rem;
}

.header-col:first-child, .row-col:first-child {
    width: 250px;
    border-right: 1px solid var(--panel-border);
    flex-shrink: 0;
}

.row-col:first-child {
    font-weight: 600;
    color: var(--primary);
}

.row-col:last-child {
    color: var(--text-main);
    line-height: 1.4;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.alias-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(55, 65, 81, 0.08);
    color: var(--primary);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    margin: 0.15rem;
    font-size: 0.9rem;
    border: 1px solid rgba(55, 65, 81, 0.1);
    transition: all 0.2s;
}

.alias-remove {
    cursor: pointer;
    opacity: 0.4;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    transition: all 0.2s;
    line-height: 1;
    font-size: 11px;
    margin-left: 0.1rem;
}

.alias-remove:hover {
    opacity: 1;
    background: rgba(220, 38, 38, 0.1);
    color: var(--error);
}

.new-alias-tag {
    display: inline-flex;
    align-items: center;
    background: rgba(46, 204, 113, 0.08);
    color: #2ecc71;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    margin: 0.15rem;
    font-size: 0.9rem;
    border: 1px dashed rgba(46, 204, 113, 0.4);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    user-select: none;
}

.new-alias-tag:hover {
    background: rgba(46, 204, 113, 0.15);
    border-style: solid;
}

.new-alias-input {
    background: white;
    border: 1px solid #2ecc71;
    border-radius: 0;
    padding: 0.1rem 0.4rem;
    font-size: 0.85rem;
    width: 100px;
    outline: none;
    color: var(--text-main);
    font-family: inherit;
    margin: 0.15rem;
}

.input-group-row {
    display: flex;
    gap: 1rem;
}

@media (max-width: 400px) {
    .input-group-row {
        flex-direction: column;
    }
}

.flex-1 {
    flex: 1;
    min-width: 0;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.m-0 {
    margin: 0 !important;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-active {
    background: #2ecc71 !important;
    color: white !important;
    border-color: #2ecc71 !important;
}

.status-inactive {
    background: #6b7280 !important;
    color: white !important;
    border-color: #6b7280 !important;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ── Utility Classes ── */
.flex {
    display: flex;
}

.flex-wrap {
    flex-wrap: wrap;
}

.gap-small {
    gap: 0.5rem !important;
}

.gap-medium {
    gap: 1rem !important;
}

.gap-large {
    gap: 2rem !important;
}

.text-center {
    text-align: center !important;
}

.p-2rem {
    padding: 2rem !important;
}

.bold-500 {
    font-weight: 500 !important;
}

.w-full {
    width: 100% !important;
}

.max-w-400 {
    max-width: 400px !important;
}

.max-w-600 {
    max-width: 600px !important;
}

.min-w-60 { min-width: 60px !important; }
.min-w-80 { min-width: 80px !important; }
.min-w-90 { min-width: 90px !important; }
.min-w-100 { min-width: 100px !important; }
.min-w-150 { min-width: 150px !important; }

.w-small {
    width: 100px !important;
    flex-grow: 0 !important;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

.overflow-y-auto {
    overflow-y: auto !important;
}

.m-0 {
    margin: 0 !important;
}

.mt-1rem {
    margin-top: 1rem !important;
}

/* ── Success message ── */
.success-msg {
    color: #2ecc71;
    font-size: 0.9rem;
    margin-top: 1rem;
    text-align: center;
    min-height: 1.5em;
}

/* ── Small button variant ── */
.small-btn {
    padding: 0.5rem 1rem !important;
    font-size: 0.85rem !important;
}

/* ── Danger / destructive button ── */
.danger-btn {
    color: var(--text-main) !important;
}

.danger-btn:hover {
    background: rgba(0, 0, 0, 0.06) !important;
    color: var(--text-main) !important;
}

/* ── Warning / amber button (e.g. Pause) ── */
.warning-btn {
    color: #b45309 !important;
    background: rgba(245, 158, 11, 0.08) !important;
    border: 1px solid rgba(245, 158, 11, 0.25) !important;
}

.warning-btn:hover {
    background: rgba(245, 158, 11, 0.15) !important;
    color: #92400e !important;
}

/* ── Paused state button (red text) ── */
.hs-paused-btn {
    color: var(--error) !important;
    background: rgba(220, 38, 38, 0.06) !important;
    border: 1px solid rgba(220, 38, 38, 0.2) !important;
}

.hs-paused-btn:hover {
    background: rgba(220, 38, 38, 0.12) !important;
}

/* ── Icon-only button ── */
.icon-btn {
    padding: 0.4rem !important;
}

/* ── Checkbox column in tables ── */
.checkbox-col {
    text-align: center !important;
    width: 80px;
}

.checkbox-col input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    cursor: pointer;
    accent-color: var(--primary);
    padding: 0;
    background: var(--input-bg);
    border-radius: 0;
}

/* ── Users table ── */
.users-table {
    min-width: 640px;
}

.action-cell {
    vertical-align: middle;
}

/* ── Hint text inside labels ── */
.hint {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-muted);
    text-transform: none;
    letter-spacing: 0;
}

/* ── Login footer link ── */
.login-footer {
    margin-top: 1.5rem;
    text-align: center;
}

.link-btn {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 0.9rem;
    cursor: pointer;
    text-decoration: none;
    font-family: var(--font-stack);
    transition: color 0.2s;
}

.link-btn:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* ── Registration/reset success box ── */
.success-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
    padding: 1.5rem 0;
}

.warning-panel {
    background: var(--warning-bg);
    border: 1px solid var(--warning);
    border-radius: 0;
    padding: 1.25rem;
    margin-bottom: 2rem;
    color: #92400e; /* Darker amber for text readability */
    font-size: 0.95rem;
    line-height: 1.5;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.warning-panel strong {
    color: #b45309;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.success-box svg {
    color: #2ecc71;
}

.success-box h2 {
    font-size: 1.4rem;
    color: #2ecc71;
}

.success-box p {
    color: var(--text-muted);
    line-height: 1.6;
}

/* ── Checkbox group on forms ── */
.checkbox-group {
    flex-direction: row !important;
    align-items: center;
    gap: 0.75rem !important;
}

.checkbox-group input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--primary);
    padding: 0;
    flex-shrink: 0;
}

/* ── Inline Username Edit ── */
.edit-username-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.edit-username-input {
    background: var(--input-bg);
    border: 1px solid var(--panel-border);
    color: var(--text-main);
    padding: 0.3rem 0.5rem;
    border-radius: 0;
    font-size: 0.9rem;
    width: 120px;
    outline: none;
}

.edit-username-input:focus {
    border-color: var(--primary);
}



/* ── Password Visibility Toggle ── */
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper input {
    padding-right: 3rem !important;
    /* Make room for the eye */
    width: 100%;
}

.password-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.password-input-wrapper input {
    flex: 1;
}

.toggle-password {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, transform 0.1s;
    z-index: 10;
}

.password-wrapper .toggle-password {
    position: absolute;
    right: 0.75rem;
}

.toggle-password:hover,
.toggle-password.active {
    color: var(--primary);
}

.toggle-password:active {
    transform: scale(0.9);
}

.eye-icon {
    pointer-events: none;
}

/* Hide vendor-specific reveal/clear buttons (Edge, IE) */
input::-ms-reveal,
input::-ms-clear {
    display: none;
}

/* ── Cleaned Utility & Specific Component Classes ── */

/* Typography & Display Utils */
.mb-0 {
    margin-bottom: 0 !important;
}

.mt-0 {
    margin-top: 0 !important;
}

.flex-1 {
    flex: 1;
}

.h-100 {
    height: 100%;
}

.overflow-hidden {
    overflow: hidden;
}

.overflow-y-auto {
    overflow-y: auto;
}

/* Filter & Search Wrappers */
.filter-panel {
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 1.25rem;
    align-items: flex-end;
    max-width: none;
}

.filter-group {
    margin: 0;
    flex: 1 1 140px;
    min-width: 140px;
}

.filter-search-group {
    margin: 0;
    flex: 2 1 200px;
    min-width: 200px;
}

@media (max-width: 600px) {
    .filter-group,
    .filter-search-group {
        flex-basis: 100%;
    }
}

.search-input-wrapper {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.search-input-wrapper input {
    flex: 1;
    background: var(--input-bg);
    border: 1px solid var(--panel-border);
}

.search-checkbox-group {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    white-space: nowrap;
    cursor: pointer;
}

/* Data Tables & Headers */
.data-panel {
    flex: 1;
    overflow: auto;
    padding: 0;
    max-width: none;
}

.table-auto {
    table-layout: auto;
    width: 100%;
}

.sticky-header {
    position: sticky;
    top: 0;
    background: var(--panel-bg);
    z-index: 10;
}

.resizable-header {
    resize: horizontal;
    overflow: hidden;
}

/* Upload Event UI */
.upload-panel {
    padding: 2.5rem;
    max-width: none;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.upload-description {
    color: var(--text-muted);
    margin-top: 0;
}

.upload-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.gap-large {
    gap: 1.5rem;
}

.file-upload-group {
    background: rgba(0, 0, 0, 0.02);
    padding: 1.5rem;
    border-radius: 0;
    border: 1px dashed var(--panel-border);
}

.file-upload-label {
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    display: block;
}

.file-upload-input {
    padding: 0.5rem;
    display: block;
    width: 100%;
    cursor: pointer;
    color: var(--text-main);
}

.file-upload-input::file-selector-button {
    background: var(--primary);
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 0;
    color: white;
    cursor: pointer;
    margin-right: 1rem;
    font-family: var(--font-stack);
}

.upload-hint {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.upload-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1rem;
}

.min-w-150 {
    min-width: 150px;
}

/* ── Server Unreachable Overlay ── */
.gk-alert-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fadeIn 0.3s ease;
}

.gk-alert-box {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 0;
    padding: 2.5rem 3rem;
    max-width: 440px;
    width: calc(100% - 2rem);
    text-align: center;
    box-shadow: var(--card-shadow);
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.gk-alert-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(220, 38, 38, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--error);
    margin-bottom: 0.25rem;
}

.gk-alert-box h2 {
    font-size: 1.4rem;
    color: var(--text-main);
    margin: 0;
}

.gk-alert-box p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0;
}

/* ── Session Expired Banner ── */
.gk-session-banner {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(245, 158, 11, 0.12);
    border: 1px solid rgba(245, 158, 11, 0.4);
    color: #92400e;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.75rem 1rem;
    border-radius: 0;
    margin-bottom: 1.5rem;
    animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    line-height: 1.4;
}

/* ── Export Empty Toast ── */
.gk-export-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(1rem);
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(30, 30, 40, 0.95);
    border: 1px solid rgba(245, 158, 11, 0.45);
    color: #fde68a;
    font-size: 0.92rem;
    font-weight: 500;
    padding: 0.8rem 1.25rem;
    border-radius: 0;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
}
.gk-export-toast--visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}


/* ── Handsets & Transaction Details ── */
.barcode-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s;
    border-bottom: 1px dashed var(--input-focus);
}

.barcode-link:hover {
    color: var(--primary-hover);
    border-bottom-style: solid;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.85rem;
}

.detail-grid--2col {
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem 1.5rem;
}

/* Premium Modal Components */
.modal-info-strip {
    background: rgba(var(--primary-rgb), 0.05);
    border: 1px solid rgba(var(--primary-rgb), 0.1);
    border-radius: 0;
    padding: 1.25rem;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.info-block {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.info-block label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin: 0;
}

.info-block span {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-divider {
    height: 1px;
    background: rgba(var(--primary-rgb), 0.15);
    margin: 1.5rem 0;
    width: 100%;
    flex-shrink: 0;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.form-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 1.5rem;
}

.premium-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.premium-input-group label {
    font-size: 0.8rem;
    font-weight: 600;
    margin: 0;
}

.premium-input-group textarea {
    min-height: 80px;
    resize: vertical;
    line-height: 1.4;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.detail-item strong {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-item span {
    font-weight: 500;
    color: var(--text-main);
}

.detail-line {
    height: 1px;
    background: var(--panel-border);
    margin: 0.5rem 0;
}

.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(0, 0, 0, 0.05);
}

.color-primary {
    color: var(--primary) !important;
}

.section-title {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-main);
}

/* ── Event cell divider ── */
.event-cell-divider {
    border: none;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    margin: 6px 0 6px 0;
}

/* ── Event Summary Modal ── */
.event-summary-modal-panel {
    width: 100%;
    max-width: 660px;
    padding: 2rem 2.5rem 2.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.2);
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ── Tag filter grid ── */
.esm-tag-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
}

.esm-tag-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.875rem;
    cursor: pointer;
    padding: 0.3rem 0.6rem;
    border-radius: 8px;
    border: 1px solid var(--panel-border);
    transition: background 0.15s;
    user-select: none;
}

.esm-tag-label:hover {
    background: rgba(0, 0, 0, 0.04);
}

.esm-tag-label input[type="checkbox"] {
    width: 0.95rem;
    height: 0.95rem;
    accent-color: #2ecc71;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
}

/* ── Stats row ── */
.esm-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.esm-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1;
}

.esm-stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

/* ── Chart container ── */
.esm-chart-container {
    width: 100%;
    max-width: 360px;
    margin: 1.5rem auto 0;
}

/* ── Legend ── */
.esm-legend {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.esm-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-main);
}

.esm-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}

/* ── Settings Grid Layout ── */
.settings-panel {
    max-width: 860px;
    width: 100%;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem 2.5rem;
}

.settings-actions {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
}

@media (max-width: 768px) {
    .settings-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }
    
    .settings-panel {
        max-width: 100%;
    }
}

/* Tabs */
.tab-btn {
    border: none;
    background: transparent;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    font-size: 1rem;
    font-family: var(--font-stack);
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}

.tab-content {
    animation: fadeIn 0.3s ease;
}

/* ── Sales Report Tab ── */
.sales-report-tab-wrapper {
    display: flex;
    flex-direction: column;
}

.sales-report-grid-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    border: 1px solid var(--panel-border);
    border-radius: 0;
    overflow: hidden;
}

.sales-report-table-container {
    flex: 1 1 0;
    min-height: 0;
    overflow-x: auto;
    overflow-y: auto;
}

.sales-report-table-container .data-table {
    margin-top: 0;
}

.sales-report-totals-bar {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 2.5rem;
    padding: 0.85rem 1.25rem;
    background: var(--panel-bg);
    border-top: 2px solid var(--panel-border);
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text-main);
}

.sales-report-totals-bar span {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
