/* =====================================================================
   BUSINESS DASHBOARD - MAIN STYLESHEET
   ---------------------------------------------------------------------
   All colors are stored as CSS variables so the whole theme can be
   changed from one place. The layout uses CSS Grid + Flexbox so it
   automatically adapts to phones, tablets and desktops.
   ===================================================================== */

/* ---------- 1. THEME TOKENS (change colors here) ---------- */
:root {
  --bg-page:        #121317;   /* full page background (almost black) */
  --bg-header:      #202a4d;   /* navy header bar */
  --bg-panel:      #232d52;   /* navy panel behind transaction cards */
  --bg-card-warm:   #6d5750;   /* brown card */
  --bg-card-cool:   #565b66;   /* slate-gray card */
  --bg-surface:     #1b1d24;   /* dark surface for order cards */
  --bg-input:       #2a2d38;   /* input / table fill */
  --line:           #3a4266;   /* border lines */

  --text-main:      #f2f3f7;   /* main light text */
  --text-dim:       #aeb3c2;   /* secondary text */
  --accent:         #e0555f;   /* red accent (logo, contact, danger) */
  --accent-2:       #4c8dff;   /* blue accent (primary actions) */
  --success:        #35b57e;   /* green (finished orders) */
  --warning:        #e2a63a;   /* amber (pending orders) */

  --radius:         10px;
  --radius-sm:      6px;
  --gap:            16px;
  --maxw:           1180px;
  --shadow:         0 6px 20px rgba(0,0,0,.35);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Noto Sans Bengali", sans-serif;
}

/* ---------- 2. GLOBAL RESET ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg-page);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Utility container to keep content centered and readable */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }

img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: 14px; }
a { color: inherit; text-decoration: none; }

/* Respect users who prefer less motion */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- 3. BUTTONS ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line);
  background: var(--bg-input);
  color: var(--text-main);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
}
.btn:hover  { background: #333744; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

.btn-primary { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.btn-primary:hover { background: #3d7be6; }
.btn-danger  { background: transparent; border-color: var(--accent); color: var(--accent); }
.btn-danger:hover { background: rgba(224,85,95,.12); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-ghost   { background: transparent; }
.btn-sm { padding: 5px 10px; font-size: 13px; }
.btn-icon { padding: 6px 9px; }

/* ---------- 4. SIDEBAR LAYOUT ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 240px; flex-shrink: 0; background: var(--bg-header);
  border-right: 1px solid var(--line);
  position: fixed; top: 0; left: 0; height: 100vh; z-index: 60;
  display: flex; flex-direction: column;
}
.sidebar-logo { padding: 16px; border-bottom: 1px solid var(--line); }
.side-nav { flex: 1; overflow-y: auto; padding: 12px 10px; display: flex; flex-direction: column; gap: 4px; }
.sidebar-foot {
  border-top: 1px solid var(--line); padding: 12px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}

.main-area { flex: 1; margin-left: 240px; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40; background: var(--bg-header);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
}
.topbar-title { font-weight: 700; color: var(--text-main); }
.sidebar-backdrop {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 55;
}

/* Logo box (editable text/image) */
.logo-box {
  background: #ffffff; color: var(--accent);
  font-weight: 800; letter-spacing: .5px;
  padding: 4px 12px; border-radius: var(--radius-sm);
  cursor: pointer; user-select: none;
  display: flex; align-items: center; justify-content: center; min-height: 48px;
}
.logo-img { max-height: 60px; max-width: 100%; display: block; border-radius: 4px; }

/* Sidebar navigation links (vertical) */
.side-nav .nav-link {
  display: block; width: 100%; padding: 11px 14px; border-radius: var(--radius-sm);
  color: var(--text-main); cursor: pointer; border: 1px solid transparent; white-space: nowrap;
  font-size: 15px;
}
.side-nav .nav-link:hover { background: rgba(255,255,255,.08); }
.side-nav .nav-link.active { background: var(--accent-2); border-color: var(--accent-2); }

/* username row (used inside the sidebar) hidden by default */
.nav-user { display: none; }

.header-user { display: flex; align-items: center; gap: 8px; }
.user-chip {
  font-size: 12px; color: var(--text-dim);
  background: rgba(255,255,255,.06); padding: 6px 10px; border-radius: 20px;
}

/* Mobile menu toggle (hamburger) - hidden on desktop (sidebar always visible) */
.menu-toggle { display: none; }


/* ---------- 5. SECTION TITLES ---------- */
.section { padding: 26px 0; }
.section-title {
  text-align: center; font-size: 20px; font-weight: 700;
  margin-bottom: 20px; letter-spacing: .3px;
}
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 18px; flex-wrap: wrap;
}
.section-head .section-title { margin: 0; text-align: left; }

/* ---------- 6. DAILY TRANSACTION CARDS ---------- */
.transaction-panel { background: var(--bg-panel); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }

/* Sale / Purchase / Subtotal groups */
.stat-group { margin-bottom: 20px; }
.stat-group:last-child { margin-bottom: 0; }
.stat-group-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; margin-bottom: 12px; padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
}
.stat-group-head h3 { font-size: 15px; font-weight: 700; color: var(--text-main); }
.stat-empty { color: var(--text-dim); font-size: 13px; padding: 6px 2px; }

/* transaction date */
.trans-date-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.trans-date { font-size: 14px; color: var(--text-dim); }
.trans-date-wrap input[type="date"] {
  background: var(--bg-input); color: var(--text-main);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 8px;
}

/* Update/Delete buttons on transaction cards */
.stat-actions { display: flex; gap: 6px; justify-content: center; margin-top: 10px; }
.stat-actions .btn { padding: 3px 10px; font-size: 12px; }

/* ---------- TEAM CHAT WIDGET ---------- */
.chat-widget { position: fixed; right: 18px; bottom: 18px; z-index: 150; }
.chat-fab {
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--accent-2); color: #fff; border: none; cursor: pointer;
  font-size: 24px; box-shadow: var(--shadow);
}
.chat-fab:hover { background: #3d7be6; }
.chat-panel {
  position: absolute; right: 0; bottom: 66px;
  width: 320px; max-width: 84vw; height: 420px; max-height: 70vh;
  background: var(--bg-surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden;
}
.chat-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; background: var(--bg-header); border-bottom: 1px solid var(--line);
  font-weight: 600;
}
.chat-head > div { display: flex; gap: 6px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.chat-msg { max-width: 80%; padding: 7px 10px; border-radius: 10px; font-size: 13px; background: var(--bg-input); }
.chat-msg .who { font-size: 11px; color: var(--accent-2); font-weight: 600; margin-bottom: 2px; }
.chat-msg .when { font-size: 10px; color: var(--text-dim); margin-top: 3px; }
.chat-msg .msg-actions { display: flex; gap: 8px; margin-top: 4px; opacity: .7; }
.chat-msg .msg-actions span { cursor: pointer; font-size: 12px; }
.chat-msg .msg-actions span:hover { opacity: 1; }
.chat-msg .edited { font-size: 10px; color: var(--text-dim); font-style: italic; }
.chat-msg.mine { align-self: flex-end; background: var(--accent-2); color: #fff; }
.chat-msg.mine .who, .chat-msg.mine .when { color: rgba(255,255,255,.85); }
.chat-input { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
.chat-input input {
  flex: 1; background: var(--bg-input); color: var(--text-main);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px;
}
/* channel selector + unread badge */
.chat-channels { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.chat-channels select {
  width: 100%; background: var(--bg-input); color: var(--text-main);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 7px 8px;
}
.chat-fab { position: relative; }
.chat-badge {
  position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px;
  background: var(--accent); color: #fff; border-radius: 10px; font-size: 11px;
  display: flex; align-items: center; justify-content: center; padding: 0 5px; font-weight: 700;
}

/* company settings form */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 620px) { .settings-grid { grid-template-columns: 1fr; } }

.card-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--gap);
}
.stat-card {
  border-radius: var(--radius-sm);
  padding: 14px 12px; text-align: center;
  position: relative; cursor: default;
  transition: transform .1s ease;
  border: 1px solid rgba(0,0,0,.15);
}
.stat-card:hover { transform: translateY(-2px); }
.stat-card.warm { background: var(--bg-card-warm); }
.stat-card.cool { background: var(--bg-card-cool); }
.stat-card.total { outline: 2px solid var(--accent-2); }
.stat-card.loss-card { outline: 2px solid var(--accent); background: rgba(224,58,58,.10); }
.stat-card.loss-card .stat-value { color: var(--accent); }

.stat-label { font-size: 13px; color: #f4eeeb; opacity: .95; margin-bottom: 6px; }
.stat-value { font-size: 20px; font-weight: 700; letter-spacing: .5px; }

/* small delete button that appears on custom cards */
.stat-card .card-del {
  position: absolute; top: 4px; right: 4px;
  width: 20px; height: 20px; line-height: 18px; text-align: center;
  border-radius: 50%; background: rgba(0,0,0,.35); color: #fff;
  font-size: 13px; cursor: pointer; display: none;
}
.stat-card:hover .card-del { display: block; }

/* ---------- 6b. BUSINESS ANALYTICS ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi-card {
  background: var(--bg-surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
}
.kpi-label { font-size: 12px; color: var(--text-dim); margin-bottom: 6px; }
.kpi-value { font-size: 22px; font-weight: 700; letter-spacing: .3px; }

.analytics-charts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.chart-card {
  background: var(--bg-surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px;
}
.chart-card h4 { font-size: 14px; margin-bottom: 12px; color: var(--text-main); }
.donut-wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.legend { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-dim); }
.legend-row { display: flex; align-items: center; gap: 8px; }
.legend .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.legend strong { color: var(--text-main); margin-left: 4px; }

.mini-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini-table th { text-align: left; color: var(--text-dim); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.mini-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); }
.mini-table tr:last-child td { border-bottom: none; }

@media (max-width: 900px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } .analytics-charts { grid-template-columns: 1fr; } }
@media (max-width: 380px) { .kpi-grid { grid-template-columns: 1fr; } }

/* daily-ledger analytics */
.loss-banner {
  background: rgba(224,58,58,.14); border: 1px solid var(--accent);
  color: var(--accent); padding: 10px 14px; border-radius: var(--radius-sm);
  margin-bottom: 14px; font-weight: 600; font-size: 14px;
}
.analytics-controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.an-days { font-size: 13px; color: var(--text-dim); display: flex; align-items: center; gap: 6px; }
.an-days input { width: 64px; background: var(--bg-input); color: var(--text-main); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 8px; }
.an-days input:disabled { opacity: .4; }
.an-search { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-dim); flex-wrap: wrap; }
.an-search input[type="date"] { background: var(--bg-input); color: var(--text-main); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 8px; }
.an-note { font-size: 12px; color: var(--text-dim); margin: -4px 0 10px; }
.an-hint { font-weight: 400; color: var(--text-dim); font-size: 11px; }
.an-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 920px; }
.an-table th { text-align: left; color: var(--text-dim); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.an-table td { padding: 8px; border-bottom: 1px solid var(--line); }
.an-table td.num, .an-table th.num { text-align: right; }
.an-table tr:last-child td { border-bottom: none; }
.an-table .loss-row { background: rgba(224,58,58,.10); }
.an-edit, .an-del { cursor: pointer; opacity: .75; }
.an-edit:hover, .an-del:hover { opacity: 1; }
.an-preview { margin: 10px 0; padding: 10px 12px; background: var(--bg-input); border-radius: var(--radius-sm); font-size: 13px; color: var(--text-dim); }

/* ---------- 7. DAILY ORDER LIST ---------- */
.order-filters {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  background: var(--bg-surface); padding: 14px; border-radius: var(--radius);
  border: 1px solid var(--line); margin-bottom: 20px;
}
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; color: var(--text-dim); }
.field input, .field select, .field textarea {
  background: var(--bg-input); color: var(--text-main);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 9px 10px; width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: 2px solid var(--accent-2); outline-offset: 0; border-color: var(--accent-2);
}

/* Pending / Finished order groups */
.order-group { margin-bottom: 24px; }
.order-group-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
}
.order-group-head h3 { font-size: 16px; font-weight: 700; }
.order-group-head.pending h3 { color: var(--warning); }
.order-group-head.finished h3 { color: var(--success); }
.order-group-count {
  font-size: 12px; padding: 2px 10px; border-radius: 20px;
  background: var(--bg-input); border: 1px solid var(--line); color: var(--text-dim);
}

/* One order block */
.order-card {
  background: var(--bg-surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; margin-bottom: 18px;
}
.order-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}
.order-meta { font-size: 14px; }
.order-meta strong { color: var(--text-main); }
.order-date { color: var(--text-dim); font-size: 14px; }

/* status badge */
.badge {
  font-size: 12px; padding: 3px 10px; border-radius: 20px; font-weight: 600;
}
.badge.pending  { background: rgba(226,166,58,.15); color: var(--warning); border: 1px solid var(--warning); }
.badge.finished { background: rgba(53,181,126,.15); color: var(--success); border: 1px solid var(--success); }

/* order items table */
.order-table { width: 100%; border-collapse: collapse; margin-top: 6px; overflow: hidden; border-radius: var(--radius-sm); }
.order-table th {
  background: var(--bg-card-warm); color: #fff; text-align: left;
  padding: 10px 12px; font-size: 13px; font-weight: 600;
}
.order-table td {
  background: var(--bg-input); padding: 8px 12px; font-size: 14px;
  border-bottom: 1px solid var(--line);
}
.order-table tr:last-child td { border-bottom: none; }
.order-table input, .order-table textarea {
  background: transparent; border: 1px solid transparent; color: var(--text-main);
  width: 100%; padding: 4px 6px; border-radius: 4px; resize: vertical;
}
.order-table input:focus, .order-table textarea:focus { border-color: var(--accent-2); outline: none; background: rgba(0,0,0,.2); }
.col-sl   { width: 70px; }
.col-qty  { width: 80px; }
.col-unit { width: 90px; }
.row-del  { color: var(--accent); cursor: pointer; text-align: center; }

.order-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* ---------- 7b. DAILY PAYMENT (7-day tables) ---------- */
.pay-day-tabs {
  display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 16px;
}
.pay-tab {
  background: var(--bg-input); color: var(--text-dim); border: 1px solid var(--line);
  border-radius: 20px; padding: 6px 14px; font-size: 12.5px; cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.pay-tab:hover { background: rgba(255,255,255,.08); color: var(--text-main); }
.pay-tab.active { background: var(--accent-2); border-color: var(--accent-2); color: #fff; font-weight: 600; }
.pay-tab.is-today:not(.active) { border-color: var(--accent-2); color: var(--accent-2); }
.pay-tab-today-jump { background: transparent; border-style: dashed; color: var(--text-dim); }
.pay-tab-today-jump:hover { color: var(--text-main); }
/* days filtered out by the tab picker are fully hidden (header + table) */
.pay-day-filtered { display: none; }

.pay-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);  /* two tables per row on desktop */
  gap: 18px;
}
.pay-grid.pay-grid-single { grid-template-columns: 1fr; max-width: 640px; }
.pay-day {
  background: var(--bg-surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px;
}
.pay-date {
  font-weight: 700; font-size: 15px; margin-bottom: 10px;
  color: var(--text-main); padding-bottom: 8px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
/* collapsed day hides its table */
.pay-collapsed table, .pay-collapsed .pay-add-row, .pay-collapsed tfoot { display: none; }
/* highlight today's payment table */
.pay-today { outline: 2px solid var(--accent-2); box-shadow: 0 0 0 4px rgba(76,141,255,.12); }
.pay-today .pay-date { color: var(--accent-2); }
.today-badge {
  background: var(--accent-2); color: #fff; font-size: 10px; font-weight: 700;
  padding: 2px 8px; border-radius: 20px; margin-left: 6px; vertical-align: middle;
}
.pay-table { width: 100%; border-collapse: collapse; }
.pay-table th {
  background: var(--bg-card-cool); color: #fff; text-align: left;
  padding: 8px 10px; font-size: 12px; font-weight: 600;
}
.pay-table td { background: var(--bg-input); padding: 6px 10px; font-size: 13px; border-bottom: 1px solid var(--line); }
.pay-table input {
  background: transparent; border: 1px solid transparent; color: var(--text-main);
  width: 100%; padding: 4px 6px; border-radius: 4px;
}
.pay-table input:focus { border-color: var(--accent-2); outline: none; background: rgba(0,0,0,.2); }
.col-amt { width: 110px; }
.pay-table td.col-amt input { text-align: right; }

/* footer rows: subtotal / cash on hand / balance */
.pay-table tfoot td { background: #262a36; font-weight: 600; }
.pay-table tfoot .foot-label { color: var(--text-dim); font-weight: 600; }
.pay-table tfoot .foot-value { text-align: right; }
.pay-table tfoot .balance-row td { color: var(--accent-2); border-top: 2px solid var(--line); }
/* pay day header flex and toggle */
.pay-date {
  font-weight: 700; font-size: 15px; margin-bottom: 10px;
  color: var(--text-main); padding-bottom: 8px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
/* collapsed day hides its table */
.pay-collapsed table, .pay-collapsed .pay-add-row, .pay-collapsed tfoot { display: none; }

/* ---------- 9. FOOTER ---------- */
.site-footer {
  background: var(--bg-header); border-top: 1px solid var(--line);
  margin-top: 30px; padding: 26px 0;
}
.footer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.footer-grid h4 { margin-bottom: 8px; font-size: 15px; }
.footer-grid p, .footer-grid a { color: var(--text-dim); font-size: 14px; }
.footer-bottom { text-align: center; color: var(--text-dim); font-size: 13px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }

/* ---------- 10. MODAL (popup) ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  display: none; align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--bg-surface); border: 1px solid var(--line);
  border-radius: var(--radius); width: 100%; max-width: 460px; padding: 22px; box-shadow: var(--shadow);
}
.modal h3 { margin-bottom: 14px; }
.modal .field { margin-bottom: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* ---------- 11. TOAST (notification) ---------- */
/* App update banner (shown when a new version is waiting) */
.update-banner {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  z-index: 210; background: var(--bg-header); border: 1px solid var(--accent-2);
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
  border-radius: var(--radius); padding: 12px 16px;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  max-width: calc(100vw - 32px);
}
.update-banner-actions { display: flex; gap: 8px; }
@media (max-width: 480px) { .update-banner { flex-direction: column; align-items: stretch; text-align: center; } }

.toast-wrap { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #2a2d38; border: 1px solid var(--line); border-left: 4px solid var(--accent-2);
  padding: 12px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow);
  animation: slideIn .2s ease;
}
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- 12. ADMIN PANEL ---------- */
.admin-table { width: 100%; border-collapse: collapse; }
.admin-table th, .admin-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); font-size: 14px; }
.admin-table th { color: var(--text-dim); font-weight: 600; }
.role-pill { font-size: 12px; padding: 2px 10px; border-radius: 20px; background: var(--bg-input); border: 1px solid var(--line); }
.hidden { display: none !important; }

/* ---------- 13. LOGIN PAGE ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: var(--bg-surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 30px; width: 100%; max-width: 380px; box-shadow: var(--shadow); }
.login-card h1 { text-align: center; font-size: 22px; margin-bottom: 4px; }
.login-card .sub { text-align: center; color: var(--text-dim); font-size: 13px; margin-bottom: 22px; }
.login-card .field { margin-bottom: 14px; }
.login-hint { font-size: 12px; color: var(--text-dim); text-align: center; margin-top: 14px; line-height: 1.7; }

/* =====================================================================
   14. RESPONSIVE BREAKPOINTS  (tablet + mobile)
   ===================================================================== */

/* Tablet: 2 columns instead of 4 */
@media (max-width: 900px) {
  .card-grid   { grid-template-columns: repeat(2, 1fr); }
  .order-filters { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .pay-grid    { grid-template-columns: 1fr; }
}

/* Mobile: single column + hamburger menu */
/* ---------- Sidebar becomes a drawer on tablets/phones ---------- */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; max-width: 100vw; }
  .menu-toggle { display: inline-flex; }
  .sidebar-backdrop.show { display: block; }
  /* hide sidebar fully when closed, to save space */
  .sidebar:not(.open) { display: none; }
  .topbar { justify-content: space-between; }
  .topbar-title { margin-right: auto; }
}

@media (max-width: 620px) {
  .logo-img { max-height: 52px; }
  .card-grid    { grid-template-columns: repeat(2, 1fr); }
  .order-filters{ grid-template-columns: 1fr; }
  .footer-grid  { grid-template-columns: 1fr; }
  .section-title{ font-size: 18px; }

  /* Let wide order tables scroll sideways instead of breaking layout */
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .order-table  { min-width: 560px; }

  /* Mobile: hide sidebar by default */
  .sidebar { transform: translateX(-100%); } 
}

@media (max-width: 380px) {
  .card-grid { grid-template-columns: 1fr; }
}
