/* ===== ADMIN BODY ===== */
.admin-body {
  background: #f0f2f5;
  min-height: 100vh;
  font-family: var(--font-th);
  color: var(--text);
}

/* ===== TOP BAR ===== */
.admin-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  height: 56px;
  background: var(--primary-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.admin-topbar-left { display: flex; align-items: center; gap: 14px; }
.sidebar-toggle {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  font-size: 20px;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: background 0.2s;
  display: none;
}
.sidebar-toggle:hover { background: rgba(255,255,255,0.1); }
.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.admin-brand img {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
}
.admin-brand span {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
}
.admin-brand em {
  font-style: normal;
  font-size: 12px;
  font-weight: 400;
  color: var(--accent);
  display: block;
  line-height: 1;
  margin-top: 2px;
}
.admin-topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar-btn {
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.85);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.2s;
  white-space: nowrap;
}
.topbar-btn:hover { background: var(--accent); color: var(--primary-dark); }
.topbar-date { font-size: 12px; color: rgba(255,255,255,0.5); white-space: nowrap; }

/* ===== LAYOUT ===== */
.admin-wrap {
  display: flex;
  margin-top: 56px;
  min-height: calc(100vh - 56px);
}

/* ===== SIDEBAR ===== */
.bo-sidebar {
  width: 230px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--border);
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow-y: auto;
  scrollbar-width: thin;
  padding: 16px 0;
}
.bo-nav { padding: 0; }
.bo-nav-group { margin-bottom: 6px; }
.bo-nav-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--gray);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 18px 4px;
}
.bo-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s;
}
.bo-nav-item:hover { background: #f5f7fa; color: var(--primary); }
.bo-nav-item.active {
  background: rgba(26,58,107,0.08);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 600;
}
.nav-icon { font-size: 16px; flex-shrink: 0; }

/* ===== MAIN ===== */
.bo-main {
  flex: 1;
  min-width: 0;
  padding: 28px 32px;
  overflow-x: hidden;
}

/* ===== SECTIONS ===== */
.bo-section { display: none; }
.bo-section.active { display: block; }

.bo-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.bo-page-header h1 {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
  margin: 0 0 4px;
}
.bo-page-header p { font-size: 13px; color: var(--gray); margin: 0; }

/* ===== CARD ===== */
.bo-card {
  background: #fff;
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  border: 1px solid var(--border);
}
.bo-card h3 { font-size: 16px; font-weight: 700; color: var(--primary); margin: 0 0 4px; }

/* ===== DASHBOARD ===== */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}
.dash-stat-card {
  background: #fff;
  border-radius: 14px;
  padding: 20px;
  text-align: center;
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  transition: box-shadow 0.2s, transform 0.2s;
  cursor: default;
}
.dash-stat-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.1); transform: translateY(-2px); }
.dash-stat-card.accent { border-color: var(--accent); background: #fffbf0; }
.ds-icon { font-size: 32px; margin-bottom: 8px; }
.ds-val { font-size: 28px; font-weight: 800; color: var(--primary); }
.ds-label { font-size: 12px; color: var(--gray); margin-top: 4px; }
.quick-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.ql-btn {
  background: var(--light-gray);
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}
.ql-btn:hover { background: var(--primary); color: #fff; }

/* ===== TABLE ===== */
.bo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.bo-table th {
  background: #f8f9fb;
  color: var(--gray);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.bo-table td {
  padding: 12px 12px;
  border-bottom: 1px solid #f0f2f5;
  vertical-align: middle;
}
.bo-table tr:last-child td { border-bottom: none; }
.bo-table tr:hover td { background: #fafbfc; }
.no-data { text-align: center; color: var(--gray); padding: 40px !important; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-th);
  border: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-secondary { background: #f1f5f9; color: var(--text); }
.btn-secondary:hover { background: #e2e8f0; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

.icon-btn {
  background: #f1f5f9;
  border: none;
  border-radius: 6px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}
.icon-btn:hover { background: #e2e8f0; }
.icon-btn.edit:hover { background: #dbeafe; }
.icon-btn.del:hover { background: #fee2e2; }

.toggle-btn {
  border: none;
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font-th);
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}
.toggle-btn.on { background: #dcfce7; color: #166534; }
.toggle-btn.off { background: #f1f5f9; color: var(--gray); }
.toggle-btn.on:hover { background: #bbf7d0; }
.toggle-btn.off:hover { background: #e2e8f0; }

/* ===== BADGES ===== */
.badge-primary { background: #dbeafe; color: var(--primary); font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 20px; display: inline-block; white-space: nowrap; }
.badge-accent { background: #fef3c7; color: #92400e; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 20px; display: inline-block; white-space: nowrap; }

/* ===== FORMS ===== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: var(--font-th);
  color: var(--text);
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,58,107,0.08);
}
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { cursor: pointer; }
.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.filter-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

/* ===== MODAL ===== */
.bo-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 500;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.bo-modal-overlay.open { display: flex; }
.bo-modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  animation: modalIn 0.2s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-20px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.bo-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}
.bo-modal-header h3 { font-size: 17px; font-weight: 700; color: var(--primary); margin: 0; }
.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--gray);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background 0.15s;
  line-height: 1;
  flex-shrink: 0;
}
.modal-close:hover { background: #f1f5f9; color: var(--danger); }
.bo-modal-body { padding: 20px 24px 24px; }

/* ===== EXPORT PAGE ===== */
.export-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: #1e293b;
  color: #fff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  animation: toastIn 0.25s ease;
  pointer-events: auto;
  max-width: 300px;
  border-left: 4px solid var(--accent);
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: #22c55e; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ===== DAILY STATUS BAR ===== */
.daily-status-bar {
  display: flex;
  align-items: center;
  gap: 20px;
  background: linear-gradient(135deg, #1a3a6b 0%, #2a5298 100%);
  border-radius: 16px;
  padding: 20px 28px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.dstatus-icon {
  width: 48px; height: 48px;
  background: rgba(255,255,255,0.15);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #fff; flex-shrink: 0;
}
.dstatus-main { display: flex; flex-direction: column; gap: 2px; }
.dstatus-label { font-size: 12px; color: rgba(255,255,255,0.65); font-weight: 500; }
.dstatus-date-big { font-size: 20px; font-weight: 800; color: #fff; line-height: 1.2; }
.dstatus-divider { width: 1px; height: 44px; background: rgba(255,255,255,0.2); flex-shrink: 0; }
.dstatus-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.dstatus-stat-num { font-size: 26px; font-weight: 800; color: #fff; line-height: 1; }
.dstatus-stat-lbl { font-size: 11px; color: rgba(255,255,255,0.6); }
.dstatus-source-wrap {
  margin-left: auto;
  background: rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 6px 16px;
  font-size: 13px; color: #fde68a; font-weight: 600;
}

/* ===== DAILY ENTRY TABLE ===== */
.daily-entry-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.daily-entry-table thead tr {
  background: var(--primary);
}
.daily-entry-table th {
  padding: 11px 10px;
  text-align: left;
  color: rgba(255,255,255,0.9);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.daily-entry-table td {
  padding: 5px 6px;
  border-bottom: 1px solid #f0f2f5;
  vertical-align: middle;
}
.daily-entry-table tr:hover td { background: #fafbfc; }
.daily-entry-table tr:nth-child(even) td { background: #f8f9fb; }
.daily-entry-table tr:nth-child(even):hover td { background: #f0f4ff; }
.det-no {
  text-align: center;
  color: #94a3b8;
  font-size: 12px;
  padding: 5px 8px;
}
.det-input {
  width: 100%;
  padding: 6px 8px;
  border: 1.5px solid transparent;
  border-radius: 6px;
  font-size: 13px;
  font-family: var(--font-th);
  color: var(--text);
  background: transparent;
  box-sizing: border-box;
  transition: border-color 0.15s, background 0.15s;
}
.det-input:hover { background: #fff; border-color: #e2e8f0; }
.det-input:focus { outline: none; background: #fff; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,58,107,0.07); }
.det-cat { cursor: pointer; }
.det-price {
  text-align: right;
  font-weight: 600;
  color: var(--primary);
}
.det-price::placeholder { color: #cbd5e1; font-weight: 400; }
.det-del-btn {
  background: none;
  border: none;
  color: #cbd5e1;
  cursor: pointer;
  font-size: 14px;
  padding: 4px 6px;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
  display: block;
  margin: 0 auto;
}
.det-del-btn:hover { background: #fee2e2; color: var(--danger); }

/* Row color for price change */
.daily-entry-table tr.det-row-up td   { background: #fff0f0 !important; }
.daily-entry-table tr.det-row-down td { background: #f0fff4 !important; }

/* Yesterday reference column */
.det-yest-col { background: #f0fdf4 !important; }
.daily-entry-table tr:nth-child(even) .det-yest-col { background: #e8fdf1 !important; }
.det-copy-btn {
  background: #16a34a;
  color: #fff;
  border: none;
  border-radius: 5px;
  font-size: 11px;
  padding: 2px 6px;
  cursor: pointer;
  line-height: 1.4;
  transition: background 0.15s, transform 0.1s;
  flex-shrink: 0;
}
.det-copy-btn:hover { background: #15803d; transform: scale(1.1); }
@keyframes detFlash {
  0%   { background: #bbf7d0; }
  100% { background: #fff; }
}
.det-price-flash { animation: detFlash 0.6s ease; }
.daily-table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: #f8f9fb;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .sidebar-toggle { display: flex; }
  .bo-sidebar {
    position: fixed;
    left: -230px;
    top: 56px;
    height: calc(100vh - 56px);
    z-index: 100;
    transition: left 0.25s ease;
    box-shadow: 2px 0 16px rgba(0,0,0,0.15);
  }
  .bo-sidebar.open { left: 0; }
  .bo-main { padding: 20px 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .export-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .dash-stats { grid-template-columns: repeat(2, 1fr); }
  .filter-row { flex-direction: column; align-items: stretch; }
  .topbar-date { display: none; }
  .bo-modal { max-width: 100%; }
}

/* ===== PAGE BANNER ADMIN TABS ===== */
.pb-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-th);
  color: var(--gray);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.pb-tab:hover { border-color: var(--primary); color: var(--primary); }
.pb-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== SHOPS ZONE CARDS ===== */
.shops-zone-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.shops-zone-card {
  border-radius: 14px;
  overflow: hidden;
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: box-shadow 0.18s, transform 0.18s;
  background: #fff;
}
.shops-zone-card:hover {
  box-shadow: 0 8px 28px rgba(0,0,0,0.12);
  transform: translateY(-3px);
}
.szc-header {
  padding: 18px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.szc-body {
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-top: 1px solid #f0f2f5;
}
.szc-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 44px;
}
.szc-num {
  font-size: 22px;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}
.szc-lbl {
  font-size: 11px;
  color: var(--gray);
  margin-top: 2px;
}
.szc-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-th);
  cursor: pointer;
  transition: opacity 0.15s;
  white-space: nowrap;
}
.szc-btn:hover { opacity: 0.85; }
@media (max-width: 600px) {
  .shops-zone-grid { grid-template-columns: 1fr 1fr; }
}

/* ===== PRICE ADD LANDING / CHOICE ===== */
.padd-choice-btn {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  background: #fff;
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 16px 20px;
  cursor: pointer;
  font-family: var(--font-th);
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.padd-choice-btn:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}
.padd-choice-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
