:root {
    --bg-app: #0f1218;
    --text-primary: #ededed;
    --text-secondary: #94a3b8;

    --primary-color: #FC4B08;
    --primary-glow: rgba(252, 75, 8, 0.5);

    --glass-bg: rgba(30, 41, 59, 0.4);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);

    --radius-lg: 24px;
    --radius-md: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-app);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* --- Ambient Glows --- */
.background-glows {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
}

.glow {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--primary-glow) 0%, rgba(0, 0, 0, 0) 70%);
    border-radius: 50%;
    opacity: 0.6;
    animation: pulseGlow 10s infinite alternate;
}

.glow-1 {
    top: -100px;
    left: 20%;
}

.glow-2 {
    bottom: -100px;
    right: 10%;
    background: radial-gradient(circle, rgba(255, 100, 50, 0.4) 0%, rgba(0, 0, 0, 0) 70%);
    animation-delay: 2s;
}

@keyframes pulseGlow {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }

    100% {
        transform: scale(1.2);
        opacity: 0.7;
    }
}

/* --- Layout --- */
.app-container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* --- Glassmorphism Components --- */
.glass-panel {
    background: var(--glass-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--glass-shadow);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    transition: transform 0.3s ease;
}

.glass-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 14px;
    border-radius: var(--radius-md);
    width: 100%;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.glass-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(252, 75, 8, 0.3);
    background: rgba(0, 0, 0, 0.5);
}

.glass-inner {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* --- Navigation Menu --- */
.app-nav {
    display: flex;
    gap: 1rem;
    padding: 0.8rem 1rem;
    /* Reduced margin to match gap */
    margin-bottom: 0;
    /* Remove extra margin, rely on container gap */
    justify-content: center;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all 0.2s;
    letter-spacing: 0.5px;
}

.nav-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.05);
}

.nav-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(252, 75, 8, 0.3);
}

/* --- Header --- */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
}

.main-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
    letter-spacing: -0.5px;
}

.main-header p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: var(--primary-color);
    box-shadow: 0 0 20px var(--primary-glow);
}

/* --- Content Grid --- */
.content-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 900px) {
    .content-grid {
        grid-template-columns: 1fr 1fr 340px;
        grid-template-areas: "service calc summary";
    }

    .service-panel {
        grid-area: service;
    }

    .calculator-panel {
        grid-area: calc;
    }

    .summary-panel {
        grid-area: summary;
    }

    /* FIX: Ensure Price List and Receipt View span full width */
    #view-pricelist,
    #view-receipts,
    #view-ledger {
        grid-column: 1 / -1;
        width: 100%;
    }
}

/* --- Panel Styles --- */
.panel {
    padding: 2rem;
}

.panel h2 {
    font-size: 1rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

/* --- Form Elements --- */
.form-group {
    margin-bottom: 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

label {
    font-size: 0.9rem;
    color: #e2e8f0;
    font-weight: 500;
}

select option {
    background: #1e293b;
    color: white;
}

/* --- Info Card --- */
.info-card {
    padding: 1.2rem;
    margin-top: 1rem;
}

.price-tag {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.2rem;
    margin-top: 0.5rem;
    text-shadow: 0 0 20px rgba(252, 75, 8, 0.4);
}

/* --- Summary --- */
.summary-details {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
    color: #e2e8f0;
}

.total-row {
    font-size: 1.8rem;
    font-weight: 800;
    color: white;
    margin-top: 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.total-row span:last-child {
    color: var(--primary-color);
    text-shadow: 0 0 20px rgba(252, 75, 8, 0.5);
    word-break: break-word;
    overflow-wrap: break-word;
    text-align: right;
    max-width: 100%;
}

.divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 1rem 0;
}

.button-group {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

.btn-primary {
    background: linear-gradient(135deg, #FF6B00 0%, #ff8800 100%);
    border: none;
    color: white;
    padding: 12px 28px;
    /* Slightly more padding */
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    flex: 2;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(255, 107, 0, 0.3);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    font-size: 0.9rem;
    white-space: nowrap;
    /* Force single line */
}

.glow-btn:hover {
    box-shadow: 0 10px 15px -3px rgba(255, 107, 0, 0.5), 0 4px 6px -2px rgba(255, 107, 0, 0.3);
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    cursor: pointer;
    flex: 1;
    transition: all 0.2s;
    font-weight: 500;
    letter-spacing: 0.5px;
    font-size: 0.9rem;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    color: white;
}

/* --- Price List Layout (V2: Left Side Control, Right Floating Cards) --- */
.pricelist-wrapper {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    align-items: start;
    padding-top: 1rem;
    /* Add some top spacing since we removed the panel padding */
}

.pricelist-sidebar {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: sticky;
    top: 20px;
    height: auto;
    max-height: 80vh;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    /* Keep border or maybe remove it for cleaner look? User wanted "no box". 
       Let's keep inner glass look or make it cleaner. */
    background: rgba(30, 41, 59, 0.2);
    /* very subtle background for sidebar */
    border-radius: var(--radius-lg);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.pricelist-sidebar .search-bar-container {
    margin-bottom: 0.5rem;
}

.pricelist-sidebar .filter-container {
    background: rgba(0, 0, 0, 0.2);
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.pricelist-sidebar .filter-container label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.pricelist-sidebar .sidebar-actions {
    margin-top: auto;
    /* Push to bottom if needed, or just leave as flow */
    padding-top: 1rem;
}

.sidebar-header h2 {
    font-size: 1.4rem;
    color: white;
    margin-bottom: 0.5rem;
}

.sidebar-header p {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.pricelist-main {
    width: 100%;
}

/* Floating Grid System */
.pricelist-grid-floating {
    display: grid;
    grid-template-columns: 1fr;
    /* Mobile default */
    gap: 1.5rem;
    padding-bottom: 2rem;
}

@media (min-width: 1024px) {
    .pricelist-grid-floating {
        grid-template-columns: 1fr 1fr;
        /* Force 2 columns on desktop */
    }
}

/* Floating Card Style - Independent Cards */
.pricelist-category {
    background: rgba(30, 41, 59, 0.4);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.pricelist-category:hover {
    transform: translateY(-5px) scale(1.02);
    background: rgba(30, 41, 59, 0.6);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.3);
}

/* Aesthetic Header inside card */
.cat-select-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 1rem;
    margin-bottom: 0.5rem;
}

.cat-select-wrapper h3 {
    font-size: 1.1rem;
    color: var(--primary-color);
    margin: 0;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-shadow: 0 0 15px rgba(252, 75, 8, 0.2);
}

/* Items inside card */
.pricelist-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 0;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
    transition: background 0.2s;
}

.pricelist-item:hover {
    background: rgba(255, 255, 255, 0.02);
    padding-left: 5px;
    padding-right: 5px;
    border-radius: 4px;
}

.pricelist-item:last-child {
    border-bottom: none;
}

.item-name {
    color: #e2e8f0;
    font-weight: 400;
}

.item-price {
    font-weight: 700;
    color: white;
    background: rgba(252, 75, 8, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.9rem;
}

.cat-checkbox {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

@media (max-width: 900px) {
    .pricelist-wrapper {
        grid-template-columns: 1fr;
    }

    .pricelist-sidebar {
        position: relative;
        top: 0;
        margin-bottom: 2rem;
    }

    .pricelist-grid-floating {
        grid-template-columns: 1fr;
    }
}

/* --- Config Panel (Overlay) --- */
.config-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s;
}

.config-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.config-modal {
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    /* Reverted to max-height */
    height: auto;
    /* Allow auto height */
    display: flex;
    flex-direction: column;
    padding: 0;
    /* Padding moved to children */
    background: #1e293b;
    background: rgba(30, 41, 59, 0.95);
    overflow: hidden;
    /* Important for scroll */
}

.config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(30, 41, 59, 0.98);
    backdrop-filter: blur(10px);
    z-index: 10;
    flex-shrink: 0;
}

.config-view {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
}

.admin-items-list.hidden {
    display: none;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
}

.config-actions {
    margin-bottom: 1.5rem;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.admin-category {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid var(--glass-border);
}

.admin-cat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.admin-cat-header h4 {
    color: var(--primary-color);
}

.admin-items-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.admin-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 8px 12px;
    transition: background 0.2s;
}

.btn-xs {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-weight: bold;
    font-size: 1.1rem;
    padding: 0 4px;
}

.btn-delete {
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    cursor: pointer;
}

.btn-add {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: 6px;
    transition: all 0.2s;
    box-shadow: none;
}

/* --- Utilities --- */
.currency-input {
    position: relative;
}

.currency-input span {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    z-index: 2;
}

.currency-input input {
    padding-left: 30px;
}

.hidden {
    display: none !important;
}

/* --- PDF Hidden Template (Use Light Theme for Print) --- */
.pdf-template-base {
    color: black !important;
    background: white !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.pdf-header h1 {
    color: #FC4B08;
}

.pdf-table th {
    background: #FC4B08;
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #0f1218;
}

::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 5px;
    border: 2px solid #0f1218;
}

::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* --- Hide Number Spinners --- */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* --- Modal Overlay & Cards --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-card {
    width: 90%;
    max-width: 420px;
    background: #1e293b;
    border: 1px solid var(--glass-border);
    padding: 2rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
    transform: scale(1);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.hidden .modal-card {
    transform: scale(0.9) translateY(20px);
}

.modal-card h3 {
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    font-size: 1.4rem;
    text-align: center;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    justify-content: center;
}

.btn-delete-action {
    background: #ef4444;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 700;
    transition: background 0.2s;
    font-family: inherit;
}

.btn-delete-action:hover {
    background: #dc2626;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

/* --- Radio Group in Modal --- */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-top: 0.5rem;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-md);
    transition: all 0.2s;
    border: 1px solid transparent;
}

.radio-label:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
    border-color: rgba(255, 255, 255, 0.1);
}

.radio-label:has(input:checked) {
    background: rgba(252, 75, 8, 0.1);
    border-color: var(--primary-color);
    color: white;
}

.radio-label input[type="radio"] {
    accent-color: var(--primary-color);
    width: 18px;
    height: 18px;
}


/* --- Quantity Control Integration --- */
.quantity-control {
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 4px;
    height: 54px;
    /* Match standard inputs */
}

.qty-btn {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border: none;
    width: 44px;
    height: 100%;
    border-radius: 8px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    line-height: 0;
}

.qty-btn:hover {
    background: var(--primary-color);
    box-shadow: 0 0 15px rgba(252, 75, 8, 0.4);
}

.qty-btn:active {
    transform: scale(0.95);
}

.qty-input-field {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 700;
    width: 60px;
    height: 100%;
    font-family: inherit;
    padding: 0;
}

.qty-input-field:focus {
    outline: none;
}

/* --- Refined Admin Buttons --- */
.btn-add:hover {
    background: #3b82f6;
    color: white;
    transform: none;
    box-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

.admin-cat-header .actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.admin-item:hover {
    background: rgba(255, 255, 255, 0.07);
}

.admin-cat-header button.btn-delete {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.admin-cat-header button.btn-delete:hover {
    background: #ef4444;
    color: white;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
}

.admin-item .btn-xs:hover {
    color: white;
    background: #ef4444;
}

/* --- New Config Menu Styles --- */
/* (Header styles moved to main modal block for sticky support) */

.back-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.back-btn:hover {
    color: var(--primary-color);
}

.menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1rem;
}

.menu-card {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    color: white;
}

.menu-card:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}



.menu-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.menu-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.menu-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.config-view.hidden {
    display: none;
}

/* --- Identity Settings Styles --- */
.logo-upload-area {
    border: 2px dashed rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-md);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    min-height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.logo-upload-area:hover {
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.02);
}

.logo-upload-area img {
    max-width: 100%;
    max-height: 140px;
    object-fit: contain;
    z-index: 2;
}

.upload-placeholder {
    color: var(--text-secondary);
    pointer-events: none;
}

/* --- Header Dynamic Styles --- */
.logo-area {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.app-logo {
    height: 50px;
    width: auto;
    object-fit: contain;
}

.app-logo.hidden {
    display: none;
}

/* --- Edit Button --- */
.btn-edit {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
    border-radius: 4px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    margin-left: auto;
    /* Push to right before delete btn */
    margin-right: 0.5rem;
    transition: all 0.2s;
}

.btn-edit:hover {
    background: #3b82f6;
    color: white;
}

/* Toggle Switch Styles */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .4s;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--primary-color);
}

input:checked+.slider:before {
    transform: translateX(24px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* --- Admin/Config Redesign (Refined) --- */
.config-content {
    display: flex;
    flex-direction: column;
    /* Force column layout for stack */
    gap: 1.5rem;
    padding-bottom: 2rem;
}

/* Glassmorphic Category Card */
.admin-category {
    background: rgba(30, 41, 59, 0.4);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    /* Subtle border */
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.admin-category:hover {
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.3);
    background: rgba(30, 41, 59, 0.6);
    transform: translateY(-2px);
}

/* Header styling */
/* Header styling */
.admin-cat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 1.5rem;
    background: transparent;
    /* Seamless */
    border-bottom: none;
    cursor: pointer;
    transition: background 0.2s;
}

/* .admin-cat-header:hover removed to rely on parent card hover for seamless effect */

.cat-title-area h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #e2e8f0;
    letter-spacing: 0.5px;
}

/* Items List Styling */
.admin-items-list {
    padding: 1rem 1.5rem;
    background: transparent;
    /* Seamless */
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    border-top: none;
}

.admin-items-list.hidden {
    display: none;
}

/* Individual Service Item */
.admin-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.2rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.admin-item:hover {
    background: rgba(255, 255, 255, 0.06);
    /* Brighter hover */
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateX(4px);
}

.admin-item span {
    font-size: 0.95rem;
    color: #cbd5e1;
    font-family: 'Outfit', sans-serif;
}

.admin-item small {
    color: #94a3b8 !important;
    font-weight: 600;
    margin-left: 10px;
    background: rgba(0, 0, 0, 0.3);
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

/* Polished Action Buttons */
.admin-cat-header .btn-sm {
    width: 36px;
    height: 36px;
    /* Larger touch targets */
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.2) !important;
}

.btn-add:hover {
    background: #3b82f6;
    color: white;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
    border-color: #3b82f6 !important;
    transform: scale(1.05);
}

.btn-delete {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2) !important;
}

.btn-delete:hover {
    background: #ef4444;
    color: white;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.4);
    border-color: #ef4444 !important;
    transform: scale(1.05);
}

/* Inner Item Buttons (Edit/Delete) */
.btn-edit {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 8px;
}

.btn-edit:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(252, 75, 8, 0.4);
}

.btn-xs.btn-delete {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

/* --- Receipt Form Grid --- */
.receipt-form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .receipt-form-grid {
        grid-template-columns: 1fr 1fr;
    }

    /* Make full-width elements span both columns */
    .receipt-full-width {
        grid-column: 1 / -1;
    }
}

/* --- Receipt Form 3-Column Layout --- */
.receipt-steps-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 1024px) {
    .receipt-steps-layout {
        grid-template-columns: 1fr 1fr 1fr;
    }

    .receipt-span-2 {
        grid-column: span 2;
    }
}

.step-col h3 {
    display: none;
    /* Hide old titles just in case */
}

/* ==========================================================================
   Ledger / Libro Diario Dashboard
   ========================================================================== */

#view-ledger {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0;
}

.ledger-dashboard {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: 100%;
}

/* --- Stats Grid (Top) --- */
.ledger-stats-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .ledger-stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ... existing stat card styles ... */
.stat-card {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: transform 0.2s, background 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    background: rgba(30, 41, 59, 0.85);
}

.stat-card.card-income {
    border-left: 4px solid #4ade80;
}

.stat-card.card-expense {
    border-left: 4px solid #f87171;
}

.stat-card.card-balance {
    border-left: 4px solid #fbbf24;
}

.stat-icon {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: bold;
}

.card-income .stat-icon {
    background: rgba(74, 222, 128, 0.15);
    color: #4ade80;
}

.card-expense .stat-icon {
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
}

.card-balance .stat-icon {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-info span {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.stat-info h3 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    color: white;
}


/* --- Main Content Grid --- */
.ledger-main-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    align-items: start;
}

@media (min-width: 900px) {
    .ledger-main-grid {
        grid-template-columns: 320px 1fr;
    }
}

.ledger-panel {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.ledger-panel h3 {
    margin-top: 0;
    margin-bottom: 1.25rem;
    font-size: 1.1rem;
    color: var(--primary-color);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.8rem;
    font-weight: 600;
}

/* Input Form Styles */
.ledger-form-stack {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.type-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.5rem;
    border-radius: 10px;
    margin-top: 0.5rem;
}

.type-option {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.6rem;
    border-radius: 8px;
    transition: background 0.2s;
    font-weight: 500;
}

.type-option:hover {
    background: rgba(255, 255, 255, 0.05);
}

.type-option input {
    margin: 0;
    accent-color: currentColor;
}

.option-income {
    color: #4ade80;
}

.option-expense {
    color: #f87171;
}

.currency-input {
    position: relative;
    display: flex;
    align-items: center;
}

.currency-input span {
    position: absolute;
    left: 1rem;
    color: var(--text-secondary);
    font-size: 1.1rem;
    pointer-events: none;
}

.currency-input input {
    padding-left: 2rem !important;
}

/* List Styles */
.panel-header-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 0.8rem;
}

.panel-header-actions h3 {
    margin: 0;
    border: none;
    padding: 0;
}

.ledger-controls {
    display: flex;
    gap: 0.8rem;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.ledger-list-wrapper {
    flex: 1;
    overflow-y: auto;
    max-height: 500px;
    padding-right: 4px;
}

.ledger-table {
    width: 100%;
    border-collapse: collapse;
}

.ledger-table th {
    text-align: left;
    color: var(--text-secondary);
    font-weight: 500;
    padding: 1rem 0.8rem;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    background: #1e293b;
    /* Fallback */
    z-index: 5;
}

.ledger-item-row td {
    padding: 1rem 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.95rem;
    color: var(--text-primary);
}

.ledger-item-row:hover {
    background: rgba(255, 255, 255, 0.02);
}

.ledger-item-row:last-child td {
    border-bottom: none;
}

/* Empty State */
.empty-state {
    padding: 3rem;
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    background: rgba(255, 255, 255, 0.01);
    border-radius: 8px;
    margin-top: 2rem;
}

/* Responsive */
@media (max-width: 900px) {
    .ledger-main-grid {
        grid-template-columns: 1fr;
        /* Stack on smaller screens */
    }

    .ledger-panel.form-panel {
        order: -1;
        /* Form on top */
    }
}

/* --- Utility Classes (Enforce Visibility) --- */
/* ... */
.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.2s;
    white-space: nowrap;
    /* Prevent wrapping */
}

/* ... */

.btn-delete-ledger {
    background: transparent;
    border: none;
    color: #ef4444;
    cursor: pointer;
    opacity: 0.6;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    border-radius: 6px;
}

.btn-delete-ledger:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.1);
    transform: scale(1.1);
}

/* --- Utility Classes (Enforce Visibility) --- */
.hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

#view-ledger.hidden {
    display: none !important;
}

/* --- Login Screen --- */
.login-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.login-card {
    width: 90%;
    max-width: 400px;
    padding: 3rem 2rem;
    border-radius: var(--border-radius);
    background: rgba(15, 23, 42, 0.7) !important;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.login-card h1 {
    font-size: 2rem;
    text-align: center;
    letter-spacing: -1px;
}

/* --- User List Styling --- */
.user-list-styled {
    list-style: none;
    padding: 0;
    margin: 0;
}

.user-list-styled li {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 12px 16px;
    margin-bottom: 8px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.user-list-styled li:hover {
    background: rgba(255, 255, 255, 0.06);
}

.admin-only-section {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1rem 0;
    margin: 2rem 0;
}