/* WR Shop Board — Weller Racing red theme */
:root {
  --bg: #f5f5f5;
  --surface: #ffffff;
  --border: #e2e2e2;
  --text: #111111;
  --text-2: #595959;
  --accent: #e30613;          /* WR red */
  --accent-2: #b00510;        /* darker red on hover */
  --accent-tint: #fdecee;     /* very pale red */
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --success: #15803d;
  --success-bg: #f0fdf4;
  --warn: #b45309;
  --black: #111111;
  --silver: #888888;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 12px rgba(0,0,0,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 720px; margin: 0 auto; padding: 16px; }
.wrap-wide { max-width: 1100px; margin: 0 auto; padding: 16px; }

/* WR logo — text fallback when image not present */
.wr-logo { display: inline-flex; align-items: center; gap: 10px; line-height: 1; }
.wr-logo img { height: 40px; width: auto; display: block; }
.wr-logo .wr-text { display: flex; flex-direction: column; }
.wr-logo .wr-text .wr { font-weight: 900; color: var(--accent); font-size: 22px; letter-spacing: 1px; -webkit-text-stroke: 1px var(--black); }
.wr-logo .wr-text .sub { font-size: 10px; font-weight: 700; color: var(--black); letter-spacing: .15em; text-transform: uppercase; }
.wr-logo .wr-text .name { font-size: 11px; font-weight: 700; color: var(--accent); letter-spacing: .05em; }

.brand { text-transform: uppercase; letter-spacing: .14em; color: var(--accent); font-weight: 700; font-size: 12px; text-align: center; margin-top: 24px; }
h1, h2, h3 { font-weight: 800; line-height: 1.2; margin: 8px 0; color: var(--black); }
h1 { font-size: 28px; text-align: center; }
h2 { font-size: 20px; margin-top: 24px; }
h3 { font-size: 16px; }
.muted { color: var(--text-2); font-size: 14px; }
.center { text-align: center; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 12px 0; box-shadow: var(--shadow); }
.card-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
input, select, textarea { font: inherit; color: inherit; padding: 12px; width: 100%; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(227,6,19,.18); }
textarea { min-height: 80px; resize: vertical; }
label { display: block; font-size: 13px; color: var(--text-2); margin: 8px 0 4px; font-weight: 600; }
button { font: inherit; cursor: pointer; padding: 12px 16px; border: 1px solid var(--accent); background: var(--accent); color: #fff; border-radius: 8px; font-weight: 700; width: 100%; transition: filter .15s, background .15s; letter-spacing: .02em; }
button:hover { background: var(--accent-2); border-color: var(--accent-2); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
button.secondary:hover { background: #fafafa; border-color: #bbb; }
button.danger { background: var(--danger); border-color: var(--danger); }
button.ghost { background: transparent; border-color: transparent; color: var(--text-2); width: auto; padding: 8px; }
button.ghost:hover { background: var(--bg); }
button.small { padding: 6px 10px; font-size: 13px; font-weight: 600; width: auto; }
.err { display: none; background: var(--danger-bg); color: var(--danger); padding: 10px 12px; border-radius: 8px; font-size: 14px; margin: 8px 0; border: 1px solid #fecaca; }
.ok { display: none; background: var(--success-bg); color: var(--success); padding: 10px 12px; border-radius: 8px; font-size: 14px; margin: 8px 0; border: 1px solid #bbf7d0; }
.badge { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #eeeeee; color: var(--text-2); letter-spacing: .02em; }
.badge.red { background: var(--accent-tint); color: var(--accent); }
.badge.green { background: var(--success-bg); color: var(--success); }
.badge.orange { background: #fff7ed; color: #b45309; }
.badge.blue { background: #eff6ff; color: #1d4ed8; }
.badge.gray { background: #f3f4f6; color: #4b5563; }
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin: 16px 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; position: sticky; top: 64px; z-index: 49; background: var(--bg); padding-top: 4px; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 10px 14px; cursor: pointer; border: none; background: none; color: var(--text-2); border-bottom: 3px solid transparent; font: inherit; font-weight: 600; white-space: nowrap; width: auto; margin-bottom: -2px; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; }
.row.tight { gap: 4px; }
.spacer { flex: 1; }
.list-item { padding: 10px 0; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.list-item:last-child { border-bottom: none; }
.empty { color: var(--text-2); text-align: center; padding: 24px; font-size: 14px; }
.loading { text-align: center; padding: 40px 20px; color: var(--text-2); }
header.app { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--black); color: #fff; border-bottom: 3px solid var(--accent); position: sticky; top: 0; z-index: 50; }
header.app .title { font-weight: 800; color: #fff; }
header.app .badge { background: var(--accent); color: #fff; }
header.app button { color: #fff; }
header.app button.ghost { color: #ddd; }
header.app button.ghost:hover { background: rgba(255,255,255,.1); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; cursor: pointer; border: 1px solid var(--border); }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: none; align-items: center; justify-content: center; padding: 16px; z-index: 100; }
.modal-bg.show { display: flex; }
.modal { background: var(--surface); border-radius: var(--radius); padding: 20px; max-width: 480px; width: 100%; max-height: 90vh; overflow-y: auto; border-top: 4px solid var(--accent); }
.modal h2 { margin-top: 0; }
.cost-big { font-size: 28px; font-weight: 800; color: var(--black); }
.update-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.update-item:last-child { border-bottom: none; }
.update-meta { font-size: 12px; color: var(--text-2); margin-top: 4px; }
@media (max-width: 540px) {
  .grid2 { grid-template-columns: 1fr; }
  h1 { font-size: 22px; }
  .wr-logo img { height: 32px; }
  .tabs { top: 60px; }
  header.app { padding: 8px 10px; }
  header.app .title { display: none; } /* logo alone is enough on small phones */
  .wrap, .wrap-wide { padding: 10px; }
  .card { padding: 12px; margin: 8px 0; }
  .tab { padding: 8px 10px; font-size: 13px; }
  button { padding: 10px 12px; font-size: 14px; }
  button.small { padding: 6px 8px; font-size: 12px; }
  input, select, textarea { padding: 10px; font-size: 16px; } /* 16px prevents iOS zoom-on-focus */
  /* Tables that would overflow — wrap them in .table-scroll for horizontal scroll on phones */
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  /* Prevent any element from blowing out the viewport */
  pre, code { white-space: pre-wrap; word-break: break-word; }
}
/* Anchor scrolls (notifications "Open and Reply", action-banner jump, hash navigation)
   need to land BELOW the sticky header + tabs, not behind them. ~120px clears both. */
[id^="task-"], details.task-block, details.task-panel { scroll-margin-top: 120px; }
@media (max-width: 540px) {
  [id^="task-"], details.task-block, details.task-panel { scroll-margin-top: 110px; }
}
@media print {
  header.app, .tabs { position: static !important; }
}
