* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  /* Native iOS rubber-band bounce on overscroll — was previously blocked
     by `overscroll-behavior-y: none`. Devin wanted the Instagram-style
     elastic feel when pulling up from the bottom or down from the top.
     `contain` lets the bounce play but stops scroll chaining to parent
     surfaces (e.g. opens a settings overlay that has its own scroller —
     prevents the page underneath from also scrolling). */
  overscroll-behavior-y: contain;
  /* Lock auto text-resize on iOS Safari so the zoom-on-input-focus
     behavior doesn't kick in and so layout doesn't reflow when the user
     rotates the device with the keyboard open. */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-size: 16px;
  line-height: 1.4;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* iOS Safari zooms the viewport when a focused <input>'s computed
   font-size is below 16px. Force every form control to ≥16px to prevent
   the surprise zoom (which traps staff at 1.2× zoom mid-edit). */
input,
select,
textarea {
  font: inherit;
  font-size: 16px;
}

#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* App header — two-row stack.
   Row 1: "Sample App by Devin" eyebrow left  ·  "192 samples" right.
   Row 2: SRSW seal · centered "Search" input · gear pill.
   The input lives in the static markup so iOS keeps the keyboard up
   across view transitions (was: re-rendered each pass, which dismissed). */
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding: calc(var(--safe-top) + 10px) 14px 12px;
  border-bottom: 1px solid var(--line);
}

.app-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
  margin-bottom: var(--space-2-5);
}

.app-title {
  font-size: var(--text-xs);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-mute);
  line-height: 1;
  font-weight: 500;
  margin: 0;
}
.app-title-credit {
  color: var(--accent);
  font-weight: 600;
}

.app-meta {
  font-size: var(--text-xs);
  color: var(--fg-dim);
  line-height: 1;
  letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.app-meta strong {
  color: var(--accent);
  font-weight: 700;
  margin-right: 4px;
}

.search-shell {
  display: flex;
  align-items: center;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  /* Right pad ≈ logo width (32) + gap (10) + left pad (14), minus a touch,
     so the centered "Search" placeholder reads as visually centered in the
     shell with nothing on the right to balance the logo on the left. */
  padding: 4px 52px 4px 14px;
  gap: var(--space-2-5);
  /* Anchors the absolutely-positioned clear button (change B) into the reserved
     right pad so it never compresses the input or widens the pill. */
  position: relative;
  transition: border-color var(--t-fast) ease-out, box-shadow var(--t-fast) ease-out;
}
.search-shell:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(196, 152, 64, 0.18);
}

/* Logo IS the settings button — tap to open the overlay. Visually identical
   to its previous span form (32px square, white seal, soft glow), but with
   button-element affordances (cursor, focus ring, press feedback). */
.logo-mark {
  width: 32px;
  height: 32px;
  flex: 0 0 32px;
  padding: 0;
  border: 0;
  background-color: transparent;
  background-image: url("/public/icons/srsw-logo-white.png");
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  cursor: pointer;
  /* Subtle soft glow so the white seal reads as a logo, not a sticker. */
  filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.12));
  transition: filter var(--t-fast) ease-out, transform var(--t-fast) ease-out;
}
.logo-mark:hover {
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.28));
}
.logo-mark:active {
  transform: scale(0.94);
}
.logo-mark:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 50%;
}

#search-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  color: var(--fg);
  font-size: var(--text-base);
  padding: 11px 0;
  outline: none;
  text-align: center;
  letter-spacing: 0.02em;
}
#search-input::placeholder {
  color: var(--fg-mute);
  text-align: center;
}
#search-input::-webkit-search-cancel-button { display: none; }

/* One-tap clear control (change B). Absolutely positioned in the shell's
   reserved right pad so it overlays no text and never compresses the input or
   widens the pill. Hidden via the [hidden] attr until the query is non-empty
   (toggled in main.js). 44px tap target for phone-first reliability; brand-gold
   glyph. Centred vertically; right edge ~4px inside the pill so the glyph reads
   near the right rim where the placeholder-balancing pad already sat empty. */
.search-clear {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--gold);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--t-fast) ease-out, transform var(--t-fast) ease-out;
}
.search-clear[hidden] { display: none; }
.search-clear svg { width: 18px; height: 18px; display: block; }
.search-clear:hover { color: var(--fg); }
.search-clear:active { transform: translateY(-50%) scale(0.9); }
.search-clear:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 50%; }

#main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.loading-state {
  padding: var(--space-8) var(--space-4);
  text-align: center;
  color: var(--fg-dim);
}

/* hide header in detail and customer modes */
#app[data-view="detail"] .app-header,
body[data-mode="customer"] .app-header {
  display: none;
}
