:root {
    /* Light Mode Palette - High Contrast */
    --bg-main: #e2e8f0; /* Slightly darker gray to make white cards pop */
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --bg-sidebar: #ffffff;
    --text-primary: #0f172a; /* Very dark slate for high contrast */
    --text-secondary: #475569; /* Darker secondary text */
    --accent-primary: #0284c7; /* Darker blue for contrast */
    --accent-hover: #0369a1;
    --accent-bg: #e0f2fe;
    --success: #059669; /* Darker green */
    --danger: #dc2626; /* Darker red */
    --danger-hover: #b91c1c;
    --warning: #d97706; /* Darker orange */
    --border-color: #cbd5e1; /* Stronger borders */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.15), 0 4px 6px -2px rgba(0, 0, 0, 0.1);
    
    --sidebar-width: 260px;
    --font-main: 'Inter', 'Kanit', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-main);
    color: var(--text-primary);
    overflow: hidden;
}

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

/* Sidebar */
.sidebar {
    --bg-sidebar: #0f172a;
    --border-color: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --bg-card-hover: #1e293b;
    --accent-bg: rgba(56, 189, 248, 0.1);
    --accent-primary: #38bdf8;

    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-sm);
    z-index: 10;
}

.logo {
    padding: 24px; font-size: 20px; font-weight: 700; color: var(--accent-primary);
    display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--border-color);
}

.nav-links { list-style: none; padding: 20px 0; }
.nav-links li {
    padding: 16px 24px; display: flex; align-items: center; gap: 16px;
    color: var(--text-secondary); cursor: pointer; transition: all 0.3s ease;
    font-weight: 500; border-left: 4px solid transparent;
}
.nav-links li:hover { color: var(--text-primary); background-color: var(--bg-card-hover); }
.nav-links li.active {
    color: var(--accent-primary); background-color: var(--accent-bg);
    border-left: 4px solid var(--accent-primary);
}

.sidebar-bottom { margin-top: auto; border-top: 1px solid var(--border-color); }
.sidebar-bottom .nav-links { padding: 10px 0; }

/* Main Content */
.main-content {
    flex: 1; overflow-y: auto; position: relative; background-color: var(--bg-main);
}
.page { display: none; padding: 24px; height: 100%; animation: fadeIn 0.4s ease; }
.page.active { display: block; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Typography */
h2 { font-size: 26px; font-weight: 700; margin-bottom: 24px; color: var(--text-primary); letter-spacing: -0.5px; }
h3 { font-size: 20px; font-weight: 700; margin-bottom: 16px; color: var(--text-primary); letter-spacing: -0.5px; }

/* Buttons */
button { font-family: inherit; border: none; cursor: pointer; border-radius: 8px; font-weight: 500; transition: all 0.2s ease; }
.btn-primary { background-color: var(--accent-primary); color: white; padding: 10px 16px; }
.btn-primary:hover { background-color: var(--accent-hover); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary { background-color: var(--bg-card); color: var(--text-primary); border: 1px solid var(--border-color); padding: 10px 16px; }
.btn-secondary:hover { background-color: var(--bg-card-hover); }
.btn-success { background-color: var(--success); color: white; padding: 12px 24px; font-size: 16px; width: 100%; }
.btn-success:hover { filter: brightness(1.05); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.btn-checkout { background-color: var(--accent-primary); color: white; padding: 16px; font-size: 18px; width: 100%; margin-top: 16px; font-weight: 600; }
.btn-checkout:disabled { background-color: var(--border-color); color: var(--text-secondary); cursor: not-allowed; box-shadow: none; transform: none; }
.btn-icon { background: transparent; border: none; color: var(--text-secondary); padding: 4px; border-radius: 4px; cursor: pointer; }
.btn-icon:hover { color: var(--accent-primary); background: var(--accent-bg); }

/* Inputs */
input, select, textarea {
    background-color: var(--bg-card); border: 2px solid var(--border-color); color: var(--text-primary);
    padding: 12px 14px; border-radius: 8px; font-family: inherit; font-size: 15px; font-weight: 500;
    transition: border-color 0.2s, box-shadow 0.2s; width: 100%;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--accent-primary); box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.2);
}
label { display: block; font-size: 14px; color: var(--text-primary); margin-bottom: 6px; font-weight: 600; }
::placeholder { color: #94a3b8; opacity: 1; }

/* 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;
}

/* Custom Number Input Group */
.number-input-group {
    display: flex;
    align-items: center;
    width: 100%;
}
.number-input-group input {
    text-align: center;
    border-radius: 0;
    border-left: none;
    border-right: none;
    font-size: 16px;
    font-weight: 700;
}
.number-input-group input:focus {
    box-shadow: none;
    border-color: var(--border-color); /* prevent focus ring covering buttons */
}
.number-input-group button {
    background: var(--bg-main);
    border: 2px solid var(--border-color);
    padding: 12px 12px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.number-input-group button:hover {
    background: #cbd5e1;
}
.number-input-group .btn-minus {
    border-radius: 8px 0 0 8px;
}
.number-input-group .btn-plus {
    border-radius: 0 8px 8px 0;
}

.form-group { margin-bottom: 16px; }
.input-row { display: flex; gap: 12px; margin-bottom: 12px; align-items: flex-end; }
.input-row > div { flex: 1; }

/* Layout */
.pos-layout {
    display: grid; grid-template-columns: minmax(400px, 800px) 400px; justify-content: center; gap: 32px; height: calc(100vh - 48px);
}
.products-area { overflow-y: auto; padding-right: 8px; }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Special Services */
.special-services { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-bottom: 32px; }
.service-card {
    background: white; border: 2px solid var(--border-color); border-radius: 12px; padding: 20px;
    position: relative; overflow: hidden; box-shadow: var(--shadow-sm);
    display: flex; flex-direction: column;
}
.service-card::before {
    content: ''; position: absolute; top: 0; left: 0; bottom: 0; width: 4px; background: var(--accent-primary);
}
.service-card#card-boardgame::before { background: #8b5cf6; }
.service-card#card-privateroom::before { background: #f97316; }

.service-card h3 { display: flex; align-items: center; font-size: 16px; }
.service-card h3 i { margin-right: 8px; color: var(--accent-primary); }
.service-card#card-boardgame h3 i { color: #8b5cf6; }
.service-card#card-privateroom h3 i { color: #f97316; }

.service-desc { color: var(--text-secondary); font-size: 13px; margin-bottom: 16px; }

.realtime-preview {
    background-color: var(--bg-main); border-radius: 8px; padding: 12px; margin-top: 16px;
    border: 1px dashed var(--border-color); font-size: 13px;
}
.preview-row { display: flex; justify-content: space-between; margin-bottom: 4px; }
.preview-total { font-weight: 600; color: var(--accent-primary); font-size: 15px; margin-top: 8px; border-top: 1px solid var(--border-color); padding-top: 8px; }

.warning-note { font-size: 12px; color: #b45309; margin-top: 12px; padding: 8px; background: #fef3c7; border-radius: 6px; display: flex; align-items: center; gap: 6px; }

/* Products Section */
.products-header { display: flex; justify-content: space-between; align-items: center; margin-top: 32px; border-bottom: 2px solid var(--border-color); padding-bottom: 12px; margin-bottom: 16px; }
.products-header h3 { margin: 0; border: none; padding: 0; }
.btn-custom-item { background: var(--success); color: white; border: none; padding: 8px 16px; border-radius: 8px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow-sm); display: flex; align-items: center; gap: 8px; }
.btn-custom-item:hover { background: #047857; transform: translateY(-1px); box-shadow: var(--shadow-md); }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; padding-bottom: 24px; }
.product-card {
    background-color: white; border: 2px solid var(--border-color); border-radius: 12px; padding: 16px;
    cursor: pointer; transition: all 0.2s ease; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--shadow-sm);
}
.product-card:hover { border-color: var(--accent-primary); transform: translateY(-4px); box-shadow: var(--shadow-md); }
.product-name { font-weight: 600; font-size: 16px; margin-bottom: 8px; color: var(--text-primary); }
.product-price { color: var(--accent-primary); font-weight: 700; font-size: 18px; }

/* Calculator Section (Modal Version) */
.calc-screen {
    background: var(--bg-main);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    text-align: right;
}
.calc-expression {
    font-size: 16px;
    color: var(--text-secondary);
    min-height: 24px;
    margin-bottom: 8px;
    font-family: monospace;
    word-wrap: break-word;
}
.calc-result {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    font-family: monospace;
    overflow-x: auto;
}
.calc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.calc-btn { background: white; border: 2px solid var(--border-color); font-size: 20px; padding: 16px 0; border-radius: 10px; font-weight: 600; color: var(--text-primary); }
.calc-btn:hover { background: var(--bg-card-hover); border-color: var(--text-secondary); }
.calc-btn.op { background: var(--accent-bg); color: var(--accent-primary); border-color: transparent; }
.calc-btn.op:hover { background: #bae6fd; }
.calc-btn.eq { background: var(--accent-primary); color: white; border-color: transparent; }
.calc-btn.eq:hover { background: var(--accent-hover); }

/* Dark Theme Utility */
.dark-theme {
    --bg-main: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #162032; /* Adding dark hover color for zebra stripes */
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --danger: #ef4444; /* Brighter red for better contrast on dark background */
    color: var(--text-primary);
}

.dark-theme input, 
.dark-theme select {
    background-color: #ffffff !important;
    color: #0f172a !important;
    border-color: #cbd5e1 !important;
}

.dark-theme label {
    color: #f8fafc !important;
}

/* Cart Area */
.cart-area {
    background-color: var(--bg-main); border-radius: 16px; border: 1px solid var(--border-color);
    display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-md);
}
.cart-area.dark-theme {
    /* Variables now inherited, keeping class for backward compatibility if needed */
}
.cart-header { padding: 20px; border-bottom: 1px solid var(--border-color); background-color: var(--bg-card); }
.cart-header h2 { margin: 0; font-size: 18px; }
.cart-items { flex: 1; overflow-y: auto; padding: 20px; }
.empty-cart-msg { color: var(--text-secondary); text-align: center; margin-top: 40px; font-size: 14px; }
.cart-item { display: flex; justify-content: space-between; align-items: flex-start; padding-bottom: 16px; margin-bottom: 16px; border-bottom: 1px dashed var(--border-color); animation: slideInRight 0.3s ease; }

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

.cart-item-info { flex: 1; }
.cart-item-info h4 { font-size: 14px; margin-bottom: 4px; display: flex; align-items: center; gap: 6px; }
.cart-item-qty { background: var(--bg-card); padding: 2px 6px; border-radius: 4px; font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.cart-item-details { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }
.cart-item-qty-highlight { font-size: 16px; font-weight: 700; color: var(--accent-primary); padding-right: 2px; }
.cart-item-note { font-size: 12px; color: #a78bfa; margin-top: 4px; font-style: italic; }

.cart-item-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; margin-left: 12px; }
.item-price { font-weight: 600; color: var(--text-primary); }
.action-buttons { display: flex; gap: 4px; }
.action-buttons button { color: var(--text-secondary); }
.action-buttons .btn-remove:hover { color: var(--danger); }
.action-buttons .btn-edit-note:hover { color: var(--accent-primary); }

.cart-footer { padding: 20px; background-color: var(--bg-card); border-top: 1px solid var(--border-color); }
.external-food-input { margin-bottom: 16px; }
.input-with-icon { position: relative; }
.input-with-icon i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-secondary); }
.input-with-icon input { padding-left: 36px; }

#table-number {
    background-color: #ffffff;
    color: #000000;
    border-color: #cbd5e1;
}
#table-number option {
    background-color: #ffffff;
    color: #000000;
}

.cart-summary { display: flex; flex-direction: column; gap: 8px; }
.summary-row { display: flex; justify-content: space-between; font-size: 14px; color: var(--text-secondary); }
.summary-row.total { font-size: 18px; font-weight: 700; color: var(--text-primary); margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border-color); }
.summary-row.total span:last-child { color: var(--accent-primary); font-size: 20px; }

/* Dashboard */
.dashboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.date-filter select { width: auto; padding-right: 32px; font-weight: 500; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 32px; }
.stat-card { background: white; border: 1px solid var(--border-color); border-radius: 12px; padding: 20px; display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow-sm); }
.stat-icon { width: 48px; height: 48px; background-color: var(--accent-bg); color: var(--accent-primary); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.stat-info p { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.stat-info h3 { margin: 0; font-size: 20px; color: var(--text-primary); }

.history-section { background-color: white; border-radius: 12px; border: 1px solid var(--border-color); padding: 20px; box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { white-space: nowrap; }
.admin-table td:nth-child(3) { white-space: normal; min-width: 200px; word-break: break-word; } /* allow name to wrap if very long */
th, td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--border-color); }
th { background-color: var(--bg-main); font-weight: 600; color: var(--text-secondary); font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; }
td { font-size: 14px; }
.history-row { cursor: pointer; transition: background 0.2s; }
.history-row:hover { background-color: var(--bg-card-hover) !important; }

/* Zebra Striping for Tables */
.admin-table tbody tr:nth-child(even),
.history-table tbody tr:nth-child(even),
table tbody tr.expense-row:nth-child(even) {
    background-color: var(--bg-card-hover);
}

/* Custom Modals */
.modal-overlay {
    position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(15, 23, 42, 0.6);
    display: flex; align-items: center; justify-content: center; z-index: 1000;
    opacity: 0; visibility: hidden; pointer-events: none; transition: all 0.2s ease; backdrop-filter: blur(2px);
}
.modal-overlay.active { opacity: 1; visibility: visible; pointer-events: auto; }
.modal-overlay.no-overlay { background: transparent; backdrop-filter: none; pointer-events: none; }
.modal-overlay.no-overlay.active { pointer-events: none; }
.modal-overlay.no-overlay .custom-modal { pointer-events: auto; box-shadow: 0 10px 30px rgba(0,0,0,0.2); }

.custom-modal {
    background: white; border-radius: 16px; width: 100%; max-width: 450px; padding: 24px;
    box-shadow: var(--shadow-lg); transform: translateY(20px); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-height: 90vh; overflow-y: auto; position: relative;
}
.modal-overlay.active .custom-modal { transform: translateY(0); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header.drag-handle { cursor: move; user-select: none; }
.modal-header h3 { margin: 0; font-size: 20px; }
.btn-close-modal { background: var(--bg-main); border: 1px solid var(--border-color); border-radius: 8px; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; font-size: 20px; color: var(--text-secondary); cursor: pointer; transition: all 0.2s; }
.btn-close-modal:hover { background: var(--danger); color: white; border-color: var(--danger); }

.modal-footer { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--border-color); }

/* Detail Modal specific */
.receipt-details { background: var(--bg-main); padding: 16px; border-radius: 8px; margin-bottom: 16px; }
.receipt-item { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px dashed #cbd5e1; }
.receipt-total { display: flex; justify-content: space-between; font-weight: 600; font-size: 15px; margin-top: 12px; padding-top: 12px; border-top: 2px solid #cbd5e1; }

/* Payment Methods */
.payment-methods { display: flex; gap: 12px; margin-bottom: 24px; }
.payment-btn { flex: 1; padding: 12px; background-color: white; border: 1px solid var(--border-color); color: var(--text-primary); border-radius: 8px; display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 500; }
.payment-btn.active { border-color: var(--accent-primary); background-color: var(--accent-bg); color: var(--accent-primary); }
.cash-calculator { margin-bottom: 24px; }
.cash-calculator input { font-size: 20px; padding: 12px; text-align: right; margin-bottom: 16px; font-weight: 600; }
.change-display { display: flex; justify-content: space-between; align-items: center; padding: 16px; background-color: #ecfdf5; border: 1px solid #a7f3d0; border-radius: 8px; }
.highlight-change { font-size: 24px; font-weight: 700; color: var(--success); }

/* Toasts */
.toast-container { position: fixed; top: 24px; right: 24px; display: flex; flex-direction: column; gap: 12px; z-index: 9999; }
.toast {
    background: white; border-radius: 8px; padding: 12px 16px; box-shadow: var(--shadow-md);
    display: flex; align-items: center; gap: 12px; min-width: 250px;
    animation: toastSlideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border-left: 4px solid var(--accent-primary);
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--accent-primary); }
.toast i { font-size: 18px; }
.toast.success i { color: var(--success); }
.toast.error i { color: var(--danger); }
.toast.info i { color: var(--accent-primary); }
.toast-content { flex: 1; }
.toast-title { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.toast-msg { font-size: 12px; color: var(--text-secondary); }
.toast-close { background: transparent; border: none; color: var(--text-secondary); cursor: pointer; }

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

/* Admin */
.admin-login-container { height: 100%; display: flex; align-items: center; justify-content: center; }
.login-card { background-color: white; border: 1px solid var(--border-color); padding: 40px; border-radius: 16px; width: 360px; text-align: center; box-shadow: var(--shadow-md); }
.login-card h2 { margin-bottom: 8px; color: var(--text-primary); }
.login-card p { color: var(--text-secondary); margin-bottom: 24px; font-size: 14px; }
.login-card input { text-align: center; font-size: 24px; letter-spacing: 4px; margin-bottom: 16px; }
.admin-layout { display: grid; grid-template-columns: 320px 1fr; gap: 24px; }
.add-product-form { background-color: white; padding: 24px; border-radius: 12px; border: 1px solid var(--border-color); height: fit-content; box-shadow: var(--shadow-sm); }

/* Closing Calculator */
.closing-tabs { display: flex; gap: 12px; margin-bottom: 24px; border-bottom: 2px solid var(--border-color); padding-bottom: 16px; justify-content: center; }
.closing-tab { padding: 12px 24px; border: 1px solid var(--border-color); border-radius: 8px; font-weight: 600; background: white; color: var(--text-secondary); }
.closing-tab:hover { background: var(--bg-card-hover); }
.closing-tab.active { background: var(--accent-primary); color: white; border-color: var(--accent-primary); }

.closing-layout-core { display: flex; justify-content: center; gap: 24px; margin: 0 auto; max-width: fit-content; align-items: flex-start; }
.closing-col-1 { width: 300px; display: flex; flex-direction: column; }
.closing-col-2 { width: 420px; display: flex; flex-direction: column; }
.closing-col-3 { width: 420px; display: flex; flex-direction: column; }
.closing-col-4 { width: 420px; display: flex; flex-direction: column; }

.step-header { display: flex; align-items: center; font-size: 18px; font-weight: 700; margin-bottom: 16px; color: var(--text-primary); }
.step-header .badge { background: var(--accent-primary); color: white; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; margin-right: 12px; font-weight: bold; }


.closing-card { background: white; border: 1px solid var(--border-color); border-radius: 12px; box-shadow: var(--shadow-sm); overflow: hidden; }
.closing-card-header { padding: 8px 16px; border-bottom: 1px solid var(--bg-main); background: #f8fafc; display: flex; align-items: center; min-height: 48px; }
.closing-card-header h3 { margin: 0; font-size: 16px; flex: 1; }
.closing-card-header.bg-primary { background: #f1f5f9; border-bottom: 1px solid var(--border-color); }
.closing-card-header.bg-primary h3 { color: #334155; }
.closing-card-header.bg-secondary { background: #e0f2fe; border-bottom: 1px solid #bae6fd; }
.closing-card-body { padding: 12px; }
.closing-card-body.p-0 { padding: 0; }

/* Thematic Cards */
.closing-card.theme-blue { }
.closing-card.theme-blue .closing-card-header { background: #eff6ff; border-bottom: 1px solid #bfdbfe; }
.closing-card.theme-blue .closing-card-header h3 { color: #1e40af; }

.closing-card.theme-red { }
.closing-card.theme-red .closing-card-header { background: #fef2f2; border-bottom: 1px solid #fecaca; }
.closing-card.theme-red .closing-card-header h3 { color: #991b1b; }

.closing-card.theme-orange { }
.closing-card.theme-orange .closing-card-header { background: #fff7ed; border-bottom: 1px solid #fed7aa; }
.closing-card.theme-orange .closing-card-header h3 { color: #9a3412; }

.data-group { display: flex; flex-direction: column; margin-bottom: 16px; border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; box-shadow: 0 2px 4px rgba(0,0,0,0.04); background: white; }
.data-group:last-child { margin-bottom: 0; }
.data-group-header { padding: 6px 16px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border-color); }
.data-group.bg-cash { border-left: 4px solid #10b981; }
.data-group.bg-cash .data-group-header { background: #ecfdf5; color: #047857; }
.data-group.bg-transfer { border-left: 4px solid #f97316; }
.data-group.bg-transfer .data-group-header { background: #fff7ed; color: #c2410c; }
.data-group.bg-delivery { border-left: 4px solid #0ea5e9; }
.data-group.bg-delivery .data-group-header { background: #f0f9ff; color: #0369a1; }

.data-items { flex: 1; display: flex; flex-direction: column; background: white; }
.data-items .borderless-item { 
    display: flex; 
    justify-content: flex-start; 
    border-bottom: 1px dashed var(--border-color); 
    padding: 6px 16px; 
    gap: 16px; 
}
.data-items .borderless-item-label { 
    font-size: 13.5px; 
    line-height: 1.2; 
    color: var(--text-primary); 
    padding-right: 8px;
    word-break: break-word;
    width: 100px; /* Smaller width to bring inputs closer */
}
.data-items .borderless-item:last-child { border-bottom: none; }

/* Fixed width container for input+button to keep everything aligned */
.input-container-box {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-start;
    flex-shrink: 0;
}

.bento-hero { display: flex; justify-content: center; gap: 16px; margin: 0 auto 24px auto; max-width: 1188px; }
.bento-card { background: white; border: 1px solid var(--border-color); border-radius: 12px; padding: 20px; display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow-sm); flex: 1; }
.bento-icon { width: 48px; height: 48px; border-radius: 12px; background: var(--bg-main); display: flex; align-items: center; justify-content: center; font-size: 24px; color: var(--text-secondary); }
.bento-card.success .bento-icon { background: #dcfce7; color: #16a34a; }
.bento-card.error .bento-icon { background: #fee2e2; color: #dc2626; }
.bento-card.info .bento-icon { background: #e0f2fe; color: #0284c7; }
.bento-card.warning .bento-icon { background: #fef9c3; color: #ca8a04; }
.bento-info { flex: 1; }
.bento-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.bento-value { font-size: 20px; font-weight: 700; color: var(--text-primary); }

.borderless-list { display: flex; flex-direction: column; }
.borderless-item { display: flex; justify-content: flex-start; gap: 16px; align-items: center; padding: 6px 16px; border-bottom: 1px solid var(--bg-main); transition: background 0.2s; }
.borderless-item:hover { background: var(--bg-main); }
.borderless-item:last-child { border-bottom: none; }
.borderless-item-label { font-size: 14px; color: var(--text-primary); display: flex; align-items: center; gap: 12px; width: 150px; flex-shrink: 0; }
.borderless-item-value { font-weight: 600; font-size: 15px; margin-left: 12px; text-align: left; }

.recon-list-item { justify-content: space-between; }
.recon-list-item .borderless-item-label { width: auto; flex: 1; }
.recon-list-item .borderless-item-value { margin-left: 0; text-align: right; min-width: 90px; }
.borderless-header { background: var(--bg-main); padding: 10px 16px; font-size: 13px; font-weight: 700; color: var(--text-secondary); display: flex; justify-content: space-between; border-top: 2px solid var(--border-color); border-bottom: 1px solid var(--border-color); }
.borderless-header:first-child { border-top: none; }

.soft-input { 
    background: #ffffff; 
    border: 2px solid #cbd5e1; 
    border-radius: 6px; 
    padding: 8px; 
    width: 105px; /* Expanded width (20% more) */
    font-size: 15px; 
    font-weight: 600; 
    color: var(--text-primary); 
    transition: all 0.2s; 
    text-align: center;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
}
.soft-input::placeholder { color: #cbd5e1; font-weight: 500; font-size: 14px; }
.soft-input:focus { background: #f0fdfa; border-color: var(--accent-primary); box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.2); outline: none; }

/* Wrapper for input + diff span alignment */
.input-diff-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.diff-label {
    text-align: center;
    font-weight: 700;
    font-size: 16.5px;
    white-space: nowrap;
    width: 110px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
}


.denom-table { 
    width: 100%; 
    border-collapse: collapse; 
    table-layout: fixed; /* Keep column widths strict */
}
.denom-table th, .denom-table td { 
    padding: 10px 8px; 
    border-bottom: 1px solid var(--bg-main); 
    font-size: 14px; 
    overflow: hidden;
}
/* Column specific widths */
.denom-table th:nth-child(1), .denom-table td:nth-child(1) { width: 70px; text-align: center; }
.denom-table th:nth-child(2), .denom-table td:nth-child(2) { width: 100px; text-align: center; }
.denom-table th:nth-child(3), .denom-table td:nth-child(3) { width: 110px; text-align: right; padding-right: 16px; }

.denom-input { 
    width: 80px; 
    padding: 6px; 
    border: 1.5px solid var(--border-color); 
    border-radius: 6px; 
    text-align: center; 
    font-size: 14px; 
    font-weight: 600;
}
.denom-sum {
    font-weight: 600;
    color: var(--text-primary);
}

.recon-table { width: 100%; border-collapse: collapse; }
.recon-table th, .recon-table td { padding: 12px 16px; border-bottom: 1px solid var(--border-color); }
.recon-table th { background: transparent; font-size: 13px; }
.recon-input { width: 120px; padding: 6px; font-size: 14px; text-align: right; border: 1px solid var(--border-color); border-radius: 6px; transition: border-color 0.2s; }
.recon-input:focus { outline: none; border-color: var(--accent-primary); box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1); }
.recon-input.large { 
    font-size: 20px; 
    font-weight: bold; 
    color: var(--accent-primary); 
    padding: 12px 16px; 
    text-align: right; 
    border: 2px solid var(--accent-primary); 
    background: #ffffff; 
    width: 100%; 
    border-radius: 8px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.05), 0 2px 4px rgba(2, 132, 199, 0.1);
}
.recon-input.large::placeholder { font-size: 16px; color: #94a3b8; font-weight: 500; }
.recon-input.large:focus { border-color: var(--text-primary); box-shadow: 0 0 0 4px rgba(2, 132, 199, 0.2); background: white; }
.recon-diff { font-weight: 600; text-align: right; }

.total-row td { background: var(--bg-main); font-weight: 700; font-size: 15px; border-top: 2px solid var(--border-color); }
.highlight-total { color: var(--accent-primary); text-align: right; font-size: 18px !important; }

.diff-card { padding: 16px; border-radius: 8px; border: 2px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; font-size: 16px; }
.mt-16 { margin-top: 16px; }
.mb-0 { margin-bottom: 0 !important; }

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

/* Quick Expenses Chips */
.quick-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-main);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}
.quick-chip:hover {
    background-color: var(--accent-bg);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}
.quick-chip .delete-btn {
    margin-left: 6px;
    color: var(--text-secondary);
    font-size: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    transition: all 0.2s;
}
.quick-chip .delete-btn:hover {
    background-color: var(--danger);
    color: white;
}
.input-error {
    border: 2px solid var(--danger) !important;
    background-color: #fef2f2 !important;
}

@keyframes toastPop {
    0% { transform: scale(0.8) translateY(10px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

.btn-close-circle {
    position: absolute;
    top: -16px;
    left: -16px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text-main);
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: all 0.2s;
    z-index: 100;
}
.btn-close-circle:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
    transform: scale(1.1);
}

/* Mini Add Button */
.btn-mini-add {
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    z-index: 10;
}
.btn-mini-add:hover {
    background: var(--accent-secondary);
    transform: scale(1.1);
}

.denom-sum {
    text-align: right;
    width: 110px;
    font-weight: 600;
    color: var(--text-primary);
    padding-right: 16px;
    white-space: nowrap;
}

/* Bill History Card Style */
.bill-history-list { display: flex; flex-direction: column; gap: 12px; padding: 4px; }
.bill-history-card { 
    display: flex; 
    border: 1.5px solid #e2e8f0; 
    border-radius: 12px; 
    overflow: hidden; 
    background: white;
    min-height: 80px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}
.bill-card-col { display: flex; flex-direction: column; justify-content: center; padding: 12px; }
.bill-card-left { width: 30%; border-right: 1px solid #f1f5f9; }
.bill-card-mid { width: 35%; border-right: 1px solid #f1f5f9; text-align: center; color: #94a3b8; font-size: 13px; background: #f8fafc; }
.bill-card-right { width: 35%; background: #f0fdf4; color: #166534; }

.bill-card-title { font-weight: 800; font-size: 15px; color: #1e293b; margin-bottom: 2px; }
.bill-card-subtitle { font-size: 11px; color: #64748b; }
.bill-card-header-small { font-size: 11px; font-weight: 700; display: flex; align-items: center; gap: 6px; margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.bill-card-row { display: flex; justify-content: space-between; align-items: center; font-size: 14px; font-weight: 600; }
.bill-card-time { color: #64748b; font-size: 12px; font-weight: normal; }
.bill-card-amount { font-weight: 800; font-size: 16px; color: #0f172a; }

/* Step Badges */
.badge {
    background: var(--accent-primary);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 800;
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.08);
}

.closing-card-header .badge {
    background: white;
    color: var(--accent-primary);
}

.theme-red .closing-card-header .badge {
    color: var(--danger);
}

.theme-blue .closing-card-header .badge {
    color: #2b6cb0;
}

.theme-primary .closing-card-header .badge {
    color: #047857;
}

/* Closing History Styles */
.history-table th {
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 12px;
}

.history-table td {
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.closing-history-detail-modal .closing-card {
    border: 1px solid #e2e8f0;
}

/* Notes Styles */
.note-card {
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.note-card:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 20px -6px rgba(0,0,0,0.1) !important;
    z-index: 2;
}
.note-card:active {
    transform: scale(0.98);
}
#notes-list::-webkit-scrollbar {
    width: 4px;
}
#notes-list::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.1);
}
#note-editor {
    animation: slideUp 0.3s ease-out;
}
@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.history-modal-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}
.history-modal-tab {
    padding: 8px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
}
.history-modal-tab:hover {
    background: #f8fafc;
}
.history-modal-tab.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}
/* Notes Page Styles */
.book-pill {
    padding: 6px 14px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}
.book-pill:hover {
    background: #f1f5f9;
    color: var(--text-primary);
}
.book-pill.active {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
    box-shadow: 0 2px 4px rgba(2, 132, 199, 0.2);
}

.color-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}
.color-dot:hover {
    transform: scale(1.2);
}
.color-dot.active {
    border-color: var(--accent-primary);
    transform: scale(1.1);
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--accent-primary);
}

.note-item {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s;
}
.note-item:hover {
    border-color: var(--accent-primary);
    background: #f8fafc;
}
.note-item.active {
    border-color: var(--accent-primary);
    background: #f0f9ff;
    box-shadow: 0 0 0 1px var(--accent-primary);
}

/* Notes Page Styles */
.book-pill {
    padding: 8px 16px;
    background: #f1f5f9;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.book-pill:hover {
    background: #e2e8f0;
    color: var(--text-primary);
    transform: translateY(-1px);
}
.book-pill.active {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
}

.color-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}
.color-dot:hover {
    transform: scale(1.2);
}
.color-dot.active {
    border-color: var(--accent-primary);
    transform: scale(1.1);
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--accent-primary);
}

.note-item {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.note-item:hover {
    border-color: var(--accent-primary);
    background: #f8fafc;
    transform: translateX(4px);
}
.note-item.active {
    border-color: var(--accent-primary);
    background: white;
    box-shadow: 0 10px 20px -10px rgba(0,0,0,0.1);
    transform: translateX(8px);
}

    box-shadow: none;
}

.closing-history-detail-modal h2 {
    font-size: 22px;
    letter-spacing: -0.5px;
}

/* History Detail Tabs */
.history-modal-tabs { display: flex; gap: 8px; margin-bottom: 20px; border-bottom: 1px solid #e2e8f0; padding-bottom: 0; }
.history-modal-tab { 
    padding: 10px 20px; border: none; background: transparent; cursor: pointer; font-weight: 600; font-size: 14px; color: #64748b; border-bottom: 3px solid transparent; transition: all 0.2s;
}
.history-modal-tab.active { color: var(--accent-primary); border-bottom-color: var(--accent-primary); background: #f0f9ff; border-radius: 8px 8px 0 0; }
.history-modal-tab:hover:not(.active) { color: var(--text-primary); background: #f8fafc; border-radius: 8px 8px 0 0; }
@keyframes shake-anim {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}
.shake-anim { animation: shake-anim 0.2s ease-in-out 0s 2; }

/* Closing Page Locked State */
.closing-layout-core.is-locked {
    position: relative;
    pointer-events: none;
    user-select: none;
}

.closing-layout-core.is-locked .closing-card {
    filter: grayscale(0.2) contrast(0.9);
    opacity: 0.85;
}

.closing-layout-core.is-locked::after {
    content: '\f023'; /* FontAwesome lock */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 120px;
    color: rgba(100, 116, 139, 0.1);
    pointer-events: none;
    z-index: 5;
}

/* Input Error States */
.input-error {
    border-color: #ef4444 !important;
    background-color: #fff1f2 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.2) !important;
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

@keyframes pulse-error {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
