/*
 * SiteSnap field app styling.
 *
 * Hand-written rather than Tailwind-built: no Node toolchain on the deploy
 * host, and no external CSS/JS request to block first paint on a jobsite
 * LTE connection. Palette and the hard-shadow brutalist look are carried
 * over from the reference React app (zinc + amber).
 */

:root {
  --zinc-50: #fafafa;
  --zinc-100: #f4f4f5;
  --zinc-200: #e4e4e7;
  --zinc-300: #d4d4d8;
  --zinc-400: #a1a1aa;
  --zinc-500: #71717a;
  --zinc-700: #3f3f46;
  --zinc-800: #27272a;
  --zinc-900: #18181b;
  --zinc-950: #09090b;
  --amber-400: #fbbf24;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --red-600: #dc2626;
  --green-600: #16a34a;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--zinc-200);
  color: var(--zinc-950);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

.shell {
  max-width: 32rem;
  margin: 0 auto;
  min-height: 100dvh;
  background: var(--zinc-100);
  border-left: 1px solid var(--zinc-300);
  border-right: 1px solid var(--zinc-300);
  display: flex;
  flex-direction: column;
}

/* ---------- header ---------- */

.topbar {
  background: var(--zinc-950);
  color: #fff;
  border-bottom: 4px solid var(--amber-500);
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar h1 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.topbar .accent { color: var(--amber-500); }

.topbar form { margin: 0; }

.main { padding: 1.25rem 1rem 3rem; flex: 1; }

/* ---------- labels & fields ---------- */

.field { margin-bottom: 1.75rem; }

.label {
  display: block;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--zinc-500);
  border-bottom: 1px solid var(--zinc-300);
  padding-bottom: 0.3rem;
  margin-bottom: 0.7rem;
}

input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
  width: 100%;
  font: inherit;
  padding: 0.75rem;
  background: var(--zinc-50);
  border: 2px solid var(--zinc-950);
  border-radius: 0;
  color: var(--zinc-950);
  -webkit-appearance: none;
  appearance: none;
}

select {
  background-image: linear-gradient(45deg, transparent 50%, var(--zinc-950) 50%),
                    linear-gradient(135deg, var(--zinc-950) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2.25rem;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--amber-500);
}

input::placeholder, textarea::placeholder { color: var(--zinc-400); }

.hint {
  font-size: 0.75rem;
  color: var(--zinc-500);
  margin-top: 0.4rem;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.85rem 1rem;
  border: 2px solid var(--zinc-950);
  background: var(--zinc-100);
  color: var(--zinc-950);
  cursor: pointer;
  border-radius: 0;
  text-decoration: none;
  transition: background-color .12s, transform .06s, box-shadow .06s;
}

.btn:active { transform: translate(1px, 1px); }

.btn-primary {
  background: var(--amber-500);
  box-shadow: 4px 4px 0 0 var(--zinc-950);
}
.btn-primary:hover { background: var(--amber-400); }
.btn-primary:active { box-shadow: 2px 2px 0 0 var(--zinc-950); }

.btn-dark { background: var(--zinc-900); color: #fff; border-color: var(--zinc-900); }
.btn-dark:hover { background: var(--zinc-800); }

.btn-ghost {
  background: transparent;
  border-color: var(--zinc-700);
  color: var(--zinc-300);
  padding: 0.5rem 0.7rem;
  font-size: 0.65rem;
}
.btn-ghost:hover { background: var(--zinc-900); }

.btn-block { width: 100%; }

.btn[disabled] { opacity: .45; cursor: not-allowed; filter: grayscale(1); }
.btn[disabled]:active { transform: none; }

/* ---------- capture: photo ---------- */

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  border: 2px dashed var(--zinc-400);
  background: var(--zinc-200);
  color: var(--zinc-500);
  cursor: pointer;
  text-align: center;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  gap: 0.5rem;
}
.dropzone:active { background: var(--zinc-300); }

.photo-wrap { position: relative; border: 2px solid var(--zinc-950); background: var(--zinc-200); }
.photo-wrap img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.photo-wrap .retake {
  position: absolute; top: 0.75rem; right: 0.75rem;
  background: var(--zinc-950); color: #fff; border: none;
  font: inherit; font-size: 0.65rem; font-weight: 900;
  letter-spacing: 0.14em; text-transform: uppercase;
  padding: 0.4rem 0.7rem; cursor: pointer;
}

/* ---------- capture: audio ---------- */

.recorder {
  border: 2px solid var(--zinc-950);
  background: #fff;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.rec-btn {
  width: 5rem; height: 5rem;
  border-radius: 50%;
  border: 2px solid var(--zinc-300);
  background: var(--zinc-100);
  color: var(--zinc-700);
  font-size: 1.75rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.rec-btn.recording {
  background: var(--zinc-950);
  color: var(--amber-500);
  border: 4px solid var(--amber-500);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .55 } }

.rec-timer {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--amber-600);
  text-transform: uppercase;
}

.audio-panel {
  border: 1px solid var(--zinc-300);
  background: var(--zinc-50);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.audio-panel audio { width: 100%; height: 2.5rem; }

.transcript {
  background: #fff;
  border: 2px solid var(--zinc-950);
  padding: 1rem;
  font-size: 0.9rem;
  color: var(--zinc-700);
  /* NB: no white-space: pre-wrap here -- it would render the Blade
     template's own indentation and newlines as literal whitespace.
     It belongs on the text node itself (.transcript-text). */
}

.transcript-text { white-space: pre-wrap; }
.transcript .transcript-head {
  font-size: 0.65rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber-600);
  border-bottom: 1px solid var(--zinc-200);
  padding-bottom: 0.35rem;
  margin-bottom: 0.6rem;
}
.transcript textarea {
  border: none;
  background: transparent;
  padding: 0;
  font-size: 0.9rem;
  color: var(--zinc-700);
  resize: vertical;
  min-height: 6rem;
}
.transcript textarea:focus { outline: none; }

/* ---------- alerts ---------- */

.alert {
  border: 2px solid var(--zinc-950);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
  font-weight: 600;
}
.alert-success { background: #dcfce7; border-color: var(--green-600); }
.alert-error { background: #fee2e2; border-color: var(--red-600); }

/* ---------- recent list ---------- */

.recent { margin-top: 2.5rem; }
.recent-item {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  border: 1px solid var(--zinc-300);
  background: #fff;
  padding: 0.6rem;
  margin-bottom: 0.5rem;
}
.recent-item img {
  width: 3.25rem; height: 3.25rem;
  object-fit: cover;
  border: 1px solid var(--zinc-300);
  flex-shrink: 0;
}
.recent-item .thumb-placeholder {
  width: 3.25rem; height: 3.25rem;
  background: var(--zinc-200);
  display: flex; align-items: center; justify-content: center;
  color: var(--zinc-400);
  flex-shrink: 0;
  font-size: 1.1rem;
}
.recent-item .meta { min-width: 0; }
.recent-item .meta strong {
  display: block;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recent-item .meta span {
  font-size: 0.7rem;
  color: var(--zinc-500);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------- login ---------- */

.login-wrap {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--zinc-100);
}
.login-card { width: 100%; max-width: 22rem; }
.login-card h1 {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  text-align: center;
  margin: 0 0 2rem;
}

.errors {
  border: 2px solid var(--red-600);
  background: #fee2e2;
  padding: 0.7rem 0.9rem;
  margin-bottom: 1rem;
  font-size: 0.85rem;
}
.errors ul { margin: 0; padding-left: 1.1rem; }

.spinner {
  width: 0.9rem; height: 0.9rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg) } }

[x-cloak] { display: none !important; }

/* ==================================================================
   Added: navigation, record list/detail, feedback widget
   ================================================================== */

/* ---------- tab nav ---------- */

.tabs { display: flex; background: var(--zinc-900); padding: 0.25rem; gap: 0.25rem; }
.tabs a {
  flex: 1;
  text-align: center;
  padding: 0.6rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--zinc-400);
  text-decoration: none;
}
.tabs a.active { background: var(--amber-500); color: var(--zinc-950); }

/* ---------- segmented control (chips) ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  font: inherit;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.5rem 0.7rem;
  border: 2px solid var(--zinc-950);
  background: #fff;
  color: var(--zinc-950);
  cursor: pointer;
}
.chip[aria-pressed="true"] { background: var(--zinc-950); color: var(--amber-500); }
.chip.danger[aria-pressed="true"] { background: var(--red-600); color: #fff; border-color: var(--red-600); }

/* ---------- photo strip (multi-photo capture) ---------- */

.photo-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.photo-strip .cell { position: relative; border: 2px solid var(--zinc-950); background: var(--zinc-200); }
.photo-strip .cell img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.photo-strip .cell button {
  position: absolute; top: 2px; right: 2px;
  background: var(--zinc-950); color: #fff; border: none;
  width: 1.5rem; height: 1.5rem; cursor: pointer;
  font-size: 0.9rem; line-height: 1;
}
.photo-strip .add {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  aspect-ratio: 1;
  border: 2px dashed var(--zinc-400);
  background: var(--zinc-200);
  color: var(--zinc-500);
  cursor: pointer;
  font-size: 1.5rem;
}

/* ---------- record cards ---------- */

.rec-card {
  display: flex;
  gap: 0.85rem;
  background: #fff;
  border: 2px solid var(--zinc-950);
  box-shadow: 4px 4px 0 0 var(--zinc-950);
  padding: 0.85rem;
  margin-bottom: 0.9rem;
  text-decoration: none;
  color: inherit;
}
.rec-card:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 0 var(--zinc-950); }
.rec-card img, .rec-card .noimg {
  width: 5.25rem; height: 5.25rem;
  object-fit: cover;
  border: 1px solid var(--zinc-300);
  flex-shrink: 0;
}
.rec-card .noimg {
  background: var(--zinc-200);
  display: flex; align-items: center; justify-content: center;
  color: var(--zinc-400); font-size: 1.4rem;
}
.rec-card .body { min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 0.3rem; }
.rec-card h3 {
  margin: 0; font-size: 0.95rem; font-weight: 900;
  text-transform: uppercase; letter-spacing: -0.01em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rec-card .when {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.7rem; color: var(--zinc-500); text-transform: uppercase;
}

.tag {
  display: inline-block;
  font-size: 0.6rem; font-weight: 900;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.15rem 0.4rem;
  background: var(--zinc-200); color: var(--zinc-500);
}
.tag.dark { background: var(--zinc-950); color: #fff; }
.tag.amber { background: var(--amber-500); color: var(--zinc-950); }
.tag.red { background: var(--red-600); color: #fff; }
.tag-row { display: flex; gap: 0.3rem; flex-wrap: wrap; }

/* ---------- gallery ---------- */

.gallery-card {
  background: #fff;
  border: 2px solid var(--zinc-950);
  box-shadow: 4px 4px 0 0 var(--zinc-950);
  margin-bottom: 1.5rem;
  text-decoration: none;
  color: inherit;
  display: block;
}
.gallery-card .shot { position: relative; border-bottom: 2px solid var(--zinc-950); }
.gallery-card .shot img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.gallery-card .stamp {
  position: absolute; top: 0.5rem; right: 0.5rem;
  background: var(--amber-500); color: var(--zinc-950);
  border: 2px solid var(--zinc-950);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.6rem; font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0.2rem 0.4rem;
}
.gallery-card .meta { padding: 0.9rem; }
.gallery-card .meta h3 { margin: 0 0 0.45rem; font-size: 1.05rem; font-weight: 900; text-transform: uppercase; }
.gallery-card .meta p {
  margin: 0; font-size: 0.85rem; color: var(--zinc-700);
  border-left: 2px solid var(--amber-500); padding-left: 0.7rem;
}
.gallery-link { display: block; color: inherit; text-decoration: none; }
.gallery-actions {
  display: flex; align-items: center; justify-content: flex-end; gap: 0.6rem;
  padding: 0.6rem 0.9rem;
  background: var(--zinc-100);
  border-top: 2px solid var(--zinc-950);
}
.gallery-error { flex: 1; font-size: 0.75rem; font-weight: 700; color: var(--red-600); }

/* ---------- record detail ---------- */

.detail-section { margin-bottom: 1.75rem; }
.detail-photos { display: grid; gap: 0.5rem; }
.detail-photos img { display: block; width: 100%; border: 2px solid var(--zinc-950); }

.summary-box {
  background: #fffbeb;
  border: 2px solid var(--amber-500);
  padding: 1rem;
  font-weight: 700;
  font-size: 0.95rem;
}

.meta-grid { display: grid; grid-template-columns: auto 1fr; gap: 0.35rem 0.9rem; font-size: 0.82rem; }
.meta-grid dt { font-weight: 900; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.68rem; color: var(--zinc-500); align-self: center; }
.meta-grid dd { margin: 0; }

.empty {
  text-align: center;
  padding: 3.5rem 1rem;
  color: var(--zinc-500);
}
.empty .icon { font-size: 2.5rem; display: block; margin-bottom: 0.75rem; }
.empty h2 { font-size: 1.05rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.1em; color: var(--zinc-700); margin: 0 0 0.4rem; }

.pager { display: flex; gap: 0.5rem; justify-content: center; margin-top: 1.5rem; }

/* ---------- shared modal action row ---------- */

.modal-actions { display: flex; gap: 0.5rem; margin-top: 1rem; }
.modal-actions .btn { flex: 1; }

.tag.green { background: var(--green-600); color: #fff; }

/* ---------- search ---------- */

.searchbar { display: flex; gap: .4rem; margin-bottom: .9rem; }
.searchbar input[type="search"] {
  flex: 1;
  min-width: 0;
  font: inherit;
  padding: .7rem .75rem;
  background: var(--zinc-50);
  border: 2px solid var(--zinc-950);
  border-radius: 0;
  color: var(--zinc-950);
  -webkit-appearance: none;
  appearance: none;
}
.searchbar input[type="search"]:focus { outline: none; border-color: var(--amber-500); }
.searchbar .btn { padding: .7rem .85rem; flex-shrink: 0; }

/* ---------- send-to-trade sheet ---------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  /* Above the feedback widget's floating button (9998/9999), which
     otherwise sits on top of the contact list. */
  z-index: 10000;
  background: rgba(9, 9, 11, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet {
  width: 100%;
  max-width: 32rem;
  max-height: 85dvh;
  overflow-y: auto;
  background: var(--zinc-100);
  border-top: 4px solid var(--amber-500);
  padding: 1rem 1rem calc(1.25rem + env(safe-area-inset-bottom));
}
.sheet-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.contact-list { list-style: none; margin: 0; padding: 0; }
.contact-list li { margin-bottom: 0.4rem; }
.contact-list button {
  width: 100%;
  text-align: left;
  font: inherit;
  background: #fff;
  border: 1px solid var(--zinc-300);
  padding: 0.65rem 0.75rem;
  cursor: pointer;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.5rem;
  color: var(--zinc-950);
}
.contact-list button:active { background: var(--zinc-200); }
.contact-list strong { font-size: 0.9rem; }
.contact-list span { font-size: 0.72rem; color: var(--zinc-500); flex-basis: 100%; }
.contact-list em {
  font-style: normal;
  font-size: 0.6rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--amber-500);
  padding: 0.05rem 0.35rem;
}

.sent-list { list-style: none; margin: 0.9rem 0 0; padding: 0; font-size: 0.78rem; }
.sent-list li {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.5rem;
  padding: 0.45rem 0;
  border-top: 1px solid var(--zinc-300);
}
.sent-list strong { flex: 1; }
.sent-list span { color: var(--zinc-500); }
.sent-list .opened { color: var(--green-600); font-weight: 700; flex-basis: 100%; }
.sent-list .muted { flex-basis: 100%; }
