@import url('https://fonts.googleapis.com/css2?family=Oswald:wght@500;600;700&display=swap');

:root {
  --brand: #c92f32;       /* sampled from the Legends Hydration logo */
  --brand-dark: #a02426;
  --brand-light: #fdf1f1;
  --ink: #17130f;         /* near-black, matches the logo's lettering */
  --muted: #6b6560;
  --line: #e7e2de;
  --bg: #f6f4f2;
  --card: #ffffff;
  --ok: #1e8e5a;
  --err: #d93025;
  --radius: 14px;
  --heading-font: 'Oswald', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
h1, h2, .brand-word, .tile-label, .btn { font-family: var(--heading-font); }

.app-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px; background: var(--card); border-bottom: 1px solid var(--line);
  border-top: 3px solid var(--brand);
  position: sticky; top: 0; z-index: 10;
}
.app-header .brand { display: flex; align-items: center; gap: 10px; }
.app-header .brand img.logo { width: 34px; height: 34px; border-radius: 50%; display: block; box-shadow: 0 0 0 2px var(--brand-light); }
.app-header .brand .brand-word { font-weight: 700; font-size: 16px; letter-spacing: .02em; text-transform: uppercase; }
.app-header nav { display: flex; gap: 8px; align-items: center; }
.iconbtn {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 8px 12px; border-radius: 10px; font-size: 14px; cursor: pointer; text-decoration: none;
}
.iconbtn:hover { border-color: var(--brand); color: var(--brand); }

.container { max-width: 720px; margin: 0 auto; padding: 20px 16px 80px; }

.page-title {
  font-family: var(--heading-font); font-weight: 600; font-size: 22px; letter-spacing: .01em;
  margin: 22px 0 2px; text-transform: uppercase;
}

.picker-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 18px;
}
@media (min-width: 560px) { .picker-grid { grid-template-columns: repeat(3, 1fr); } }
.picker-tile {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 12px 18px; text-align: center; cursor: pointer; text-decoration: none; color: var(--ink);
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  transition: transform .1s ease, box-shadow .1s ease, border-color .1s ease;
  position: relative; overflow: hidden;
}
.picker-tile::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--brand); transform: scaleX(0); transform-origin: left;
  transition: transform .15s ease;
}
.picker-tile:hover::before { transform: scaleX(1); }
.picker-tile:active { transform: scale(0.97); }
.picker-tile:hover { box-shadow: 0 6px 18px rgba(201,47,50,.12); border-color: #f0d5d5; }
.picker-tile .emoji-badge {
  width: 52px; height: 52px; border-radius: 50%; background: var(--brand-light);
  display: flex; align-items: center; justify-content: center; font-size: 24px;
}
.picker-tile .tile-label { font-weight: 600; font-size: 13px; letter-spacing: .01em; text-transform: uppercase; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 14px;
}
.card h2 { margin: 0 0 14px; font-size: 16px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; }
.card h3 { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.field label .req { color: var(--brand); }
.field input, .field select, .field textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  font-size: 16px; background: #fff; color: var(--ink);
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(201,47,50,.12);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .field-row { grid-template-columns: 1fr; } }

.autocomplete { position: relative; }
.ac-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: #fff;
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.08);
  max-height: 220px; overflow-y: auto; z-index: 20; display: none;
}
.ac-list.open { display: block; }
.ac-item { padding: 10px 12px; cursor: pointer; font-size: 14px; }
.ac-item:hover, .ac-item.active { background: var(--brand-light); }
.ac-item.quickadd { color: var(--brand); font-weight: 600; border-top: 1px solid var(--line); }

.item-line {
  border: 1px dashed var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; position: relative;
}
.item-line .item-tag {
  position: absolute; top: -10px; left: 12px; background: var(--brand); color: #fff;
  font-size: 11px; font-weight: 700; letter-spacing: .04em; padding: 2px 8px; border-radius: 999px;
  font-family: var(--heading-font);
}
.item-line .remove-line {
  position: absolute; top: 8px; right: 8px; border: none; background: none; color: var(--muted);
  font-size: 18px; cursor: pointer; line-height: 1; padding: 4px;
}
.item-line .remove-line:hover { color: var(--brand); }

.payment-row { display: flex; gap: 10px; margin-bottom: 8px; align-items: center; }
.payment-row select { flex: 1.2; } .payment-row input { flex: 1; }
.payment-row .rm { border: none; background: none; color: var(--muted); font-size: 18px; cursor: pointer; }
.total-line { font-size: 13px; color: var(--muted); margin-top: 4px; }
.total-line.ok { color: var(--ok); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 12px; padding: 13px 18px; font-size: 14px; font-weight: 600;
  letter-spacing: .03em; text-transform: uppercase; cursor: pointer; width: 100%;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-secondary { background: #fff; color: var(--ink); border: 1px dashed var(--line); }
.btn-ghost { background: none; color: var(--brand); padding: 8px; width: auto; text-transform: none; letter-spacing: normal; }

.toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; font-size: 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,.2); z-index: 100; max-width: calc(100% - 32px); text-align: center;
}
.toast.err { background: var(--err); }
.toast.ok { background: var(--ok); }

.error-text { color: var(--err); font-size: 13px; margin-top: 6px; }
.muted { color: var(--muted); font-size: 13px; }

table.simple { width: 100%; border-collapse: collapse; font-size: 14px; }
table.simple th, table.simple td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); }
table.simple th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }

.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 16px; padding-bottom: 2px; }
.tabs button {
  border: 1px solid var(--line); background: #fff; padding: 8px 14px; border-radius: 999px;
  font-size: 13px; white-space: nowrap; cursor: pointer; font-weight: 500;
}
.tabs button.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(circle at 50% 0%, #fff 0%, var(--bg) 65%);
}
.login-card {
  width: 100%; max-width: 380px; background: #fff; border-radius: 18px; padding: 34px 26px 30px;
  box-shadow: 0 16px 50px rgba(23,19,15,.10); border-top: 4px solid var(--brand); text-align: center;
}
.login-card img.logo { width: 84px; height: 84px; border-radius: 50%; margin: 0 auto 16px; display: block; box-shadow: 0 0 0 4px var(--brand-light); }
.login-card h1 {
  font-family: var(--heading-font); font-weight: 700; font-size: 22px; letter-spacing: .04em;
  margin: 0 0 4px; text-transform: uppercase;
}
.login-card p.sub { text-align: center; color: var(--muted); margin: 0 0 24px; font-size: 13px; letter-spacing: .02em; }
.login-card .field { text-align: left; }
