/* === ПАЛІТРА ОСМАНТУС ЧАЙ === */
:root {
    --tea-dark-green: #2d5016;
    --tea-green: #6ba82f;
    --tea-beige: #d4a574;
    --tea-cream: #f5f1ed;
    --tea-gold: #c9a961;
    --tea-dark: #3d3d3d;
    --tea-light-panel: #faf8f6;
    --tea-shadow: #e8ddd2;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #FAF9F6;
    /* Warm cream background from Stitch */
    color: #333333;
    padding: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    background: transparent;
    padding: 0;
    box-shadow: none;
}

h1,
h2,
h3 {
    color: var(--tea-dark);
    margin-bottom: 20px;
    font-weight: 700;
}

h1 {
    font-size: 1.6em;
    text-align: left;
    margin-bottom: 0;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: rgba(250, 249, 246, 0.9);
    backdrop-filter: blur(12px);
    z-index: 100;
    padding: 12px 4px;
    margin-bottom: 20px;
}

/* Панелі (Cards) */
.panel,
.admin-section {
    background: #ffffff;
    padding: 24px;
    margin-bottom: 20px;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    /* Soft, native iOS shadow */
}

/* Кнопки */
button {
    background-color: var(--tea-green);
    /* Основний зелений з дизайну Stitch */
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 24px;
    /* Pill-shape */
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    min-height: 48px;
    /* Tap friendly 44px+ for mobile */
    transition: all 0.25s ease;
    box-shadow: 0 4px 12px rgba(107, 168, 47, 0.2);
}

button:hover {
    background-color: var(--tea-dark-green);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(107, 168, 47, 0.3);
}

button:disabled {
    background-color: #e0e0e0;
    color: #aaa;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

/* Ефект натискання */
button:active:not(:disabled) {
    transform: scale(0.96);
    box-shadow: 0 2px 6px rgba(107, 168, 47, 0.2);
}

/* Фокус з клавіатури */
button:focus {
    outline: 2px solid var(--tea-highlight);
    outline-offset: 2px;
}

/* Стан завантаження - додатковий клас */
button.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

button.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Input поля */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
input[type="date"],
select {
    width: 100%;
    padding: 14px 16px;
    /* Larger tap targets */
    margin-bottom: 16px;
    border: 1px solid #e2e2e2;
    border-radius: 12px;
    font-size: 15px;
    background: #fafafa;
    transition: all 0.2s ease;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.02);
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--tea-green);
    box-shadow: 0 0 0 3px rgba(107, 168, 47, 0.1);
}

/* Таблиці */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

thead {
    background-color: var(--tea-shadow);
}

th,
td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--tea-shadow);
}

th {
    font-weight: 600;
    color: var(--tea-dark-green);
}

tbody tr:nth-child(even) {
    background-color: #f9f8f7;
}

tbody tr:hover {
    background-color: var(--tea-shadow);
}

/* Модальні вікна */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(61, 61, 61, 0.6);
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* Прокрутка для списку точок у модалі призначення */
#pointsCheckboxes {
    max-height: 400px;
    overflow-y: auto;
    margin: 20px 0;
    padding: 15px;
    border-radius: 4px;
    background-color: #fafafa;
    box-shadow: inset 0 1px 4px rgba(0,0,0,0.04);
}

.close,
.close-password,
.close-edit,
.close-delete {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close-password:hover,
.close-edit:hover,
.close-delete:hover {
    color: var(--tea-dark);
}

/* Forms */
form {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

form label {
    flex: 1 1 100%;
    font-weight: 500;
    color: var(--tea-dark);
}

form input[type="text"],
form input[type="password"],
form input[type="date"],
form input[type="number"],
form select {
    flex: 1 1 calc(50% - 10px);
    min-width: 200px;
}

form button[type="submit"],
form button[type="button"] {
    flex: 0 0 auto;
}

/* Scrollable tables */
.scrollable-table {
    max-height: 400px;
    overflow-y: auto;
}

/* Fixed table header in scrollable tables */
.scrollable-table table {
    border-collapse: collapse;
}

.scrollable-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.scrollable-table thead th {
    position: sticky;
    top: 0;
    background-color: var(--tea-shadow);
    z-index: 10;
}

/* Login page */
.login-container {
    max-width: 400px;
    margin: 100px auto;
    padding: 40px;
    background: white;
    border-radius: 8px;
    border-top: 4px solid var(--tea-green);
    box-shadow: 0 2px 10px rgba(61, 61, 61, 0.15);
}

.login-container h2 {
    text-align: center;
    color: var(--tea-dark-green);
}

.login-container input {
    margin-bottom: 15px;
}

.login-container button {
    width: 100%;
}

/* Message */
#message {
    padding: 10px;
    margin: 15px 0;
    border-radius: 4px;
    text-align: center;
    font-weight: 500;
    transition: all 0.3s ease;
    min-height: 20px;
}

#message:empty {
    padding: 0;
    margin: 0;
}

#message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

#message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

#message.loading {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

/* Dropdown Menu для управління користувачами */
.user-actions {
    position: relative;
    display: inline-block;
}

.user-actions-btn {
    background: #6c757d;
    color: white;
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 18px;
}

.user-actions-btn:hover {
    background: #5a6268;
}

.user-actions-menu {
    display: none;
    position: absolute;
    right: 0;
    background-color: white;
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
    z-index: 1;
    border-radius: 4px;
}

.user-actions-menu.show {
    display: block;
}

.user-actions-menu button {
    color: var(--tea-dark);
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    width: 100%;
    text-align: left;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
}

.user-actions-menu button:hover {
    background-color: var(--tea-shadow);
}

.user-actions-menu button.delete-action {
    color: #dc3545;
}

.user-actions-menu button.edit-action {
    color: #17a2b8;
}

.user-actions-menu button.password-action {
    color: var(--tea-gold);
}

/* === Collapsible panel === */
.panel-collapsible .panel-body {
    display: none;
    overflow: hidden;
}

.panel-collapsible.expanded .panel-body {
    display: block;
}

.panel-toggle {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-toggle:hover {
    opacity: 0.8;
}

.toggle-chevron {
    display: inline-block;
    font-size: 0.7em;
    transition: transform 0.25s ease;
}

.panel-collapsible.expanded .toggle-chevron {
    transform: rotate(90deg);
}

/* === Compact date range row === */
.date-range-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.date-range-row input[type="date"] {
    flex: 1;
    padding: 8px 10px;
    border: 1.5px solid #ddd;
    border-radius: 20px;
    font-size: 14px;
    background: #fafafa;
    outline: none;
    transition: border-color 0.2s;
}

.date-range-row input[type="date"]:focus {
    border-color: var(--tea-green, #6ba82f);
}

.date-sep {
    color: #999;
    font-weight: 300;
}

/* === Form actions row === */
.form-actions-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    /* Allows stacking on small screens to prevent overflow */
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    cursor: pointer;
    white-space: nowrap;
    padding: 8px 0;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin: 0;
    accent-color: var(--tea-green);
}

.form-actions-row button[type="submit"] {
    padding: 12px 24px;
    border-radius: 24px;
    font-weight: 600;
    white-space: nowrap;
    flex: 1 1 auto;
    /* Allows button to fill space gracefully when text is long */
    min-width: 140px;
}

/* === Back button pill === */
.back-btn-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border: 1.5px solid #ddd;
    border-radius: 20px;
    background: #fff;
    color: #555;
    font-size: 13px;
    cursor: pointer;
    margin-bottom: 12px;
    transition: all 0.2s;
}

.back-btn-pill:hover {
    border-color: var(--tea-green, #6ba82f);
    color: var(--tea-green, #6ba82f);
}


.chart-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}

/* === Stats card === */
.stats-card {
    background: #f9f9f7;
    border-radius: 12px;
    padding: 14px 18px;
    margin-top: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.stats-card h3 {
    margin: 0 0 8px 0;
    font-size: 15px;
}

.stats-card p {
    margin: 4px 0;
    font-size: 14px;
    color: #444;
}

/* === RESPONSIVE DESIGN для iPhone === */
@media (max-width: 768px) {
    body {
        padding: 12px;
    }

    .container {
        width: 100%;
        padding: 20px;
    }

    h1 {
        font-size: 1.5em;
    }

    h2 {
        font-size: 1.3em;
    }

    h3 {
        font-size: 1.1em;
    }

    .panel,
    .admin-section {
        padding: 16px;
        margin-bottom: 16px;
    }

    button {
        padding: 10px 16px;
        font-size: 14px;
    }

    table {
        font-size: 13px;
    }

    th,
    td {
        padding: 8px 6px;
    }

    form input[type="text"],
    form input[type="password"],
    form input[type="date"],
    form select {
        flex: 1 1 100%;
        min-width: auto;
    }

    .modal-content {
        width: 95%;
        margin: 15% auto;
        padding: 20px;
    }

    .scrollable-table {
        max-height: 300px;
    }

    /* Dropdown menu адаптація */
    .user-actions-menu {
        min-width: 140px;
        font-size: 14px;
    }

    .user-actions-menu button {
        padding: 10px 12px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 8px;
    }

    .container {
        padding: 12px;
    }

    h1 {
        font-size: 1.3em;
    }

    h2 {
        font-size: 1.1em;
    }

    .panel,
    .admin-section {
        padding: 12px;
    }

    /* Только submit-кнопки в формах на полную ширину */
    .form-actions-row button[type="submit"] {
        width: 100%;
        margin-bottom: 8px;
    }

    input[type="text"],
    input[type="password"],
    input[type="date"],
    input[type="number"],
    select {
        padding: 10px;
        font-size: 16px;
        /* Запобігає zoom на iOS */
    }

    table {
        display: block;
        overflow-x: auto;
        font-size: 12px;
    }

    th,
    td {
        padding: 6px 4px;
        white-space: nowrap;
    }

    .modal-content {
        margin: 5% auto;
        padding: 15px;
    }

    /* Chart: не ограничиваем ApexCharts высоту */

    .login-container {
        margin: 50px auto;
        padding: 24px;
    }
}

/* === ADMIN LAYOUT WITH SIDEBAR === */

.admin-layout {
    padding: 0;
    margin: 0;
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background: var(--tea-dark-green);
    color: white;
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    transition: transform 0.3s ease;
    z-index: 1000;
}

.sidebar.collapsed {
    transform: translateX(-250px);
}

.sidebar-header {
    padding: 20px;
    background: var(--tea-dark-green);
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.burger-btn {
    background: var(--tea-dark-green);
    border: 2px solid var(--tea-dark-green);
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 4px;
    transition: all 0.3s;
}

.burger-btn:hover {
    background: var(--tea-green);
    border-color: var(--tea-green);
}

.sidebar-title {
    margin: 0;
    font-size: 1.3em;
    color: white;
}

.sidebar-nav {
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 4px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-item.active {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-left-color: var(--tea-gold);
}

.nav-icon {
    font-size: 1.5em;
    margin-right: 12px;
}

.nav-text {
    font-size: 1em;
    font-weight: 500;
}

/* Main Content */
.main-content {
    margin-left: 250px;
    flex: 1;
    padding: 20px;
    transition: margin-left 0.3s ease;
    background-color: var(--tea-cream);
}

.main-content.expanded {
    margin-left: 0;
}

.top-bar {
    background: var(--tea-light-panel);
    padding: 20px 30px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(61, 61, 61, 0.1);
}

.top-bar h1 {
    margin: 0;
    border: none;
    padding: 0;
    font-size: 1.8em;
}

.top-bar button {
    margin: 0;
}

/* Content Sections */
.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

.section-title {
    font-size: 1.5em;
    color: var(--tea-dark-green);
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--tea-green);
}

/* === RESPONSIVE DESIGN FOR SIDEBAR === */

@media (max-width: 768px) {

    /* На мобільних sidebar прихований за замовчуванням */
    .sidebar {
        transform: translateX(-250px);
    }

    .sidebar:not(.collapsed) {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
    }

    .top-bar {
        flex-direction: column;
        gap: 15px;
    }

    .top-bar h1 {
        font-size: 1.5em;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .sidebar {
        width: 200px;
    }

    .sidebar-header {
        padding: 15px;
    }

    .sidebar-title {
        font-size: 1.1em;
    }

    .nav-item {
        padding: 12px 15px;
    }

    .nav-icon {
        font-size: 1.3em;
    }

    .top-bar {
        padding: 15px 20px;
    }
}

/* ========================================
   CASHIER REPORTS STYLES
   ======================================== */

.cashier-report-section {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--tea-shadow);
}

.cashier-period-info {
    background: var(--tea-cream);
    padding: 10px 15px;
    border-radius: 4px;
    margin-bottom: 15px;
    border-left: 4px solid var(--tea-green);
}

.cashier-period-info p {
    margin: 0;
    font-weight: 500;
}

.report-period-override {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 15px;
}

.report-period-override label {
    flex: 0 0 auto;
    font-weight: 500;
}

.report-period-override input[type="date"] {
    flex: 0 0 auto;
    width: 150px;
    margin-bottom: 0;
    padding: 8px 10px;
}

.report-period-override span {
    color: var(--tea-shadow);
}

.report-period-override button {
    flex: 0 0 auto;
    padding: 8px 16px;
}

.secondary-btn {
    background-color: #6c757d !important;
}

.secondary-btn:hover {
    background-color: #5a6268 !important;
}

.hint-text {
    color: var(--tea-shadow);
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* Horizontal scrolling container */
.table-horizontal-scroll {
    overflow-x: auto;
    overflow-y: visible;
    max-width: 100%;
    margin: 15px 0;
    border: 1px solid var(--tea-shadow);
    border-radius: 4px;
    background: white;
}

/* Ensure table doesn't shrink below content */
.table-horizontal-scroll table {
    min-width: max-content;
}

/* Cashier report table styles */
.cashier-report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.cashier-report-table th,
.cashier-report-table td {
    padding: 8px 12px;
    text-align: right;
    border: 1px solid var(--tea-shadow);
    white-space: nowrap;
}

.cashier-report-table th {
    background: var(--tea-dark-green);
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.cashier-report-table th:first-child,
.cashier-report-table td:first-child {
    text-align: left;
    position: sticky;
    left: 0;
    background: white;
    z-index: 5;
    min-width: 180px;
}

.cashier-report-table th:first-child {
    z-index: 15;
    background: var(--tea-dark-green);
}

/* Point header row */
.point-header-row {
    background: var(--tea-cream) !important;
}

.point-header-row td {
    font-weight: 600;
}

.point-header-row td:first-child {
    background: var(--tea-cream) !important;
}

/* Cashier row indentation */
.cashier-row .cashier-name {
    padding-left: 25px !important;
}

/* Fallback data indicator */
.fallback-data {
    background: #fff3cd !important;
    position: relative;
}

.fallback-data::after {
    content: '*';
    color: #856404;
    font-weight: bold;
    margin-left: 2px;
}

/* Totals column styling */
.total-cell {
    font-weight: 600;
    background: #e9ecef !important;
}

/* Average check cell */
.avg-check-cell {
    color: var(--tea-dark-green);
    font-weight: 500;
}

/* Loading state */
.loading-indicator {
    text-align: center;
    padding: 30px;
    color: var(--tea-shadow);
}

/* Error state */
.error-message {
    text-align: center;
    padding: 20px;
    color: #dc3545;
    background: #f8d7da;
    border-radius: 4px;
}

/* Mobile responsive for cashier reports */
@media (max-width: 768px) {
    .report-period-override {
        flex-direction: column;
        align-items: stretch;
    }

    .report-period-override input[type="date"] {
        width: 100%;
    }

    .report-period-override button {
        width: 100%;
    }

    .cashier-report-table {
        font-size: 11px;
    }

    .cashier-report-table th,
    .cashier-report-table td {
        padding: 6px 8px;
    }

    .cashier-report-table th:first-child,
    .cashier-report-table td:first-child {
        min-width: 120px;
    }
}

/* Legend for fallback data */
.report-legend {
    margin-top: 10px;
    font-size: 12px;
    color: var(--tea-shadow);
}

.report-legend .fallback-marker {
    display: inline-block;
    background: #fff3cd;
    padding: 2px 6px;
    border-radius: 3px;
    margin-right: 5px;
}

.report-legend .fallback-marker::after {
    content: '*';
    color: #856404;
}

/* ========================================
   CASHIER CHARTS STYLES
   ======================================== */

/* Chart container */
#report1Container,
#report2Container {
    min-height: 300px;
}

/* ApexCharts manages canvas height via responsive config */

/* Chart stats section */
.chart-stats {
    margin-top: 20px;
    padding: 15px;
    background: var(--tea-cream);
    border-radius: 6px;
    border-left: 4px solid var(--tea-green);
}

.chart-stats p {
    margin: 0 0 10px 0;
}

.chart-stats p:last-child {
    margin-bottom: 0;
}

/* Chart hint text */
.chart-hint {
    font-size: 12px;
    color: var(--tea-shadow);
    font-style: italic;
    margin-top: 10px !important;
}

/* Cashier stats grid */
.cashier-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.cashier-stat-item {
    background: white;
    padding: 12px 15px;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    font-size: 13px;
    line-height: 1.5;
}

.cashier-stat-item strong {
    color: var(--tea-dark-green);
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
}

/* Back button for drill-down */
.back-btn {
    background-color: #6c757d !important;
    margin-bottom: 15px;
    padding: 8px 16px !important;
    font-size: 13px !important;
}

.back-btn:hover {
    background-color: #5a6268 !important;
}

/* Mobile responsive for charts */
@media (max-width: 768px) {
    .cashier-stats-grid {
        grid-template-columns: 1fr;
    }

    .cashier-stat-item {
        padding: 10px 12px;
    }

    /* ApexCharts manages its own responsive height */
}

/* ========================================
   CHART CONTROLS (Toggle All Button)
   ======================================== */

.chart-controls {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-bottom: 15px;
    padding: 10px;
    background: var(--tea-cream);
    border-radius: 4px;
    border-bottom: 2px solid var(--tea-gold);
}

.chart-controls-hidden {
    display: none !important;
}

.chart-control-btn {
    background-color: var(--tea-gold) !important;
    color: white !important;
    border: none !important;
    padding: 8px 16px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    border-radius: 4px !important;
    cursor: pointer !important;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.chart-control-btn:hover {
    background-color: #b89450 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chart-control-btn:active {
    transform: translateY(0);
}

.chart-control-btn.all-hidden {
    background-color: var(--tea-green) !important;
}

.chart-control-btn.all-hidden:hover {
    background-color: #5a8c25 !important;
}

/* Mobile responsive */
@media (max-width: 768px) {
    .chart-controls {
        justify-content: center;
    }

    .chart-control-btn {
        width: 100%;
        max-width: 300px;
    }
}

/* ========================================
   WARNING BANNER STYLES
   ======================================== */

.warning-banner {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    color: #856404;
    border-radius: 6px;
    margin-top: 15px;
    margin-bottom: 10px;
    font-size: 14px;
    line-height: 1.6;
}

.warning-banner summary {
    padding: 10px 15px;
    cursor: pointer;
    font-weight: 600;
    list-style: revert;
}

.warning-banner .warning-banner-details {
    padding: 5px 15px 12px;
}

.warning-banner strong {
    color: #664d03;
}

.warning-banner small {
    display: block;
    margin-top: 8px;
    color: #997404;
}

/* Cashier stats details (collapsible) */
.cashier-stats-details {
    margin-top: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.cashier-stats-details summary {
    padding: 10px 15px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    list-style: revert;
}

.cashier-stats-details .cashier-stats-grid {
    padding: 0 12px 12px;
}

/* ========================================
   DANGER ZONE STYLES
   ======================================== */

.danger-zone {
    border-left: 4px solid #dc3545 !important;
    background: #fff5f5;
}

.danger-zone h3 {
    color: #dc3545;
}

/* Заблокированная зона — визуально недоступна */
.danger-zone--locked {
    opacity: 0.4;
    pointer-events: none;
    user-select: none;
    filter: grayscale(30%);
}

.btn-danger {
    background-color: #dc3545 !important;
    color: white !important;
    border: none;
}

.btn-danger:hover {
    background-color: #c82333 !important;
}

/* Unallocated stat item (red highlight) */
.unallocated-stat {
    background: #fff5f5 !important;
    border-color: #f5c6cb !important;
    border-left: 3px solid #dc3545 !important;
}

.unallocated-stat strong {
    color: #dc3545 !important;
}

/* Close button for clear tables modal */
.close-clear-tables {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-clear-tables:hover {
    color: var(--tea-dark);
}

/* ========================================
   SYNC STATUS INDICATOR STYLES
   ======================================== */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.page-header h1 {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.sync-status {
    padding: 8px 15px;
    border-radius: 4px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sync-status.syncing {
    background: #fff3cd;
    color: #856404;
}

.sync-status.fresh {
    background: #d4edda;
    color: #155724;
}

.sync-status.stale {
    background: #f8d7da;
    color: #721c24;
}

.sync-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #856404;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Mobile responsive for sync status */
@media (max-width: 768px) {
    .page-header {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
    }

    .page-header h1 {
        font-size: 1.2em;
        flex: 1 1 auto;
    }

    .sync-status {
        font-size: 12px;
        padding: 5px 10px;
        order: 1;
    }

    .page-header button {
        font-size: 12px;
        padding: 8px 14px;
        min-height: 40px;
        order: 2;
    }
}

/* ========================================
   APEXCHARTS CUSTOMIZATION
   ======================================== */

/* Cursor pointer for clickable chart bars (drill-down) - only when .chart-clickable class is present */
.chart-clickable .apexcharts-bar-area {
    cursor: pointer;
}

/* Horizontal scroll for wide charts */
.chart-scroll-container {
    overflow-x: auto;
    width: 100%;
}

.chart-scroll-container .apexchart {
    min-width: 800px;
}

/* ========================================
   LOGIN PAGE — Osmantus Premium Design
   Scoped to .login-page — does NOT affect admin.html
   ======================================== */

.login-page {
    font-family: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #FAF9F6;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    position: relative;
    overflow: hidden;
}

/* override global body padding */
body.login-page { padding: 32px 20px; }

.login-page .login-wrapper {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 28px;
    position: relative;
    z-index: 1;
}

/* === BRANDING === */
.login-page .login-brand {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.login-page .login-logo-wrap {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(107, 167, 47, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}

.login-page .login-logo-icon {
    font-size: 36px;
    color: #6ba72f;
}

.login-page .login-brand-name {
    font-size: 30px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #0f172a;
    margin: 0;
}

.login-page .login-brand-sub {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: #94a3b8;
    margin: 0;
}

/* === CARD === */
.login-page .login-card {
    width: 100%;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0,0,0,0.04);
    padding: 32px 28px;
}

.login-page .login-title {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #0f172a;
    margin: 0 0 4px;
}

.login-page .login-subtitle {
    font-size: 13px;
    color: #64748b;
    margin: 0 0 24px;
    font-weight: 500;
}

/* === FORM === */
.login-page form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex-wrap: nowrap;
}

.login-page .login-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-page .login-field-label {
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    padding-left: 4px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.login-page .login-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.login-page .login-input-icon {
    position: absolute;
    left: 16px;
    font-size: 20px;
    color: #94a3b8;
    pointer-events: none;
    font-variation-settings: 'wght' 300;
}

.login-page .login-input-wrap input {
    width: 100%;
    height: 52px;
    padding: 0 16px 0 50px;
    border-radius: 9999px;
    border: 1.5px solid #e2e8f0;
    background: #f8fafc;
    font-family: inherit;
    font-size: 15px;
    font-weight: 500;
    color: #0f172a;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
    margin: 0;
    box-sizing: border-box;
}

.login-page .login-input-wrap input:focus {
    border-color: #6ba72f;
    box-shadow: 0 0 0 3px rgba(107, 167, 47, 0.15), inset 0 2px 4px rgba(0,0,0,0.02);
    background: #ffffff;
}

.login-page .login-input-wrap input::placeholder {
    color: #cbd5e1;
}

/* password has extra right padding for eye btn */
.login-page .login-input-wrap input[type="password"],
.login-page .login-input-wrap input[type="text"].password-visible {
    padding-right: 48px;
}

.login-page .login-eye-btn {
    position: absolute;
    right: 14px;
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    min-height: auto;
    box-shadow: none;
    border-radius: 50%;
    transition: color 0.15s;
    font-size: 14px;
}

.login-page .login-eye-btn:hover { color: #64748b; }
.login-page .login-eye-btn:active { transform: none; box-shadow: none; }

.login-page .login-eye-btn .material-symbols-outlined {
    font-size: 20px;
}

/* === SUBMIT BUTTON === */
.login-page .login-submit-btn {
    width: 100%;
    height: 52px;
    border-radius: 9999px;
    background: #6ba72f;
    color: white;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(107, 167, 47, 0.3);
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
    margin-top: 4px;
    letter-spacing: 0.01em;
}

.login-page .login-submit-btn:hover { opacity: 0.92; }
.login-page .login-submit-btn:active { transform: scale(0.98); box-shadow: none; }

/* === MESSAGE === */
.login-page #message {
    margin-top: 14px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    color: #dc2626;
    min-height: 0;
    padding: 0;
    background: none;
}

.login-page #message:empty { display: none; }

/* === FOOTER === */
.login-page .login-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
}

.login-page .login-forgot {
    font-size: 13px;
    font-weight: 600;
    color: #0f172a;
    text-decoration: none;
    transition: color 0.15s;
}

.login-page .login-forgot:hover { color: #6ba72f; }

.login-page .login-footer-divider {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.login-page .login-footer-divider::before,
.login-page .login-footer-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}

.login-page .login-footer-text {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: #94a3b8;
    white-space: nowrap;
}

/* === DECORATIVE BG === */
.login-page .login-gradient-bg {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 35%;
    background: linear-gradient(to top, rgba(107, 167, 47, 0.07), transparent);
    pointer-events: none;
    z-index: 0;
}

/* ========================================
   APEXCHARTS — Remove default borders
   ======================================== */
.apexcharts-canvas,
.apexcharts-canvas > svg {
    border: none !important;
    outline: none !important;
}

.apexcharts-canvas > svg > rect:first-child {
    stroke: none !important;
    stroke-width: 0 !important;
}