:root {
  --primary: #e60012;
  --primary-dark: #b8000e;
  --primary-light: #fff0f1;
  --mixue-red: #e60012;
  --green: #16a34a;
  --orange: #d97706;
  --red: #dc2626;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 2px 10px rgba(15, 23, 42, 0.05);
  --radius: 12px;
}

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

body {
  font-family: 'Prompt', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  background-color: var(--bg);
  color: var(--text-main);
  line-height: 1.55;
  padding-bottom: 50px;
  overflow-x: hidden;
}

.container {
  max-width: 1580px;
  width: 97%;
  margin: 0 auto;
  padding: 0 16px;
}

/* Topbar */
.topbar {
  background: linear-gradient(135deg, #e60012 0%, #c4000f 100%);
  color: #fff;
  padding: 13px 0;
  box-shadow: 0 2px 10px rgba(230, 0, 18, 0.18);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 48px;
  height: 48px;
  background: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
}

.brand h1 {
  font-size: 1.42rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  line-height: 1.25;
}

.brand .subtitle {
  font-size: 0.92rem;
  opacity: 0.92;
}

.role-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.current-date {
  font-size: 0.95rem;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.18);
  padding: 6px 14px;
  border-radius: 20px;
}

.role-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  padding: 5px 8px 5px 14px;
  border-radius: 30px;
  color: var(--text-main);
}

.role-badge {
  font-size: 0.95rem;
  font-weight: 700;
}

.role-badge.staff {
  color: #0284c7;
}

.role-badge.admin {
  color: var(--primary);
}

/* Summary Grid */
.main-content {
  margin-top: 18px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.summary-card {
  background: var(--card-bg);
  border-radius: 12px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.card-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 25px;
  flex-shrink: 0;
}

.card-icon.blue { background: #e0f2fe; }
.card-icon.red { background: #fee2e2; }
.card-icon.green { background: #dcfce7; }
.card-icon.gold { background: #fef3c7; }

.card-label {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-muted);
  display: block;
}

.card-info h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 2px;
  line-height: 1.25;
}

/* Tabs */
.tabs-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  margin-bottom: 18px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04);
}

.tab-btn {
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 600;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #334155;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

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

.tab-btn.active {
  background: var(--primary);
  color: #ffffff !important;
  border-color: var(--primary);
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(230, 0, 18, 0.22);
}

.tab-btn.admin-tab {
  background: #fff0f1;
  color: #be123c;
  border-color: #fecdd3;
}

.tab-btn.admin-tab:hover {
  background: #ffe4e6;
}

.tabs-row-break {
  flex-basis: 100%;
  width: 100%;
  height: 0;
  border-top: 1px dashed #e2e8f0;
  margin: 2px 0;
}

/* Panels */
.tab-panel {
  display: none;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.tab-panel.active {
  display: block;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #f1f5f9;
}

.panel-header h3 {
  font-size: 1.28rem;
  font-weight: 700;
  color: #0f172a;
}

.text-muted {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.text-muted.small {
  font-size: 0.88rem;
  margin-bottom: 4px;
}

.filter-bar, .staff-form-inline {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* Inputs & Buttons */
.input-field {
  font-family: inherit;
  font-size: 0.98rem;
  padding: 9px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
  background: #fff;
}

.input-field:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(230, 0, 18, 0.1);
}

.input-field.full-width {
  width: 100%;
}

.qty-input {
  width: 86px;
  text-align: center;
  font-weight: 700;
  font-size: 1.02rem;
  padding: 8px 8px;
}

.btn {
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.18s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.btn-sm {
  padding: 7px 14px;
  font-size: 0.9rem;
  border-radius: 8px;
}

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

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

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

.btn-success:hover {
  background: #15803d;
}

.btn-outline {
  background: #fff;
  color: var(--text-main);
  border: 1px solid #cbd5e1;
}

.btn-outline:hover {
  background: #f1f5f9;
}

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

.btn-danger:hover {
  background: #fecaca;
}

/* Table */
.table-responsive {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.stock-table,
.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.stock-table th,
.stock-table td,
.data-table th,
.data-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
  font-size: 0.98rem;
}

.stock-table tbody tr:last-child td,
.data-table tbody tr:last-child td {
  border-bottom: none;
}

.stock-table th,
.data-table th {
  background: #f8fafc;
  font-size: 0.92rem;
  font-weight: 700;
  color: #334155;
  white-space: nowrap;
}

.stock-table tbody tr:hover,
.data-table tbody tr:hover {
  background: #f8fafc;
}

.text-center { text-align: center !important; }
.text-right { text-align: right !important; }

/* Unit Badges (ลัง / แพ็ค / ชิ้น) */
.unit-pills {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  flex-wrap: nowrap;
  justify-content: center;
}

.unit-pill {
  padding: 5px 11px;
  border-radius: 7px;
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
}

.unit-pill.box {
  background: #fee2e2;
  color: #b91c1c;
}

.unit-pill.pack {
  background: #e0f2fe;
  color: #0369a1;
}

.unit-pill.piece {
  background: #f3e8ff;
  color: #6d28d9;
}

.status-badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-ok {
  background: var(--success-light);
  color: var(--success);
}

.status-restock {
  background: #e0f2fe;
  color: #0369a1;
}

.status-low {
  background: var(--warning-light);
  color: var(--warning);
}

.status-out {
  background: var(--danger-light);
  color: var(--danger);
}

.category-tag {
  font-size: 0.88rem;
  font-weight: 500;
  background: #f1f5f9;
  color: #475569;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
}

/* Admin Banner */
.admin-banner {
  background: var(--primary-light);
  border: 1px solid #fecdd3;
  padding: 14px 18px;
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.admin-banner strong {
  color: var(--primary);
  display: block;
  font-size: 1.08rem;
}

.admin-banner span {
  font-size: 0.94rem;
  color: #475569;
}

/* History Cards */
.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 18px;
  background: #fcfcfd;
}

.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.history-type {
  font-weight: 600;
  font-size: 0.92rem;
  padding: 3px 10px;
  border-radius: 6px;
}

.history-type.check {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #86efac;
}

.history-type.restock {
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #7dd3fc;
}

.history-items {
  font-size: 0.88rem;
  color: #334155;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 6px;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-card {
  background: #fff;
  border-radius: 14px;
  max-width: 620px;
  width: 100%;
  padding: 24px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  max-height: 92vh;
  overflow-y: auto;
}

.modal-card.modal-sm {
  max-width: 400px;
}

.modal-card h3 {
  margin-bottom: 12px;
}

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

.form-group label {
  display: block;
  font-size: 0.86rem;
  font-weight: 500;
  margin-bottom: 5px;
}

.req {
  color: var(--primary);
}

.form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.unit-config-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 16px;
}

.unit-config-box h4 {
  font-size: 0.95rem;
  margin-bottom: 4px;
}

.price-preview {
  background: #fff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.86rem;
  font-weight: 600;
  color: #0369a1;
  border: 1px dashed #bae6fd;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--primary);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

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

.category-manage-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 4px;
}

.category-manage-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.category-manage-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.category-count-badge {
  font-size: 0.75rem;
  background: #e2e8f0;
  color: #475569;
  padding: 2px 8px;
  border-radius: 12px;
}

.analytics-summary-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.analytics-stat-box {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 18px;
}

.analytics-stat-box.highlight {
  background: #fff0f1;
  border-color: #fecdd3;
}

.analytics-stat-box .stat-title {
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--text-muted);
  display: block;
}

.analytics-stat-box h3 {
  font-size: 1.45rem;
  font-weight: 700;
  margin-top: 4px;
  color: var(--text-main);
}

.analytics-stat-box.highlight h3 {
  color: var(--primary);
}

.order-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.order-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  background: #f1f5f9;
  color: #334155;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 6px;
}

.btn-order {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #334155;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  transition: all 0.15s;
}

.btn-order:hover:not(:disabled) {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-order:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* 7-Day Stock Matrix */
.matrix-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 12px;
}

.matrix-mode-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.matrix-mode-btn {
  background: #fff;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.matrix-mode-btn.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.matrix-week-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.matrix-range-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  padding: 0 6px;
}

.matrix-legend {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: #475569;
  margin-bottom: 14px;
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
}

.legend-dot.restock {
  background: #0284c7;
}

.legend-dot.spike {
  background: #f97316;
}

.matrix-table th,
.matrix-table td {
  padding: 10px 10px;
  font-size: 0.92rem;
}

.matrix-cell-spike {
  background: #fff7ed !important;
  border-left: 3px solid #f97316;
}

.matrix-restock-badge {
  display: inline-block;
  margin-top: 3px;
  padding: 3px 7px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 4px;
  background: #e0f2fe;
  color: #0369a1;
}

.matrix-spike-badge {
  display: inline-block;
  margin-top: 3px;
  padding: 3px 7px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 4px;
  background: #ffedd5;
  color: #c2410c;
}

.matrix-table tfoot td {
  background: #f8fafc;
  font-weight: 700;
  border-top: 2px solid #cbd5e1;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 18px;
}

.settings-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
}

.settings-card h4 {
  font-size: 1.12rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.day-record-banner {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 12px 18px;
  margin-bottom: 16px;
  font-size: 0.96rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.day-record-banner.recorded {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #166534;
}

.day-record-banner.recorded-restock {
  background: #f0f9ff;
  border-color: #bae6fd;
  color: #0369a1;
}

.day-record-banner.past-admin {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}

.color-picker-input {
  width: 36px;
  height: 36px;
  padding: 2px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  flex-shrink: 0;
}

#overviewTableFoot td {
  background: #fff0f1;
  border-top: 2px solid #fecdd3;
  font-weight: 700;
  padding: 14px;
}

/* ==========================================
   Combined Calendar Date Picker & Popup
========================================== */

.date-picker-bar {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f8fafc;
  padding: 4px 8px;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
}

.btn-calendar-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 7px 14px;
  font-family: inherit;
  font-size: 0.96rem;
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-calendar-trigger:hover:not(:disabled) {
  border-color: var(--mixue-red);
  color: var(--mixue-red);
  background: #fff0f1;
}

.btn-calendar-trigger:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.btn-date-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  font-size: 0.78rem;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-date-step:hover:not(:disabled) {
  border-color: var(--mixue-red);
  color: var(--mixue-red);
  background: #fff0f1;
}

.btn-date-step:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-date-today {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  border-radius: 7px;
  padding: 5px 10px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-date-today:hover:not(:disabled) {
  border-color: var(--mixue-red);
  color: var(--mixue-red);
  background: #fff0f1;
}

.btn-date-today:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.calendar-native-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  margin-bottom: 10px;
}

.calendar-month-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 4px;
  margin-bottom: 6px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.calendar-weekdays {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: #64748b;
  margin-bottom: 4px;
}

.calendar-weekdays .sun {
  color: #dc2626;
}

.calendar-weekdays .sat {
  color: #2563eb;
}

.calendar-day-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 46px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.12s ease;
  position: relative;
  padding: 2px;
}

.calendar-day-btn:hover:not(:disabled) {
  border-color: var(--mixue-red);
  background: #fff0f1;
}

.calendar-day-btn.today {
  border-color: #f59e0b;
  background: #fffbeb;
}

.calendar-day-btn.selected {
  background: var(--mixue-red);
  border-color: var(--mixue-red);
  color: #ffffff;
}

.calendar-day-btn:disabled {
  opacity: 0.32;
  background: #f1f5f9;
  cursor: not-allowed;
}

.calendar-day-empty {
  height: 46px;
}

.cal-dots-row {
  display: flex;
  gap: 3px;
  margin-top: 3px;
  height: 6px;
  align-items: center;
}

.cal-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.cal-dot.check {
  background: #16a34a;
}

.cal-dot.restock {
  background: #0284c7;
}

.cal-dot.empty {
  background: #cbd5e1;
}

.calendar-day-btn.selected .cal-dot.check {
  background: #86efac;
}

.calendar-day-btn.selected .cal-dot.restock {
  background: #7dd3fc;
}

.calendar-legend {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: #475569;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
}

.calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* ==========================================
   Main Module Switcher & Daily Cash Closing
========================================== */

.module-switcher-bar {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px 20px;
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}

.module-switcher-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 1.04rem;
}

.module-switcher-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.module-switch-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 2px solid #cbd5e1;
  background: #f8fafc;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: all 0.18s ease;
}

.module-switch-btn:hover {
  border-color: #94a3b8;
  background: #ffffff;
}

.module-switch-btn.active {
  border-color: var(--mixue-red);
  background: #fff0f1;
  box-shadow: 0 3px 10px rgba(230, 0, 18, 0.12);
}

.module-icon {
  font-size: 1.75rem;
  line-height: 1;
}

.module-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
}

.module-switch-btn.active .module-title {
  color: var(--mixue-red);
}

.module-desc {
  font-size: 0.86rem;
  color: #64748b;
}

.cash-closing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.cash-box-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.cash-box-header {
  padding-bottom: 10px;
  margin-bottom: 14px;
  border-bottom: 2px solid #f1f5f9;
}

.cash-box-header h4 {
  margin: 0 0 2px 0;
  font-size: 1.15rem;
}

.cash-box-header.pos-header h4 {
  color: #0369a1;
}

.cash-box-header.actual-header h4 {
  color: #15803d;
}

.cash-input-group {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.cash-input-group.highlight-total {
  background: #f0f9ff;
  border-color: #bae6fd;
}

.currency-input-wrap {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 10px;
}

.currency-input-wrap:focus-within {
  border-color: var(--mixue-red);
  box-shadow: 0 0 0 2px rgba(230, 0, 18, 0.12);
}

.currency-prefix {
  font-weight: 700;
  font-size: 1.02rem;
  color: #64748b;
  margin-right: 6px;
  user-select: none;
}

.currency-input-wrap .input-field {
  border: none !important;
  box-shadow: none !important;
  padding: 9px 6px;
  text-align: right;
  font-weight: 700;
  font-size: 1.08rem;
  width: 100%;
  background: transparent;
}

.cash-channels-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.cash-channel-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: #f8fafc;
  padding: 9px 14px;
  border-radius: 9px;
  border: 1px solid #e2e8f0;
}

.cash-channel-row.compact {
  background: #ffffff;
  padding: 7px 12px;
  margin-bottom: 6px;
}

.cash-channel-row label {
  font-size: 0.98rem;
  font-weight: 600;
  color: #334155;
}

.cash-channel-row .currency-input-wrap {
  width: 190px;
  flex-shrink: 0;
}

.delivery-sub-box {
  background: #f0f9ff;
  border: 1px dashed #7dd3fc;
  border-radius: 10px;
  padding: 12px 14px;
}

.denom-section {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
}

.denom-section-title {
  font-weight: 700;
  font-size: 1rem;
  color: #1e293b;
  margin-bottom: 10px;
}

.denom-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.denom-subtitle {
  font-size: 0.92rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 8px;
}

.denom-row {
  display: grid;
  grid-template-columns: 86px 82px 1fr;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
}

.denom-badge {
  display: inline-block;
  text-align: center;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 700;
  background: #e2e8f0;
  color: #1e293b;
}

.denom-badge.note-1000 { background: #f3e8ff; color: #6b21a8; }
.denom-badge.note-500  { background: #ede9fe; color: #5b21b6; }
.denom-badge.note-100  { background: #fee2e2; color: #b91c1c; }
.denom-badge.note-50   { background: #e0f2fe; color: #0369a1; }
.denom-badge.note-20   { background: #dcfce7; color: #15803d; }
.denom-badge.coin-10   { background: #fef3c7; color: #b45309; }
.denom-badge.coin-5    { background: #f1f5f9; color: #334155; }
.denom-badge.coin-2    { background: #fef9c3; color: #854d0e; }
.denom-badge.coin-1    { background: #f1f5f9; color: #475569; }
.denom-badge.coin-satang { background: #ffedd5; color: #9a3412; font-size: 0.78rem; }

.denom-input {
  text-align: center;
  padding: 6px 8px !important;
  font-size: 0.98rem !important;
  font-weight: 700;
}

.denom-sum {
  text-align: right;
  font-size: 0.92rem;
  font-weight: 600;
  color: #334155;
}

.drawer-float-box {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #cbd5e1;
}

.drawer-float-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.96rem;
}

.drawer-float-row.net-row {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #e2e8f0;
}

.cash-summary-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-radius: 10px;
  margin-top: auto;
}

.cash-summary-banner.pos-summary {
  background: #e0f2fe;
  border: 1px solid #7dd3fc;
  color: #0c4a6e;
}

.cash-summary-banner.actual-summary {
  background: #dcfce7;
  border: 1px solid #86efac;
  color: #14532d;
}

.cash-summary-amount {
  font-size: 1.25rem;
  font-weight: 800;
}

.cash-verification-section {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 18px 20px;
}

.cash-action-buttons {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.btn-lg-action {
  padding: 12px 24px;
  font-size: 0.98rem;
  font-weight: 700;
}

.cash-verification-card {
  margin-top: 16px;
  padding: 16px 20px;
  border-radius: 12px;
  border: 2px solid #cbd5e1;
  background: #f8fafc;
}

.cash-verification-card.match-exact,
.cash-verification-card.status-exact {
  background: #f0fdf4;
  border-color: #4ade80;
}

.cash-verification-card.match-short,
.cash-verification-card.status-short {
  background: #fef2f2;
  border-color: #f87171;
}

.cash-verification-card.match-over,
.cash-verification-card.status-over {
  background: #fffbeb;
  border-color: #fbbf24;
}

.verify-headline {
  font-size: 1.05rem;
  font-weight: 800;
  padding: 10px 14px;
  border-radius: 9px;
  margin-bottom: 12px;
}

.verify-headline.exact {
  background: #dcfce7;
  color: #15803d;
}

.verify-headline.short {
  background: #fee2e2;
  color: #b91c1c;
}

.verify-headline.over {
  background: #fef3c7;
  color: #b45309;
}

.verify-compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.verify-compare-box,
.verify-stat-item {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
}

.verify-compare-box .v-title {
  font-weight: 700;
  font-size: 0.92rem;
  color: #1e293b;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #f1f5f9;
}

.verify-compare-box .v-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.86rem;
  margin-bottom: 6px;
  color: #475569;
}

.verify-compare-box .v-line.total {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed #cbd5e1;
  font-weight: 700;
  color: #0f172a;
}

.day-record-banner {
  padding: 11px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  border: 1px solid #e2e8f0;
}

.day-record-banner.done {
  background: #f0fdf4;
  border-color: #86efac;
  color: #14532d;
}

.day-record-banner.pending {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

/* Manual Daily Usage Inputs in Average Usage Table */
.manual-usage-group {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: nowrap;
}

.manual-unit-box {
  display: inline-flex;
  align-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #ffffff;
  overflow: hidden;
}

.manual-unit-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(230, 0, 18, 0.12);
}

.manual-unit-input {
  width: 56px;
  border: none;
  padding: 6px 7px;
  text-align: right;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  color: #0f172a;
  outline: none;
  background: transparent;
}

.manual-unit-label {
  background: #f1f5f9;
  color: #475569;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 6px 8px;
  border-left: 1px solid #e2e8f0;
  white-space: nowrap;
}

/* ==========================================
   Full-Screen Login Overlay & User Permissions
========================================== */

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: linear-gradient(135deg, #fff1f2 0%, #f8fafc 50%, #f0f9ff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  padding: 28px 28px 24px;
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.12);
}

.login-brand {
  text-align: center;
  margin-bottom: 22px;
}

.login-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 10px;
  background: #fff0f1;
  border: 2px solid #fecdd3;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.1rem;
}

.login-brand h2 {
  margin: 0 0 4px;
  font-size: 1.35rem;
  color: #0f172a;
}

.login-error-msg {
  background: #fef2f2;
  border: 1px solid #f87171;
  color: #b91c1c;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.login-quick-hint {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px dashed #cbd5e1;
}

.login-demo-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.login-demo-pill {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 5px 10px;
  font-family: inherit;
  font-size: 0.78rem;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.login-demo-pill:hover {
  border-color: var(--primary);
  background: #fff0f1;
  color: var(--primary);
}

.perm-checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  cursor: pointer;
}

.perm-checkbox-row input[type='checkbox'] {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  accent-color: var(--primary);
  cursor: pointer;
}

.hidden {
  display: none !important;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  z-index: 200;
  font-size: 0.92rem;
}
