/* ═══════════════════════════════════════════════════════════════════════════
   Receiptile — Involink brand system
   Teal #007070 primary · Turquoise #3ECAB0 accent · Poppins head / Calibri body
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
  /* Brand */
  --teal: #007070;
  --teal-dark: #005a5a;
  --turquoise: #3ecab0;
  --turquoise-soft: #e6f7f2;
  --turquoise-tint: #d3efe8;
  /* Neutrals */
  --ink: #12201f;
  --body: #374b4a;
  --muted: #6b7c7b;
  --faint: #9aa8a7;
  --line: #e4ecea;
  --bg: #eef3f2;
  --surface: #ffffff;
  /* Shape */
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(4, 60, 58, 0.10);
  --shadow-sm: 0 1px 3px rgba(4, 60, 58, 0.07);
  /* Type */
  --font-head: "Poppins", -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body: "Calibri", "Segoe UI", system-ui, -apple-system, sans-serif;
}

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

body {
  background: var(--bg);
  font-family: var(--font-body);
  color: var(--body);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 24px 16px 48px;
  -webkit-font-smoothing: antialiased;
}

/* ═══════════════════════════════════════════════════════════════════════════
   RECEIPT PAGE
   ═══════════════════════════════════════════════════════════════════════════ */
.receipt-card {
  background: var(--surface);
  width: 100%;
  max-width: 400px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 24px 22px;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Language toggle (top-corner, excluded from export capture) */
.lang-toggle {
  position: absolute;
  top: 14px;
  right: 14px;
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  font-family: var(--font-head);
}
.lang-toggle button {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  cursor: pointer;
  font-family: inherit;
}
.lang-toggle button.active { background: var(--teal); color: #fff; }

/* Header */
.receipt-header { text-align: center; padding-bottom: 16px; }
.brand-logo { height: 46px; width: auto; margin: 2px auto 14px; display: block; }
.brand {
  font-family: var(--font-head);
  font-size: 12px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--teal); margin-bottom: 8px;
}
.merchant {
  font-family: var(--font-head);
  font-size: 22px; font-weight: 700; color: var(--ink); line-height: 1.2;
}
.address { font-size: 13px; color: var(--muted); margin-top: 4px; }
.datetime { font-size: 13px; color: var(--faint); margin-top: 6px; }

.divider { border: none; border-top: 1px dashed var(--line); margin: 16px 0; }

/* Items */
.items { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.item { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.item-name { font-size: 15px; color: var(--body); flex: 1; }
.item-price {
  font-size: 15px; color: var(--ink);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}

/* Totals */
.totals { display: flex; flex-direction: column; gap: 8px; }
.total-row { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); }
.total-row.grand {
  font-family: var(--font-head);
  font-size: 18px; font-weight: 700; color: var(--teal); margin-top: 4px;
}

/* QR */
.qr-section { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 8px 0; }
.qr-label {
  font-size: 12px; color: var(--faint); text-transform: uppercase;
  letter-spacing: 1px; font-weight: 600; font-family: var(--font-head);
}
.qr-img { border-radius: 8px; border: 1px solid var(--line); }

/* Verified badge */
.verified-badge {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--teal);
  background: var(--turquoise-soft); border-radius: 999px;
  padding: 6px 14px; margin: 4px auto; width: fit-content;
  font-family: var(--font-head);
}

/* Export bar */
.export-bar { display: flex; gap: 8px; margin: 14px 0 4px; }
.export-btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--teal); background: var(--surface); color: var(--teal);
  border-radius: var(--radius-sm); padding: 9px 10px; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: var(--font-head);
}
.export-btn.primary { background: var(--teal); color: #fff; }
.export-btn:active { transform: translateY(1px); }
.export-btn svg { width: 15px; height: 15px; }

/* Signature */
.sig-details { margin-top: 8px; }
.sig-details summary { font-size: 12px; color: var(--faint); cursor: pointer; user-select: none; }
.sig-text {
  font-size: 10px; color: var(--faint); word-break: break-all;
  margin-top: 6px; font-family: "Courier New", monospace; line-height: 1.5;
}
.sig-text.pubkey { margin-top: 4px; }

/* Footer */
.footer { text-align: center; margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line); }
.footer p { font-size: 12px; color: var(--faint); }
.footer strong { color: var(--teal); font-family: var(--font-head); }
.uuid { font-size: 9px; margin-top: 4px; font-family: monospace; word-break: break-all; }

/* RTL (Arabic) */
.receipt-card[dir="rtl"] .item { flex-direction: row-reverse; }
.receipt-card[dir="rtl"] .total-row { flex-direction: row-reverse; }
.receipt-card[dir="rtl"] .lang-toggle { right: auto; left: 14px; }

/* ═══════════════════════════════════════════════════════════════════════════
   ADMIN DASHBOARD  (white nav + teal accents; scoped under body.admin)
   ═══════════════════════════════════════════════════════════════════════════ */
body.admin { display: block; padding: 0; background: var(--bg); color: var(--ink); }

/* Top nav — white with teal accents */
.topnav { background: var(--surface); border-bottom: 1px solid var(--line); }
.topnav-inner {
  max-width: 1040px; margin: 0 auto; padding: 0 20px; min-height: 60px;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
}
.topnav-logo { height: 34px; width: auto; display: block; }
.topnav-brand {
  display: inline-flex; align-items: center; text-decoration: none;
  font-family: var(--font-head); font-weight: 700; color: var(--ink); font-size: 17px;
}
.topnav-links { display: flex; gap: 2px; align-items: center; flex-wrap: wrap; }
.topnav-links a {
  color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600;
  padding: 8px 12px; border-radius: 8px; font-family: var(--font-head);
}
.topnav-links a:hover { background: var(--turquoise-soft); color: var(--teal); }
.topnav-links a.active { background: var(--turquoise-soft); color: var(--teal); }
.topnav-links a.logout { color: var(--faint); }
.topnav-links a.logout:hover { color: var(--teal); background: transparent; }

/* Main */
.admin-main { max-width: 1040px; margin: 0 auto; padding: 28px 20px 56px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--font-head); font-size: 24px; font-weight: 700; color: var(--ink); }
.crumb { font-size: 13px; color: var(--muted); text-decoration: none; font-family: var(--font-head); }
.crumb:hover { color: var(--teal); }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-sm); padding: 18px 20px; border: 1px solid var(--line); }
.stat-value { font-family: var(--font-head); font-size: 28px; font-weight: 700; color: var(--teal); font-variant-numeric: tabular-nums; }
.stat-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; margin-top: 4px; }

/* Cards */
.card { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-sm); border: 1px solid var(--line); padding: 20px 22px; margin-bottom: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.card-head h2 { font-family: var(--font-head); font-size: 15px; font-weight: 700; color: var(--ink); }

/* Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 480px; }
.table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--faint); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line);
  font-family: var(--font-head);
}
.table td { padding: 11px 10px; border-bottom: 1px solid var(--line); color: var(--body); }
.table tr:last-child td { border-bottom: none; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.num { color: var(--ink); font-weight: 600; }

/* Bits */
.muted { color: var(--faint); }
.strong { font-weight: 700; }
.mono { font-family: "Courier New", monospace; font-size: 13px; }
.link { color: var(--teal); text-decoration: none; font-weight: 600; }
.link:hover { text-decoration: underline; }
.pill {
  display: inline-block; min-width: 26px; text-align: center; background: var(--turquoise-soft);
  color: var(--teal); font-weight: 700; border-radius: 999px; padding: 2px 10px; font-size: 13px;
  font-family: var(--font-head);
}
.empty { color: var(--muted); font-size: 14px; padding: 10px 2px; }
.hint { color: var(--faint); font-size: 12px; margin-top: 8px; }

/* Forms */
.stack { display: flex; flex-direction: column; gap: 14px; }
.row-form { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 180px; }
.field span { font-size: 12px; font-weight: 600; color: var(--muted); font-family: var(--font-head); }
.field input {
  border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  font-size: 14px; font-family: inherit; color: var(--ink); background: var(--surface);
}
.field input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(0, 112, 112, 0.14); }
.btn { border: none; border-radius: 8px; padding: 10px 20px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: var(--font-head); }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); }
.btn-ghost { background: var(--surface); border: 1px solid var(--teal); color: var(--teal); }
.btn-ghost:hover { background: var(--turquoise-soft); }

/* Key/value blocks (terminal detail) */
.kv { padding: 12px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: none; }
.kv-key { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; font-family: var(--font-head); }
.kv-val { font-size: 14px; color: var(--ink); }
.selectable { user-select: all; }
.copy-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.copy-btn {
  border: 1px solid var(--teal); background: var(--surface); color: var(--teal);
  border-radius: 8px; padding: 5px 12px; font-size: 12px; font-weight: 600; cursor: pointer;
  font-family: var(--font-head);
}
.copy-btn:hover { background: var(--turquoise-soft); }
.cmd {
  background: var(--ink); color: var(--turquoise); border-radius: 8px; padding: 12px 14px;
  font-family: "Courier New", monospace; font-size: 13px; overflow-x: auto; margin: 6px 0;
}

/* Login */
body.admin.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.login-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 32px 30px; width: 100%; max-width: 360px; }
.login-logo { height: 48px; width: auto; display: block; margin: 0 auto 10px; }
.login-brand { font-family: var(--font-head); font-size: 22px; font-weight: 700; color: var(--ink); text-align: center; }
.login-sub { font-size: 13px; color: var(--muted); text-align: center; margin: 4px 0 22px; }
.alert-error { background: #fef2f2; color: #b91c1c; border-radius: 8px; padding: 10px 12px; font-size: 13px; margin-bottom: 16px; }

/* Responsive */
@media (max-width: 640px) {
  .admin-main { padding: 20px 14px 40px; }
  .topnav-links a { padding: 7px 10px; font-size: 13px; }
}

/* ── Ops tooling: flash, status dots, action buttons ─────────────────────────*/
.flash {
  background: var(--turquoise-soft); color: var(--teal);
  border: 1px solid var(--turquoise); border-radius: 10px;
  padding: 11px 14px; font-size: 14px; font-weight: 600; margin-bottom: 18px;
  font-family: var(--font-head);
}
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.dot.on  { background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,0.15); }
.dot.off { background: #cbd5d3; }
.status.on  { color: #16a34a; }
.status.off { color: var(--faint); }

.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn-sm {
  border-radius: 8px; padding: 8px 14px; font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: var(--font-head); border: 1px solid var(--teal);
  background: var(--surface); color: var(--teal); text-decoration: none; display: inline-block;
}
.btn-sm:hover { background: var(--turquoise-soft); }
.btn-sm.primary { background: var(--teal); color: #fff; }
.btn-sm.primary:hover { background: var(--teal-dark); }
.btn-sm.danger { border-color: #dc2626; color: #dc2626; }
.btn-sm.danger:hover { background: #fef2f2; }
form.inline { display: inline; margin: 0; }

details.danger-zone { margin-top: 8px; }
details.danger-zone summary { font-size: 12px; color: var(--faint); cursor: pointer; }
.qr-download { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.qr-download img { border: 1px solid var(--line); border-radius: 8px; width: 120px; height: 120px; }
