/* ================================================================
   ROOT & RESET
   ================================================================ */
:root {
  color-scheme: only light;
  --bg: #faf8f3;
  --surface: #ffffff;
  --surface-2: #f2efe6;
  --ink: #14140f;
  --ink-soft: #726d63;
  --ink-faint: #a49d8e;
  --line: #e6e1d4;
  --line-soft: #efeadd;
  --accent: #2b3324;
  --accent-soft: #e9e8dd;
  --yellow: #c9a227;
  --yellow-soft: #f3e9c9;
  --danger: #a8402c;
  --danger-soft: #f8e9e4;
  --success: #3c5c33;
  --success-soft: #e8efe3;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  height: 100%;
  margin: 0;
}
body {
  background: var(--bg);
  color: var(--ink);
  font-family:
    "Archivo",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 15px;
  line-height: 1.45;
  overscroll-behavior-y: none;
  letter-spacing: -0.01em;
}
button,
input,
select,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
@media (prefers-color-scheme: dark) {
  html,
  body {
    background: var(--bg) !important;
    color: var(--ink) !important;
  }
}

#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 1440px;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
}

/* ================================================================
   MOBILE — nascondi backup
   ================================================================ */
@media (max-width: 767px) {
  .icon-btn {
    display: none !important;
  }
}

/* ================================================================
   TOPBAR
   ================================================================ */
.topbar {
  display: flex;
  align-items: center;
  background: rgba(250, 248, 243, 0.94);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 40;
  padding-top: var(--safe-top);
  height: calc(56px + var(--safe-top));
}
nav.tabs {
  display: flex;
  gap: 2px;
  padding: 0 4px 0 12px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  height: 100%;
  align-items: stretch;
}
nav.tabs::-webkit-scrollbar {
  display: none;
}
nav.tabs button {
  border: none;
  background: transparent;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
  padding: 0 14px;
  border-radius: 0;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  position: relative;
  transition: color 0.2s ease;
  letter-spacing: 0.01em;
}
nav.tabs button:hover {
  color: var(--ink);
}
nav.tabs button.active {
  color: var(--ink);
  font-weight: 700;
}
nav.tabs button.active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 0;
  height: 2px;
  background: var(--accent);
}
.icon-btn {
  flex-shrink: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  width: 38px;
  height: 38px;
  border-radius: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 12px 0 4px;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}
.icon-btn:hover {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.icon-btn svg {
  width: 17px;
  height: 17px;
}

main {
  flex: 1;
  overflow-y: auto;
  padding: 14px 0 140px;
  position: relative;
  -webkit-overflow-scrolling: touch;
}

/* ================================================================
   FILTERS
   ================================================================ */
.filters {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  overflow-x: auto !important;
  gap: 0 !important;
  margin: 0 0 16px !important;
  padding: 4px 16px 10px !important;
  justify-content: flex-start !important;
  align-items: center !important;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
  scroll-padding-left: 16px;
}
.filters::-webkit-scrollbar {
  display: none;
}
.filters .group {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  align-items: center;
  scroll-snap-align: start;
}
.filters .group + .group {
  margin-left: 6px;
}
.filters .group + .group::before {
  content: "";
  width: 1px;
  height: 16px;
  background: var(--line);
  margin-right: 6px;
  flex-shrink: 0;
}
.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 7px 14px;
  border-radius: 0;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  flex-shrink: 0;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.chip:hover {
  border-color: var(--ink-faint);
}
.chip:active {
  transform: scale(0.97);
}
.chip.on {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}

/* ================================================================
   GRID / WARDROBE CARDS — catalog-tag style, sharp, always-visible
   controls (no hover-only affordances).
   ================================================================ */
.grid {
  column-count: 2;
  column-gap: 10px;
  padding: 0 12px;
}
@media (min-width: 640px) {
  .grid {
    column-count: 3;
    column-gap: 14px;
    padding: 0 16px;
  }
}
@media (min-width: 960px) {
  .grid {
    column-count: 4;
    column-gap: 16px;
    padding: 0 24px;
  }
}
@media (min-width: 1280px) {
  .grid {
    column-count: 5;
    column-gap: 18px;
    padding: 0 28px;
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  display: block;
  break-inside: avoid;
  margin-bottom: 10px;
  transition: border-color 0.15s ease;
}
@media (min-width: 640px) {
  .card {
    margin-bottom: 14px;
  }
}
.card:hover {
  border-color: var(--ink-faint);
}
.card:active {
  transform: scale(0.988);
}
.card-media {
  background: var(--surface-2);
  display: flex;
}
.card img {
  width: 100%;
  height: auto;
  display: block;
  background: var(--surface-2);
  object-fit: contain;
}
.card-cap {
  padding: 9px 10px 10px;
  border-top: 1px solid var(--line-soft);
}
.card-cap-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.card-num {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  flex-shrink: 0;
}
.card-cat {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-note {
  margin: 0 0 6px;
  font-size: 12.5px;
  color: var(--ink);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.season-tags {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  margin-top: 2px;
}
.season-tags::-webkit-scrollbar {
  display: none;
}
.season-tag {
  flex-shrink: 0;
  background: transparent;
  color: var(--ink-faint);
  font-size: 10px;
  font-weight: 600;
  padding: 0;
  border-radius: 0;
  white-space: nowrap;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.season-tag + .season-tag::before {
  content: "·";
  margin-right: 4px;
  color: var(--ink-faint);
  font-weight: 400;
}
.card-owned {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  border: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink-faint);
  transition: all 0.15s ease;
}
.card-owned svg {
  width: 13px;
  height: 13px;
}
.card-owned.on {
  background: var(--success);
  border-color: var(--success);
  color: var(--bg);
}

/* ================================================================
   LISTS (Ledger / Notes)
   ================================================================ */
main > .list-summary,
main > .list-group-title,
main > .list-row,
main > .list-wrap,
main > .ledger-sheet,
main > .empty,
main > .quicknote-bar {
  margin-left: 14px;
  margin-right: 14px;
}
@media (min-width: 640px) {
  main > .list-summary,
  main > .list-group-title,
  main > .list-row,
  main > .list-wrap,
  main > .ledger-sheet,
  main > .empty,
  main > .quicknote-bar {
    margin-left: 20px;
    margin-right: 20px;
  }
}
.list-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 14px 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.list-summary .label {
  font-size: 11px;
  color: var(--ink-soft);
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.list-summary .amount {
  font-size: 21px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.list-summary .btn {
  flex: none;
  white-space: nowrap;
  padding: 10px 16px;
  font-size: 12.5px;
}
@media (max-width: 480px) {
  .list-summary {
    flex-direction: column;
    align-items: stretch;
  }
  .list-summary .btn {
    width: 100%;
  }
}
.list-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  margin: 20px 0 8px;
}
.list-group-title:first-of-type {
  margin-top: 0;
}
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition:
    background 0.12s ease,
    border-color 0.12s ease;
}
.list-row:hover {
  border-color: var(--ink-faint);
}
.list-row:active {
  background: var(--surface-2);
}
.list-thumb {
  width: 54px;
  height: 54px;
  object-fit: contain;
  background: var(--surface-2);
  flex-shrink: 0;
  padding: 4px;
}
.list-info {
  flex: 1;
  min-width: 0;
}
.list-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 2px;
  letter-spacing: -0.005em;
}
.list-note {
  font-size: 12.5px;
  color: var(--ink-soft);
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.list-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.list-price-col {
  flex-shrink: 0;
  text-align: right;
}
.list-price {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.list-status {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}
.list-status.owned {
  color: var(--success);
}
.list-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  background: var(--accent-soft);
}
.list-thumb-empty svg {
  width: 20px;
  height: 20px;
}
.list-domain {
  font-size: 10.5px;
  color: var(--ink-soft);
  background: transparent;
  border: none;
  padding: 0;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}
.list-domain::before {
  content: none;
}
.list-open {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink);
  transition:
    background 0.15s ease,
    color 0.15s ease;
}
.list-open:hover {
  background: var(--ink);
  color: var(--bg);
}
.list-open svg {
  width: 15px;
  height: 15px;
}

.empty {
  color: var(--ink-soft);
  text-align: center;
  padding: 70px 24px;
  font-size: 14px;
  line-height: 1.6;
  border: 1px dashed var(--line);
}

/* ================================================================
   LEDGER — one continuous sheet, dotted price-leaders (an actual
   ledger line), not a stack of boxed rows.
   ================================================================ */
.ledger-sheet {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 4px 16px;
}
.ledger-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line-soft);
  cursor: pointer;
}
.ledger-row:last-child {
  border-bottom: none;
}
.ledger-row:hover .ledger-name {
  color: var(--ink);
}
.ledger-thumb {
  width: 42px;
  height: 42px;
  object-fit: contain;
  background: var(--surface-2);
  flex-shrink: 0;
  padding: 3px;
  margin-top: 1px;
}
.ledger-main {
  flex: 1;
  min-width: 0;
}
.ledger-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.ledger-name {
  font-size: 13.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 55%;
}
.ledger-leader {
  flex: 1;
  min-width: 12px;
  border-bottom: 1px dotted var(--ink-faint);
  margin-bottom: 4px;
  height: 1px;
}
.ledger-price {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
.ledger-note {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ledger-row .list-tags {
  margin-top: 4px;
}

/* ================================================================
   PLAIN TEXT NOTE ROW (Notes tab — no title, no image, just words)
   ================================================================ */
.note-row {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  padding: 12px 14px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.note-row:hover {
  border-color: var(--ink-faint);
  border-left-color: var(--accent);
}
.note-text {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--ink);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  white-space: pre-wrap;
}

/* ================================================================
   QUICK NOTE BAR (Notes tab — Keep-style compose trigger)
   ================================================================ */
.quicknote-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 13px 16px;
  margin-bottom: 14px;
  cursor: pointer;
  color: var(--ink-soft);
  font-size: 13.5px;
  transition:
    border-color 0.15s ease,
    color 0.15s ease;
}
.quicknote-bar:hover {
  border-color: var(--ink);
  color: var(--ink);
}
.quicknote-bar svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ================================================================
   FAB
   ================================================================ */
.fab {
  position: fixed;
  bottom: calc(20px + var(--safe-bottom));
  right: 20px;
  width: 54px;
  height: 54px;
  background: var(--ink);
  color: var(--bg);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  transition: transform 0.15s ease;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 18px 100%, 0 calc(100% - 18px));
}
.fab svg {
  width: 22px;
  height: 22px;
}
.fab:active {
  transform: scale(0.93);
}
input[type="file"] {
  display: none;
}

/* ================================================================
   MODAL
   ================================================================ */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 15, 0.46);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}
.sheet {
  background: var(--surface);
  width: 100%;
  max-width: 540px;
  max-height: 92dvh;
  overflow-y: auto;
  border-radius: 0;
  padding: 20px 20px calc(20px + var(--safe-bottom));
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  -webkit-overflow-scrolling: touch;
  position: relative;
  border-top: 1px solid var(--line);
}
.sheet h3 {
  margin: 0 0 16px;
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.sheet .preview {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  background: var(--surface-2);
  margin-bottom: 18px;
}

/* ================================================================
   MODE TOGGLE (segmented control — Note / Link)
   ================================================================ */
.mode-toggle {
  display: flex;
  border: 1px solid var(--line);
  margin-bottom: 18px;
}
.mode-toggle button {
  flex: 1;
  border: none;
  background: var(--surface);
  color: var(--ink-soft);
  padding: 10px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease;
}
.mode-toggle button + button {
  border-left: 1px solid var(--line);
}
.mode-toggle button.on {
  background: var(--ink);
  color: var(--bg);
}

/* ================================================================
   FORMS
   ================================================================ */
.field {
  margin-bottom: 16px;
}
.field label {
  display: block;
  font-size: 10.5px;
  color: var(--ink-faint);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}
select,
input[type="text"],
textarea {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 0;
  font-size: 16px;
  background: var(--surface);
  color: var(--ink);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
}
textarea {
  resize: vertical;
  min-height: 96px;
  line-height: 1.5;
}
select {
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23726d63' stroke-width='2' stroke-linecap='square'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 38px;
}
select:focus,
input[type="text"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
}
.chiprow {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.hint {
  font-size: 11.5px;
  color: var(--ink-faint);
  margin-top: 6px;
  margin-bottom: 12px;
  line-height: 1.5;
}
.field-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.field-row input {
  flex: 1;
  min-width: 0;
}
.field-row .btn {
  flex: none;
  padding: 0 14px;
  font-size: 12.5px;
  min-width: auto;
}
.dropzone {
  border: 1px dashed var(--line);
  padding: 24px 16px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 13px;
  margin-bottom: 14px;
  cursor: pointer;
  background: var(--surface-2);
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
}
.dropzone:active {
  border-color: var(--ink);
  background: var(--accent-soft);
}
.dropzone b {
  color: var(--ink);
  font-weight: 700;
}

/* ================================================================
   BUTTONS
   ================================================================ */
.btnrow {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.btn {
  flex: 1;
  padding: 13px 16px;
  border-radius: 0;
  border: 1px solid transparent;
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  transition:
    transform 0.1s ease,
    background 0.15s ease,
    color 0.15s ease,
    opacity 0.15s ease;
  min-height: 48px;
}
.btn:active {
  transform: scale(0.98);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn.primary {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.btn.primary:hover {
  background: var(--accent);
  border-color: var(--accent);
}
.btn.ghost {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}
.btn.ghost:hover {
  border-color: var(--ink);
}
.btn.danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}
.btn.danger:hover {
  background: var(--danger);
  color: var(--bg);
}

/* ================================================================
   TOAST
   ================================================================ */
.top-toast {
  position: fixed;
  top: calc(72px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  background: var(--ink);
  color: var(--bg);
  padding: 11px 20px;
  border-radius: 0;
  font-size: 12.5px;
  font-weight: 600;
  z-index: 200;
  opacity: 0;
  transition:
    opacity 0.22s ease,
    transform 0.22s ease;
  pointer-events: none;
  max-width: calc(100% - 40px);
  text-align: center;
}
.top-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ================================================================
   CHECKER & SLIDER
   ================================================================ */
.checker {
  background-image:
    linear-gradient(45deg, #ddd8ca 25%, transparent 25%),
    linear-gradient(-45deg, #ddd8ca 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #ddd8ca 75%),
    linear-gradient(-45deg, transparent 75%, #ddd8ca 75%);
  background-size: 16px 16px;
  background-position:
    0 0,
    0 8px,
    8px -8px,
    -8px 0px;
  background-color: var(--surface-2);
}
.tol-slider {
  width: 100%;
  margin: 12px 0;
  -webkit-appearance: none;
  appearance: none;
  height: 3px;
  background: var(--line);
  outline: none;
}
.tol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: var(--ink);
  cursor: pointer;
}
.tol-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: var(--ink);
  cursor: pointer;
  border: none;
}
.tol-value {
  font-size: 12px;
  color: var(--ink-soft);
  text-align: center;
  margin-bottom: 4px;
}

/* ================================================================
   DRAG & DROP
   ================================================================ */
body.dragover::after {
  content: "Drop to add";
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 15, 0.9);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.02em;
  z-index: 300;
  pointer-events: none;
}

/* ================================================================
   LOGIN PAGE
   ================================================================ */
#loginPage {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.3s;
  padding: var(--safe-top) 20px var(--safe-bottom);
  overflow: hidden;
}
#loginPage.hidden {
  display: none;
  opacity: 0;
}

#loginBg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  z-index: 0;
}

.login-form {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 10px;
  align-items: stretch;
  width: 100%;
  max-width: 320px;
}

.login-input {
  flex: 1;
  min-width: 0;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 0;
  font-size: 19px;
  font-family: "Archivo", "SF Mono", "Menlo", "Consolas", monospace;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  color: var(--ink);
  letter-spacing: 0.22em;
  text-align: center;
  font-weight: 700;
  -webkit-text-security: asterisk;
  text-security: asterisk;
  transition:
    border-color 0.15s ease,
    background 0.15s ease;
  -webkit-appearance: none;
  appearance: none;
}
.login-input::placeholder {
  color: var(--ink-faint);
  -webkit-text-security: none;
  text-security: none;
  letter-spacing: normal;
  font-family: "Archivo", sans-serif;
  font-size: 14px;
  font-weight: 500;
}
.login-input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.97);
}

.login-btn {
  flex: none;
  width: 54px;
  min-width: 54px;
  background: var(--ink);
  color: var(--bg);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    transform 0.12s ease,
    background 0.15s ease;
}
.login-btn:hover {
  background: var(--accent);
}
.login-btn:active {
  transform: scale(0.94);
}
.login-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.login-btn svg {
  width: 19px;
  height: 19px;
}

@media (min-width: 768px) {
  .login-form {
    max-width: 340px;
    gap: 12px;
  }
  .login-input {
    padding: 17px 20px;
    font-size: 20px;
  }
  .login-btn {
    width: 58px;
    min-width: 58px;
  }
}

/* ================================================================
   IMPORT PROGRESS
   ================================================================ */
.import-progress {
  margin-top: 14px;
  padding: 13px 15px;
  background: var(--accent-soft);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  display: none;
  align-items: center;
  gap: 10px;
  line-height: 1.4;
  border: 1px solid var(--line);
}
.import-progress.show {
  display: flex;
}
.import-progress.error {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger);
}
.import-progress.success {
  background: var(--success-soft);
  color: var(--success);
  border-color: var(--success);
}
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.import-info {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
}
.import-info b {
  color: var(--ink);
}

/* ================================================================
   DESKTOP
   ================================================================ */
@media (min-width: 768px) {
  main {
    padding: 24px 0 120px;
  }
  .topbar {
    height: 64px;
  }
  nav.tabs {
    padding: 0 8px 0 24px;
    gap: 4px;
  }
  nav.tabs button {
    font-size: 14.5px;
    padding: 0 16px;
  }
  nav.tabs button.active::after {
    left: 16px;
    right: 16px;
  }
  .icon-btn {
    margin: 0 20px 0 4px;
  }
  .filters {
    padding: 6px 24px 12px !important;
    margin-bottom: 18px !important;
    scroll-padding-left: 24px;
  }
  .grid {
    padding: 0 24px;
  }
  .overlay {
    align-items: center;
    padding: 24px;
  }
  .sheet {
    max-height: 88vh;
    padding: 26px;
    animation: none;
  }
  .fab {
    bottom: 28px;
    right: 28px;
    width: 58px;
    height: 58px;
  }
  .top-toast {
    top: 18px;
  }
}
@media (min-width: 1024px) {
  .grid {
    padding: 0 32px;
  }
  .filters {
    padding-left: 32px !important;
    padding-right: 32px !important;
    scroll-padding-left: 32px;
  }
}
