*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #0b100c;
  --surface: #141b15;
  --line: #26332a;
  --line-soft: #1d2721;
  --text: #eaf2ea;
  --muted: #9db0a1;
  --faint: #67796c;

  --accent: #9bdc4f;
  --accent-soft: #1c2913;
  --ok: #46c877;
  --ok-soft: #143020;
  --warn: #e3b34c;
  --err: #f2635a;
  --err-soft: #381b17;

  --r-lg: 12px;
  --r-md: 9px;
  --r-sm: 6px;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 1px 3px rgba(0, 0, 0, .45), 0 8px 20px -6px rgba(0, 0, 0, .35);

  --mono: "Consolas", "SF Mono", ui-monospace, "Roboto Mono", monospace;
  --appbar-h: 80px;   /* leaves room for the scan status line under the field */
}

html, body { height: 100%; }

body {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, p, ul { margin: 0; }
ul { list-style: none; padding: 0; }

/* ================================================================
   App bar
   ================================================================ */

.appbar {
  flex: none;
  height: var(--appbar-h);
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  z-index: 20;
}

/* Scannafest wordmark, linking back to the marketing site */
.app-logo {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}

/* The mark is the product logo itself — its dark tile reads as an app icon
   against the near-black bar, so it gets a faint ring to hold its edge. */
.app-logo-img {
  width: 46px;
  height: 46px;
  flex: none;
  border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(155, 220, 79, .28), 0 3px 10px rgba(0, 0, 0, .5);
}

.app-logo-text b {
  display: block;
  font: 800 22px/1.1 "Segoe UI", system-ui, -apple-system, sans-serif;
  letter-spacing: -.5px;
  color: #b4ea70;                              /* solid fallback */
}

/* leaf-to-lime gradient across the wordmark where supported */
@supports (-webkit-background-clip: text) or (background-clip: text) {
  .app-logo-text b {
    background: linear-gradient(105deg, #d3f7a1 0%, #9bdc4f 55%, #6faf35 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: #b4ea70;
  }
}

.app-logo-text small {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--faint);
}

.version-tag {
  font-weight: 600;
  letter-spacing: .05em;
}


/* Quiet links out to the explainer, for someone who arrives not knowing what
   this is. Deliberately understated — the scan field is the point of the page. */
.app-nav {
  flex: none;
  display: flex;
  gap: 4px;
}

.app-nav button {
  padding: 8px 14px;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  font: 600 14.5px/1.4 "Segoe UI", system-ui, sans-serif;
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
  transition: background .12s, color .12s;
}

.app-nav button:hover {
  background: #1c2916;
  color: var(--accent);
}

.empty-help {
  margin-top: 14px;
  font-size: 13px;
  color: var(--faint);
}

.empty-help button {
  padding: 0;
  border: 0;
  background: none;
  font: 600 13px/1 "Segoe UI", system-ui, sans-serif;
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

/* --- the scan field is the primary control, so it gets center stage --- */

/* Left-pinned rather than centered in the leftover space: on a full-width
   monitor that places the field over the middle of the sheet, which is where
   the eye is while scanning. */
.scanfield {
  position: relative;
  flex: 1 1 auto;
  max-width: 560px;
  margin-right: auto;
  display: flex;
  align-items: center;
}

.scanfield-icon {
  position: absolute;
  left: 13px;
  width: 19px;
  height: 19px;
  color: var(--accent);
  pointer-events: none;
}

#scanInput {
  width: 100%;
  padding: 11px 14px 11px 40px;
  font: 600 16px/1.2 var(--mono);
  letter-spacing: .4px;
  color: var(--text);
  background: #0f1510;
  border: 1.5px solid var(--accent);
  border-radius: var(--r-md);
  outline: none;
  transition: box-shadow .15s, border-color .15s, background .15s;
}

#scanInput::placeholder {
  font: 400 14.5px/1.2 "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0;
  color: var(--faint);
}

/* Only glows while focused, so it is obvious at a glance whether the next
   scan will be captured. */
#scanInput:focus {
  background: #121a13;
  box-shadow: 0 0 0 3.5px rgba(155, 220, 79, .18);
}

#scanInput:not(:focus) {
  border-color: var(--line);
  color: var(--muted);
}

.scan-status {
  position: absolute;
  top: calc(100% + 6px);
  left: 2px;
  right: 2px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.scan-status.ok   { color: var(--ok); }
.scan-status.warn { color: var(--warn); }
.scan-status.err  { color: var(--err); }

.actions {
  flex: none;
  display: flex;
  gap: 7px;
}

/* ================================================================
   Buttons & controls
   ================================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 13px;
  font: 600 13px/1 "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}

.btn:hover { background: #1b241c; border-color: #35453a; }
.btn:active { transform: translateY(.5px); }

.btn-primary {
  color: #0e1707;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { background: #ace368; border-color: #ace368; }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
.btn-ghost:hover { background: #1b241c; border-color: transparent; color: var(--err); }

.btn-small { padding: 6px 10px; font-size: 12px; }

/* Shown only when the browser refuses to persist anything — an operator
   should never assume a half-finished count is being saved when it isn't. */
.storage-warning {
  flex: none;
  padding: 9px 20px;
  background: #2b2210;
  border-bottom: 1px solid #4a3b16;
  color: #e6c26a;
  font-size: 13px;
}

.storage-warning[hidden] { display: none; }

/* ================================================================
   Layout: sheet on the left, supporting detail on the right
   ================================================================ */

.layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 306px;
  gap: 14px;
  padding: 14px;
}

.sheet-pane {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

/* ---------- toolbar above the sheet ---------- */

.sheet-toolbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(#161e17, #141b15);
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 1 340px;
}

.search svg {
  position: absolute;
  left: 10px;
  width: 15px;
  height: 15px;
  color: var(--faint);
  pointer-events: none;
}

.search input {
  width: 100%;
  padding: 7px 10px 7px 32px;
  font-size: 13.5px;
  color: var(--text);
  background: #0f1510;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  outline: none;
}

.search input:focus {
  background: #121a13;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(155, 220, 79, .12);
}

.search input::-webkit-search-cancel-button { cursor: pointer; }

/* toggle switch */

.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  flex: none;
}

.switch input { position: absolute; opacity: 0; pointer-events: none; }

.switch-track {
  width: 32px;
  height: 18px;
  padding: 2px;
  border-radius: 999px;
  background: #2e3b31;
  transition: background .16s;
}

.switch-knob {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #dfe9df;
  box-shadow: var(--shadow-sm);
  transition: transform .16s;
}

.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track .switch-knob { transform: translateX(14px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px rgba(155, 220, 79, .2); }

.switch-label { font-size: 13px; color: var(--muted); }

.row-count {
  margin-left: auto;
  flex: none;
  font-size: 12.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

/* ================================================================
   The sheet
   ================================================================ */

.sheet-scroll {
  position: relative;
  flex: 1;
  overflow: auto;
  scrollbar-gutter: stable;
}

/* Capped and centerd: past ~1160px the columns stop stretching, so a
   24-character code never floats in the middle of a huge cell. */
.sheet {
  width: 100%;
  max-width: 1400px;
  margin-inline: auto;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.sheet thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: left;
  padding: 9px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .085em;
  text-transform: uppercase;
  color: var(--muted);
  background: #181f19;
  border-bottom: 1px solid var(--line);
}

.sheet thead th.col-scan { padding-left: 20px; }

.col-scan { width: 26%; }
.col-pkg  { width: 24%; }
.col-item { width: 50%; }

/* `height` on a table cell behaves as a minimum, so rows keep their 42px
   rhythm for short names and grow when a long one wraps. */
.sheet tbody td {
  height: 42px;
  padding: 9px 14px;
  background: color-mix(in srgb, var(--file) 10%, var(--surface));
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}

/* Scanned codes and package tags are fixed-length, so they stay on one line. */
.cell-scan, .cell-pkg {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet tbody tr:hover td { filter: brightness(1.25); }
.sheet tbody tr.hidden { display: none; }

/* the file's color rides the leading edge of every row */
.sheet tbody td.cell-scan {
  position: relative;
  padding-left: 20px;
}

/* bottom:-1px so the rail runs unbroken through each row border */
.sheet tbody td.cell-scan::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: -1px;
  width: 5px;
  background: var(--file);
}

.cell-pkg {
  font-family: var(--mono);
  font-size: 13.5px;
  letter-spacing: .35px;
  color: #c6d4c8;
}

/* Metrc item names run past 120 characters on some manifests, so this cell
   wraps rather than hiding the end of the name. */
.cell-item {
  font-size: 13.8px;
  line-height: 1.45;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* ---------- scan cell ---------- */

.scan-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 100%;
}

.mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  font-size: 11.5px;
  font-weight: 700;
  color: transparent;
  border: 1.5px dashed #3d4d41;
  transition: background .15s, border-color .15s, color .15s;
}

.scan-value {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .35px;
}

/* Pending rows stay blank on purpose — the dashed ring already says
   "not scanned", and repeating a placeholder down 300 rows is just noise. */

.row-clear {
  flex: none;
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--faint);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  visibility: hidden;
}

.row-clear:hover { background: var(--err-soft); color: var(--err); }

/* only surfaces on the row you are pointing at, so filled rows stay tidy */
tr:hover .row-clear { visibility: visible; }
tr:not(.scanned) .row-clear { visibility: hidden; }

/* ---------- row states ---------- */

tr.scanned .mark {
  color: #0e1707;
  background: var(--ok);
  border: 1.5px solid var(--ok);
}

tr.scanned .cell-pkg,
tr.scanned .cell-item { color: var(--faint); }
tr.scanned .scan-value { color: var(--muted); }

@keyframes flash-ok  { from { background: #2f6b40; } to { background: color-mix(in srgb, var(--file) 10%, var(--surface)); } }
@keyframes flash-err { from { background: #6b2f2a; } to { background: color-mix(in srgb, var(--file) 10%, var(--surface)); } }

tr.flash-ok td  { animation: flash-ok 1s ease-out; }
tr.flash-err td { animation: flash-err 1s ease-out; }

/* ---------- empty state ---------- */

.empty {
  position: absolute;
  inset: 44px 0 0;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  padding: 24px;
  color: var(--muted);
}

.empty[hidden] { display: none; }

.empty-art {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 14px;
  color: var(--accent);
  background: var(--accent-soft);
}

.empty-art svg { width: 28px; height: 28px; }

.empty-title {
  font-size: 15.5px;
  font-weight: 650;
  color: var(--text);
}

.empty-sub {
  max-width: 380px;
  margin-top: 6px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
}

/* ================================================================
   Sidebar
   ================================================================ */

.sidebar {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: auto;
}

.app-credit {
  flex: none;
  margin-top: auto;          /* drops to the foot of the sidebar */
  padding: 4px 2px 2px;
  text-align: center;
  font-size: 11.5px;
  letter-spacing: .01em;
  color: var(--faint);
}

.app-credit b {
  font-weight: 650;
  color: var(--muted);
}

.panel {
  flex: none;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
}

/* Sizes to its contents rather than stretching, so a two-file sheet does not
   leave a tall empty card; the list scrolls once there are many files. */
.panel-grow { display: flex; flex-direction: column; min-height: 0; }

.panel-title {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
}

.badge {
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--muted);
  background: #202a22;
}

.badge-err { color: var(--err); background: var(--err-soft); }

/* ---------- progress ---------- */

.stat-head {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-bottom: 10px;
}

.stat-done {
  font-size: 30px;
  font-weight: 680;
  line-height: 1;
  letter-spacing: -.5px;
  font-variant-numeric: tabular-nums;
}

.stat-total { font-size: 13px; color: var(--muted); }
.stat-total b { color: var(--text); font-weight: 650; }

.bar {
  height: 7px;
  border-radius: 999px;
  background: #232e25;
  overflow: hidden;
}

.bar-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--ok);
  transition: width .3s ease;
}

.stat-list {
  margin-top: 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.stat-list li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-list b {
  margin-left: auto;
  color: var(--text);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.stat-list li[hidden] { display: none; }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: none;
}

.dot-ok   { background: var(--ok); }
.dot-idle { background: #3d4d41; }
.dot-err  { background: var(--err); }

/* ---------- file list ---------- */

.file-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
  max-height: 42vh;
  overflow: auto;
}

.file-card {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: #171f18;
}

.file-card-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.file-swatch {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 3px;
  background: var(--c);
}

.file-name {
  flex: 1;
  min-width: 0;
  font-size: 12.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-remove,
.file-rename {
  flex: none;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--faint);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.file-remove:hover { background: var(--err-soft); color: var(--err); }

.file-rename svg { width: 13px; height: 13px; }
.file-rename:hover { background: var(--accent-soft); color: var(--accent); }

/* Editing the label of a loaded manifest. */
.file-name-input {
  flex: 1;
  min-width: 0;
  padding: 3px 6px;
  font: 600 12.5px/1.3 "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: #0f1510;
  border: 1px solid var(--accent);
  border-radius: var(--r-sm);
  outline: none;
  box-shadow: 0 0 0 2.5px rgba(155, 220, 79, .16);
}

.file-card .bar { height: 5px; }
.file-card .bar-fill { background: var(--c); }

.file-meta {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.file-meta .done { color: var(--ok); font-weight: 700; }

.panel-empty {
  font-size: 12.5px;
  color: var(--faint);
}

.panel-empty[hidden] { display: none; }

/* ---------- unexpected scans ---------- */

.panel-alert {
  border-color: #4a2622;
  background: #1c1412;
}

.panel-alert[hidden] { display: none; }

.panel-note {
  margin: -4px 0 9px;
  font-size: 12px;
  color: var(--muted);
}

.unexpected-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 190px;
  overflow: auto;
  margin-bottom: 10px;
}

.unexpected-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: var(--r-sm);
  background: var(--err-soft);
  font-family: var(--mono);
  font-size: 12px;
  color: #f0938b;
}

.unexpected-list .times {
  margin-left: auto;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
}

/* ================================================================
   Information windows
   ================================================================ */

.modal {
  width: min(760px, calc(100vw - 32px));
  max-height: min(84vh, 900px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 60px -16px rgba(0, 0, 0, .65);
  overflow: hidden;
}

.modal::backdrop {
  background: rgba(0, 0, 0, .62);
  backdrop-filter: blur(2px);
}

.modal-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 17px 20px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(#161e17, #141b15);
}

.modal-head h2 {
  flex: 1;
  font-size: 17.5px;
  font-weight: 680;
  letter-spacing: -.3px;
}

.modal-close {
  flex: none;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  color: var(--muted);
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover { background: #1b241c; color: var(--text); }

.modal-body {
  padding: 20px;
  overflow-y: auto;
  max-height: calc(min(84vh, 900px) - 65px);
  font-size: 14.5px;
  line-height: 1.6;
  color: #b9c8bc;
}

.modal-body p { margin: 0; }
.modal-body b { color: var(--text); font-weight: 650; }

.modal-body code {
  padding: 1px 5px;
  border-radius: 4px;
  background: #1d2721;
  font-family: var(--mono);
  font-size: 12.5px;
  color: #cfdcd1;
}

.modal-lead {
  font-size: 15.5px;
  color: #c9d7cb;
  padding-bottom: 18px;
  margin-bottom: 4px !important;
  border-bottom: 1px solid var(--line);
}

/* ---------- the how-it-works walkthrough ---------- */

.guide {
  counter-reset: guide;
  list-style: none;
  padding: 0;
  margin: 0;
}

.guide > li {
  position: relative;
  padding: 18px 0 18px 44px;
  border-bottom: 1px solid var(--line-soft);
}

.guide > li:last-child { border-bottom: 0; }

.guide > li::before {
  counter-increment: guide;
  content: counter(guide);
  position: absolute;
  left: 0;
  top: 18px;
  width: 27px;
  height: 27px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: #0e1707;
  font-size: 13px;
  font-weight: 700;
}

.guide h3 {
  margin: 0 0 5px;
  font-size: 15.5px;
  font-weight: 650;
  color: var(--text);
  letter-spacing: -.2px;
}

.guide .opt {
  margin-left: 7px;
  padding: 1px 6px;
  border-radius: 4px;
  background: #1d2721;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  vertical-align: 2px;
}

.guide .note {
  margin-top: 8px !important;
  font-size: 13.5px;
  color: var(--muted);
}

.tones {
  margin: 12px 0 0;
  padding: 12px 14px;
  list-style: none;
  border-radius: var(--r-md);
  background: #101710;
  border: 1px solid var(--line);
  display: grid;
  gap: 9px;
  font-size: 13.8px;
}

.tones li { display: flex; align-items: baseline; gap: 10px; }

.tone {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  transform: translateY(-1px);
}

.tone-ok   { background: var(--ok); }
.tone-warn { background: var(--warn); }
.tone-err  { background: var(--err); }

.callout {
  margin-top: 18px;
  padding: 15px 17px;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  border: 1px solid #33491a;
}

.callout b { display: block; margin-bottom: 4px; color: #cdeba1; }
.callout p { font-size: 13.8px; color: #a8bd90; }

/* ---------- faq ---------- */

.faq details {
  border-bottom: 1px solid var(--line);
}

.faq details:last-child { border-bottom: 0; }

.faq summary {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 2px;
  cursor: pointer;
  font-size: 14.8px;
  font-weight: 620;
  color: var(--text);
  list-style: none;
}

.faq summary::-webkit-details-marker { display: none; }

.faq summary::after {
  content: "";
  margin-left: auto;
  flex: none;
  width: 8px;
  height: 8px;
  border: solid var(--faint);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform .18s;
}

.faq details[open] summary::after { transform: rotate(-135deg) translate(-2px, -2px); }
.faq summary:hover { color: var(--accent); }

.faq-body {
  padding: 0 2px 15px;
  font-size: 14px;
}

/* ---------- contact ---------- */

.contact-tips {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: #101710;
  border: 1px solid var(--line);
  font-size: 13.6px;
}

.contact-tips b { display: block; margin-bottom: 3px; }
.contact-tips p { color: var(--muted); }

.contact-tips ul {
  margin: 9px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.contact-tips li {
  position: relative;
  padding-left: 17px;
}

.contact-tips li::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--faint);
}


.contact-heading {
  margin: 20px 0 5px;
  font-size: 15.5px;
  font-weight: 650;
  color: var(--text);
}

.contact-lead { font-size: 14px; margin-bottom: 15px !important; }

.contact-form { display: grid; gap: 13px; }

.field-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
}

.field { display: grid; gap: 5px; }

.field > span {
  font-size: 12.5px;
  font-weight: 620;
  color: var(--text);
}

.field > span i {
  font-style: normal;
  font-weight: 400;
  color: var(--faint);
}

.field input,
.field textarea {
  width: 100%;
  padding: 9px 11px;
  font: 400 14px/1.5 "Segoe UI", system-ui, sans-serif;
  color: var(--text);
  background: #0f1510;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  outline: none;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  background: #121a13;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(155, 220, 79, .14);
}

.field textarea.invalid { border-color: var(--err); box-shadow: 0 0 0 3px rgba(242, 99, 90, .16); }

.contact-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.contact-status {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.contact-status.ok  { color: var(--ok); }
.contact-status.err { color: var(--err); }

.contact-direct {
  margin-top: 16px !important;
  padding-top: 15px;
  border-top: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--muted);
}

.contact-direct a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 560px) {
  .field-row { grid-template-columns: minmax(0, 1fr); }
  .modal-body { padding: 16px; }
}

/* ================================================================
   Drop overlay
   ================================================================ */

.drop-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(4, 7, 5, .82);
  backdrop-filter: blur(2px);
  z-index: 60;
  pointer-events: none;
}

.drop-overlay span {
  padding: 20px 34px;
  font-size: 19px;
  font-weight: 650;
  color: var(--accent);
  background: #141b15;
  border: 2px dashed var(--accent);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
}

body.dragging .drop-overlay { display: flex; }

/* ================================================================
   Narrow screens: the sidebar drops below the sheet
   ================================================================ */

@media (max-width: 1080px) {
  /* Stacked, with the sheet keeping a usable height instead of being
     squeezed into a few rows by the panels below it. */
  .layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    overflow: auto;
  }
  .sheet-pane { min-height: min(560px, 68vh); }
  .sidebar { overflow: visible; }
  .panel-grow { min-height: 0; }
  .file-list { max-height: 260px; }
}

@media (max-width: 860px) {
  .appbar {
    height: auto;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 14px 22px;
  }
  .scanfield { order: 3; flex-basis: 100%; max-width: none; margin: 0; }
  .actions { margin-left: auto; }
  .sheet-toolbar { flex-wrap: wrap; gap: 10px 14px; }
  .search { flex-basis: 100%; }
  .row-count { margin-left: 0; }
}
