/* ── Variables ─────────────────────────────────────────────────────────────── */
:root {
  --brand:      #54697A;
  --brand-dark: #072943;
  --bg:         #EAE7DE;
  --card:       #F7F4EE;
  --text:       #072943;
  --muted:      #54697A;
  --border:     rgba(84, 105, 122, 0.24);
  --success:    #072943;
  --danger:     #c0392b;
}

/* ── Reset & base ───────────────────────────────────────────────────────────── */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 24px;
}

/* ── Header ─────────────────────────────────────────────────────────────────── */
.hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 28px;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand);
  font-weight: 700;
  margin: 0 0 6px;
}

h1, h2, h3 { margin: 0 0 8px; }
.subtitle { margin: 0; color: var(--muted); }

/* ── Auth pill ──────────────────────────────────────────────────────────────── */
.auth-pill {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(84, 105, 122, 0.12);
  color: var(--brand-dark);
  font-weight: 600;
  white-space: nowrap;
}

/* ── Buttons ────────────────────────────────────────────────────────────────── */
button {
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  min-height: 46px;
  font: inherit;
}

button.primary   { background: var(--brand-dark); color: #EAE7DE; }
button.primary:hover { background: var(--brand); }
button.secondary { background: var(--brand);      color: #EAE7DE; }
button.secondary:hover { opacity: 0.85; }
button.compact   { min-height: 36px; padding: 6px 12px; font-size: 13px; }
button.hidden    { display: none; }

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--brand);
  color: #EAE7DE;
  text-decoration: none;
  font-weight: 600;
  white-space: nowrap;
}

/* ── Card ───────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(15, 76, 129, 0.06);
}

/* ── Sign-in prompt ─────────────────────────────────────────────────────────── */
.sign-in-prompt {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 24px;
}

/* ── Asset menu (home page cards) ───────────────────────────────────────────── */
.asset-menu {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 640px;
}

.asset-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  text-decoration: none;
  color: var(--text);
  box-shadow: 0 4px 16px rgba(15, 76, 129, 0.06);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.asset-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(15, 76, 129, 0.12);
}

.asset-card:active {
  transform: translateY(0);
}

.asset-card-icon {
  font-size: 2.4rem;
  line-height: 1;
  flex-shrink: 0;
}

.asset-card-body {
  flex: 1;
}

.asset-card-body h2 {
  font-size: 1.15rem;
  margin-bottom: 4px;
}

.asset-card-body p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.asset-card-arrow {
  font-size: 1.6rem;
  color: var(--brand);
  flex-shrink: 0;
}

/* ── Toolbar (search + location filter) ─────────────────────────────────────── */
.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.search-input,
.location-filter {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  color: var(--text);
}

.search-input { flex: 1; min-width: 160px; }
.location-filter { min-width: 150px; }

.search-input:focus,
.location-filter:focus {
  outline: 2px solid rgba(84, 105, 122, 0.22);
  border-color: var(--brand-dark);
}

/* ── Table ──────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th, td {
  padding: 11px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 14px;
}

th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }

tbody tr:hover { background: rgba(84, 105, 122, 0.06); cursor: pointer; }

.empty-state { padding: 20px 0; color: var(--muted); }

/* ── Detail panel ───────────────────────────────────────────────────────────── */
.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(480px, 100vw);
  background: var(--card);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 40px rgba(0,0,0,0.14);
  overflow-y: auto;
  padding: 24px 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.detail-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 41, 67, 0.35);
  z-index: 199;
}

.detail-close {
  position: sticky;
  top: 0;
  align-self: flex-end;
  background: var(--brand);
  color: #EAE7DE;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  min-height: unset;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}

.detail-content h2 { margin-bottom: 16px; }

.detail-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 16px;
  margin: 0;
}

.detail-grid dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.detail-grid dd {
  margin: 0;
  font-size: 14px;
  word-break: break-word;
}

.service-logs h3 { margin-bottom: 12px; }

/* ── Misc ───────────────────────────────────────────────────────────────────── */
.hidden   { display: none !important; }
.muted    { color: var(--muted); }
.is-error { color: var(--danger); }

.status-message {
  min-height: 24px;
  margin: 12px 0 0;
  font-weight: 600;
  color: var(--success);
}

/* ── Scanner page ───────────────────────────────────────────────────────────── */
.scan-shell {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.scan-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.scan-header-row h1 { margin: 0; }

.link-button.compact { padding: 8px 12px; min-height: 38px; font-size: 14px; }

.scanner-wrap {
  position: relative;
  width: 100%;
  border-radius: 18px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 4 / 3;
}

.scan-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.scan-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
}

.scan-target {
  position: relative;
  width: 58%;
  aspect-ratio: 1;
  /* Clear the overlay within the target box */
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.4);
  border-radius: 4px;
}

.corner {
  position: absolute;
  width: 22px;
  height: 22px;
  border-color: #EAE7DE;
  border-style: solid;
  border-width: 0;
}

.corner.tl { top: 0;    left: 0;  border-top-width: 3px;    border-left-width: 3px;   border-top-left-radius: 4px; }
.corner.tr { top: 0;    right: 0; border-top-width: 3px;    border-right-width: 3px;  border-top-right-radius: 4px; }
.corner.bl { bottom: 0; left: 0;  border-bottom-width: 3px; border-left-width: 3px;   border-bottom-left-radius: 4px; }
.corner.br { bottom: 0; right: 0; border-bottom-width: 3px; border-right-width: 3px;  border-bottom-right-radius: 4px; }

.scan-line {
  position: absolute;
  left: 6px;
  right: 6px;
  height: 2px;
  background: var(--brand);
  top: 0;
  animation: scanline 2s ease-in-out infinite;
}

@keyframes scanline {
  0%   { top: 6px;              opacity: 1; }
  50%  { top: calc(100% - 6px); opacity: 1; }
  100% { top: 6px;              opacity: 1; }
}

.scan-status {
  text-align: center;
  color: var(--muted);
  margin: 0;
  font-weight: 600;
  min-height: 22px;
}

.upload-label { cursor: pointer; display: inline-block; }
.upload-label input[type="file"] { position: absolute; opacity: 0; width: 0; height: 0; }

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 12px 20px;
  border-radius: 12px;
  background: var(--brand-dark);
  color: #EAE7DE;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}

.manual-entry {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.manual-entry input {
  flex: 1;
  min-width: 160px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  color: var(--text);
}

.manual-entry input:focus {
  outline: 2px solid rgba(84, 105, 122, 0.22);
  border-color: var(--brand-dark);
}

.result-card { border-left: 4px solid var(--brand-dark); }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  .hero, .hero-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .toolbar { flex-direction: column; }
  .detail-panel { width: 100vw; border-left: none; }
}
