body { font-size: 15px; }
.muted { color: var(--text-3); }
.mono { font-family: var(--mono); font-size: 13px; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Sign in */
.signin { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.signin-card {
  width: min(420px, 100%);
  padding: 40px 32px 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-panel);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}
.signin-card img { width: 56px; height: 56px; margin: 0 auto; border-radius: 14px; outline: 1px solid var(--line-strong); outline-offset: -1px; }
.signin-card h1 { margin-top: 20px; font-size: 24px; }
.signin-card > p:not(#status) { margin-top: 8px; color: var(--text-2); }
.signin-card .button { width: 100%; margin-top: 28px; }
#status { min-height: 1.5em; margin-top: 16px; color: var(--text-2); font-size: 14px; overflow-wrap: anywhere; }
#status.error { color: var(--danger); }
.noscript { margin-top: 16px; color: var(--text-2); text-align: center; }

/* Shell */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100dvh; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 22px 16px 20px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.sidebar .brand { padding: 0 8px; font-size: 16px; }
.brand-tag {
  margin-left: 2px;
  padding: 2px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 550;
  letter-spacing: 0;
}
.tabs { display: flex; flex-direction: column; gap: 2px; }
.tabs a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-control);
  color: var(--text-2);
  font-weight: 500;
  text-decoration: none;
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
.tabs a:hover { background: var(--raised); color: var(--text); }
.tabs a[aria-current="page"] { background: var(--raised); color: var(--text); }
.tabs a[aria-current="page"] .icon { color: var(--accent-text); }
.sidebar #sign-out { margin-top: auto; justify-content: flex-start; padding: 0 10px; }

.content { width: 100%; max-width: 1120px; padding: 40px 40px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.page-head h1 { font-size: 28px; }
.page-head p { margin-top: 6px; max-width: 64ch; color: var(--text-2); }

.panel { border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--surface); }
.panel h2 { font-size: 16px; }

.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}
.pill.pass { background: color-mix(in srgb, var(--signal) 16%, transparent); color: var(--signal); }
.pill.fail { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.pill.pending { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent-text); }
.pill.accent { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent-text); }
.pill.neutral { background: var(--raised); color: var(--text-2); }

/* Validate */
.upload { padding: 20px; }
.drops { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.drop {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 14px;
  align-items: center;
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--bg);
  cursor: pointer;
  transition: border-color .15s var(--ease), background-color .15s var(--ease);
}
.drop:hover, .drop.dragging { border-color: var(--accent); }
.drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.drop.has-file { border-style: solid; border-color: color-mix(in srgb, var(--signal) 55%, var(--line)); }
.drop.has-file .drop-icon { color: var(--signal); }
.drop-icon { grid-row: span 2; width: 28px; height: 28px; color: var(--text-3); }
.drop-title { font-weight: 600; }
.drop-meta { color: var(--text-2); font-size: 14px; overflow-wrap: anywhere; }
.drop input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.upload-foot { display: flex; align-items: center; gap: 24px; margin-top: 16px; }
.upload-foot p { flex: 1; color: var(--text-3); font-size: 13px; line-height: 1.5; }

.split { margin-top: 16px; display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 16px; align-items: start; }
.history { padding: 16px 8px 8px; }
.history h2 { padding: 0 10px 10px; }
.history-list { list-style: none; margin: 0; padding: 0; max-height: 640px; overflow-y: auto; }
.history-item {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  text-align: left;
}
.history-item:hover { background: var(--raised); }
.history-item[aria-current="true"] { background: var(--raised); box-shadow: inset 2px 0 0 var(--accent); }
.history-names { display: grid; min-width: 0; }
.history-names strong, .history-names span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.history-names strong { font-weight: 550; }
.history-names span { color: var(--text-2); }
.history-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--text-3); font-size: 12px; }

.report { padding: 24px; min-width: 0; }
.report-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.report-head h2 { font-size: 20px; }
.report-head p { margin-top: 4px; font-size: 13px; overflow-wrap: anywhere; }
.report h3 { margin: 28px 0 8px; font-size: 14px; color: var(--text-2); font-weight: 600; letter-spacing: 0; }
.stats { display: flex; flex-wrap: wrap; gap: 12px 32px; margin: 20px 0 0; padding: 16px 0; border-block: 1px solid var(--line); }
.stats .field { display: grid; grid-template-columns: none; gap: 2px; }
.stats dt { color: var(--text-3); font-size: 12px; }
.stats dd { margin: 0; font-family: var(--mono); font-size: 18px; }
.stat-pass { color: var(--signal); }
.stat-fail { color: var(--danger); }
.stat-warn { color: var(--warn); }

.checks { list-style: none; margin: 0; padding: 0; }
.check { display: grid; grid-template-columns: 20px 1fr; gap: 12px; padding: 10px 0; }
.check + .check { border-top: 1px solid var(--line); }
.check > .icon { width: 20px; height: 20px; margin-top: 1px; }
.check strong { font-weight: 550; }
.check p { margin-top: 2px; color: var(--text-2); font-size: 14px; overflow-wrap: anywhere; }
.check-pass > .icon { color: var(--signal); }
.check-fail > .icon { color: var(--danger); }
.check-warn > .icon { color: var(--warn); }
.check-info > .icon { color: var(--text-3); }

.disclosure { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; }
.disclosure summary { cursor: pointer; color: var(--text-2); font-weight: 550; }
.disclosure summary:hover { color: var(--text); }
.scope { margin-top: 24px; color: var(--text-3); font-size: 13px; }

.progress { position: relative; height: 4px; margin-top: 24px; overflow: hidden; border-radius: 999px; background: var(--raised); }
.progress::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 35%;
  border-radius: inherit;
  background: var(--accent);
  animation: indeterminate 1.4s var(--ease) infinite;
}
@keyframes indeterminate { from { transform: translateX(-100%); } to { transform: translateX(300%); } }
.report .progress + p { margin-top: 12px; font-size: 14px; }

.empty { display: grid; justify-items: center; gap: 6px; padding: 40px 16px; text-align: center; }
.empty .icon { width: 28px; height: 28px; margin-bottom: 6px; color: var(--text-3); }
.empty p { max-width: 36ch; color: var(--text-2); font-size: 14px; }

/* Shared field list for hashes and metadata */
.fields { display: grid; gap: 12px; margin: 16px 0 0; }
.field { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 16px; align-items: center; }
.fields dt { color: var(--text-3); font-size: 13px; }
.fields dt::first-letter { text-transform: uppercase; }
.fields dd { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0; min-width: 0; }

.hash {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}
.hash code { font-size: 12.5px; }
.hash .icon { width: 14px; height: 14px; color: var(--text-3); }
.hash:hover { border-color: var(--line-strong); }
.hash:hover .icon { color: var(--accent-text); }

/* Assets */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 24px; }
.search { position: relative; flex: 1 1 320px; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search input {
  width: 100%;
  height: 40px;
  padding: 0 12px 0 38px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--surface);
}
.search input::placeholder { color: var(--text-3); }
.segmented { display: inline-flex; padding: 3px; border: 1px solid var(--line); border-radius: var(--radius-control); background: var(--surface); }
.segmented button { padding: 0 14px; height: 32px; border: 0; border-radius: 7px; background: transparent; color: var(--text-2); font-weight: 500; }
.segmented button[aria-pressed="true"] { background: var(--raised); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }

.asset-group + .asset-group { margin-top: 40px; }
.asset-group h2 { font-size: 20px; }
.asset-group h3 { display: flex; align-items: center; gap: 8px; margin: 20px 0 10px; color: var(--text-2); font-size: 14px; font-weight: 600; letter-spacing: 0; }
.count { padding: 0 7px; border-radius: 999px; background: var(--raised); color: var(--text-2); font-family: var(--mono); font-size: 12px; }
.asset-list { border: 1px solid var(--line); border-radius: var(--radius-panel); background: var(--surface); overflow: hidden; }
.asset + .asset { border-top: 1px solid var(--line); }
.asset summary {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) 104px minmax(0, 1.6fr) 80px 72px 18px;
  gap: 16px;
  align-items: center;
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
}
.asset summary::-webkit-details-marker { display: none; }
.asset summary:hover { background: color-mix(in srgb, var(--raised) 60%, transparent); }
.asset[open] summary { background: var(--raised); }
.asset-name { display: grid; min-width: 0; }
.asset-name strong { font-weight: 550; overflow-wrap: anywhere; }
.asset-name span { font-size: 13px; }
.asset summary .pill { justify-self: start; }
.asset-info { color: var(--text-2); font-size: 14px; overflow-wrap: anywhere; }
.asset-size { font-family: var(--mono); font-size: 13px; color: var(--text-2); text-align: right; }
.asset-state { font-size: 13px; }
.asset-state.newest { color: var(--signal); }
.caret { color: var(--text-3); transition: transform .2s var(--ease); }
.asset[open] .caret { transform: rotate(180deg); }
.asset .fields { margin: 0; padding: 16px 18px 20px; border-top: 1px solid var(--line); }

/* Catalog */
.asset.compact summary { grid-template-columns: minmax(0, 2fr) minmax(88px, auto) minmax(0, 1.6fr) 18px; }
.asset-group h2 .count { margin-left: 8px; vertical-align: 3px; }
.group-note { max-width: 72ch; margin: 6px 0 0; color: var(--text-2); font-size: 14px; }
.asset-group h3 + .group-note { margin: -4px 0 10px; }
.warning-text { color: var(--warn); }
.lookup { display: grid; gap: 16px; margin-bottom: 32px; padding: 20px; }
.lookup-text p { margin-top: 4px; max-width: 72ch; color: var(--text-2); font-size: 14px; }
.lookup-fields { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.lookup-fields label { display: grid; gap: 6px; color: var(--text-2); font-size: 13px; font-weight: 550; }
.lookup-fields input {
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 14px;
  text-transform: uppercase;
}
.lookup-fields .lookup-check { display: flex; align-items: center; gap: 8px; height: 40px; color: var(--text); font-size: 14px; font-weight: 500; }
.lookup-check input { width: 16px; height: 16px; accent-color: var(--accent); }
#fingerprint-code { width: 7ch; }
#fingerprint-vin { width: 22ch; }
#fingerprint-results:not(:empty) { margin-bottom: 40px; }
#fingerprint-results h2 { margin-bottom: 10px; font-size: 16px; }

.skeleton { display: grid; gap: 10px; }
.skeleton div { height: 56px; border-radius: var(--radius-control); background: var(--raised); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }

/* z-index scale: mobile top bar 10, toast 40. */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 40;
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 16px;
  transform: translateX(-50%);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-control);
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 500;
}
.toast.error { background: var(--danger); border-color: transparent; color: #fff8f6; }

@media (max-width: 1023px) {
  .content { padding: 32px 24px 56px; }
  .split { grid-template-columns: 1fr; }
  .history-list { max-height: 320px; }
  .asset summary, .asset.compact summary { grid-template-columns: minmax(0, 1fr) auto 18px; }
  .asset-info, .asset-size, .asset-state { display: none; }
  .field { grid-template-columns: 1fr; gap: 4px; }
}

@media (max-width: 767px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky;
    z-index: 10;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 12px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .tabs { order: 3; flex-direction: row; width: 100%; }
  .tabs a { flex: 1; justify-content: center; }
  .sidebar #sign-out { margin: 0 0 0 auto; }
  .content { padding: 24px 16px 48px; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head .button { align-self: flex-start; }
  .drops { grid-template-columns: 1fr; }
  .upload-foot { flex-direction: column; align-items: stretch; }
  .report { padding: 18px; }
  .segmented { width: 100%; }
  .lookup-fields label { flex: 1 1 100%; }
  #fingerprint-code, #fingerprint-vin { width: 100%; }
  .segmented button { flex: 1; }
}
