:root {
    --bg-color: rgba(255, 255, 255, 0.75);
    --primary-color: #e65c00;
    --secondary-color: #ff660069;
    --text-main: #333333;
    --text-muted: #666666;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --bg-hover: #f1f5f9;
    --error: #ef4444;
    --success: #22c55e;
    --sidebar-width: 260px;
    --sidebar-width-collapsed: 80px;
    --transition-speed: 0.35s;
    --border-color: #eaeaea;
}

html {
    scroll-padding-top: 80px;
}

/* Auth Styles */
.auth-container {
    height: 100vh;
    width: 100vw;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #0f172a;
    background-image: linear-gradient(rgba(15, 23, 42, 0.72), rgba(15, 23, 42, 0.72)), url('pozadie.PNG');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 2000;
}

.auth-card {
    width: 100%;
    max-width: 500px;
    padding: 2.5rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
    max-height: 90vh;
    overflow-y: auto;
    background: var(--bg-color);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.form-grid, .form-grid-responsive {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.checkbox-group input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-group label {
    margin-bottom: 0;
    font-size: 0.9rem;
    cursor: pointer;
}

/* Scrollbar styling for auth card */
.auth-card::-webkit-scrollbar {
    width: 6px;
}

.auth-card::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.auth-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    color: var(--primary-color);
}

.auth-logo h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.auth-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

.auth-switch {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.auth-switch a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

.auth-switch a:hover {
    text-decoration: underline;
}

.btn-full {
    width: 100%;
    margin-top: 1rem;
}

.error-msg {
    background-color: #fee2e2;
    color: #b91c1c;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    border: 1px solid #fecaca;
}

.success-msg {
    background-color: #dcfce7;
    color: #15803d;
    padding: 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 1rem;
    border: 1px solid #bbf7d0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #0f172a;
    color: var(--text-main);
    overflow-x: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-info-wrapper {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.credits-badge {
    background: rgba(251, 191, 36, 0.1);
    border-color: rgba(251, 191, 36, 0.2);
    color: #b45309;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-name {
    font-weight: 600;
    color: var(--text-main);
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-color);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-right: 1px solid rgba(255, 255, 255, 0.5);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: width var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.03);
    z-index: 100;
}

/* Unpinned State */
.sidebar.unpinned {
    width: var(--sidebar-width-collapsed);
}

.sidebar.unpinned:hover {
    width: var(--sidebar-width);
    box-shadow: 10px 0 25px rgba(0, 0, 0, 0.08);
}

.sidebar-top {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.logo-container {
    height: 80px;
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--primary-color);
    overflow: hidden;
    white-space: nowrap;
}

.logo-icon {
    min-width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    transition: opacity var(--transition-speed);
}

.menu-container {
    display: flex;
    flex-direction: column;
    padding: 0 1rem;
    gap: 0.5rem;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1rem;
    text-decoration: none;
    color: var(--text-muted);
    border-radius: 10px;
    font-weight: 500;
    transition: all 0.2s ease;
    overflow: hidden;
    white-space: nowrap;
}

.menu-item i,
.menu-item svg {
    min-width: 24px;
    flex-shrink: 0;
    transition: color 0.2s ease;
}

.pin-button i,
.pin-button svg {
    min-width: 24px;
    flex-shrink: 0;
}

.menu-text {
    transition: opacity var(--transition-speed);
}

.menu-item:hover {
    background-color: var(--secondary-color);
    color: var(--primary-color);
}

.sidebar.unpinned:not(:hover) .menu-item {
    padding: 0.8rem 0;
    justify-content: center;
}

.sidebar.unpinned:not(:hover) .pin-button {
    padding: 0.8rem 0;
    justify-content: center;
}

.sidebar.unpinned:not(:hover) .menu-text {
    width: 0;
    opacity: 0;
    visibility: hidden;
}

.menu-item.active {
    background-color: var(--secondary-color);
    color: var(--primary-color);
    font-weight: 600;
}

/* Bottom Actions */
.sidebar-bottom {
    padding: 1.5rem 1rem;
    border-top: 1px solid var(--border-color);
}

.pin-button {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
    padding: 0.8rem 1rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s ease;
    overflow: hidden;
    white-space: nowrap;
}

.pin-button:hover {
    background-color: #f5f5f5;
    color: var(--text-main);
}

/* Hide text when unpinned and not hovered */
.sidebar.unpinned:not(:hover) .logo-text,
.sidebar.unpinned:not(:hover) .menu-text {
    opacity: 0;
    width: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Main Content Area */
.main-content {
    flex: 1;
    min-width: 0;
    background: transparent;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.page-header {
    min-height: 80px;
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 1.5rem 3rem;
    background: rgba(255, 255, 255, 0.90);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    gap: 0.5rem;
    margin: -3rem -3rem 2rem -3rem;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.page-header p.text-muted {
    margin: 0;
    font-size: 0.95rem;
}

#admin-app-container .content .page-header {
    margin: -3rem -3rem 2rem -3rem !important;
}

.content {
    padding: 3rem;
}

/* Cards */
.card {
    background: var(--bg-color);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.5);
    width: 100%;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-narrow {
    max-width: 600px;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.06);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
}

.status-indicator {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 2rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.status-badge {
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.status-badge.open {
    background-color: rgba(34, 197, 94, 0.15);
    color: #16a34a;
}

.status-badge.closed {
    background-color: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

.error-highlight {
    border: 2px solid #ef4444 !important;
    background-color: rgba(239, 68, 68, 0.05) !important;
}

.hours-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.hour-row {
    display: flex;
    justify-content: space-between;
    padding-bottom: 0.8rem;
    border-bottom: 1px dashed var(--border-color);
}

.hour-row .day {
    font-weight: 500;
    color: var(--text-muted);
}

.hour-row .time {
    font-weight: 600;
    color: var(--text-main);
}

.processing-time {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background-color: var(--secondary-color);
    border-radius: 12px;
    color: var(--primary-color);
    font-weight: 500;
}

.processing-time strong {
    font-weight: 700;
}

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

.divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.divider::before,
.divider::after {
    content: "";
    flex: 1;
    border-bottom: 1px solid var(--border-color);
}

.divider:not(:empty)::before {
    margin-right: 1rem;
}

.divider:not(:empty)::after {
    margin-left: 1rem;
}

.btn i {
    margin-right: 0.5rem;
}

.setup-card {
    max-width: 500px !important;
}

.setup-intro {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
    line-height: 1.5;
}

.form-actions {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 1rem;
    margin-top: 2rem;
}

/* Admin View Styles */
.admin-header {
    justify-content: space-between;
}

.admin-header h1 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary-color);
}

.admin-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.admin-card {
    max-width: 800px;
}

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

.form-group>label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.text-input {
    width: 100%;
    font-family: inherit;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: white;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.text-input:focus {
    border-color: var(--primary-color);
}

.time-inputs {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.time-input {
    font-family: inherit;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: white;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.time-input:focus {
    border-color: var(--primary-color);
}

.time-inputs span {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-muted);
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.btn {
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-family: inherit;
}

/* Admin Sidebar Dropdowns */
.menu-group {
    display: flex;
    flex-direction: column;
}

.menu-sub-container {
    padding-left: 3rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.25rem;
    overflow: hidden;
    transition: all 0.3s ease;
}

.menu-sub-container.hidden {
    display: none;
}

.menu-sub-item {
    padding: 0.6rem 0.8rem;
    font-size: 0.9rem;
    color: #64748b;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s;
}

.menu-sub-item:hover {
    background-color: #f1f5f9;
    color: var(--primary-color);
}

.menu-sub-item.active {
    background-color: #eff6ff;
    color: #2563eb;
    font-weight: 600;
}

.group-arrow {
    width: 16px;
    height: 16px;
    transition: transform 0.3s;
}

.menu-group.open .group-arrow {
    transform: rotate(180deg);
}

.menu-group-btn {
    cursor: pointer;
}

/* Admin Tables */
.table-container {
    overflow-x: auto;
}

table {
    border-spacing: 0;
}

th, td {
    border-bottom: 1px solid #f1f5f9;
}

tr:last-child td {
    border-bottom: none;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    border-radius: 6px;
}

.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-primary { background: #eff6ff; color: #2563eb; }
.badge-secondary { background: #f1f5f9; color: #475569; }

.btn-link {
    background: none;
    border: none;
    color: #2563eb;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
}

.btn-link:hover {
    color: #1d4ed8;
}

.btn-danger-link {
    color: #ef4444;
}

.btn-danger-link:hover {
    color: #dc2626;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: #cc5200;
}

.btn-secondary {
    background-color: var(--bg-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: #e2e8f0;
    color: var(--text-primary);
}

/* --- NEW STYLES: Topbar, Grid, Cards --- */

/* Topbar */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 3rem;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.01);
}

.topbar-left,
.topbar-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.credits-text {
    font-weight: 500;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.credits-text strong {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.coins-icon {
    color: #eab308;
    /* yellow-500 */
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
    color: var(--text-main);
}

.profile-icon {
    color: var(--text-muted);
}

.logout-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    background: #fee2e2;
    color: #ef4444;
}

.admin-btn:hover {
    background: var(--secondary-color);
    color: var(--primary-color);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    max-width: 1200px;
}

.form-grid-responsive {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* ECU upload form — single-column, centered (replaces removed inline style) */
.ecu-form {
    grid-template-columns: 1fr;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

@media (max-width: 640px) {
    .form-grid-responsive {
        grid-template-columns: 1fr !important;
    }
}

.grid-column {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Specific Cards */
.info-card {
    background: linear-gradient(135deg, var(--bg-color), #f9fafb);
}

.ecu-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: var(--secondary-color);
    border-radius: 12px;
    margin-top: 1rem;
}

.ecu-label {
    font-weight: 500;
    color: var(--primary-color);
}

.ecu-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.highlight-card {
    border-top: 4px solid var(--primary-color);
}

.msg-content {
    line-height: 1.6;
    color: var(--text-main);
}

.warning-card {
    border-top: 4px solid #ef4444;
    background: #fffafa;
}

.text-warning {
    color: #ef4444 !important;
}

.warning-subtitle {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.warning-card p {
    margin-bottom: 1rem;
    color: var(--text-main);
}

.warning-links {
    list-style-type: disc;
    padding-left: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.warning-links li {
    color: var(--text-muted);
    line-height: 1.5;
}

.text-link {
    color: #3b82f6;
    text-decoration: underline;
    font-weight: 500;
    transition: color 0.2s;
}

.text-link:hover {
    color: #2563eb;
}

.text-area {
    width: 100%;
    font-family: inherit;
    padding: 0.8rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: white;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
    resize: vertical;
    min-height: 100px;
}

.text-area:focus {
    border-color: var(--primary-color);
}

/* Mobile Toggle Button */
.mobile-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.mobile-toggle:hover {
    background: var(--secondary-color);
    color: var(--primary-color);
}

/* Sidebar Overlay */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.45);
    z-index: 105;
    /* No backdrop-filter to keep admin content visible behind overlay */
}

.sidebar-overlay.show {
    display: block;
}

/* Make grid responsive */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .content {
        padding: 2rem;
    }

    .page-header {
        padding: 0 2rem;
        margin: -2rem -2rem 2rem -2rem;
    }

    .topbar {
        padding: 1rem 2rem;
    }
}

/* -------------------------------------
 * ADMIN MOBILE OVERRIDES
 * ------------------------------------- */
.admin-mobile-header {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 200;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    height: 56px;
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

/* Tablet and Mobile Scaling */
@media (max-width: 768px) {
    /* Prevent entire page from scrolling horizontally */
    html, body {
        overflow-x: hidden;
    }

    /* Admin: show mobile header */
    .admin-mobile-header {
        display: flex;
    }

    .mobile-toggle {
        display: flex;
    }

    /* Admin: sidebar hidden off-screen by default */
    #admin-app-container .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px !important;
        transform: translateX(-100%);
        z-index: 300 !important;  /* Must be above overlay */
        box-shadow: 15px 0 30px rgba(0, 0, 0, 0.15);
        transition: transform 0.3s ease;
    }

    #admin-app-container .sidebar.show {
        transform: translateX(0);
    }

    /* Admin overlay: below sidebar but above content */
    #admin-app-container .sidebar-overlay,
    #admin-sidebar-overlay {
        z-index: 250 !important;
        display: none;
        background: rgba(0, 0, 0, 0.4);
    }
    #admin-app-container .sidebar-overlay.show,
    #admin-sidebar-overlay.show {
        display: block;
    }

    /* Admin: mobile header always on top */
    .admin-mobile-header {
        z-index: 400 !important;
    }

    /* Admin: main content takes full width */
    #admin-app-container.app-container {
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        width: 100%;
        overflow-x: hidden;
    }

    #admin-app-container main.main-content {
        width: 100% !important;
        min-width: 0 !important;
        padding-top: 56px !important;
        overflow-x: hidden;
    }

    /* Admin: hide the desktop topbar on mobile (admin-mobile-header takes over) */
    #admin-app-container main.main-content > .topbar {
        display: none !important;
    }

    /* Admin content area padding */
    #admin-app-container .content {
        padding: 1rem !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: hidden;
    }

    #admin-app-container .content .page-header {
        margin: 0 -1rem 1.5rem -1rem !important;
        padding: 1rem !important;
    }

    #admin-app-container .sidebar .logo-text,
    #admin-app-container .sidebar .menu-text {
        opacity: 1 !important;
        width: auto !important;
        visibility: visible !important;
    }

    #admin-app-container .sidebar-bottom {
        display: flex;
    }

    /* User-facing sidebar on mobile */
    #sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px !important;
        transform: translateX(-100%);
        z-index: 110;
        box-shadow: 15px 0 30px rgba(0, 0, 0, 0.1);
        transition: transform 0.3s ease;
    }
    #sidebar.show {
        transform: translateX(0);
    }
    .sidebar.unpinned {
        width: 280px !important;
    }
    .logo-text, .menu-text {
        opacity: 1 !important;
        width: auto !important;
        visibility: visible !important;
    }
    .sidebar-bottom {
        display: none;
    }

    /* User-facing topbar */
    .topbar {
        padding: 0.5rem 1rem;
    }
    .topbar-right .user-name {
        display: none;
    }
    .topbar-left {
        gap: 0.75rem;
    }

    /* User-facing main content - clear sticky topbar */
    body:not(:has(#admin-app-container)) .main-content {
        padding-top: 0;
    }

    /* Page header (user pages) */
    .page-header {
        height: auto;
        min-height: 60px;
        padding: 0.75rem 1rem;
        margin: 0 -1rem 1.5rem -1rem !important;
    }

    /* Content area (user pages) */
    .content {
        padding: 0 1rem 1rem 1rem !important;
        min-width: 0;
        box-sizing: border-box;
    }

    /* Auth scaling */
    .auth-container {
        align-items: flex-start;
        height: 100vh;
        height: 100dvh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 1rem 0;
        box-sizing: border-box;
    }

    .auth-card {
        padding: 1.5rem;
        margin: 1rem;
        width: calc(100% - 2rem);
        max-height: none;
        overflow-y: visible;
    }

    /* ── GRID/LAYOUT RESETS ─────────────────────────────────── */
    
    /* Single-column for the outer ticket/ECU layout wrapper */
    .dashboard-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem !important;
        width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
    }

    /* Cards fill full width */
    .card {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    /* ECU vehicle info grid → single column */
    .form-grid, .form-grid-responsive {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
        width: 100%;
        box-sizing: border-box;
    }

    /* ECU services checkboxes list */
    #ecu-services-list, #tcu-services-list {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.5rem !important;
    }

    /* ECU upload form total price row */
    #ecu-upload-form .card > div[style*="justify-content: space-between"] {
        flex-direction: column !important;
        gap: 0.5rem !important;
        align-items: flex-start !important;
    }

    /* Tables: allow horizontal scroll inside container, not full page */
    .table-container {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        display: block;
        box-sizing: border-box;
    }

    .table-container table {
        min-width: 480px;
    }

    /* Word wrap for card titles */
    .card-title {
        word-break: break-word;
    }
}

@media (max-width: 480px) {
    .credits-text {
        font-size: 0.85rem;
    }

    .logo-container {
        padding: 0 1rem;
    }

    .card {
        padding: 1.25rem;
    }

    .form-grid {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .status-indicator {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    .page-header h1 {
        font-size: 1.25rem;
    }
}

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

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

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

.spin {
    animation: spin 1s linear infinite;
}

/* =========================================
 * PC DESKTOP LAYOUT FIXES
 * ========================================= */

/* Admin pages: full-width tables, no white borders */
#admin-app-container .card {
    max-width: 100% !important;
}

#admin-app-container .table-container {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

#admin-app-container table {
    border: none !important;
}

/* ECU Upload form: stretch to full available width on desktop */
@media (min-width: 1025px) {
    #ecu-upload-form-wrapper {
        max-width: 100%;
        width: 100%;
    }

    #ecu-upload-form-wrapper .card,
    .upload-file-content .card {
        max-width: 100% !important;
        width: 100% !important;
    }

    /* 2-column vehicle info form on desktop */
    .ecu-vehicle-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 1.25rem;
    }

    /* 3-column for wide screens */
    .ecu-vehicle-grid-3 {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        gap: 1.25rem;
    }

    /* Tickets and support: fixed max-width and centered */
    .tickets-content-wrapper {
        max-width: 900px;
        margin: 0 auto;
        width: 100%;
    }

    .tickets-two-col {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
        align-items: flex-start;
    }

    /* Admin page-level content full width */
    #admin-app-container .content {
        padding: 2rem 3rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    #admin-app-container main.main-content {
        overflow-x: hidden;
    }
}

/* Admin var overrides to match standard blue-grey admin theme */
#admin-app-container {
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --bg-hover: #f8fafc;
    --border-color: #e2e8f0;
}

/* Admin responsive grid classes */
.admin-pages-grid {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 1.5rem;
    align-items: flex-start;
}

.admin-settings-grid,
.admin-ecu-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: flex-start;
}

.opening-hours-row, .opening-hours-header {
    display: grid;
    grid-template-columns: 120px 110px 1fr 1fr;
    gap: 0.75rem;
    align-items: center;
}

.opening-hours-header {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0 0.25rem;
}

.opening-hours-row {
    padding: 0.5rem 0.25rem;
    border-bottom: 1px solid var(--border-color);
}

@media (max-width: 1024px) {
    .admin-settings-grid,
    .admin-ecu-detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .admin-pages-grid {
        grid-template-columns: 1fr;
    }
    
    .opening-hours-row, .opening-hours-header {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
    }
    .opening-hours-row > *:nth-child(3),
    .opening-hours-header > *:nth-child(3),
    .opening-hours-row > *:nth-child(4),
    .opening-hours-header > *:nth-child(4) {
        display: none; /* Hide 'to' text and second input if space is too tight, or we can adjust */
    }
    
    /* Better yet, just use a flexible layout for mobile opening hours */
    .opening-hours-row, .opening-hours-header {
        display: flex;
        flex-wrap: wrap;
    }
    .opening-hours-row > * {
        flex: 1 1 auto;
    }
}

#admin-app-container {
    --error: #ef4444;
    --primary-color: #2563eb;
}

/* Badge outline */
.badge-outline {
    border: 2px solid;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
}
