/* DynBrew app — standalone PWA. Mirrors the web's navy+gold identity. */
:root {
  --bg: #161a24; --surface: #1f2432; --surface2: #272d3e;
  --border: #343b4f; --text: #e8e4da; --muted: #9aa0ae;
  --gold: #c7a85f; --gold-text: #161a24;
  --ok: #5aad6a; --warn: #e4a924; --err: #d05f5f; --info: #6a9fd8;
  --radius: 12px; --tabbar-h: calc(58px + env(safe-area-inset-bottom));
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f1ec; --surface: #ffffff; --surface2: #efece5;
    --border: #ddd8cc; --text: #2a2723; --muted: #6e6a60;
  }
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  font: 16px/1.45 system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg); color: var(--text);
  padding-bottom: var(--tabbar-h);
  -webkit-tap-highlight-color: transparent;
}
/* Safe area: in standalone mode content otherwise slides under the
   iPhone status bar (clock/battery). */
.view { max-width: 560px; margin: 0 auto;
        padding: calc(16px + env(safe-area-inset-top)) 14px 24px; }
h1 { font-size: 22px; margin: 6px 0 14px; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .06em;
     color: var(--muted); margin: 20px 0 8px; }
a { color: var(--gold); text-decoration: none; }
p.muted, .muted { color: var(--muted); }
small { color: var(--muted); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; margin-bottom: 10px;
}
.card.tap { cursor: pointer; }
.card.tap:active { background: var(--surface2); }
.row { display: flex; align-items: center; gap: 10px; }
.row .grow { flex: 1; min-width: 0; }
.title { font-weight: 650; }
.ellip { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pill {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; padding: 3px 9px; border-radius: 999px;
  background: var(--surface2); color: var(--muted); white-space: nowrap;
}
.pill.brewing   { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn); }
.pill.planning  { background: color-mix(in srgb, var(--info) 22%, transparent); color: var(--info); }
.pill.completed, .pill.transferred { background: color-mix(in srgb, var(--ok) 22%, transparent); color: var(--ok); }
.pill.aborted   { background: color-mix(in srgb, var(--err) 22%, transparent); color: var(--err); }
.pill.gold      { background: color-mix(in srgb, var(--gold) 22%, transparent); color: var(--gold); }

button, .btn {
  font: inherit; border: none; cursor: pointer; border-radius: 10px;
  padding: 11px 18px; font-weight: 650; background: var(--surface2); color: var(--text);
}
.btn-gold { background: var(--gold); color: var(--gold-text); }
.btn-danger { background: color-mix(in srgb, var(--err) 18%, transparent); color: var(--err); }
.btn-ghost { background: none; color: var(--muted); }
.btn-sm { padding: 7px 12px; font-size: 14px; border-radius: 8px; }
.btn-block { display: block; width: 100%; text-align: center; }
button:disabled { opacity: .45; cursor: default; }

input, select, textarea {
  font: inherit; width: 100%; padding: 11px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
.field-row { display: flex; gap: 8px; }
.field-row > * { flex: 1; }

/* stats */
.stats { display: flex; gap: 14px; flex-wrap: wrap; }
.stat .v { font-size: 17px; font-weight: 750; color: var(--gold); font-variant-numeric: tabular-nums; }
.stat .l { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

/* steps */
.step { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.step:last-child { border-bottom: none; }
.step .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border); flex-shrink: 0; }
.step.running .dot { background: var(--warn); box-shadow: 0 0 0 4px color-mix(in srgb, var(--warn) 25%, transparent); }
.step.done .dot { background: var(--ok); }
.step .meta { font-size: 13px; color: var(--muted); }
.countdown { font-variant-numeric: tabular-nums; font-weight: 750; color: var(--warn); }
.countdown.over { color: var(--err); }

/* notifications */
.notif { border-left: 3px solid var(--border); }
.notif.unread { border-left-color: var(--gold); }
.notif .body { font-size: 14px; color: var(--muted); margin-top: 2px; }
.notif time { font-size: 12px; color: var(--muted); }

/* tabbar */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 100;
  display: flex; background: var(--surface); border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 0 7px; color: var(--muted); font-size: 11px; position: relative;
}
.tabbar a.active { color: var(--gold); }
.tabbar svg { width: 23px; height: 23px; fill: none; stroke: currentColor;
              stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.badge-dot {
  position: absolute; top: 6px; right: calc(50% - 18px);
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px;
  background: var(--err); color: #fff; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* toast */
.toast {
  position: fixed; bottom: calc(var(--tabbar-h) + 10px); left: 50%;
  transform: translateX(-50%); z-index: 200; max-width: 90vw;
  background: var(--surface2); border: 1px solid var(--border); color: var(--text);
  padding: 10px 18px; border-radius: 10px; font-size: 14px; text-align: center;
}
.toast.err { border-color: var(--err); }

/* login */
.login-wrap { min-height: 85vh; display: flex; flex-direction: column;
              justify-content: center; text-align: center; }
.login-wrap img { width: 84px; height: 84px; border-radius: 19px; margin: 0 auto 14px; }
.login-wrap h1 { margin-bottom: 4px; }
.login-wrap form { text-align: left; margin-top: 18px; }

/* more-list */
.menu a { display: flex; align-items: center; gap: 12px; padding: 15px 4px;
          border-bottom: 1px solid var(--border); color: var(--text); font-weight: 600; }
.menu a:last-child { border-bottom: none; }
.menu a small { font-weight: 400; }
.menu .chev { margin-left: auto; color: var(--muted); }

/* calculators */
.calc-result {
  margin-top: 14px; padding: 13px; border-radius: 10px; text-align: center;
  background: color-mix(in srgb, var(--gold) 12%, transparent);
  font-size: 21px; font-weight: 750; color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.calc-result small { display: block; font-size: 12px; font-weight: 500; }

.offline-note {
  background: color-mix(in srgb, var(--warn) 15%, transparent);
  color: var(--warn); padding: 9px 13px; border-radius: 10px;
  font-size: 14px; font-weight: 600; margin-bottom: 12px;
}
.topbar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.topbar .back { font-size: 26px; line-height: 1; padding: 2px 10px 4px 0; color: var(--gold); background: none; }
.center { text-align: center; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }

.install-hint {
  position: fixed; bottom: calc(var(--tabbar-h) + 8px); left: 12px; right: 12px; z-index: 150;
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0,0,0,.35); font-size: 14px;
}
.install-hint .grow small { display: block; color: var(--muted); font-size: 12px; }

/* modal */
.modal-overlay {
  position: fixed; inset: 0; z-index: 300; background: rgba(0,0,0,.55);
  display: flex; align-items: flex-end; justify-content: center;
}
.modal-sheet {
  width: 100%; max-width: 560px; background: var(--surface);
  border-radius: 18px 18px 0 0; padding: 20px 18px calc(18px + env(safe-area-inset-bottom));
  border: 1px solid var(--border); border-bottom: none;
}
.modal-sheet h3 { font-size: 17px; margin-bottom: 6px; }
.modal-sheet p { color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.modal-sheet button { display: block; width: 100%; margin-top: 8px; }

/* label images */
.label-thumb { width: 46px; height: 46px; border-radius: 10px;
               object-fit: cover; flex-shrink: 0; background: var(--surface2); }
.thumb-lg { width: 66px; height: 66px; border-radius: 13px; object-fit: cover;
            flex-shrink: 0; box-shadow: 0 4px 14px rgba(0,0,0,.4); }
.glowcard { position: relative; overflow: hidden; isolation: isolate; }
.glowcard .glow {
  position: absolute; inset: -24px; z-index: -1;
  background-size: cover; background-position: center;
  filter: blur(28px) saturate(1.5); opacity: .28;
}

/* pull to refresh */
.ptr {
  position: fixed; top: calc(env(safe-area-inset-top) + 4px); left: 50%;
  transform: translate(-50%, -64px); z-index: 250; pointer-events: none;
}
.ptr-circle {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--surface2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--gold); font-size: 21px; font-weight: 700;
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
  transition: background .15s, color .15s;
}
.ptr.ready .ptr-circle { background: var(--gold); color: var(--gold-text); }
.ptr.spin .ptr-circle { animation: ptr-rot .7s linear infinite; }
@keyframes ptr-rot { to { transform: rotate(360deg); } }
body { overscroll-behavior-y: contain; }

/* ingredient suggestions */
.suggest { border: 1px solid var(--border); border-radius: 10px; margin-top: 4px;
           overflow: hidden; background: var(--surface2); }
.suggest button { display: flex; width: 100%; text-align: left; border-radius: 0;
                  padding: 10px 12px; background: none; font-weight: 500;
                  border-bottom: 1px solid var(--border); gap: 8px; align-items: baseline; }
.suggest button:last-child { border-bottom: none; }
.suggest button:active { background: var(--surface); }
.suggest .meta { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.linked-note { font-size: 12px; color: var(--ok); margin-top: 4px; }
