:root {
  /* Vic Social: logo navy, neon red, Edison amber, marble white, black walls */
  --navy: #1e1f55;
  --navy-2: #26286b;
  --accent: #ff2d3f;          /* neon red */
  --neon: #ff2d3f;
  --amber: #f0b45a;           /* Edison bulb glow */
  --wall: #111114;            /* black walls */
  --wall-2: #1b1b21;
  --bg: #111114;
  --card: #fbfaf7;            /* marble counter */
  --line: #e4e0d8;
  --text: #1d1d27;
  --muted: #6f6c75;
  --green: #1c8f5a;
  --green-bg: #e6f5ec;
  --orange: #c4561c;
  --orange-bg: #fcefe5;
  --red: #c62a36;
  --red-bg: #fcebec;
  --blue-row: #f1efe9;
  --radius: 14px;
  --display: "Bebas Neue", "Oswald", Impact, "Arial Narrow", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
}

.topbar {
  background: var(--navy);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand { font-weight: 700; letter-spacing: 0.2px; }
.brand span { color: var(--accent); font-weight: 600; margin-left: 4px; }
#topbar-right { display: flex; align-items: center; gap: 10px; font-size: 0.9em; }
#topbar-right .who { opacity: 0.85; }

main { padding: 16px; max-width: 560px; margin: 0 auto; }
main.wide { max-width: 1000px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 4px; font-size: 1.3em; }
.card h3 { margin: 0 0 10px; font-size: 1.05em; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 0.85em; }
.hidden { display: none !important; }

label { display: block; font-weight: 600; font-size: 0.9em; margin: 12px 0 4px; }
input, select, textarea {
  width: 100%;
  font: inherit;
  font-size: 16px;
  padding: 11px 12px;
  border: 1px solid #c7cfd6;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
input.bad { border-color: var(--red); background: var(--red-bg); }
textarea { min-height: 70px; resize: vertical; }

.money { position: relative; }
.money::before { content: "$"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.money input { padding-left: 24px; text-align: right; font-variant-numeric: tabular-nums; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 380px) { .grid2 { grid-template-columns: 1fr; } }

button {
  font: inherit;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
  background: var(--navy-2);
  color: #fff;
}
button:disabled { opacity: 0.55; cursor: default; }
button.block { width: 100%; margin-top: 16px; }
button.green { background: var(--green); }
button.orange { background: var(--accent); }
button.red { background: var(--red); }
button.ghost { background: transparent; color: var(--navy-2); border: 1px solid #c7cfd6; }
button.link { background: none; color: var(--navy-2); padding: 6px 4px; text-decoration: underline; font-weight: 500; }
button.sm { padding: 6px 10px; font-size: 0.85em; }
.topbar button { background: rgba(255,255,255,0.12); padding: 7px 12px; font-size: 0.85em; }

.seg { display: flex; background: #e3e8ec; border-radius: 10px; padding: 4px; gap: 4px; margin-bottom: 14px; }
.seg button { flex: 1; background: transparent; color: var(--text); padding: 9px 6px; font-size: 0.92em; }
.seg button.on { background: #fff; color: var(--navy); box-shadow: 0 1px 2px rgba(0,0,0,0.12); }
.seg.dark button.on { background: var(--navy-2); color: #fff; }

.check {
  display: flex; align-items: center; gap: 10px;
  background: #f6f8f9; border: 1px solid #e3e8ec; border-radius: 8px;
  padding: 10px 12px; margin-top: 10px; font-weight: 500; cursor: pointer;
}
.check input { width: 20px; height: 20px; margin: 0; flex: none; }

.section-title {
  font-size: 0.78em; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted);
  font-weight: 700; margin: 18px 0 2px; border-bottom: 1px solid var(--line); padding-bottom: 4px;
}

.summary { background: #f3f6f8; border-radius: 10px; padding: 12px 14px; margin-top: 16px; }
.row { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; font-variant-numeric: tabular-nums; }
.row .lbl { color: #44515c; }
.row .lbl small { color: var(--muted); }
.row.strong { font-weight: 700; border-top: 1px dashed #c7cfd6; margin-top: 4px; padding-top: 6px; }
.row.warn { color: var(--red); font-weight: 600; }

.due { text-align: center; border-radius: 10px; padding: 10px; margin-top: 10px; }
.due .t { font-size: 0.78em; text-transform: uppercase; letter-spacing: 0.6px; font-weight: 700; }
.due .a { font-size: 1.6em; font-weight: 800; font-variant-numeric: tabular-nums; }
.due.owes { background: var(--green-bg); color: var(--green); }
.due.drop { background: var(--orange-bg); color: var(--orange); }
.due.info { background: #eef1f4; color: var(--navy-2); }

.pool { margin-top: 10px; background: #fff; border: 1px solid #e3e8ec; border-radius: 8px; padding: 8px 12px; }

.name-row { display: flex; gap: 8px; margin-top: 8px; }
.name-row input { flex: 1; }
.name-row button { flex: none; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 14px; }
.stat { background: #f6f8f9; border: 1px solid #e6eaed; border-radius: 10px; padding: 10px 6px; text-align: center; }
.stat .v { font-weight: 800; color: var(--green); font-variant-numeric: tabular-nums; }
.stat .l { font-size: 0.72em; text-transform: uppercase; color: var(--muted); letter-spacing: 0.4px; }

.badge { display: inline-block; font-size: 0.72em; font-weight: 700; border-radius: 999px; padding: 2px 8px; vertical-align: middle; white-space: nowrap; }
.badge.regular { background: #e6edf3; color: var(--navy-2); }
.badge.latenight { background: #ece6f5; color: #5b3d8a; }
.badge.takeout { background: #fdf0e6; color: #a5521a; }
.badge.flag { background: var(--red); color: #fff; }
.badge.void { background: #555; color: #fff; }
.badge.ok { background: var(--green-bg); color: var(--green); }

.list-item { border: 1px solid #e3e8ec; border-radius: 10px; padding: 12px; margin-top: 10px; background: #fff; }
.list-item .top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.list-item .meta { font-size: 0.85em; color: var(--muted); margin-top: 4px; display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
.list-item .acts { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; align-items: center; }
.amt-owes { color: var(--green); font-weight: 700; }
.amt-drop { color: var(--orange); font-weight: 700; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 0.88em; font-variant-numeric: tabular-nums; }
th, td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { font-size: 0.8em; text-transform: uppercase; color: var(--muted); letter-spacing: 0.4px; background: #f6f8f9; position: sticky; top: 0; }
td.num, th.num { text-align: right; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #e3eef6; }
tr.wk-a td { background: var(--blue-row); }
tr.voided td { color: #999; text-decoration: line-through; }
tr.total td { font-weight: 700; border-top: 2px solid #b9c3cc; background: #f6f8f9; }
td input[type=checkbox] { width: 20px; height: 20px; margin: 0; }
.stamp { display: block; font-size: 0.75em; color: var(--green); font-weight: 700; }

.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0 10px; margin-bottom: 8px; }
.filters label { margin-top: 6px; }

.overview { background: #fff7e0; border: 1px solid #f3e1a6; border-radius: 10px; padding: 12px 14px; margin-top: 14px; color: #6e5410; }

.notice { border-radius: 8px; padding: 10px 12px; margin: 10px 0; font-size: 0.9em; }
.notice.red { background: var(--red-bg); color: #7d2318; border: 1px solid #f1c4bf; }
.notice.yellow { background: #fff7e0; color: #6e5410; border: 1px solid #f3e1a6; }
.notice.green { background: var(--green-bg); color: #145c3b; border: 1px solid #bfe5cf; }
.error { color: var(--red); text-align: center; margin-top: 10px; font-weight: 600; min-height: 1.2em; }

.history { font-size: 0.85em; margin-top: 8px; }
.history .h { border-left: 3px solid #c7cfd6; padding: 4px 0 4px 10px; margin: 6px 0; }
.history .h b { color: var(--navy-2); }
.history .h .ch { color: #44515c; }

/* Modal */
.modal-bg {
  position: fixed; inset: 0; background: rgba(15, 22, 30, 0.55);
  display: flex; align-items: flex-end; justify-content: center; z-index: 100;
}
@media (min-width: 640px) { .modal-bg { align-items: center; } }
.modal {
  background: #fff; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
  border-radius: 16px 16px 0 0; padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
}
@media (min-width: 640px) { .modal { border-radius: 16px; } }
.modal h3 { margin: 0 0 8px; }
.modal .btns { display: flex; gap: 10px; margin-top: 16px; position: sticky; bottom: 0; background: #fff; padding-top: 8px; }
.modal .btns button { flex: 1; }

.toast {
  position: fixed; left: 50%; top: calc(12px + env(safe-area-inset-top)); transform: translateX(-50%) translateY(-200px);
  background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 10px; z-index: 200;
  transition: transform 0.25s ease; max-width: 92vw; text-align: center; font-weight: 600;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--red); }

/* Print */
#print-area { display: none; }
@media print {
  body { background: #fff; }
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block; color: #000; font-size: 12px; }
  #print-area h1 { font-size: 16px; margin: 0 0 4px; }
  #print-area h2 { font-size: 13px; margin: 14px 0 4px; }
  #print-area table { font-size: 11px; }
  #print-area th { position: static; background: #eee; color: #000; }
  #print-area th, #print-area td { border: 1px solid #999; padding: 3px 5px; }
  #print-area .row { padding: 1px 0; }
  #print-area .slip { max-width: 380px; page-break-inside: avoid; }
  #print-area .sig { margin-top: 24px; border-top: 1px solid #000; width: 220px; padding-top: 2px; }
  @page { margin: 12mm; }
}

.mgr-table td { white-space: normal; vertical-align: top; }
.mgr-table td .badge { margin-top: 3px; }
@media (max-width: 480px) {
  .mgr-table { font-size: 0.82em; }
  .mgr-table th, .mgr-table td { padding: 7px 4px; }
  .stamp { max-width: 64px; overflow: hidden; text-overflow: ellipsis; }
}


/* ============================================================
   Vic Social theme
   ============================================================ */
body {
  background:
    radial-gradient(ellipse at 15% -10%, rgba(240,180,90,0.10), transparent 45%),
    radial-gradient(ellipse at 110% 10%, rgba(255,45,63,0.08), transparent 40%),
    var(--wall);
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
}

/* Top bar: black wall with a strip of red neon underneath */
.topbar {
  background: #0a0a0d;
  border-bottom: 2px solid var(--neon);
  box-shadow: 0 1px 0 rgba(255,45,63,0.6), 0 4px 18px rgba(255,45,63,0.25);
  padding-top: max(10px, env(safe-area-inset-top));
  padding-bottom: 10px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 400; }
.brand img { height: 34px; width: auto; display: block; }
.brand span {
  font-family: var(--display); font-size: 1.45em; letter-spacing: 1.5px; margin: 0; line-height: 1;
  color: #ffd9dc;
  text-shadow: 0 0 4px rgba(255,45,63,0.9), 0 0 12px rgba(255,45,63,0.7), 0 0 22px rgba(255,45,63,0.4);
}
.topbar button { background: transparent; border: 1px solid rgba(255,255,255,0.25); color: #fff; }
.topbar button:hover { border-color: var(--neon); }
#topbar-right .who { color: var(--amber); opacity: 1; }

/* Cards are the white marble counter */
.card {
  background: var(--card);
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 10px 30px rgba(0,0,0,0.35), 0 1px 0 rgba(255,255,255,0.6) inset;
}
.card h2, .card h3, .modal h3 {
  font-family: var(--display); font-weight: 400; letter-spacing: 1px; font-size: 1.6em; line-height: 1.05;
}
.card h3, .modal h3 { font-size: 1.4em; }
.section-title {
  font-family: var(--display); font-weight: 400; font-size: 1.05em; letter-spacing: 1.2px;
  color: var(--navy); border-bottom: 2px solid var(--line);
}
.section-title::before { content: ""; display: inline-block; width: 14px; height: 3px; background: var(--neon); margin-right: 8px; vertical-align: middle; border-radius: 2px; }

/* Buttons */
button { background: var(--navy); border-radius: 10px; letter-spacing: 0.2px; }
button:hover:not(:disabled) { filter: brightness(1.12); }
button.green { background: var(--green); }
button.block.green, button.block:not(.ghost):not(.link) {
  font-family: var(--display); font-weight: 400; font-size: 1.3em; letter-spacing: 1.5px; padding: 12px 16px;
}
button.ghost { color: var(--navy); border-color: #cfc9be; background: transparent; }
button.link { color: var(--navy); }
button.orange { background: var(--neon); }

/* Segmented tabs */
.seg { background: #ece8e0; }
.seg button { font-weight: 600; }
.seg.dark button.on { background: var(--navy); color: #fff; box-shadow: 0 2px 0 var(--neon); }
/* Manager tabs sit right on the black wall */
main > .seg { background: var(--wall-2); border: 1px solid #2a2a33; }
main > .seg button { color: #cfcfd8; }
main > .seg button.on { background: var(--navy); color: #fff; box-shadow: 0 2px 0 var(--neon), 0 6px 14px rgba(255,45,63,0.25); }

input:focus, select:focus, textarea:focus { outline: 2px solid var(--neon); border-color: var(--neon); }
.check { background: #f4f1eb; border-color: #e6e0d5; }
.check input { accent-color: var(--navy); }
td input[type=checkbox] { accent-color: var(--navy); }

/* Summary = the bar top */
.summary { background: #f2efe8; border: 1px solid #e6e0d5; }
.due.owes { background: var(--green-bg); }
.due .a { font-family: var(--display); font-weight: 400; font-size: 2.1em; letter-spacing: 1px; }
.stat { background: #f4f1eb; border-color: #e6e0d5; }
.stat .v { font-family: var(--display); font-weight: 400; font-size: 1.5em; letter-spacing: 0.5px; }

/* Warm Edison glow for the overview box */
.overview { background: linear-gradient(180deg, #fff7e8, #fdf0d8); border-color: #efd6a6; color: #5e4214; }

th { background: #f1ede6; }
tr.wk-a td { background: #f6f3ed; }
tr.click:hover td { background: #ffeef0; }

.badge.regular { background: #e6e7f3; color: var(--navy); }
.badge.latenight { background: #2a1d3d; color: #ffb3bb; box-shadow: 0 0 6px rgba(255,45,63,0.25); }
.badge.takeout { background: #fdf0e0; color: #9a5310; }

.toast { background: #0a0a0d; border: 1px solid var(--neon); box-shadow: 0 0 16px rgba(255,45,63,0.35); }
.toast.err { background: var(--red); border-color: var(--red); }

.modal { background: var(--card); }
.modal .btns { background: var(--card); }
.modal-bg { background: rgba(5,5,8,0.7); }

/* ---------- Sign-in & setup: the bar after dark ---------- */
body.lobby {
  background:
    linear-gradient(180deg, rgba(8,8,11,0.55) 0%, rgba(8,8,11,0.78) 55%, rgba(8,8,11,0.95) 100%),
    url("bg-neon.jpg") center 35% / cover no-repeat fixed,
    var(--wall);
}
body.lobby main { padding-top: 6vh; }
body.lobby .card {
  background: rgba(14,14,18,0.78);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.1);
  color: #f2f0ec;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
}
body.lobby .card h2 {
  color: #ffe3e5; font-size: 2.2em; text-align: center; margin-bottom: 14px;
  text-shadow: 0 0 4px rgba(255,45,63,0.9), 0 0 14px rgba(255,45,63,0.7), 0 0 30px rgba(255,45,63,0.45);
}
body.lobby .card label { color: #e8e4dc; }
body.lobby .card .muted { color: #b9b4ab; }
body.lobby .card input, body.lobby .card select { background: rgba(255,255,255,0.95); }
body.lobby .seg { background: rgba(255,255,255,0.08); }
body.lobby .seg button { color: #ddd; }
body.lobby .error { color: #ff8a93; }
.lobby-logo { display: block; width: 120px; margin: 4px auto 14px; filter: drop-shadow(0 0 10px rgba(255,255,255,0.15)); }
body.lobby .topbar .brand img { display: none; }

@media print {
  body, body.lobby { background: #fff !important; }
}

@media (max-width: 420px) {
  .brand img { height: 28px; }
  .brand span { font-size: 1.2em; }
  #topbar-right .who { display: none; }
}

.acts-cell { white-space: normal; text-align: right; }
.acts-cell button { margin: 2px 0 2px 4px; }
.check > span { flex: 1; }
