/* Shop Sales — shared styles. Mobile-first, calm, high-contrast, big tap targets. */
:root {
  --bg: #f4f6f8;
  --card: #ffffff;
  --ink: #16191d;
  --muted: #6b7480;
  --line: #e4e8ec;
  --primary: #1f4fd8;
  --primary-ink: #ffffff;
  --primary-soft: #eaf0ff;
  --good: #0f9d58;
  --good-soft: #e7f6ee;
  --warn: #b45309;
  --danger: #d13a3a;
  --danger-soft: #fdecec;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16,25,40,.06), 0 6px 20px rgba(16,25,40,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
  line-height: 1.4;
}
.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px 96px; }
.hidden { display: none !important; }

/* Header */
.appbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.appbar-inner {
  max-width: 560px; margin: 0 auto; padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
}
.appbar .brand { font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.appbar .brand small { display:block; font-weight: 500; color: var(--muted); font-size: 12px; }
.appbar .spacer { flex: 1; }

.sync-pill {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: #fff;
  border-radius: 999px; padding: 7px 12px; font-size: 13px; font-weight: 600;
  color: var(--ink); cursor: pointer; white-space: nowrap;
}
.sync-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); }
.sync-pill.pending { color: var(--warn); border-color: #f3d9b0; background: #fff8ee; }
.sync-pill.pending .dot { background: var(--warn); }

.link-btn { background: none; border: none; color: var(--primary); font-weight: 600; cursor: pointer; font-size: 14px; padding: 6px; }

/* Cards */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; margin-top: 16px;
}
h1 { font-size: 22px; margin: 20px 0 4px; letter-spacing: -.02em; }
h2 { font-size: 17px; margin: 0 0 12px; }
.sub { color: var(--muted); font-size: 14px; margin: 0 0 12px; }

/* Forms */
label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 6px; }
input[type=text], input[type=password], input[type=number], input[type=tel], input[type=date], select {
  width: 100%; padding: 14px; font-size: 17px;
  border: 1.5px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink);
  -webkit-appearance: none; appearance: none;
}
input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.money-in { position: relative; }
.money-in::before { content: "Rs"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 14px; font-weight: 600; pointer-events: none; }
.money-in input { padding-left: 40px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 16px; font-size: 17px; font-weight: 700;
  border-radius: 12px; border: 1.5px solid transparent; cursor: pointer; margin-top: 14px;
}
.btn.primary { background: var(--primary); color: var(--primary-ink); }
.btn.primary:active { filter: brightness(.95); }
.btn.ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.subtle { background: var(--primary-soft); color: var(--primary); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.good { background: var(--good); color: #fff; }
.btn:disabled { opacity: .5; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.btn.small { width: auto; padding: 10px 14px; font-size: 14px; margin: 0; }

/* Switch */
.switch-row { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; padding: 4px 0; }
.switch-row .switch-label { font-weight: 700; font-size: 16px; }
.switch { position: relative; width: 52px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; inset: 0; background: #cfd6dd; border-radius: 999px; transition: .15s; }
.slider::before { content:""; position:absolute; width: 24px; height: 24px; left: 3px; top: 3px; background:#fff; border-radius:50%; transition:.15s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(22px); }

/* Profit preview */
.profit-strip {
  margin-top: 16px; padding: 14px 16px; border-radius: 12px;
  background: var(--good-soft); color: var(--good);
  display: flex; align-items: center; justify-content: space-between; font-weight: 700;
}
.profit-strip.neg { background: var(--danger-soft); color: var(--danger); }
.profit-strip small { display:block; font-weight:600; color: inherit; opacity:.8; font-size: 12px; }

/* Summary rows */
.sum-line { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 15px; }
.sum-line:last-child { border-bottom: none; }
.sum-line .k { color: var(--muted); }
.sum-line.total { font-weight: 800; font-size: 18px; border-top: 2px solid var(--line); margin-top: 4px; padding-top: 12px; }
.sum-line.profit { color: var(--good); font-weight: 800; }

/* Totals tiles */
.tiles { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-top: 16px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; text-align: center; box-shadow: var(--shadow); }
.tile .n { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.tile .l { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tile.good .n { color: var(--good); }

/* Sale list */
.sale { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-top: 10px; box-shadow: var(--shadow); }
.sale .top { display: flex; justify-content: space-between; align-items: baseline; }
.sale .time { color: var(--muted); font-size: 13px; }
.sale .amt { font-weight: 800; font-size: 17px; }
.sale .meta { color: var(--muted); font-size: 13px; margin-top: 4px; }
.sale .pf { color: var(--good); font-weight: 700; font-size: 13px; }
.sale .acts { display: flex; gap: 8px; margin-top: 10px; }
.sale.deleted { opacity: .5; }
.badge { display:inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); }

/* Tabs */
.tabs { display: flex; gap: 8px; margin-top: 16px; background: #eef1f4; padding: 5px; border-radius: 12px; }
.tab { flex: 1; text-align: center; padding: 10px; border-radius: 9px; font-weight: 700; color: var(--muted); cursor: pointer; }
.tab.active { background: #fff; color: var(--ink); box-shadow: var(--shadow); }

/* Toast / message */
.msg { margin-top: 14px; padding: 12px 14px; border-radius: 10px; font-size: 14px; font-weight: 600; }
.msg.ok { background: var(--good-soft); color: var(--good); }
.msg.err { background: var(--danger-soft); color: var(--danger); }
.msg.info { background: var(--primary-soft); color: var(--primary); }

.pin-input { text-align: center; letter-spacing: 8px; font-size: 24px; font-weight: 800; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.center { text-align: center; }
.big-check { width: 72px; height: 72px; border-radius: 50%; background: var(--good-soft); color: var(--good); display: flex; align-items: center; justify-content: center; font-size: 40px; margin: 6px auto 12px; }
.shop-pick { width:100%; text-align:left; padding: 16px; font-size: 17px; font-weight: 700; border:1.5px solid var(--line); background:#fff; border-radius: 12px; margin-top: 10px; cursor: pointer; }
.shop-pick:active { border-color: var(--primary); }
.footnote { color: var(--muted); font-size: 12px; margin-top: 10px; text-align: center; }
.settings-row { display:flex; gap: 10px; align-items:center; flex-wrap: wrap; }

/* Admin table */
.table-scroll { overflow-x: auto; margin-top: 12px; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 720px; }
th, td { text-align: right; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:first-child, td:first-child, th.l, td.l { text-align: left; }
thead th { color: var(--muted); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; position: sticky; top: 0; background: var(--card); }
tbody tr:hover { background: #fafbfc; }
td.pf { color: var(--good); font-weight: 700; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.chip { padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; font-weight: 700; font-size: 14px; cursor: pointer; color: var(--muted); }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.select-inline { width: auto; min-width: 160px; padding: 9px 12px; font-size: 14px; }
.admin-wrap { max-width: 1000px; }
