/* LotterySoft panel — styles based on the Last-Design mockup (dashboard15.html) */

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Inter', 'Segoe UI', system-ui, sans-serif; }

:root {
    --green-900: #0B2B26;
    --green-700: #176B4A;
    --green-600: #1f6e4a;
    --green-500: #2C9B6E;
    --green-100: #d9ebdf;
    --cream-50: #fffef9;
    --cream-100: #fdf9f0;
    --cream-200: #ece2d1;
    --cream-300: #e2d5c0;
    --gold: #FDDF8C;
    --text: #2d3e50;
    --text-muted: #7a6a52;
    --danger: #DC3C2C;
    --danger-dark: #b92c1e;
    --negative: #c62828;
    --topbar-h: 72px;
}

html, body { height: 100%; background: #eef2f7; overflow: hidden; }
body { overflow-x: hidden; color: var(--text); }
button, input, select, textarea { font-size: 0.9rem; }
[hidden] { display: none !important; }

/* ---------- Top bar ---------- */
.top-bar {
    position: fixed; top: 0; left: 0; width: 100%; height: var(--topbar-h);
    background: linear-gradient(125deg, #0B2B26 0%, #176B4A 45%, #2C9B6E 100%);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 32px; z-index: 1000; border-bottom: 2px solid var(--gold); gap: 12px;
}
.menu-toggle {
    background: rgba(255,255,240,0.2); border: none; width: 44px; height: 44px; border-radius: 30px;
    color: white; font-size: 1.5rem; cursor: pointer; display: none; align-items: center; justify-content: center;
}
.company-name {
    font-size: 1.7rem; font-weight: 700; letter-spacing: 1px; color: white;
    text-shadow: 0 2px 6px rgba(0,0,0,0.2); display: flex; align-items: center; gap: 12px;
    cursor: pointer; flex: 1; min-width: 0;
}
.company-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.company-name i { font-size: 2rem; color: #FFE2B5; }
.company-logo { width: 44px; height: 44px; border-radius: 12px; object-fit: cover; background: white; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: #c9b98f; flex-shrink: 0; box-shadow: 0 0 0 3px rgba(255,255,255,0.15); }
.live-dot.on { background: #6be39b; box-shadow: 0 0 0 3px rgba(107,227,155,0.3); }
.user-chip { color: #e6f3ea; font-size: 0.85rem; text-align: right; line-height: 1.2; white-space: nowrap; }
.user-chip small { display: block; color: #FFE2B5; text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.5px; }
.disconnect-btn {
    background: var(--danger); border: none; padding: 10px 26px; border-radius: 44px; font-weight: 600;
    font-size: 0.95rem; color: white; display: flex; align-items: center; gap: 12px; cursor: pointer;
    transition: all 0.2s; box-shadow: 0 4px 10px rgba(0,0,0,0.15); white-space: nowrap;
}
.disconnect-btn:hover { background: var(--danger-dark); transform: translateY(-2px); }

/* ---------- Layout ---------- */
.app-wrapper { display: flex; margin-top: var(--topbar-h); height: calc(100vh - var(--topbar-h)); height: calc(100dvh - var(--topbar-h)); align-items: flex-start; }
.sidebar {
    width: 280px; flex-shrink: 0; background: var(--cream-100); border-right: 1px solid #e2d9c8;
    display: flex; flex-direction: column; height: calc(100vh - var(--topbar-h)); height: calc(100dvh - var(--topbar-h)); overflow-y: auto; scrollbar-width: thin;
}
.sidebar-overlay {
    position: fixed; top: var(--topbar-h); left: 0; width: 100%; height: calc(100% - var(--topbar-h));
    background: rgba(0,0,0,0.45); backdrop-filter: blur(3px); z-index: 999; visibility: hidden; opacity: 0; transition: 0.2s;
}
.sidebar-overlay.active { visibility: visible; opacity: 1; }
.logo-area { padding: 28px 20px 20px 28px; border-bottom: 2px solid #ebdecb; cursor: pointer; display: flex; align-items: center; gap: 14px; }
.logo-area:hover { background: #f7efdf; }
.logo-icon {
    background: linear-gradient(135deg, #226e4a, #0e543a); width: 50px; height: 50px; border-radius: 22px;
    display: flex; align-items: center; justify-content: center; color: #FFE5B4; font-size: 1.8rem; flex-shrink: 0;
}
.logo-text { font-weight: 800; font-size: 1.2rem; color: #2b5b41; overflow: hidden; }
.logo-text span { font-size: 0.7rem; color: #9b8868; display: block; font-weight: 600; }
.nav-menu { flex: 1; padding: 22px 12px 30px 12px; display: flex; flex-direction: column; gap: 6px; }
.nav-group { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.6px; color: #a8987a; padding: 14px 18px 4px; list-style: none; }
.nav-item { list-style: none; }
.nav-item a {
    display: flex; align-items: center; gap: 14px; padding: 11px 18px; border-radius: 16px;
    font-weight: 500; color: #4a453b; text-decoration: none; transition: 0.2s;
}
.nav-item a i { width: 26px; color: #7f6e54; }
.nav-item a:hover { background: #e8e0cf; color: var(--green-600); }
.nav-item.active a { background: var(--green-100); color: #165a3b; font-weight: 600; border-left: 4px solid #2f9b5f; }
.nav-item.active a i { color: #2a7a55; }
.main-content { flex: 1; min-width: 0; background: #f4f9fe; padding: 28px 32px; overflow-y: auto; height: calc(100vh - var(--topbar-h)); height: calc(100dvh - var(--topbar-h)); }

/* ---------- Cards, titles ---------- */
.page-card, .winning-table-card {
    background: var(--cream-50); border-radius: 28px; padding: 1.6rem; box-shadow: 0 12px 24px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--cream-200); margin-bottom: 24px;
}
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h2 { color: #2c473a; display: flex; align-items: center; gap: 10px; font-size: 1.5rem; min-width: 0; }
.page-head .btn-soft { flex-shrink: 0; }
/* Several buttons in a page title (Messages): side by side, and under the title when they do not fit beside it */
.page-head-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.page-card, .winning-table-card { --card-pad: 1.6rem; }
/* Title strips, info boxes and total lines: the colors of the number details box (.kv-list), dark text (no green on green) */
.section-title {
    font-size: 1.1rem; font-weight: 700; color: var(--text); background: #f6faf7;
    border-bottom: 2px solid #e3ece6; padding: 12px var(--card-pad, 16px); margin: 0 calc(-1 * var(--card-pad, 0px)) 0;
}
.page-card > .section-title:first-child { margin-top: calc(-1 * var(--card-pad)); border-radius: 27px 27px 0 0; }
.winning-table-card { padding: 0; overflow: hidden; }
.winning-table-card .section-title { margin: 0; }
.section-title + .toolbar { margin-top: 10px; }
.page-card .table-wrap { margin-left: calc(-1 * var(--card-pad)); margin-right: calc(-1 * var(--card-pad)); width: auto; border-radius: 0; }
.winning-table-card .table-wrap { border-radius: 0; }
.page-card .data-table th:first-child, .page-card .data-table td:first-child, .winning-table-card .data-table th:first-child, .winning-table-card .data-table td:first-child { padding-left: var(--card-pad); }
.page-card .data-table th:last-child, .page-card .data-table td:last-child, .winning-table-card .data-table th:last-child, .winning-table-card .data-table td:last-child { padding-right: var(--card-pad); }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; margin-bottom: 32px; }
.stat-card { background: white; border-radius: 28px; padding: 1.5rem; box-shadow: 0 8px 18px rgba(0, 0, 0, 0.04); border-top: 5px solid #2f9b5f; }
.stat-card:nth-child(2) { border-top-color: #3a86ff; }
.stat-card:nth-child(3) { border-top-color: #e85d04; }
.stat-card:nth-child(4) { border-top-color: #8e44ad; }
.stat-title { font-size: 0.85rem; text-transform: uppercase; color: #6f6a58; margin-bottom: 12px; display: flex; gap: 8px; }
.stat-number {
    font-size: 2.2rem; font-weight: 800; background: linear-gradient(145deg, #1e4c38, #2b7c57);
    background-clip: text; -webkit-background-clip: text; color: transparent; word-break: break-all;
}
.stat-number.negative { background: none; color: var(--negative); }

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; border-radius: 10px; }
.data-table { width: 100%; border-collapse: collapse; }
/* Client's rule for every table: the first column on the left, the other columns on the right (titles like their cells) */
.data-table th, .data-table td { text-align: right; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }
.data-table th {
    padding: 14px 12px; background: #F1F5F9; color: #1e2a3a; font-weight: 600;
    border-bottom: 1px solid #e2e8f0; font-size: 0.85rem; letter-spacing: 0.3px; white-space: nowrap;
}
.data-table tbody tr:nth-child(odd) { background-color: #f7f5f5; }
.data-table tbody tr:nth-child(even) { background-color: #fafafa; }
.data-table tbody tr:hover { background-color: #E8EDF2; }
.data-table td { padding: 11px 12px; border-bottom: 1px solid #edf2f7; color: var(--text); font-size: 0.9rem; white-space: nowrap; }
.data-table th.row-no, .data-table td.row-no { width: 1%; font-variant-numeric: tabular-nums; }
.data-table td.row-no { color: var(--text-muted); }
.data-table td.wrap { white-space: normal; min-width: 160px; }
.data-table td.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.data-table .actions { white-space: nowrap; }
.data-table tr.row-negative td { color: var(--negative); font-weight: 600; }
.data-table tfoot td { background: #f6faf7; color: var(--text); font-weight: 700; border-top: 2px solid #e3ece6; }
.data-table td.empty { text-align: center; color: #8a8270; padding: 28px; }
.data-table tr.clickable { cursor: pointer; }
.data-table tr.row-inherited td { color: #7a8691; font-style: italic; }
/* Phones: a wide table scrolls sideways; its action buttons stay at the right edge, in view on every row */
@media screen and (max-width: 760px) {
    .data-table th.actions, .data-table td.actions { position: sticky; right: 0; z-index: 1; box-shadow: inset 1px 0 0 #e2e8f0; }
    .data-table tbody td.actions { background-color: inherit; }
    .data-table td.actions:has(.action-menu-list:not([hidden])) { z-index: 3; }
}

/* ---------- Badges ---------- */
.badge { display: inline-block; padding: 3px 12px; border-radius: 40px; font-size: 0.78rem; font-weight: 600; white-space: nowrap; }
.badge-success { background: #dff0e4; color: #1f6e4a; }
.badge-muted { background: #eceae4; color: #6b6556; }
.badge-danger { background: #fde4e1; color: #a52a1c; }
.badge-gold { background: #fff1cc; color: #8a6300; }

/* ---------- Buttons ---------- */
.btn-soft {
    background: #ecf3e6; padding: 8px 18px; border-radius: 36px; color: #2b6e4a; font-weight: 500;
    cursor: pointer; display: inline-flex; align-items: center; gap: 8px; transition: 0.2s; border: none;
}
.btn-soft:hover { background: #dde6d3; }
.btn-primary {
    background: #2a7a55; color: white; border: none; padding: 10px 24px; border-radius: 40px; cursor: pointer;
    font-weight: 600; display: inline-flex; align-items: center; gap: 8px;
}
.btn-primary:hover { background: #22664a; }
.btn-danger { background: var(--danger); color: white; border: none; padding: 10px 24px; border-radius: 40px; cursor: pointer; font-weight: 600; }
.btn-danger:hover { background: var(--danger-dark); }
.btn-icon {
    background: transparent; border: 1px solid #ddd1bc; width: 34px; height: 34px; border-radius: 50%;
    cursor: pointer; color: #5e5a48; display: inline-flex; align-items: center; justify-content: center; margin-left: 4px;
}
.btn-icon:hover { background: #ecf3e6; color: #2b6e4a; }
.btn-icon.danger:hover { background: #fde4e1; color: #a52a1c; }
/* "⋮" menu of a table row */
.action-menu { display: inline-block; }
.action-menu-list { position: fixed; z-index: 3000; min-width: 170px; display: flex; flex-direction: column; padding: 6px; background: #fff;
    border: 1px solid #e2e8f0; border-radius: 12px; box-shadow: 0 12px 32px rgba(15, 35, 25, .18); }
.action-menu-list[hidden] { display: none; }
.action-menu-list button { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 0; border-radius: 8px; background: none;
    font: inherit; font-size: 0.9rem; color: var(--text); text-align: left; cursor: pointer; white-space: nowrap; }
.action-menu-list button:hover { background: #eef5f0; }
.action-menu-list button.danger { color: var(--danger); }
.action-menu-list button i { width: 16px; text-align: center; }
.search-btn-modern {
    background: linear-gradient(95deg, #1f6e4a, #2e9e6b); border: none; padding: 12px 32px; border-radius: 60px;
    color: white; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 12px; white-space: nowrap;
}
button:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---------- Filters & forms ---------- */
.report-filter-card {
    background: rgba(255, 252, 242, 0.95); border-radius: 15px; padding: 22px 26px; margin-bottom: 26px;
    box-shadow: 0 1px 1px 0 rgba(0, 0, 0, 0.12); border: 1px solid #efe1ca;
}
.filter-title {
    display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 1.1rem; color: #2b5b41;
    margin-bottom: 18px; border-bottom: 2px dashed #dacfba; padding-bottom: 10px;
}
.filter-grid { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-end; }
.filter-field { flex: 1; min-width: 160px; position: relative; }
.filter-field label, .register-field label {
    display: block; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; color: var(--text-muted);
    letter-spacing: 0.5px; margin-bottom: 6px;
}
.filter-field input, .filter-field select {
    width: 100%; padding: 11px 16px; border-radius: 60px; border: 1px solid var(--cream-300); background: white; outline: none;
}
/* Date and time fields: iOS gives them a fixed native width that overflows the field */
.filter-field input[type="date"], .register-field input[type="date"], .filter-field input[type="time"], .register-field input[type="time"] { -webkit-appearance: none; appearance: none; min-width: 0; max-width: 100%; display: block; text-align: left; min-height: 42px; }
input[type="date"]::-webkit-date-and-time-value, input[type="time"]::-webkit-date-and-time-value { text-align: left; margin: 0; }
.register-field { min-width: 0; }
.filter-field input:focus, .filter-field select:focus, .register-field input:focus, .register-field select:focus, .register-field textarea:focus {
    border-color: #2e9e6b; box-shadow: 0 0 0 3px rgba(46,158,107,0.15);
}
.radio-group { display: flex; gap: 24px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.radio-group label { display: flex; align-items: center; gap: 8px; font-weight: 500; color: #2b5b41; cursor: pointer; }
.register-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; margin-bottom: 20px; }
.register-field { display: flex; flex-direction: column; gap: 4px; }
.register-field.full { grid-column: 1 / -1; }
.register-field input, .register-field select, .register-field textarea {
    padding: 10px 14px; border-radius: 28px; border: 1px solid #ddd1bc; background: white; outline: none; width: 100%;
}
.register-field .radio-group { flex-direction: column; align-items: flex-start; gap: 10px; }
.register-field .radio-group label { display: flex; align-items: center; gap: 10px; text-transform: none; font-size: 0.92rem; letter-spacing: normal; color: #2b5b41; font-weight: 500; margin: 0; }
.register-field input[type="radio"], .register-field input[type="checkbox"], .filter-field input[type="radio"], .filter-field input[type="checkbox"] { width: 18px; height: 18px; padding: 0; border: none; border-radius: 0; box-shadow: none; flex-shrink: 0; accent-color: #2a7a55; }
.register-field textarea { border-radius: 16px; min-height: 80px; resize: vertical; }
.register-field .hint { font-size: 0.75rem; color: #8a8270; }
.check-inline { display: flex; align-items: center; gap: 8px; font-weight: 500; color: #2b5b41; cursor: pointer; padding-top: 22px; }
/* A label on several lines: the box beside its first line */
.check-inline.long { align-items: flex-start; }
.check-inline.long input { margin-top: 4px; flex: none; }
.prize-input { width: 150px; padding: 8px 14px; border-radius: 40px; border: 1px solid #cfc5b2; font-weight: 500; background: white; }
.current-lottery-badge {
    background: #e9f3ec; padding: 8px 18px; border-radius: 40px; display: inline-block; margin-bottom: 18px; font-weight: 600; color: #1e6e4a;
}
.form-error { color: #a52a1c; font-size: 0.85rem; margin-top: -6px; margin-bottom: 12px; }

/* ---------- Multi-select (lottery checkboxes) ---------- */
.multi-select { position: relative; }
.multi-select-btn {
    width: 100%; padding: 11px 40px 11px 16px; border-radius: 60px; border: 1px solid var(--cream-300); background: white;
    text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; position: relative;
}
.multi-select-btn::after { content: "\25BE"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); color: #7a6a52; }
.multi-select-panel {
    position: absolute; top: calc(100% + 6px); left: 0; min-width: 100%; max-height: 280px; overflow-y: auto; background: white;
    border: 1px solid var(--cream-300); border-radius: 16px; box-shadow: 0 12px 24px rgba(0,0,0,0.12); z-index: 50; padding: 8px;
}
.multi-select-panel label {
    display: flex; align-items: center; justify-content: flex-start; gap: 10px; padding: 8px 12px; margin: 0;
    border-radius: 10px; cursor: pointer; white-space: nowrap; text-align: left;
    font-size: 0.9rem; font-weight: 500; text-transform: none; letter-spacing: normal; color: var(--text);
}
.multi-select-panel input[type="checkbox"] {
    width: 18px; height: 18px; min-width: 18px; padding: 0; margin: 0; border: none; border-radius: 4px;
    accent-color: #2a7a55; cursor: pointer; flex-shrink: 0;
}
.multi-select-panel label:hover { background: #f3f7f1; }
.multi-select-panel label.all { border-bottom: 1px solid #eee4d3; margin-bottom: 4px; font-weight: 600; }

/* ---------- Styled dropdown (replaces native <select>) ---------- */
select.cs-native { position: absolute !important; opacity: 0 !important; pointer-events: none !important; width: 1px !important; height: 1px !important; padding: 0 !important; border: 0 !important; overflow: hidden; }
.cs-button {
    width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 11px 16px; border-radius: 60px; border: 1px solid var(--cream-300); background: white;
    color: var(--text); text-align: left; cursor: pointer; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.register-field .cs-button { padding: 10px 14px; border-radius: 28px; border-color: #ddd1bc; }
.cs-button:focus-visible, .cs-button.cs-open { border-color: #2e9e6b; box-shadow: 0 0 0 3px rgba(46,158,107,0.15); }
.cs-button:disabled { background: #f5f2ea; color: #8a8270; cursor: not-allowed; opacity: 1; }
.cs-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-button.cs-placeholder .cs-label { color: #8a8270; }
.cs-arrow { font-size: 0.75rem; color: #7a6a52; transition: transform 0.15s; flex-shrink: 0; }
.cs-button.cs-open .cs-arrow { transform: rotate(180deg); }
.cs-panel {
    position: fixed; z-index: 4000; max-width: calc(100vw - 16px); max-height: 320px; display: flex; flex-direction: column;
    background: white; border: 1px solid var(--cream-300); border-radius: 16px; box-shadow: 0 12px 28px rgba(0,0,0,0.14); padding: 8px;
    animation: cs-in 0.12s ease-out;
}
@keyframes cs-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.cs-search { margin: 0 0 6px; padding: 9px 14px; border-radius: 30px; border: 1px solid var(--cream-300); outline: none; width: 100%; }
.cs-search:focus { border-color: #2e9e6b; }
.cs-options { overflow-y: auto; }
.cs-option {
    display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 9px 12px; border-radius: 10px;
    cursor: pointer; white-space: nowrap; color: var(--text); font-size: 0.9rem;
}
.cs-option:hover, .cs-option.active { background: #f3f7f1; }
.cs-option.selected { background: var(--green-100); color: #165a3b; font-weight: 600; }
.cs-option.selected i { color: #2a7a55; font-size: 0.8rem; }
.cs-option.disabled { color: #b5ad9c; cursor: not-allowed; }
.cs-empty { padding: 10px 12px; color: #8a8270; font-size: 0.85rem; }

/* ---------- Styled file picker (replaces native <input type="file">) ---------- */
input[type="file"].cs-native { position: absolute !important; opacity: 0 !important; pointer-events: none !important; width: 1px !important; height: 1px !important; padding: 0 !important; border: 0 !important; }
.cs-file {
    display: flex; align-items: center; gap: 12px; padding: 6px 6px 6px 14px; min-height: 46px;
    border: 1px dashed #d6c8ae; border-radius: 28px; background: white; transition: border-color 0.15s, background 0.15s;
}
.cs-file.has-file { border-style: solid; border-color: #b9d6c4; background: #f7fbf8; }
.cs-file.dragging { border-color: #2e9e6b; background: #eef7f1; }
.cs-file-preview { width: 34px; height: 34px; border-radius: 10px; object-fit: cover; background: #f1ede2; cursor: pointer; flex-shrink: 0; border: 1px solid var(--cream-200); }
.cs-file-info { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.cs-file-name { font-size: 0.88rem; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-file:not(.has-file) .cs-file-name { color: #8a8270; }
.cs-file-meta { font-size: 0.72rem; color: #8a8270; }
.cs-file-pick { padding: 8px 14px; white-space: nowrap; flex-shrink: 0; }
.cs-file-clear { margin: 0; flex-shrink: 0; }

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); display: flex; align-items: center;
    justify-content: center; z-index: 2000; visibility: hidden; opacity: 0; transition: 0.2s; padding: 16px;
}
.modal-overlay.active { visibility: visible; opacity: 1; }
.modal-container {
    background: #fffef7; border-radius: 32px; max-width: 780px; width: 100%; max-height: 88vh; overflow-y: auto;
    padding: 28px 32px; box-shadow: 0 30px 40px rgba(0,0,0,0.2); border: 1px solid #ebdecb;
}
.modal-container.small { max-width: 460px; }
.modal-container h3 { font-size: 1.5rem; color: var(--green-600); margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }
.modal-buttons { display: flex; justify-content: flex-end; gap: 12px; margin-top: 16px; flex-wrap: wrap; }

/* ---------- Toast, loader, pagination ---------- */
.toast-stack { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 3000; max-width: calc(100vw - 40px); }
.toast {
    background: #1f3d30; color: white; padding: 12px 18px; border-radius: 14px; box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    display: flex; gap: 10px; align-items: center; animation: toast-in 0.2s ease-out; max-width: 420px;
}
.toast.error { background: #8f2418; }
.toast.success { background: #1f6e4a; }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.loader { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 36px; color: #7a6a52; }
.loader::before {
    content: ""; width: 22px; height: 22px; border: 3px solid #d9ebdf; border-top-color: #2a7a55; border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.pagination { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 16px; flex-wrap: wrap; color: #6b6556; font-size: 0.85rem; }
.pagination .pages { display: flex; gap: 6px; align-items: center; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; color: #6b6556; font-size: 0.85rem; }
.muted { color: #8a8270; }
.text-negative { color: var(--negative); font-weight: 600; }
.mt-16 { margin-top: 16px; }

/* ---------- Report sheet (Sales Report design) ---------- */
/* The report's details: as wide as the report table */
.report-header { width: 100%; border-collapse: separate; border-spacing: 0; margin-bottom: 16px; background: #f6faf7; border: 1px solid #e3ece6; border-radius: 12px; overflow: hidden; min-width: 280px; }
.report-header th { width: 1%; text-align: left; padding: 6px 12px; color: #5d6b63; font-size: 0.85rem; white-space: nowrap; }
.report-header td { padding: 6px 16px 6px 4px; font-weight: 600; text-align: right; color: var(--text); }
/* Edge to edge in the card like the table, labels and values in line with its first and last columns */
.page-card .report-header { margin-left: calc(-1 * var(--card-pad)); margin-right: calc(-1 * var(--card-pad)); width: calc(100% + 2 * var(--card-pad)); border-radius: 0; border-left: none; border-right: none; }
.page-card .report-header th { padding-left: var(--card-pad); }
.page-card .report-header td { padding-right: var(--card-pad); }
.report-sheet .data-table th { background: #00B050; color: white; }
.report-sheet .data-table tfoot .text-negative { color: var(--negative); }
.report-sheet .btn-icon.mini { width: 22px; height: 22px; font-size: 0.62rem; margin-left: 6px; vertical-align: middle; }
.report-sheet .data-table tbody tr:nth-child(odd) { background-color: #ffffff; }
.report-sheet .data-table tbody tr:nth-child(even) { background-color: #eef6f0; }
.report-sheet .data-table tbody tr:hover { background-color: #dcefe2; }

/* ---------- Ticket detail ---------- */
.data-table tr.win-line td { color: var(--negative); font-weight: 700; }
/* Ticket number in the ticket lists (the row opens the ticket) */
.ticket-no { display: inline-block; min-width: 38px; padding: 2px 7px; border-radius: 6px; background: #1f6b4f; color: #fff;
    font-weight: 700; font-size: 0.74rem; text-align: center; font-variant-numeric: tabular-nums; }
tr.clickable:hover .ticket-no { background: #17573f; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button { background: #f1ede2; border: none; padding: 9px 18px; border-radius: 30px; cursor: pointer; font-weight: 600; color: #5e5a48; }
.tabs button.active { background: #2a7a55; color: white; }

/* ---------- Grid editor (payment terms, limits) ---------- */
.grid-editor .data-table td { padding: 8px 12px; }
.grid-editor input.prize-input { width: 160px; }

/* ---------- Messages ---------- */
.chat-layout { display: grid; grid-template-columns: 280px 1fr; gap: 16px; min-height: 480px; }
.chat-list { border: 1px solid var(--cream-200); border-radius: 18px; overflow-y: auto; max-height: 64vh; background: white; }
.chat-list input { width: calc(100% - 16px); margin: 8px; padding: 9px 14px; border-radius: 30px; border: 1px solid var(--cream-300); }
.chat-list button { display: block; width: 100%; text-align: left; padding: 12px 16px; border: none; border-bottom: 1px solid #f1ece0; background: none; cursor: pointer; }
.chat-list button:hover { background: #f6f3ea; }
.chat-list button.active { background: var(--green-100); font-weight: 600; }
.chat-panel { border: 1px solid var(--cream-200); border-radius: 18px; display: flex; flex-direction: column; background: white; min-height: 480px; max-height: 64vh; }
.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 8px; background: #fbfaf6; border-radius: 18px 18px 0 0; }
.chat-bubble { max-width: 75%; padding: 9px 14px; border-radius: 16px; background: #eef0ea; align-self: flex-start; word-wrap: break-word; }
.chat-bubble.mine { background: #d9ebdf; align-self: flex-end; }
.chat-bubble small { display: block; color: #8a8270; font-size: 0.7rem; margin-top: 4px; }
.chat-bubble a { color: #1f6e4a; }
.chat-compose { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #f1ece0; align-items: center; }
.chat-compose input[type=text] { flex: 1; padding: 11px 16px; border-radius: 30px; border: 1px solid var(--cream-300); }
/* Voice messages: player in the bubbles, recording bar, recorder of the message to all sellers */
.voice-msg { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.voice-play { flex: none; width: 34px; height: 34px; border: none; border-radius: 50%; background: #2a7a55; color: #fff; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; font-size: 0.8rem; }
.voice-play:hover { background: #22664a; }
.voice-bar { position: relative; flex: 1; height: 6px; border-radius: 3px; background: rgba(20, 60, 40, .15); cursor: pointer; overflow: hidden; }
.voice-bar > span { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: #2a7a55; }
.voice-time { min-width: 34px; text-align: right; font-size: 0.78rem; color: #5e5a48; font-variant-numeric: tabular-nums; }
.chat-caption { margin-top: 6px; }
.rec-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--danger); animation: rec-blink 1s infinite; }
.sending .rec-dot { animation: none; opacity: .4; }
@keyframes rec-blink { 50% { opacity: .25; } }
.rec-time { font-weight: 600; font-variant-numeric: tabular-nums; }
.chat-recording .rec-hint { flex: 1; font-size: 0.85rem; }
.voice-recorder { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 40px; }
.voice-recorder .voice-msg { flex: 1; max-width: 360px; }
@media (max-width: 760px) {
    .chat-layout { grid-template-columns: 1fr; }
    .chat-list { max-height: 200px; }
}

/* ---------- Inline forms (deposits) ---------- */
.inline-form { border: 1px solid #cfe3d5; background: #f7fbf8; border-radius: 16px; padding: 14px 16px; margin-bottom: 18px; }
.inline-form .register-grid { margin-bottom: 8px; }

/* ---------- Sale details ---------- */
.report-header-line { background: #f6faf7; color: var(--text); border: 1px solid #e3ece6; font-weight: 600; padding: 8px 14px; border-radius: 10px; margin-bottom: 14px; }
.sd-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.sd-title { font-weight: 700; color: var(--text); background: #f6faf7; border-bottom: 2px solid #e3ece6; padding: 8px 12px; border-radius: 10px 10px 0 0; }
.page-card .sd-grid .table-wrap { margin-left: 0; margin-right: 0; }
.sd-grid .data-table td.num { color: #1e2a3a; }

/* ---------- Compact two-column forms (results entry) ---------- */
.register-grid.two { grid-template-columns: 1fr 1fr; gap: 10px 12px; margin-bottom: 10px; }
.register-grid.two input, .register-grid.two .cs-button { padding-top: 8px; padding-bottom: 8px; }
.register-grid.two input[type="date"] { min-height: 38px; }
.day-title { font-weight: 700; color: var(--text); background: #f6faf7; padding: 8px 14px; border-radius: 10px 10px 0 0; margin-bottom: 0; border-bottom: 2px solid #e3ece6; }
/* The day heading follows the search form directly (no empty strip) */
.report-filter-card:has(+ [data-table] .day-title), [data-filters]:has(+ [data-table] .day-title) .report-filter-card { margin-bottom: 0; }

/* ---------- Print ---------- */
@media print {
    html, body { overflow: visible; height: auto; background: white; }
    .top-bar, .sidebar, .sidebar-overlay, .no-print, .toast-stack, .page-head button { display: none !important; }
    .app-wrapper { margin: 0; height: auto; display: block; }
    .main-content { padding: 0; height: auto; overflow: visible; background: white; }
    .page-card { box-shadow: none; border: none; padding: 0; }
    .data-table th, .report-sheet .data-table tfoot td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .report-sheet .data-table tbody tr, .report-header { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    .table-wrap { overflow: visible; }
    .page-card .table-wrap { margin-left: 0; margin-right: 0; }
    .page-card .report-header { margin-left: 0; margin-right: 0; width: 100%; }
    .section-title { background: none; margin: 0 0 8px; padding: 0; border: none; }
}

/* ---------- Login ---------- */
.login-page { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; background: linear-gradient(125deg, #0B2B26 0%, #176B4A 45%, #2C9B6E 100%); overflow: auto; padding: 16px; }
.login-card { background: var(--cream-50); border-radius: 32px; padding: 36px 34px; width: 100%; max-width: 420px; box-shadow: 0 30px 50px rgba(0,0,0,0.25); border-top: 4px solid var(--gold); }
.login-card .logo-area { border: none; padding: 0 0 24px; cursor: default; }
.login-card .logo-area:hover { background: none; }
.login-card .register-field { margin-bottom: 16px; }
.login-card .btn-primary { width: 100%; justify-content: center; padding: 12px; margin-top: 8px; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
    /* The page itself scrolls (no inner scroll area): normal touch scrolling down to the bottom */
    html, body { height: auto; overflow: visible; }
    body { overflow-x: hidden; }
    .app-wrapper { display: block; height: auto; }
    .main-content { height: auto; overflow: visible; min-height: calc(100vh - var(--topbar-h)); min-height: calc(100dvh - var(--topbar-h)); padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
    .menu-toggle { display: flex; }
    .sidebar {
        position: fixed; top: var(--topbar-h); left: 0; z-index: 1001; transform: translateX(-100%);
        transition: transform 0.25s ease; box-shadow: 5px 0 20px rgba(0,0,0,0.15); border-right: none;
    }
    .sidebar.open-mobile { transform: translateX(0); }
    .main-content { padding: 20px 18px; }
    .company-name { font-size: 1.25rem; }
    .company-name i { font-size: 1.6rem; }
    .top-bar { padding: 0 16px; }
    .disconnect-btn { padding: 8px 16px; gap: 8px; font-size: 0.8rem; }
    .user-chip { display: none; }
    .data-table th, .data-table td { padding: 10px 8px; font-size: 0.85rem; }
}
@media (max-width: 640px) {
    .main-content { padding: 14px 10px; }
    .page-card { padding: 1.1rem; border-radius: 20px; }
    .page-card, .winning-table-card { --card-pad: 1.1rem; }
    .winning-table-card { border-radius: 20px; }
    .page-card > .section-title:first-child { border-radius: 19px 19px 0 0; }
    .section-title { font-size: 1rem; padding-top: 10px; padding-bottom: 10px; }
    .page-head { flex-wrap: nowrap; margin-bottom: 12px; }
    .page-head.page-head-wraps { flex-wrap: wrap; }
    .page-head-wraps .page-head-actions { justify-content: flex-start; }
    .page-head h2 { font-size: 1.15rem; }
    .page-head .btn-soft { padding: 7px 12px; font-size: 0.82rem; }
    /* No side margins: filter form, report header and tables run to the card edges */
    .main-content { padding-left: 8px; padding-right: 8px; }
    .page-card .report-filter-card {
        margin-left: calc(-1 * var(--card-pad)); margin-right: calc(-1 * var(--card-pad));
        width: calc(100% + 2 * var(--card-pad)); border-radius: 0; border-left: none; border-right: none;
    }
    /* Sale details: same two-column design as on a computer, compact, edge to edge */
    .page-card .report-header-line { margin-left: calc(-1 * var(--card-pad)); margin-right: calc(-1 * var(--card-pad)); border-radius: 0; padding-left: var(--card-pad); font-size: 0.8rem; }
    .page-card .sd-grid { margin-left: calc(-1 * var(--card-pad)); margin-right: calc(-1 * var(--card-pad)); grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px; }
    .sd-title { font-size: 0.72rem; padding: 6px 6px; border-radius: 0; }
    .sd-grid .table-wrap { border-radius: 0; }
    .sd-grid .data-table th, .sd-grid .data-table td { font-size: 0.66rem; padding: 5px 4px; letter-spacing: 0; }
    .page-card .sd-grid .data-table th:first-child, .page-card .sd-grid .data-table td:first-child { padding-left: 6px; }
    .page-card .sd-grid .data-table th:last-child, .page-card .sd-grid .data-table td:last-child { padding-right: 6px; }
    /* Compact filter form */
    .report-filter-card { padding: 12px var(--card-pad, 14px); margin-bottom: 14px; box-shadow: none; }
    .filter-title { font-size: 0.95rem; margin-bottom: 10px; padding-bottom: 6px; }
    .radio-group { gap: 16px; margin-bottom: 10px; }
    .filter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
    .filter-grid > * { grid-column: 1 / -1; min-width: 0; }
    /* Two dates side by side (Date de / Date à) */
    .filter-grid > .filter-field:has(input[type="date"]):has(+ .filter-field input[type="date"]), .filter-grid > .filter-field:has(input[type="date"]) + .filter-field:has(input[type="date"]) { grid-column: auto; }
    .filter-field label { font-size: 0.68rem; margin-bottom: 4px; }
    .filter-field input, .filter-field select, .multi-select-btn, .filter-field .cs-button { padding-top: 8px; padding-bottom: 8px; }
    .filter-field input[type="date"] { min-height: 38px; padding-left: 12px; padding-right: 8px; }
    .search-btn-modern { width: 100%; padding: 10px 20px; }
    .grid-editor input.prize-input, .prize-input { width: 96px; padding: 7px 10px; }
    .stat-number { font-size: 1.5rem; }
    .search-btn-modern { justify-content: center; }
    .register-grid { grid-template-columns: 1fr; }
    .register-grid.two { grid-template-columns: 1fr 1fr; }
    .data-table .btn-icon { width: 28px; height: 28px; margin-left: 2px; font-size: 0.75rem; }
    .data-table .badge { padding: 2px 8px; }
    .page-card .day-title { margin-left: calc(-1 * var(--card-pad)); margin-right: calc(-1 * var(--card-pad)); border-radius: 0; padding-left: var(--card-pad); }
    .modal-container { padding: 20px 18px; border-radius: 24px; }
    .company-name { font-size: 1rem; }
    .company-logo { width: 34px; height: 34px; }
    .disconnect-btn span { display: none; }
    .disconnect-btn { padding: 10px 12px; }
    .data-table th, .data-table td { font-size: 0.78rem; padding: 8px 6px; }
}

/* Dashboard: lotteries waiting for their result, and the totals line of the active sellers */
.pending-draws { font-size: 13px; color: #7a5b12; background: #fff8e6; border: 1px solid #f0dca8; border-radius: 10px; padding: 8px 14px; margin: 0 0 16px; }
.pending-draws i { margin-right: 6px; }
.active-totals { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 14px; padding: 10px var(--card-pad); }
/* Active sellers: two boxes side by side, also on phones (smaller there) */
.seller-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 var(--card-pad) var(--card-pad); }
.seller-split .table-wrap { border: 1px solid #e3ece6; }
.winning-table-card .seller-split .data-table th:first-child, .winning-table-card .seller-split .data-table td:first-child { padding-left: 10px; }
.winning-table-card .seller-split .data-table th:last-child, .winning-table-card .seller-split .data-table td:last-child { padding-right: 10px; }
.muted-cell { color: var(--text-muted); font-size: 0.8rem; font-style: italic; }
/* Clickable number (sale details) */
.number-btn { display: inline-block; min-width: 36px; padding: 2px 7px; border-radius: 6px; background: #eceff3; color: #1f2d3d; box-shadow: inset 0 0 0 1px #d3d9e0;
    font-weight: 700; font-size: 0.82rem; text-align: center; font-variant-numeric: tabular-nums; }
.field-hint { display: block; margin-top: 4px; font-size: 0.75rem; color: var(--text-muted); text-transform: none; letter-spacing: normal; font-weight: 400; }
/* Number details: a number sold over a limit that was lowered afterwards */
.limit-note { font-size: 0.82rem; color: #5c4a12; background: #fff8e1; border: 1px solid #f0dfa6; border-radius: 10px; padding: 8px 12px; margin: 10px 0; line-height: 1.45; }
.limit-note i { color: #b7860b; margin-right: 6px; }
tr.clickable:hover .number-btn { background: #dfe4ea; }
/* Label : value lines (a number's details) */
.kv-list { display: grid; grid-template-columns: max-content max-content; gap: 6px 18px; margin: 0 0 14px; padding: 12px 16px;
    background: #f6faf7; border: 1px solid #e3ece6; border-radius: 10px; font-size: 0.95rem; }
.kv-list dt { color: #5d6b63; font-weight: 600; }
.kv-list dd { margin: 0; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
    .seller-split { gap: 8px; padding: 0 8px 10px; }
    .seller-split .data-table th, .seller-split .data-table td { padding: 6px 5px; font-size: 0.72rem; }
}

/* Top bar of a supervisor: its name above the company name */
.company-stack { display: flex; flex-direction: column; line-height: 1.1; min-width: 0; }
.company-stack small { font-size: max(0.55em, 10px); font-weight: 600; opacity: 0.85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Company form: lottery access checkboxes */
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 4px 14px; padding-top: 4px; }
.check-grid .check-inline { padding-top: 0; }

/* Dashboard: payment alert set by the admin */
.expiry-alert { font-size: 15px; color: #8a1c1c; background: #fdecec; border: 1px solid #f3b9b9; border-radius: 10px; padding: 10px 14px; margin: 0 0 16px; }
.expiry-alert i { margin-right: 8px; }

/* Button waiting for the server: spinner, no second click */
button.is-busy { position: relative; pointer-events: none; opacity: 0.85; }
button.is-busy::after { content: ""; display: inline-block; width: 0.9em; height: 0.9em; margin-left: 0.5em; vertical-align: -0.12em;
    border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: btn-spin 0.7s linear infinite; }
@keyframes btn-spin { to { transform: rotate(360deg); } }
