/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --sidebar-bg: #1e293b;
    --sidebar-text: #cbd5e1;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --white: #ffffff;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: var(--text-primary);
    background-color: var(--bg-color);
    line-height: 1.6;
}

/* Login Page Styles */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: #ffffff;
}

.login-container {
    width: 100%;
    max-width: 900px;
    padding: 20px;
}

.login-box {
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.login-form input[type="email"],
.login-form input[type="password"],
.login-form input[type="text"],
.login-form input[type="number"],
.login-form select,
.login-form textarea {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.login-form input:focus,
.login-form select:focus,
.login-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    font-size: 14px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 8px;
}

.forgot-link {
    color: var(--primary-color);
    text-decoration: none;
}

.forgot-link:hover {
    text-decoration: underline;
}

.btn-login {
    width: 100%;
    padding: 12px;
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

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

.error-message {
    margin-top: 16px;
    padding: 12px;
    background-color: #fef2f2;
    color: var(--danger-color);
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
}

.success-message {
    margin-top: 16px;
    padding: 12px;
    background-color: #f0fdf4;
    color: var(--success-color);
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
}

/* Dashboard Layout */
.dashboard-container {
    display: block;
    position: relative;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 72px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
    transition: width 0.25s ease;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 20;
    overflow: hidden;
}

.mobile-menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    background: var(--white);
    color: var(--text-primary);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

.mobile-menu-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    border: none;
    background: rgba(15, 23, 42, 0.45);
    z-index: 15;
}

.sidebar:hover {
    width: 260px;
}

.sidebar-header {
    padding: 24px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-header h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--white);
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 20px 0;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 4px;
}

.nav-item.has-submenu .nav-submenu {
    list-style: none;
    display: none;
}

.nav-item.has-submenu.open .nav-submenu {
    display: block;
}

.submenu-caret {
    display: none;
}

.sidebar-header h2,
.btn-logout span:not(.icon),
.btn-sync span:not(.icon) {
    display: none;
}

.nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px 6px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: all 0.2s;
    gap: 2px;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--white);
}

.nav-link.active {
    background-color: rgba(37, 99, 235, 0.2);
    color: var(--white);
    border-left: 3px solid var(--primary-color);
}

.nav-link .icon {
    margin-right: 0;
    font-size: 20px;
}

.nav-link span:not(.icon) {
    display: block;
    font-size: 10px;
    line-height: 1.2;
    text-align: center;
    opacity: 0.95;
}

.sidebar:hover .sidebar-header h2,
.sidebar:hover .nav-link span:not(.icon),
.sidebar:hover .btn-logout span:not(.icon),
.sidebar:hover .btn-sync span:not(.icon) {
    display: inline;
}

.sidebar:hover .nav-parent .submenu-caret {
    display: inline-block;
    margin-left: auto;
    font-size: 12px;
    opacity: 0.9;
    transition: transform 0.2s ease;
}

.sidebar:hover .nav-item.has-submenu.open .submenu-caret {
    transform: rotate(180deg);
}

.sidebar:hover .nav-link {
    flex-direction: row;
    justify-content: flex-start;
    padding: 12px 20px;
    gap: 0;
}

.sidebar:hover .nav-link .icon {
    margin-right: 12px;
}

.sidebar:hover .nav-link span:not(.icon) {
    font-size: 14px;
    line-height: 1.4;
    text-align: left;
}

.sidebar:hover .nav-sublink {
    padding: 8px 20px 8px 46px;
    min-height: 32px;
}

.sidebar:hover .nav-sublink .icon {
    font-size: 14px;
    margin-right: 10px;
}

.sidebar:not(:hover) .nav-submenu {
    display: none !important;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-sync {
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    background-color: rgba(16, 185, 129, 0.15);
    color: var(--sidebar-text);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-sync:hover {
    background-color: rgba(16, 185, 129, 0.28);
    color: var(--white);
}

.btn-sync .icon {
    margin-right: 0;
}

.btn-logout {
    width: 100%;
    padding: 12px;
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--sidebar-text);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-logout:hover {
    background-color: rgba(239, 68, 68, 0.2);
    color: var(--white);
}

.btn-logout .icon {
    margin-right: 0;
}

.sidebar:hover .btn-sync,
.sidebar:hover .btn-logout {
    justify-content: flex-start;
}

.sidebar:hover .btn-sync .icon,
.sidebar:hover .btn-logout .icon {
    margin-right: 8px;
}

/* Main Content */
.main-content {
    margin-left: 72px;
    width: calc(100% - 72px);
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.25s ease;
}

.top-bar {
    background-color: var(--white);
    padding: 20px 32px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    transition: all 0.25s ease;
}

.top-bar h1 {
    font-size: 24px;
    font-weight: 600;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
}

.user-menu {
    position: relative;
}

.user-menu-btn {
    appearance: none;
    list-style: none;
    border: 0;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 15px;
    font-weight: 500;
}

.user-menu-btn::-webkit-details-marker {
    display: none;
}

.user-menu-list {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 180px;
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--shadow);
    padding: 8px;
    display: none;
    z-index: 20;
}

.user-menu[open] .user-menu-list {
    display: block;
}

.user-menu-item {
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 10px;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
}

.user-menu-item:hover {
    background: #f8fafc;
    color: var(--text-primary);
}

.user-caret {
    font-size: 14px;
    line-height: 1;
    color: #64748b;
    margin-top: 1px;
}

.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    transition: all 0.25s ease;
}

/* Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
    transition: all 0.25s ease;
}

.stat-card {
    background: var(--white);
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary-color);
    transition: all 0.25s ease;
}

.stat-card h3 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    font-weight: 500;
}

.stat-card .value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-card.success {
    border-left-color: var(--success-color);
}

.stat-card.warning {
    border-left-color: var(--warning-color);
}

.stat-card.danger {
    border-left-color: var(--danger-color);
}

/* Tables */
.data-table-container {
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.table-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-header h2 {
    font-size: 18px;
    font-weight: 600;
}

/* Cross-browser control normalization for dashboard forms */
.dashboard-page input,
.dashboard-page select,
.dashboard-page textarea,
.dashboard-page button {
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
}

.dashboard-page input,
.dashboard-page textarea {
    -webkit-appearance: none;
    appearance: none;
    background-clip: padding-box;
}

.dashboard-page input[type="checkbox"],
.dashboard-page input[type="radio"] {
    -webkit-appearance: auto;
    appearance: auto;
}

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

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

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

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

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

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

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background-color: var(--bg-color);
}

.data-table th {
    padding: 16px 24px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 16px 24px;
    font-size: 14px;
    border-bottom: 1px solid var(--border-color);
}

.data-table tbody tr:hover {
    background-color: var(--bg-color);
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.badge-success {
    background-color: #d1fae5;
    color: #065f46;
}

.badge-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.badge-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.badge-info {
    background-color: #dbeafe;
    color: #1e40af;
}

/* Payment Method page */
.payment-method-page {
    padding-bottom: 8px;
}

.payment-method-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
}

.payment-search-input {
    flex: 1;
    min-width: 220px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-primary);
    background-color: var(--white);
}

.payment-search-input:focus {
    outline: none;
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.payment-method-table th:last-child,
.payment-method-table td:last-child {
    width: 52px;
    text-align: center;
}

.payment-name-cell {
    font-weight: 600;
    color: var(--text-primary);
}

.payment-name-btn {
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
}

.payment-name-btn:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.payment-subtitle {
    margin-top: 4px;
    font-size: 13px;
    color: var(--text-secondary);
}

.payment-delete-btn {
    border: none;
    background: transparent;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    opacity: 0.65;
}

.payment-delete-btn:hover {
    opacity: 1;
}

.dept-cat-row .payment-delete-btn {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.dept-card .payment-delete-btn {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.dept-card:hover .payment-delete-btn {
    opacity: 0.75;
    pointer-events: auto;
}

.dept-cat-row:hover .payment-delete-btn {
    opacity: 0.75;
    pointer-events: auto;
}

.dept-cat-row:hover .payment-delete-btn:hover {
    opacity: 1;
}

/* Discounts page */
.discount-page {
    padding-bottom: 8px;
}

.discount-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
}

.discount-search-input {
    flex: 1;
    min-width: 220px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-primary);
    background-color: var(--white);
}

.discount-search-input:focus {
    outline: none;
    border-color: #93c5fd;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.discount-table th:last-child,
.discount-table td:last-child {
    width: 52px;
    text-align: center;
}

.discount-name-btn {
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
}

.discount-name-btn:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

.discount-pagination-dummy {
    display: flex;
    justify-content: center;
    align-items: center;
    color: #94a3b8;
    padding: 12px 0 8px;
    font-size: 30px;
    line-height: 1;
}

.discount-form-page {
    padding-bottom: 8px;
}

.discount-form-wrap {
    padding: 18px 24px 24px 24px;
    max-width: 760px;
}

.discount-form-group {
    margin-bottom: 14px;
}

.discount-form-group label {
    display: block;
    font-size: 14px;
    color: #475569;
    margin-bottom: 7px;
}

.discount-form-input {
    width: 100%;
    height: 36px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 0 10px;
    font-size: 14px;
    color: #334155;
    background: #fff;
}

.discount-form-input:focus {
    outline: none;
    border-color: #93c5fd;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}

.discount-col-wide {
    max-width: 100%;
}

.discount-col-half {
    max-width: 280px;
}

.discount-inline-row {
    display: flex;
    gap: 28px;
    margin: 8px 0 14px;
}

.discount-inline-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #475569;
    margin: 0;
    min-height: 24px;
}

.discount-grid-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.discount-radio-row {
    display: flex;
    gap: 14px;
    min-height: 36px;
    align-items: center;
}

.discount-form-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.discount-multi-select {
    position: relative;
}

.discount-multi-trigger {
    min-height: 36px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 5px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    background: #fff;
    cursor: pointer;
}

.discount-multi-chips {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    min-height: 22px;
}

.discount-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #eef2ff;
    color: #334155;
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 13px;
}

.discount-chip button {
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    color: #64748b;
    padding: 0;
}

.discount-multi-placeholder {
    color: #9ca3af;
    font-size: 14px;
}

.discount-multi-arrow {
    color: #64748b;
    font-size: 14px;
}

.discount-multi-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
    max-height: 220px;
    overflow-y: auto;
    display: none;
    z-index: 30;
}

.discount-multi-menu.open {
    display: block;
}

.discount-multi-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    cursor: pointer;
    font-size: 14px;
    color: #334155;
}

.discount-multi-option:hover {
    background: #f8fafc;
}

/* Custom date picker wrapper */
.discount-date-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
    height: 36px;
    cursor: pointer;
}

.discount-date-display {
    flex: 1;
    font-size: 14px;
    color: #374151;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 4px;
}

.discount-date-display:empty::before {
    content: 'Select date';
    color: #9ca3af;
}

/* Hidden date input — zero-size, invisible, but accessible for showPicker() */
.discount-date-hidden-input {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
    border: none;
    padding: 0;
    margin: 0;
}

/* Days Factor row */
.discount-days-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
    align-items: center;
}

/* Time input wrapper (Between / To) */
.discount-time-input-wrap {
    display: flex;
    align-items: center;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
    overflow: hidden;
    height: 36px;
}

.discount-time-icon {
    padding: 0 8px;
    font-size: 14px;
    color: #6b7280;
    flex-shrink: 0;
}

.discount-time-input-wrap .discount-form-input {
    border: none;
    outline: none;
    flex: 1;
    min-width: 0;
    padding: 0 4px;
    font-size: 14px;
    background: transparent;
    box-shadow: none;
}

.discount-time-clear {
    background: transparent;
    border: none;
    border-left: 1px solid #e5e7eb;
    padding: 0 10px;
    font-size: 16px;
    color: #9ca3af;
    cursor: pointer;
    height: 100%;
    line-height: 1;
}

.discount-time-clear:hover {
    color: #374151;
    background: #f9fafb;

/* Max Disc. Amount wrapper */
.discount-amount-wrap {
    display: flex;
    align-items: center;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
    overflow: hidden;
    height: 36px;
}

.discount-amount-wrap .discount-form-input {
    flex: 1;
    border: none;
    outline: none;
    box-shadow: none;
    padding: 0 10px;
    font-size: 14px;
    background: transparent;
    min-width: 0;
    height: 100%;
}

.discount-amount-suffix {
    padding: 0 10px;
    font-size: 13px;
    color: #6b7280;
    background: #f9fafb;
    border-left: 1px solid #e5e7eb;
    height: 100%;
    display: flex;
    align-items: center;
    white-space: nowrap;
    flex-shrink: 0;
}
}

.payment-form-wrap {
    padding: 18px 24px 24px 24px;
    max-width: 760px;
}

.payment-form-group {
    margin-bottom: 14px;
}

.payment-form-group label {
    display: block;
    font-size: 14px;
    color: #475569;
    margin-bottom: 7px;
}

.payment-form-input {
    width: 100%;
    height: 36px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 0 10px;
    font-size: 14px;
    color: #334155;
    background: #fff;
}

.payment-form-input:focus {
    outline: none;
    border-color: #93c5fd;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.12);
}

.payment-inline-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #475569;
    margin: 0;
    min-height: 24px;
}

.payment-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.payment-form-sm {
    max-width: 240px;
}

.payment-help-text {
    color: #059669;
    font-size: 14px;
    margin-top: 5px;
}

.payment-check-row {
    display: flex;
    gap: 18px;
    margin: 0;
}

.payment-checklist-wrap {
    margin-top: 8px;
    margin-bottom: 14px;
    display: grid;
    row-gap: 10px;
}

.payment-check-item {
    width: 240px;
    font-size: 14px;
    line-height: 1.3;
}

.payment-check-full {
    width: auto;
}

.payment-form-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

@media (max-width: 760px) {
    .payment-method-toolbar {
        flex-wrap: wrap;
    }

    .discount-toolbar {
        flex-wrap: wrap;
    }

    .discount-grid-two {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .discount-inline-row {
        flex-direction: column;
        gap: 10px;
    }

    .discount-radio-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        margin: 8px 0;
    }

    .payment-form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .payment-check-row {
        flex-direction: column;
        gap: 10px;
    }

    .payment-check-item {
        width: 100%;
    }
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: 12px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
}

.modal-body {
    padding: 24px;
}

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

/* Form Styles */
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

/* Hide spinner arrows on number inputs in item screens (full page + modal). */
input[id^="itemForm"][type="number"],
#itemForm input[type="number"],
#editItemForm input[type="number"],
#stPriceLevel,
.item-recipe-qty-input {
    -webkit-appearance: none;
    appearance: textfield;
    -moz-appearance: textfield;
}

input[id^="itemForm"][type="number"]::-webkit-outer-spin-button,
input[id^="itemForm"][type="number"]::-webkit-inner-spin-button,
#itemForm input[type="number"]::-webkit-outer-spin-button,
#itemForm input[type="number"]::-webkit-inner-spin-button,
#editItemForm input[type="number"]::-webkit-outer-spin-button,
#editItemForm input[type="number"]::-webkit-inner-spin-button,
#stPriceLevel::-webkit-outer-spin-button,
#stPriceLevel::-webkit-inner-spin-button,
.item-recipe-qty-input::-webkit-outer-spin-button,
.item-recipe-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.profile-shell {
    display: grid;
    gap: 24px;
}

.profile-hero {
    position: relative;
    overflow: hidden;
    padding: 28px;
    border-radius: 18px;
    background: linear-gradient(135deg, #0f172a 0%, #1d4ed8 58%, #60a5fa 100%);
    color: var(--white);
    box-shadow: var(--shadow-lg);
}

.profile-hero::after {
    content: '';
    position: absolute;
    inset: auto -80px -80px auto;
    width: 220px;
    height: 220px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
}

.profile-hero-content {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 20px;
    align-items: center;
}

.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 20px;
    display: grid;
    place-items: center;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 0.04em;
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.24);
    backdrop-filter: blur(6px);
}

.profile-hero-copy h2 {
    margin: 0 0 6px;
    font-size: 28px;
    line-height: 1.15;
}

.profile-hero-copy p {
    margin: 0;
    max-width: 560px;
    color: rgba(255, 255, 255, 0.82);
    font-size: 14px;
}

.profile-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.profile-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: var(--white);
    font-size: 13px;
}

.profile-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.9fr);
    gap: 24px;
    align-items: start;
}

.profile-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.profile-card-body {
    padding: 24px;
}

.profile-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 22px;
}

.profile-card-head h3 {
    margin: 0 0 6px;
    font-size: 18px;
    color: var(--text-primary);
}

.profile-card-head p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 14px;
}

.profile-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.profile-form {
    display: grid;
    gap: 18px;
}

.profile-field {
    display: grid;
    gap: 8px;
}

.profile-field label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.profile-input {
    width: 100%;
    min-height: 48px;
    padding: 13px 15px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: #f8fafc;
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.profile-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--white);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.profile-input[readonly] {
    color: #475569;
    background: #eef2ff;
    cursor: default;
}

.profile-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 4px;
}

.profile-submit {
    min-width: 130px;
}

.profile-summary {
    display: grid;
    gap: 16px;
}

.profile-summary-card {
    padding: 18px;
    border-radius: 16px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid var(--border-color);
}

.profile-summary-card h4 {
    margin: 0 0 6px;
    font-size: 15px;
    color: var(--text-primary);
}

.profile-summary-card p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.profile-summary-value {
    display: block;
    margin-top: 12px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    word-break: break-word;
}

.profile-divider {
    height: 1px;
    background: var(--border-color);
    margin: 6px 0;
}

.profile-password-note {
    margin: 0;
    color: var(--text-secondary);
    font-size: 13px;
}

.profile-shell .success-message,
.profile-shell .error-message {
    margin-top: 0;
    text-align: left;
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--white);
    animation: spin 0.8s linear infinite;
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-container {
        overflow: visible;
    }

    .sidebar {
        width: min(84vw, 300px);
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        overflow-y: auto;
        z-index: 30;
    }

    .sidebar:hover {
        width: min(84vw, 300px);
    }

    .dashboard-container.mobile-sidebar-open .sidebar {
        transform: translateX(0);
    }

    .mobile-menu-toggle {
        display: inline-flex;
    }

    .dashboard-container.mobile-sidebar-open .mobile-menu-backdrop {
        display: block;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    .top-bar {
        padding: 14px 16px;
        gap: 10px;
    }

    .top-bar h1 {
        font-size: 20px;
    }
    
    .sidebar-header h2,
    .nav-link span:not(.icon),
    .btn-logout span:not(.icon),
    .btn-sync span:not(.icon) {
        display: inline;
    }

    .nav-parent .submenu-caret {
        display: inline-block;
        margin-left: auto;
        font-size: 12px;
        opacity: 0.9;
        transition: transform 0.2s ease;
    }

    .nav-item.has-submenu.open .submenu-caret {
        transform: rotate(180deg);
    }

    .nav-link {
        flex-direction: row;
        justify-content: flex-start;
        padding: 12px 16px;
    }

    .nav-link .icon {
        margin-right: 10px;
    }

    .nav-link span:not(.icon) {
        font-size: 14px;
        line-height: 1.4;
        text-align: left;
    }

    .nav-sublink {
        padding: 8px 16px 8px 40px;
        min-height: 32px;
    }

    .nav-sublink .icon {
        font-size: 14px;
        margin-right: 8px;
    }

    .sidebar:not(:hover) .nav-submenu {
        display: none;
    }

    .nav-item.has-submenu.open .nav-submenu {
        display: block;
    }
    
    .nav-link,
    .btn-sync,
    .btn-logout {
        justify-content: flex-start;
    }

    .btn-sync .icon,
    .btn-logout .icon {
        margin-right: 8px;
    }
    
    .content-area {
        padding: 16px;
    }

    .profile-hero {
        padding: 22px;
    }

    .profile-hero-content {
        grid-template-columns: 1fr;
    }

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

    .profile-card-body {
        padding: 20px;
    }

    .profile-card-head {
        flex-direction: column;
    }

    .profile-actions {
        justify-content: stretch;
    }

    .profile-submit {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Modern refresh: login + dashboard visual upgrade */
:root {
    --modern-navy: #0f172a;
    --modern-ink: #0b1220;
    --modern-surface: #ffffff;
    --modern-surface-soft: #f8fafc;
    --modern-border: #dbe5f1;
    --modern-shadow: 0 18px 50px rgba(15, 23, 42, 0.14);
}

body {
    font-family: "Nunito", "Avenir Next", "Segoe UI", sans-serif;
    color: var(--modern-ink);
}

.login-page {
    background:
        radial-gradient(1200px 600px at -5% -10%, rgba(59, 130, 246, 0.28), transparent 52%),
        radial-gradient(900px 500px at 110% -5%, rgba(16, 185, 129, 0.22), transparent 55%),
        radial-gradient(800px 420px at 50% 120%, rgba(14, 165, 233, 0.18), transparent 60%),
        linear-gradient(140deg, #e8f1ff 0%, #f5f9ff 45%, #eef3ff 100%);
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.login-page::before,
.login-page::after {
    content: "";
    position: absolute;
    border-radius: 999px;
    filter: blur(8px);
    z-index: 0;
}

.login-page::before {
    width: 280px;
    height: 280px;
    background: rgba(37, 99, 235, 0.18);
    top: 10%;
    left: -80px;
}

.login-page::after {
    width: 260px;
    height: 260px;
    background: rgba(16, 185, 129, 0.16);
    bottom: 8%;
    right: -80px;
}

.login-box {
    position: relative;
    z-index: 1;
    border-radius: 22px;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(10px);
    padding: 34px;
    animation: loginLift 0.45s ease-out;
    display: grid;
    grid-template-columns: minmax(260px, 0.9fr) minmax(360px, 1.1fr);
    gap: 34px;
    align-items: start;
}

.login-header {
    text-align: left;
    margin-bottom: 0;
    max-width: 360px;
}

.login-header h1 {
    font-size: clamp(34px, 3vw, 46px);
    letter-spacing: -0.02em;
    color: #1e40af;
    margin-bottom: 10px;
    text-shadow: 0 2px 8px rgba(37, 99, 235, 0.14);
    line-height: 1.08;
    white-space: normal;
    overflow-wrap: anywhere;
}

.login-header p {
    font-size: 15px;
    color: #64748b;
}

.login-form {
    max-width: 460px;
    width: 100%;
    justify-self: stretch;
}

.login-form label {
    font-weight: 600;
}

.login-form input[type="email"],
.login-form input[type="password"],
.login-form input[type="text"],
.login-form input[type="number"],
.login-form select,
.login-form textarea {
    border: 1px solid #cbd8ea;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.9);
}

.login-form input:focus,
.login-form select:focus,
.login-form textarea:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.16);
}

.btn-login {
    border-radius: 12px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 14px 28px rgba(37, 99, 235, 0.3);
    letter-spacing: 0.03em;
}

.btn-login:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    transform: translateY(-2px);
}

.dashboard-page {
    background:
        radial-gradient(900px 460px at 0% -10%, rgba(37, 99, 235, 0.08), transparent 60%),
        linear-gradient(180deg, #f5f9ff 0%, #f8fafc 40%, #f6f8fb 100%);
}

.sidebar {
    background: linear-gradient(180deg, #0f172a 0%, #111827 100%);
    box-shadow: 10px 0 30px rgba(15, 23, 42, 0.26);
}

.sidebar-header {
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.sidebar-header h2 {
    font-size: 17px;
    line-height: 1.3;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.nav-link.active {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.32), rgba(30, 64, 175, 0.18));
    border-left: 3px solid #60a5fa;
}

.main-content {
    background: transparent;
}

.top-bar {
    margin: 14px 14px 0 14px;
    border-radius: 16px;
    border: 1px solid var(--modern-border);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
}

.top-bar h1 {
    font-size: 26px;
    letter-spacing: -0.02em;
    color: #0f172a;
}

.content-area {
    padding-top: 22px;
}

.stat-card {
    border-radius: 18px;
    border: 1px solid var(--modern-border);
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

.stat-card .value {
    letter-spacing: -0.02em;
}

.data-table-container {
    border-radius: 18px;
    border: 1px solid var(--modern-border);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
}

@keyframes loginLift {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 768px) {
    .login-page {
        padding: 14px;
    }

    .login-box {
        padding: 26px 20px;
        border-radius: 16px;
        display: block;
    }

    .login-header h1 {
        font-size: 36px;
        white-space: normal;
    }

    .login-form {
        max-width: 100%;
        justify-self: auto;
    }

    .top-bar {
        margin: 8px 8px 0 8px;
    }
}

@media (max-width: 1024px) {
    .login-box {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .login-header {
        max-width: 100%;
        text-align: center;
    }

    .login-form {
        max-width: 100%;
    }
}
