/* Business POS console.
 *
 * Same tokens as the shop dashboard, so the vendor's screen and the customer's
 * screen look like one product rather than two tools that happen to share a
 * logo. Both themes are defined here; the theme is applied on <html> before
 * first paint. */

:root {
  --bg: #f6f7fb;
  --bg-elevated: #ffffff;
  --bg-sunken: #eef0f6;
  --bg-hover: #f2f4f9;
  --border: #e3e7ef;
  --border-strong: #cfd6e4;
  --text: #131722;
  --text-muted: #5b6478;
  --text-subtle: #8a93a6;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-soft: #eef0fe;
  --success: #0f9d58;
  --success-soft: #e7f6ee;
  --warning: #b45309;
  --warning-soft: #fdf3e3;
  --danger: #d92d20;
  --danger-soft: #fdeceb;
  --info: #0e7490;
  --info-soft: #e5f6fa;
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.08), 0 1px 3px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 16px 40px rgba(16, 24, 40, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --font-sans: "Inter", "IBM Plex Sans Arabic", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg: #0b0d13;
  --bg-elevated: #12151e;
  --bg-sunken: #0e1017;
  --bg-hover: #1a1f2b;
  --border: #232936;
  --border-strong: #323b4d;
  --text: #eef1f8;
  --text-muted: #9aa3b8;
  --text-subtle: #6b7488;
  --accent: #7c7bef;
  --accent-hover: #9391f5;
  --accent-soft: #1c1d3a;
  --success: #34d399;
  --success-soft: #10281f;
  --warning: #fbbf24;
  --warning-soft: #2a2110;
  --danger: #f87171;
  --danger-soft: #2c1315;
  --info: #38bdf8;
  --info-soft: #0d2430;
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.55);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; color: inherit; }

/* ---------- shell ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}
.brand-sub { color: var(--text-subtle); font-weight: 400; font-size: 12px; }

.spacer { flex: 1; }

.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--ease) 160ms, color var(--ease) 160ms;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }

.page { max-width: 1180px; margin: 0 auto; padding: 26px 22px 60px; }

/* ---------- summary ---------- */

.summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(158px, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.stat {
  padding: 14px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.stat-label { color: var(--text-muted); font-size: 12px; }
.stat-value { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat-value.warn { color: var(--warning); }
.stat-value.bad { color: var(--danger); }
.stat-value.good { color: var(--success); }

/* ---------- table ---------- */

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

table { width: 100%; border-collapse: collapse; }

thead th {
  text-align: start;
  padding: 11px 16px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-sunken);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--bg-hover); }

.shop { font-weight: 500; }
.shop-code { color: var(--text-subtle); font-size: 12px; font-family: var(--font-mono); }

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.badge.good { background: var(--success-soft); color: var(--success); }
.badge.warn { background: var(--warning-soft); color: var(--warning); }
.badge.bad { background: var(--danger-soft); color: var(--danger); }
.badge.muted { background: var(--bg-sunken); color: var(--text-muted); }

.num { font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-size: 13px; }

.actions { display: flex; gap: 6px; flex-wrap: wrap; }

.btn {
  padding: 5px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-size: 12.5px;
  cursor: pointer;
  transition: background var(--ease) 160ms, border-color var(--ease) 160ms;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- login ---------- */

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login {
  width: 100%;
  max-width: 380px;
  padding: 28px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}
.login h1 { margin: 0 0 4px; font-size: 18px; font-weight: 600; }
.login p.sub { margin: 0 0 22px; color: var(--text-muted); font-size: 13px; }

.field { margin-bottom: 14px; }
.field label { display: block; margin-bottom: 5px; font-size: 12.5px; color: var(--text-muted); }
.field input {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
}
.field input:focus { border-color: var(--accent); }

.alert {
  padding: 9px 12px;
  margin-bottom: 14px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
}

/* ---------- dialog ---------- */

dialog {
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  max-width: 460px;
  width: calc(100vw - 40px);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.55); }
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.dialog-body { padding: 20px; }
.dialog-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

.hint { color: var(--text-subtle); font-size: 12px; margin-top: 4px; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  margin-bottom: 18px;
}
.detail-grid div span { display: block; color: var(--text-muted); font-size: 12px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.timeline li:last-child { border-bottom: 0; }
.timeline .when { color: var(--text-subtle); white-space: nowrap; font-family: var(--font-mono); font-size: 11.5px; }

.empty { padding: 46px 20px; text-align: center; color: var(--text-muted); }

.section-title { margin: 20px 0 10px; font-size: 13px; font-weight: 500; color: var(--text-muted); }

@media (max-width: 720px) {
  thead { display: none; }
  tbody tr { display: block; padding: 12px 14px; border-bottom: 1px solid var(--border); }
  tbody td { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border: 0; }
  tbody td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 12px;
  }
  .actions { justify-content: flex-end; }
}

/* A text button, for actions that must not compete with the primary one. */
.link-btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 6px;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 12.5px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.link-btn:hover { color: var(--accent); }

/* Separator between the password form and Google, so the two ways in read as
   alternatives rather than one form with a stray button under it. */
.or-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 14px;
  color: var(--text-subtle);
  font-size: 12px;
}
.or-divider::before,
.or-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.google-slot {
  display: flex;
  justify-content: center;
  min-height: 40px;
}
