/* Cut My Bill: modern, clean, mobile-first. */

:root {
  --ink: #0f172a;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --card: #ffffff;
  --green: #059669;
  --green-dark: #047857;
  --green-deep: #064e3b;
  --green-soft: #ecfdf5;
  --green-ring: rgba(5, 150, 105, 0.18);
  --amber-bg: #fffbeb;
  --amber-line: #fcd34d;
  --amber-ink: #92400e;
  --red-bg: #fef2f2;
  --red-line: #fca5a5;
  --red-ink: #991b1b;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 16px rgba(15, 23, 42, 0.04);
  --shadow-lift: 0 6px 16px rgba(15, 23, 42, 0.08), 0 12px 32px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; }

body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  margin: 0;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap { max-width: 800px; margin: 0 auto; padding: 0 20px 64px; }

a { color: var(--green-dark); }

/* Top bar */

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  padding-bottom: 14px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--green);
  color: #fff;
}
.topbar-pill {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--green-dark);
  background: var(--green-soft);
  border-radius: 999px;
  padding: 5px 12px;
  white-space: nowrap;
}

/* Hero */

.hero {
  margin: 28px 0 8px;
  padding: 36px 32px;
  border-radius: 24px;
  background: linear-gradient(135deg, var(--green-deep) 0%, var(--green-dark) 55%, var(--green) 100%);
  color: #fff;
  box-shadow: var(--shadow-lift);
}
.hero h1 {
  font-size: 2.1rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
  max-width: 560px;
}
.hero-sub {
  font-size: 1.05rem;
  line-height: 1.55;
  color: #d1fae5;
  margin: 0 0 20px;
  max-width: 600px;
}
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 5px 12px;
}

.helper-note {
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
  margin: 18px auto 4px;
  max-width: 640px;
}

/* How it works */

.steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 0;
  margin: 20px 0 8px;
}
.steps li {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 800;
  font-size: 0.85rem;
  margin-bottom: 8px;
}
.steps strong { display: block; font-size: 0.95rem; margin-bottom: 2px; }
.steps span { color: var(--muted); font-size: 0.85rem; line-height: 1.45; }

/* Banners */

.banner {
  border-radius: 12px;
  padding: 13px 16px;
  margin: 16px 0;
  font-size: 0.93rem;
  border: 1px solid;
}
.banner.demo { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber-ink); }
.banner.error { background: var(--red-bg); border-color: var(--red-line); color: var(--red-ink); }

/* Cards */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  margin: 16px 0;
  box-shadow: var(--shadow);
}
.card h2 {
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
}
.card h3 { font-size: 1rem; margin: 24px 0 10px; letter-spacing: -0.01em; }
.section-sub { color: var(--muted); font-size: 0.92rem; margin: 0 0 16px; }
.bill { border-left: 4px solid var(--green); }

/* Forms */

.row { display: flex; gap: 14px; flex-wrap: wrap; margin: 12px 0; }
.row label { flex: 1 1 220px; font-size: 0.88rem; font-weight: 600; color: #334155; }
input[type="text"], input[type="date"], select {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 12px 14px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--ink);
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="text"]:focus, input[type="date"]:focus, select:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-ring);
}
input[type="text"]::placeholder { color: var(--faint); }

.upload-zone {
  display: block;
  border: 1.5px dashed #cbd5e1;
  border-radius: 12px;
  padding: 16px;
  background: #f8fafc;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.upload-zone:hover { border-color: var(--green); background: var(--green-soft); }
.upload-zone input[type="file"] { display: block; margin-top: 8px; font-size: 0.9rem; }
.upload-hint { display: block; font-weight: 400; color: var(--muted); font-size: 0.85rem; margin-top: 6px; }

/* Buttons */

.actions { margin: 24px 0; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
button.primary {
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 14px 28px;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
  transition: background 0.15s, transform 0.15s, box-shadow 0.15s;
}
button.primary:hover { background: var(--green-dark); transform: translateY(-1px); box-shadow: 0 6px 18px rgba(5, 150, 105, 0.4); }
button.primary:active { transform: translateY(0); }
button.primary:disabled { background: #86cdb3; cursor: wait; transform: none; box-shadow: none; }
button.link, a.link {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  border-radius: 999px;
  padding: 12px 22px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
button.link:hover, a.link:hover { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-ring); }

/* Loading */

.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.95rem; margin: 12px 0; }
.loading[hidden] { display: none; }
.spinner {
  width: 18px; height: 18px; flex: 0 0 18px;
  border: 3px solid #d1fae5; border-top-color: var(--green); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Text helpers */

.hint { color: var(--muted); font-size: 0.85rem; margin: 6px 0 0; }
.optional { color: var(--muted); font-weight: 400; font-size: 0.85rem; }
.save { color: var(--green-dark); }

/* Report page */

.report-head { margin: 28px 0 4px; }
.report-head h1 { font-size: 1.9rem; letter-spacing: -0.02em; margin: 0 0 4px; }
.report-head p { color: var(--muted); margin: 0; }

.share-box { border-color: #a7f3d0; background: #f0fdf4; }
.share-box .row { align-items: stretch; }
.share-box input[type="text"] { flex: 1 1 320px; margin-top: 0; }
.share-box .primary { padding: 12px 22px; }

.total {
  border: none;
  background: linear-gradient(135deg, var(--green-deep) 0%, var(--green-dark) 55%, var(--green) 100%);
  color: #fff;
  box-shadow: var(--shadow-lift);
}
.total .stats { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 8px; }
.total .stat { flex: 1 1 140px; }
.total .stat-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #a7f3d0;
  margin: 0 0 2px;
}
.total .stat-value {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
  line-height: 1.2;
}
.total .stat-value.small { font-size: 1.4rem; }
.total .hint { color: #d1fae5; }
.total .no-saving { font-size: 1.05rem; line-height: 1.55; margin: 4px 0; }

.bill-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.bill-head h2 { margin: 0; }
.bill-price {
  margin-left: auto;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--green-dark);
  background: var(--green-soft);
  border-radius: 999px;
  padding: 4px 12px;
  white-space: nowrap;
}

/* Tables */

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow-x: auto;
  margin: 10px 0;
}
table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: #f8fafc;
}
tbody tr:last-child th, tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }

.verify {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}
.verify.verified { color: var(--green-dark); background: var(--green-soft); }
.verify.not-found { color: #92400e; background: #fef3c7; }
.verify.unchecked { color: var(--muted); background: #f1f5f9; }

blockquote {
  margin: 10px 0;
  padding: 18px 20px;
  background: var(--green-soft);
  border-radius: 12px;
  font-size: 1.02rem;
  line-height: 1.6;
}

ul { padding-left: 20px; }
ul li { margin: 4px 0; }
ul.sources { font-size: 0.85rem; }

.print-only { display: none; }

footer { color: var(--muted); font-size: 0.85rem; margin-top: 36px; text-align: center; }
footer p { margin: 4px 0; }

@media print {
  body { background: #fff; }
  .topbar, .actions, .share-box, .steps, .helper-note { display: none; }
  .print-only { display: block; font-size: 0.85rem; color: var(--muted); }
  .card, .hero, .total { border: 1px solid #ccc; box-shadow: none; break-inside: avoid; background: #fff !important; color: var(--ink); }
  .hero h1, .total .stat-value { color: var(--ink); }
  .hero-sub, .total .hint, .total .stat-label { color: var(--muted); }
  .chip { color: var(--ink); border-color: var(--line); background: #fff; }
}

@media (max-width: 640px) {
  .hero { padding: 28px 22px; border-radius: 20px; }
  .hero h1 { font-size: 1.65rem; }
  .hero-sub { font-size: 0.98rem; }
  .steps { grid-template-columns: 1fr; }
  .card { padding: 20px 16px; }
  .total .stat-value { font-size: 1.6rem; }
  .actions { flex-direction: column; align-items: stretch; }
  .actions button.primary, .actions button.link, .actions a.link { width: 100%; text-align: center; }
  .bill-price { margin-left: 0; }
  .topbar-pill { display: none; }
}
