/* ===================================================================
   SuperShop POS — Design tokens
   Palette: deep indigo surface + electric teal accent (retail-tech, not
   generic SaaS blue), amber reserved ONLY for the offline/emergency state
   so it reads as a real signal, not decoration.
   Type: Sora (display / totals) + Inter (UI/body) + JetBrains Mono (prices,
   barcodes, receipt numbers — anything that must be scanned at a glance).
=================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@600;700;800&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  --ink-900: #14183B;      /* deep indigo — headers, primary buttons */
  --ink-700: #2B3163;
  --surface-0: #F7F8FA;    /* app background */
  --surface-1: #FFFFFF;    /* cards */
  --surface-2: #EEF0F6;    /* subtle panels / receipt tape */
  --border: #E2E5EE;

  --teal-500: #00C2A8;     /* primary accent — active states, totals */
  --teal-600: #00A691;
  --amber-500: #F5A623;    /* reserved: offline / emergency signal only */
  --amber-100: #FFF3DE;
  --red-500: #E5484D;

  --text-900: #1D2333;
  --text-600: #5B6178;
  --text-400: #9297AB;

  --font-display: 'Sora', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-card: 0 1px 2px rgba(20,24,59,0.04), 0 8px 24px rgba(20,24,59,0.06);
}

* { box-sizing: border-box; }

body {
  background: var(--surface-0);
  font-family: var(--font-body);
  color: var(--text-900);
  margin: 0;
}

h1, h2, h3, .display {
  font-family: var(--font-display);
  color: var(--ink-900);
  letter-spacing: -0.01em;
}

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* ---------- App shell ---------- */
.app-header {
  background: var(--ink-900);
  color: #fff;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
}
.app-header .brand {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.app-header nav a {
  color: rgba(255,255,255,0.75);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.92rem;
  margin-right: 22px;
  transition: color .15s;
}
.app-header nav a:hover, .app-header nav a.active { color: #fff; }

/* ---------- Connectivity pulse — the signature element ---------- */
.conn-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  background: rgba(0,194,168,0.15);
  color: var(--teal-500);
}
.conn-pill.offline {
  background: var(--amber-100);
  color: #A66200;
}
.conn-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: currentColor;
}
.conn-pill.online .conn-dot { animation: pulse 2s infinite; }
.conn-pill.offline .conn-dot { animation: blink 1s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(0,194,168,0.5); }
  70% { box-shadow: 0 0 0 6px rgba(0,194,168,0); }
  100% { box-shadow: 0 0 0 0 rgba(0,194,168,0); }
}
@keyframes blink { 50% { opacity: 0.3; } }

.offline-banner {
  display: none;
  background: var(--amber-500);
  color: #3A2900;
  text-align: center;
  padding: 8px;
  font-weight: 600;
  font-size: 0.88rem;
}
.offline-banner.show { display: block; }

/* ---------- Cards / surfaces ---------- */
.card-panel {
  background: var(--surface-1);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

.kpi-card { padding: 20px 22px; }
.kpi-card .label { font-size: 0.8rem; color: var(--text-600); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.kpi-card .value { font-family: var(--font-display); font-size: 1.9rem; font-weight: 700; color: var(--ink-900); margin-top: 4px; }

/* ---------- Buttons ---------- */
.btn-pos {
  font-family: var(--font-body);
  font-weight: 600;
  border-radius: var(--radius-md);
  padding: 10px 18px;
  border: none;
  cursor: pointer;
  transition: transform .08s, box-shadow .15s;
}
.btn-pos:active { transform: scale(0.98); }
.btn-primary { background: var(--ink-900); color: #fff; }
.btn-accent { background: var(--teal-500); color: #fff; }
.btn-accent:hover { background: var(--teal-600); }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text-900); }
.btn-danger { background: var(--red-500); color: #fff; }

/* ---------- Checkout screen ---------- */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  padding: 20px 24px;
  align-items: start;
}
.scan-box input {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 1.15rem;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  outline: none;
}
.scan-box input:focus { border-color: var(--teal-500); }

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 16px;
}
.product-tile {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  transition: border-color .15s, transform .1s;
}
.product-tile:hover { border-color: var(--teal-500); transform: translateY(-2px); }
.product-tile .name { font-weight: 600; font-size: 0.88rem; }
.product-tile .price { font-family: var(--font-mono); color: var(--teal-600); font-weight: 700; margin-top: 6px; }
.product-tile .stock { font-size: 0.72rem; color: var(--text-400); margin-top: 2px; }

/* Receipt-tape cart panel: dashed bottom to feel like a real ticket */
.cart-panel {
  background: var(--surface-1);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 140px);
  position: sticky;
  top: 20px;
}
.cart-items { flex: 1; overflow-y: auto; padding: 4px 18px; }
.cart-line {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px dashed var(--border);
  font-size: 0.9rem;
}
.cart-line .qty { color: var(--text-600); font-family: var(--font-mono); }
.cart-total-block {
  padding: 16px 18px;
  border-top: 2px dashed var(--border);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.cart-total-block .grand {
  display: flex; justify-content: space-between; align-items: baseline;
  font-family: var(--font-display); font-size: 1.6rem; font-weight: 800; color: var(--ink-900);
  margin-top: 6px;
}
.row-line { display: flex; justify-content: space-between; font-size: 0.86rem; color: var(--text-600); margin-top: 4px; }

/* ---------- Page shell (list/report screens) ---------- */
.page-body { padding: 20px 24px; }
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px; gap: 12px; flex-wrap: wrap;
}
.page-header h2 { margin: 0; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar input[type="text"], .toolbar input[type="search"] {
  padding: 9px 12px; border-radius: var(--radius-md); border: 1.5px solid var(--border);
  font-family: var(--font-body); font-size: 0.9rem; outline: none;
}
.toolbar input[type="text"]:focus, .toolbar input[type="search"]:focus { border-color: var(--teal-500); }

/* ---------- Data table ---------- */
.data-table-wrap { background: var(--surface-1); border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow-card); overflow: hidden; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data-table th {
  text-align: left; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-400); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
table.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data-table tbody tr:last-child td { border-bottom: none; }
table.data-table tbody tr:hover { background: var(--surface-2); }
table.data-table .empty-row td { text-align: center; color: var(--text-400); padding: 32px; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 0.74rem; font-weight: 600; }
.badge-ok { background: rgba(0,194,168,0.15); color: var(--teal-600); }
.badge-warn { background: var(--amber-100); color: #A66200; }
.badge-off { background: var(--surface-2); color: var(--text-400); }
.badge-danger { background: rgba(229,72,77,0.12); color: var(--red-500); }
.badge-info { background: rgba(20,24,59,0.08); color: var(--ink-700); }

/* ---------- Status filter tabs ---------- */
.status-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.status-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px; border: 1.5px solid var(--border);
  background: var(--surface-1); color: var(--text-600);
  font-size: 0.82rem; font-weight: 600; text-decoration: none;
  transition: border-color .12s, color .12s;
}
.status-tab:hover { border-color: var(--teal-500); color: var(--text-900); }
.status-tab.active { background: var(--ink-900); border-color: var(--ink-900); color: #fff; }
.status-tab .count {
  background: rgba(255,255,255,0.18); border-radius: 999px; padding: 1px 7px; font-size: 0.72rem;
}
.status-tab:not(.active) .count { background: var(--surface-2); color: var(--text-600); }
.status-tab.pending-tab:not(.active) .count { background: var(--amber-100); color: #A66200; }

/* ---------- Nav badge (unread-style count bubble) ---------- */
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; margin-left: 5px;
  border-radius: 999px; background: var(--amber-500); color: #14183B;
  font-size: 0.68rem; font-weight: 800; line-height: 18px; vertical-align: middle;
}

/* ---------- Forms ---------- */
.form-panel { background: var(--surface-1); border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow-card); padding: 24px; max-width: 640px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; }
.field input[type="text"], .field input[type="number"], .field input[type="url"],
.field input[type="date"], .field input[type="datetime-local"], .field input[type="email"],
.field input[type="tel"], .field input[type="password"], .field input[type="search"],
.field textarea, .field select {
  width: 100%; padding: 10px 12px; border-radius: var(--radius-md); border: 1.5px solid var(--border);
  font-family: var(--font-body); font-size: 0.92rem; outline: none;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--teal-500); }
.field input, .field select, .field textarea { box-sizing: border-box; background: var(--surface-1); color: inherit; }
.field input[type="date"], .field input[type="datetime-local"] { min-height: 42px; }
.field input[type="date"]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: 0.7; }

/* Searchable dropdown (combobox) */
.combo { position: relative; }
.combo-list {
  position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px);
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: var(--shadow-card); max-height: 300px; overflow-y: auto; display: none;
}
.combo-item { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--border); font-size: 0.88rem; }
.combo-item:last-child { border-bottom: none; }
.combo-item.active, .combo-item:hover { background: var(--surface-2); }
.combo-item .sub { font-size: 0.75rem; color: var(--text-400); }
.combo-empty { padding: 10px 12px; color: var(--text-400); font-size: 0.85rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-check { display: flex; align-items: center; gap: 8px; }
.field-check input { width: auto; }
.field .hint { font-size: 0.76rem; color: var(--text-400); margin-top: 4px; }
.validation-summary { background: #FDEDED; color: var(--red-500); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 0.88rem; }

/* ---------- Reports ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 20px; }
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 140px; padding: 16px; }
.bar-chart .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.bar-chart .bar { width: 100%; background: var(--teal-500); border-radius: 4px 4px 0 0; min-height: 2px; }
.bar-chart .bar-label { font-size: 0.7rem; color: var(--text-400); margin-top: 6px; }

/* ---------- SaaS: subscription banner, plan cards, public pages ---------- */
.sub-banner {
  background: rgba(0,194,168,0.12); color: var(--ink-900);
  padding: 9px 24px; font-size: 0.88rem; text-align: center;
}
.sub-banner a { color: var(--teal-600); font-weight: 700; margin-left: 6px; }
.sub-banner-danger { background: rgba(229,72,77,0.12); color: var(--red-500); font-weight: 600; }
.sub-banner-danger a { color: var(--red-500); }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 0.9rem; background: rgba(0,194,168,0.12); color: var(--teal-600); font-weight: 600; }
.flash-error { background: #FDEDED; color: var(--red-500); }

.sub-grid { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(320px, 1.4fr); gap: 20px; align-items: start; }
.meter { margin-top: 14px; }
.meter .meter-head { display: flex; justify-content: space-between; font-size: 0.82rem; color: var(--text-600); }
.meter .meter-track { height: 6px; background: var(--surface-2); border-radius: 999px; margin-top: 6px; overflow: hidden; }
.meter .meter-fill { height: 100%; background: var(--teal-500); border-radius: 999px; }
.meter .meter-fill.full { background: var(--red-500); }

.pay-steps { margin: 0 0 18px; padding-left: 18px; font-size: 0.88rem; color: var(--text-600); line-height: 1.7; }
.pay-steps strong { color: var(--text-900); }
.pay-number { font-family: var(--font-mono); font-weight: 700; color: #E2136E; }
.pay-ref { font-family: var(--font-mono); background: var(--surface-2); padding: 1px 6px; border-radius: 4px; color: var(--ink-900); }
.field-row-3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 16px; }
.amount-due { font-family: var(--font-display); font-size: 1.5rem; font-weight: 800; color: var(--teal-600); }

.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.plan-card { padding: 22px; display: flex; flex-direction: column; position: relative; }
.plan-card.highlight { border: 2px solid var(--teal-500); }
.plan-card.current { border: 2px solid var(--ink-900); }
.plan-card .plan-tag { position: absolute; top: 14px; right: 14px; }
.plan-card h3 { margin: 0 0 6px; font-size: 1.05rem; }
.plan-card .price { font-family: var(--font-display); font-size: 1.7rem; font-weight: 800; color: var(--ink-900); }
.plan-card .price small { font-size: 0.85rem; font-weight: 500; color: var(--text-400); }
.plan-card .yearly { font-size: 0.78rem; color: var(--text-600); margin-top: 2px; }
.plan-card ul { list-style: none; padding: 0; margin: 14px 0 18px; font-size: 0.86rem; color: var(--text-600); flex: 1; }
.plan-card li { padding: 4px 0 4px 22px; position: relative; }
.plan-card li::before { content: "✓"; position: absolute; left: 0; color: var(--teal-600); font-weight: 700; }

.public-shell { max-width: 1080px; margin: 0 auto; padding: 0 20px; }
.public-nav { display: flex; justify-content: space-between; align-items: center; padding: 18px 0; }
.public-nav .brand { font-family: var(--font-display); font-weight: 800; font-size: 1.25rem; color: var(--ink-900); text-decoration: none; }
.public-nav a.link { color: var(--text-600); text-decoration: none; font-weight: 600; margin-left: 18px; font-size: 0.92rem; }
.hero { padding: 56px 0 40px; text-align: center; }
.hero h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); margin: 0 0 14px; }
.hero p { color: var(--text-600); font-size: 1.08rem; max-width: 640px; margin: 0 auto 26px; line-height: 1.6; }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin: 20px 0 48px; }
.feature-grid .card-panel { padding: 20px; }
.feature-grid h3 { margin: 8px 0 4px; font-size: 1rem; }
.feature-grid p { margin: 0; color: var(--text-600); font-size: 0.88rem; line-height: 1.5; }
a.btn-pos { text-decoration: none; display: inline-block; }

@media (max-width: 860px) {
  .sub-grid, .field-row, .field-row-3 { grid-template-columns: 1fr; }
}
