:root {
  --bg-1: #0b1020;
  --bg-2: #111b31;
  --ink: #e2e8f0;
  --muted: #94a3b8;
  --accent: #14b8a6;
  --accent-2: #f59e0b;
  --card: rgba(15, 23, 42, 0.88);
  --border: rgba(148, 163, 184, 0.2);
  --shadow: 0 20px 45px rgba(2, 6, 23, 0.6);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top right, rgba(20, 184, 166, 0.18), transparent 45%),
              linear-gradient(140deg, var(--bg-1), var(--bg-2));
  min-height: 100vh;
}

body.is-loading {
  cursor: progress;
}

body.modal-open {
  overflow: hidden;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  white-space: nowrap;
}

h1, h2, h3, h4 {
  margin: 0 0 0.5rem 0;
  font-family: "Fraunces", "Times New Roman", serif;
}

p {
  margin: 0.4rem 0;
  color: var(--muted);
}

.bg {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top left, rgba(245, 158, 11, 0.08), transparent 45%),
              radial-gradient(circle at bottom left, rgba(20, 184, 166, 0.12), transparent 40%);
  pointer-events: none;
  z-index: 0;
}

.container {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  color: var(--accent);
}

.subhead {
  max-width: 480px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.5rem;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.loading-indicator {
  position: fixed;
  top: 1.2rem;
  right: 1.2rem;
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.95);
  color: #fff;
  font-size: 0.85rem;
  z-index: 50;
  box-shadow: 0 10px 25px rgba(2, 6, 23, 0.35);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(5.5rem + env(safe-area-inset-bottom));
  transform: translate(-50%, 8px);
  padding: 0.55rem 1rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #e2e8f0;
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: 0 12px 30px rgba(2, 6, 23, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 11;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.success {
  border-color: rgba(20, 184, 166, 0.35);
  color: #7ff0e3;
}

.toast.error {
  border-color: rgba(239, 68, 68, 0.35);
  color: #fecaca;
}

.update-banner {
  position: fixed;
  top: calc(1rem + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.92);
  box-shadow: 0 16px 30px rgba(2, 6, 23, 0.35);
  z-index: 20;
}

.update-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #e2e8f0;
}

.update-banner .primary,
.update-banner .ghost {
  padding: 0.35rem 0.8rem;
  font-size: 0.85rem;
}

.spinner {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}

.login-panel {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5rem;
  align-items: center;
}

.userbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-menu {
  position: relative;
}

.user-menu-panel {
  position: absolute;
  top: calc(100% + 0.6rem);
  right: 0;
  min-width: 200px;
  display: grid;
  gap: 0.4rem;
  padding: 0.6rem;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.2);
  box-shadow: 0 16px 30px rgba(2, 6, 23, 0.35);
  backdrop-filter: blur(12px);
  z-index: 25;
}

.user-menu-panel .ghost {
  justify-content: flex-start;
  width: 100%;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  background: rgba(20, 184, 166, 0.16);
  color: #7ff0e3;
  font-weight: 600;
}

.app {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  animation: fadeIn 0.6s ease;
  padding-bottom: 6rem;
}

.hidden {
  display: none !important;
}

.stack {
  display: grid;
  gap: 1rem;
}

.form-fields {
  display: grid;
  gap: 1.4rem;
}

.template-bar {
  display: grid;
  gap: 0.6rem;
  padding: 0.8rem 1rem;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.template-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.template-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.template-chip {
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(148, 163, 184, 0.12);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.template-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(20, 184, 166, 0.5);
  box-shadow: 0 8px 18px rgba(20, 184, 166, 0.2);
}

.form-note {
  font-size: 0.85rem;
  color: var(--muted);
  padding: 0.2rem 0;
}

.upload-progress {
  display: grid;
  gap: 0.5rem;
  padding: 0.4rem 0;
}

.progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(120deg, #14b8a6, #22d3ee);
  border-radius: 999px;
  transition: width 0.2s ease;
}

.progress-text {
  font-size: 0.8rem;
  color: var(--muted);
}

label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.required-mark {
  color: #b91c1c;
  font-weight: 700;
  margin-left: 0.35rem;
}

.field-error input,
.field-error select,
.field-error textarea,
.field-error .dropzone,
.field-error .tag-grid {
  border-color: rgba(185, 28, 28, 0.6);
  box-shadow: 0 0 0 1px rgba(185, 28, 28, 0.15);
}

.field-error .tag-grid {
  border: 1px dashed rgba(185, 28, 28, 0.4);
  border-radius: 12px;
  padding: 0.4rem;
}

.field-label {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

input, select, textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.95rem;
  background: rgba(15, 23, 42, 0.9);
  color: var(--ink);
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(20, 184, 166, 0.35);
  border-color: rgba(20, 184, 166, 0.55);
}

textarea {
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: rgba(148, 163, 184, 0.75);
}

.field-inline {
  display: grid;
  gap: 0.4rem;
}

input[type="search"] {
  border-radius: 999px;
  padding-left: 0.9rem;
  background: rgba(15, 23, 42, 0.95);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="search"]:focus {
  box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.12);
}

.toolbar {
  display: grid;
  gap: 0.9rem;
}

.toolbar-main {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(150px, 0.6fr) auto;
  align-items: center;
  gap: 0.75rem;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.25);
  min-width: 0;
}

.search-field i {
  color: var(--muted);
}

.search-field input[type="search"] {
  border: none;
  border-radius: 0;
  padding: 0.4rem 0;
  padding-left: 0;
  background: transparent;
  box-shadow: none;
}

.search-field input[type="search"]:focus {
  box-shadow: none;
}

.scan-btn {
  border-radius: 999px;
  padding: 0.45rem 0.7rem;
  margin-left: auto;
}

.scan-btn i {
  font-size: 1rem;
}

.filter-select {
  min-width: 0;
}

.view-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.2rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  justify-self: end;
}

.toolbar-extras {
  display: grid;
  gap: 0.7rem;
}

.quick-filters,
.saved-filters {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.toolbar-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.85);
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.filter-chip.is-active {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(2, 6, 23, 0.25);
}

.saved-filters-header {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.icon-btn.small {
  padding: 0.35rem 0.6rem;
  font-size: 0.85rem;
}

.save-filter-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.save-filter-form input {
  min-width: 160px;
}

.saved-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.4rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.saved-filter-chip.is-active {
  background: rgba(20, 184, 166, 0.2);
  border-color: rgba(20, 184, 166, 0.45);
  color: #7ff0e3;
}

.saved-filter-main {
  border: none;
  background: transparent;
  color: inherit;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.saved-filter-remove {
  border: none;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: rgba(148, 163, 184, 0.12);
  color: var(--muted);
  cursor: pointer;
}

.saved-filter-remove:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.empty-saved {
  font-size: 0.85rem;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: nowrap;
  position: fixed;
  left: 50%;
  bottom: calc(1rem + env(safe-area-inset-bottom));
  transform: translate(-50%, 0);
  padding: 0.6rem 0.9rem 0.7rem;
  border-radius: 22px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(148, 163, 184, 0.25);
  box-shadow: 0 16px 30px rgba(2, 6, 23, 0.4);
  backdrop-filter: blur(14px);
  z-index: 8;
  width: min(980px, 94vw);
  justify-content: center;
  animation: dockIn 0.5s ease both;
  will-change: transform, opacity;
}

.selected {
  position: absolute;
  top: -0.55rem;
  right: 1.1rem;
  font-size: 0.75rem;
  color: #7ff0e3;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(20, 184, 166, 0.18);
  border: 1px solid rgba(20, 184, 166, 0.35);
  box-shadow: 0 6px 14px rgba(2, 6, 23, 0.25);
}

.primary, .ghost {
  border: none;
  border-radius: 999px;
  padding: 0.6rem 1.2rem;
  font-weight: 600;
  cursor: pointer;
  font-family: "Space Grotesk", sans-serif;
}

.danger {
  background: rgba(239, 68, 68, 0.18);
  color: #fecaca;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.danger:hover {
  filter: brightness(1.1);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.icon-btn i {
  font-size: 0.9rem;
}

.action-btn {
  flex-direction: column;
  gap: 0.3rem;
  padding: 0.45rem 0.75rem;
  min-width: 68px;
  border-radius: 16px;
  font-weight: 600;
  font-size: 0.85rem;
}

.action-btn i {
  font-size: 1.05rem;
}

.icon-label {
  font-size: 0.68rem;
  letter-spacing: 0.02em;
  color: var(--muted);
  line-height: 1;
}

.primary .icon-label {
  color: rgba(255, 255, 255, 0.85);
}

.ghost.danger .icon-label {
  color: #fecaca;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

a.primary,
a.ghost {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 8px 18px rgba(20, 184, 166, 0.35);
}

.ghost {
  background: rgba(148, 163, 184, 0.15);
  color: var(--ink);
}

.ghost.danger {
  background: rgba(239, 68, 68, 0.18);
  color: #fecaca;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.primary:hover {
  filter: brightness(1.05);
}

.ghost:hover {
  background: rgba(148, 163, 184, 0.25);
}

.ghost.danger:hover {
  filter: brightness(1.1);
}

.toolbar-actions button:disabled {
  display: none;
}

.ghost.is-active {
  background: rgba(20, 184, 166, 0.2);
  color: #7ff0e3;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: rgba(15, 23, 42, 0.8);
  border-radius: 16px;
  padding: 1rem 1.2rem;
  border: 1px solid var(--border);
  animation: rise 0.35s ease;
  animation-delay: var(--stagger, 0ms);
  animation-fill-mode: both;
}

.stat-card h4 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.4rem;
}

.stat-card .stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--ink);
}

.stat-list {
  display: grid;
  gap: 0.35rem;
  margin-top: 0.4rem;
}

.stat-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.9rem;
  color: var(--ink);
}

.stat-line span {
  color: var(--muted);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 1.5rem;
  align-items: start;
}

.list-panel {
  min-height: 320px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 1rem;
}

.items {
  display: grid;
  gap: 0.75rem;
}

.items.is-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.item-card {
  display: grid;
  gap: 0.75rem;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0.9rem;
  box-shadow: 0 10px 25px rgba(2, 6, 23, 0.35);
  animation: rise 0.4s ease;
  animation-delay: var(--stagger, 0ms);
  animation-fill-mode: both;
}

.item-card-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
}

.item-card-body {
  display: grid;
  gap: 0.5rem;
}

.item-card .item-thumb {
  width: 100%;
  height: 140px;
  border-radius: 14px;
}

.item-card .item-thumb img {
  border-radius: 14px;
}

.item-card .item-price,
.item-card .item-barcode {
  text-align: left;
  font-size: 0.85rem;
}

.item-row {
  display: grid;
  grid-template-columns: 24px 64px minmax(0, 1fr) 140px 140px;
  gap: 0.8rem;
  align-items: center;
  background: rgba(15, 23, 42, 0.78);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.75rem 1rem;
  animation: rise 0.4s ease;
  animation-delay: var(--stagger, 0ms);
  animation-fill-mode: both;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.item-row:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

.item-row.clickable,
.item-card.clickable {
  cursor: pointer;
}

.item-title {
  font-weight: 600;
}

.item-main {
  display: grid;
  gap: 0.25rem;
}

.item-select {
  display: flex;
  align-items: center;
  justify-content: center;
}

.item-select input[type="checkbox"] {
  appearance: none;
  width: 22px;
  height: 22px;
  min-width: 22px;
  min-height: 22px;
  border-radius: 999px;
  border: 2px solid rgba(148, 163, 184, 0.45);
  background: rgba(15, 23, 42, 0.9);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.item-select input[type="checkbox"]:checked {
  background: #14b8a6;
  border-color: #14b8a6;
  box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.25);
}

.item-row.is-selected,
.item-card.is-selected {
  border-color: rgba(20, 184, 166, 0.55);
  box-shadow: 0 0 0 1px rgba(20, 184, 166, 0.2), 0 12px 24px rgba(2, 6, 23, 0.4);
  background: rgba(20, 184, 166, 0.08);
}

.item-thumb {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.12);
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.7rem;
}

.item-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: rgba(2, 6, 23, 0.7);
  cursor: zoom-in;
}

.item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  color: var(--ink);
  text-transform: capitalize;
}

.meta-status-owned {
  background: rgba(34, 197, 94, 0.2);
  color: #86efac;
}

.meta-status-for-sale {
  background: rgba(20, 184, 166, 0.2);
  color: #7ff0e3;
}

.meta-status-sold {
  background: rgba(148, 163, 184, 0.2);
  color: #cbd5f5;
}

.meta-status-archived {
  background: rgba(71, 85, 105, 0.35);
  color: #cbd5e1;
}

.meta-category-console {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}

.meta-category-game {
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
}

.meta-category-card {
  background: rgba(245, 158, 11, 0.25);
  color: #fcd34d;
}

.meta-category-phone {
  background: rgba(236, 72, 153, 0.2);
  color: #f9a8d4;
}

.meta-category-other {
  background: rgba(148, 163, 184, 0.2);
  color: #e2e8f0;
}

.meta-condition-new,
.meta-condition-like-new {
  background: rgba(34, 197, 94, 0.16);
  color: #86efac;
}

.meta-condition-good {
  background: rgba(59, 130, 246, 0.18);
  color: #93c5fd;
}

.meta-condition-fair {
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
}

.meta-condition-poor,
.meta-condition-parts {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.item-barcode {
  font-family: "Space Grotesk", monospace;
  font-size: 0.9rem;
  color: var(--accent);
  word-break: break-word;
}

.item-price {
  font-weight: 600;
  text-align: right;
}

.item-actions button {
  width: 100%;
}

.item-actions {
  display: grid;
  gap: 0.4rem;
}

.item-card .item-actions {
  grid-auto-flow: column;
  grid-auto-columns: max-content;
}

.item-card .item-actions button {
  width: auto;
}

.item-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.item-link.meta-pill {
  background: rgba(20, 184, 166, 0.2);
  color: #7ff0e3;
}

.item-link:hover {
  text-decoration: none;
  filter: brightness(1.1);
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.75);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 2.5rem 1.5rem;
  z-index: 10;
  overflow-y: auto;
  animation: fadeBackdrop 0.2s ease;
  will-change: opacity;
}

.modal.hidden {
  display: none;
}

.modal-card {
  max-width: 960px;
  width: 100%;
  animation: popIn 0.2s ease;
  transform-origin: top center;
}

.modal-card.small {
  max-width: 520px;
}

.modal-card.photo-modal {
  max-width: 920px;
}

.scan-card {
  max-width: 560px;
}

.scan-body {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(2, 6, 23, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.2);
  min-height: 220px;
  display: grid;
  place-items: center;
}

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

.scan-frame {
  position: absolute;
  inset: 18%;
  border: 2px dashed rgba(125, 211, 252, 0.8);
  border-radius: 12px;
  box-shadow: 0 0 0 999px rgba(2, 6, 23, 0.2);
  pointer-events: none;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.grid-two {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.section,
.view-section {
  display: grid;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(12, 19, 36, 0.6);
  box-shadow: inset 0 1px 0 rgba(148, 163, 184, 0.08);
  border-left: 3px solid rgba(148, 163, 184, 0.35);
}

.section.hidden,
.view-section.hidden {
  display: none;
}

.section h4,
.view-section h4 {
  margin: 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.section[data-section="core"],
.view-section[data-section="core"] {
  border-left-color: rgba(56, 189, 248, 0.9);
}

.section[data-section="pricing"],
.view-section[data-section="pricing"] {
  border-left-color: rgba(251, 191, 36, 0.85);
}

.section[data-section="tags"],
.view-section[data-section="tags"] {
  border-left-color: rgba(20, 184, 166, 0.85);
}

.section[data-section="photos"],
.view-section[data-section="photos"] {
  border-left-color: rgba(34, 197, 94, 0.85);
}

.section[data-section="console"],
.view-section[data-section="console"] {
  border-left-color: rgba(59, 130, 246, 0.85);
}

.section[data-section="game"],
.view-section[data-section="game"] {
  border-left-color: rgba(139, 92, 246, 0.85);
}

.section[data-section="card"],
.view-section[data-section="card"] {
  border-left-color: rgba(245, 158, 11, 0.85);
}

.section[data-section="other"],
.view-section[data-section="other"] {
  border-left-color: rgba(148, 163, 184, 0.7);
}

.view-content {
  display: grid;
  gap: 1rem;
}

.view-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.view-row {
  display: grid;
  gap: 0.35rem;
}

.view-row.full {
  grid-column: 1 / -1;
}

.view-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.view-value {
  font-weight: 600;
  color: var(--ink);
  word-break: break-word;
  white-space: pre-wrap;
}

.view-value a {
  color: var(--accent);
  text-decoration: none;
}

.view-value a:hover {
  text-decoration: underline;
}

.tag-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  font-size: 0.9rem;
}

.tag-grid label {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid transparent;
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
}

.tag-grid label input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.tag-grid label.is-selected {
  background: rgba(20, 184, 166, 0.2);
  border-color: rgba(20, 184, 166, 0.45);
  color: #7ff0e3;
}

.pill-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.pill-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.12);
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: var(--ink);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

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

.pill-option.is-selected {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px rgba(2, 6, 23, 0.25);
}

.pill-option.is-selected.pill-category-console {
  background: rgba(59, 130, 246, 0.2);
  border-color: rgba(59, 130, 246, 0.5);
  color: #93c5fd;
}

.pill-option.is-selected.pill-category-game {
  background: rgba(139, 92, 246, 0.2);
  border-color: rgba(139, 92, 246, 0.5);
  color: #c4b5fd;
}

.pill-option.is-selected.pill-category-card {
  background: rgba(245, 158, 11, 0.25);
  border-color: rgba(245, 158, 11, 0.55);
  color: #fcd34d;
}

.pill-option.is-selected.pill-category-phone {
  background: rgba(236, 72, 153, 0.2);
  border-color: rgba(236, 72, 153, 0.5);
  color: #f9a8d4;
}

.pill-option.is-selected.pill-category-other {
  background: rgba(148, 163, 184, 0.2);
  border-color: rgba(148, 163, 184, 0.5);
  color: #e2e8f0;
}

.pill-option.is-selected.pill-status-owned,
.filter-chip.is-active.pill-status-owned {
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(34, 197, 94, 0.55);
  color: #86efac;
}

.pill-option.is-selected.pill-status-for-sale,
.filter-chip.is-active.pill-status-for-sale {
  background: rgba(20, 184, 166, 0.2);
  border-color: rgba(20, 184, 166, 0.55);
  color: #7ff0e3;
}

.pill-option.is-selected.pill-status-sold,
.filter-chip.is-active.pill-status-sold {
  background: rgba(148, 163, 184, 0.2);
  border-color: rgba(148, 163, 184, 0.55);
  color: #cbd5f5;
}

.pill-option.is-selected.pill-status-archived,
.filter-chip.is-active.pill-status-archived {
  background: rgba(71, 85, 105, 0.35);
  border-color: rgba(71, 85, 105, 0.55);
  color: #cbd5e1;
}

.pill-option.is-selected.pill-condition-new,
.pill-option.is-selected.pill-condition-like-new {
  background: rgba(34, 197, 94, 0.16);
  border-color: rgba(34, 197, 94, 0.45);
  color: #86efac;
}

.pill-option.is-selected.pill-condition-good {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(59, 130, 246, 0.5);
  color: #93c5fd;
}

.pill-option.is-selected.pill-condition-fair {
  background: rgba(245, 158, 11, 0.2);
  border-color: rgba(245, 158, 11, 0.5);
  color: #fcd34d;
}

.pill-option.is-selected.pill-condition-poor,
.pill-option.is-selected.pill-condition-parts {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
  color: #fca5a5;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
}

.inline-check input[type="checkbox"] {
  width: 20px;
  height: 20px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.6rem;
}

.photo-card {
  background: rgba(20, 184, 166, 0.12);
  padding: 0.4rem;
  border-radius: 12px;
  display: grid;
  gap: 0.4rem;
  justify-items: center;
  font-size: 0.75rem;
  position: relative;
}

.photo-card.is-primary {
  border: 1px solid rgba(20, 184, 166, 0.6);
  box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.2);
}

.photo-card.is-dragging {
  opacity: 0.6;
}

.photo-card.is-drop-target {
  outline: 2px dashed rgba(125, 211, 252, 0.8);
  outline-offset: 2px;
}

.photo-card img {
  width: 100%;
  height: 90px;
  object-fit: contain;
  background: rgba(2, 6, 23, 0.7);
  border-radius: 8px;
  cursor: zoom-in;
}

.photo-badge {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(15, 23, 42, 0.8);
  color: #e2e8f0;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.photo-primary {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(20, 184, 166, 0.2);
  color: #7ff0e3;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.photo-actions {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  justify-content: center;
}

.photo-action {
  border: none;
  background: rgba(148, 163, 184, 0.18);
  color: #e2e8f0;
  border-radius: 999px;
  padding: 0.2rem 0.4rem;
  cursor: pointer;
  font-size: 0.65rem;
}

.photo-action.danger {
  background: rgba(239, 68, 68, 0.2);
  color: #fecaca;
}

.photo-action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.photo-block {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.photo-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.photo-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.photo-flag {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.photo-card.is-removed {
  opacity: 0.55;
  filter: grayscale(0.6);
}

.photo-preview .photo-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  border: none;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  background: rgba(31, 38, 46, 0.85);
  color: #fff;
}

.photo-preview .photo-remove:hover {
  background: rgba(31, 38, 46, 0.95);
}

.photo-placeholder {
  font-size: 0.85rem;
  color: var(--muted);
}

.dropzone {
  border: 2px dashed rgba(148, 163, 184, 0.3);
  border-radius: 16px;
  padding: 1.4rem;
  min-height: 110px;
  display: grid;
  place-items: center;
  gap: 0.35rem;
  text-align: center;
  background: rgba(15, 23, 42, 0.55);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.dropzone.is-dragover {
  border-color: var(--accent);
  background: rgba(20, 184, 166, 0.18);
  transform: translateY(-2px);
}

.dropzone-title {
  font-weight: 600;
}

.dropzone-sub {
  font-size: 0.85rem;
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.form-hint {
  min-height: 1.2rem;
  color: #b91c1c;
  font-size: 0.85rem;
}

.form-success {
  min-height: 1.2rem;
  color: #15803d;
  font-size: 0.85rem;
}

.muted {
  color: var(--muted);
}

.hint {
  font-size: 0.8rem;
  color: var(--muted);
}

.photo-preview {
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(2, 6, 23, 0.4);
  border-radius: 16px;
}

.photo-preview img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 12px;
  background: rgba(2, 6, 23, 0.8);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes dockIn {
  from { opacity: 0; transform: translate(-50%, 14px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes fadeBackdrop {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes popIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .toolbar-actions,
  .item-row,
  .item-card,
  .stat-card,
  .modal,
  .modal-card,
  .toast {
    animation: none !important;
  }
}

@media (max-width: 960px) {
  .toolbar-main {
    grid-template-columns: 1fr;
  }

  .toolbar-extras {
    grid-template-columns: 1fr;
  }

  .save-filter-form {
    width: 100%;
  }

  .save-filter-form input {
    flex: 1;
    min-width: 0;
  }

  .view-toggle {
    justify-self: flex-start;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .item-row {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  .item-select {
    justify-content: flex-start;
  }

  .item-thumb {
    width: 100%;
    height: 160px;
  }

  .item-price, .item-barcode {
    text-align: left;
  }

  .toolbar-actions {
    padding: 0.45rem 0.6rem 0.55rem;
    border-radius: 18px;
    gap: 0.4rem;
  }

  .action-btn {
    min-width: 56px;
    padding: 0.35rem 0.55rem;
  }

  .icon-label {
    font-size: 0.62rem;
  }

  .form-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .form-actions button {
    width: 100%;
  }
}
