:root {
  --navy: #0D1B2A;
  --gold: #C9A84C;
  --cream: #F5F1E8;
  --alert: #B23A3A;
  --font-display: "Cormorant Garamond", serif;
  --font-body: "Jost", sans-serif;
}

[hidden] {
  display: none !important;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--navy);
  color: var(--cream);
  font-family: var(--font-body);
}

.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
}

/* ---------- Login ---------- */

#login-view {
  justify-content: center;
}

.card {
  width: 100%;
  max-width: 400px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(201, 168, 76, 0.3);
  border-radius: 12px;
  padding: 40px 32px;
  text-align: center;
}

.card h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 2rem;
  margin: 0 0 4px;
  color: var(--gold);
}

.subtitle {
  margin: 0 0 32px;
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(245, 241, 232, 0.6);
}

.tester-banner {
  margin: -12px 0 24px;
  padding: 14px 16px;
  border-radius: 8px;
  border: 1px solid rgba(201, 168, 76, 0.5);
  background: rgba(201, 168, 76, 0.1);
  text-align: left;
}

.tester-banner p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  color: rgba(245, 241, 232, 0.85);
}

.tester-banner strong {
  color: var(--gold);
}

#login-form,
#code-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}

label {
  font-size: 0.85rem;
  color: rgba(245, 241, 232, 0.75);
}

input[type="email"],
input[type="text"] {
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid rgba(201, 168, 76, 0.4);
  background: rgba(255, 255, 255, 0.05);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 1rem;
}

input[type="text"]#code {
  letter-spacing: 0.3em;
  text-align: center;
  font-size: 1.3rem;
}

input[type="email"]:focus,
input[type="text"]:focus {
  outline: none;
  border-color: var(--gold);
}

button {
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 1rem;
}

.link-button {
  background: none;
  border: none;
  color: rgba(245, 241, 232, 0.6);
  font-size: 0.85rem;
  text-decoration: underline;
  padding: 4px 0;
}

.link-button:hover {
  color: var(--gold);
}

#login-button,
#verify-button {
  margin-top: 8px;
  padding: 12px 16px;
  border-radius: 6px;
  border: none;
  background: var(--gold);
  color: var(--navy);
  font-weight: 500;
}

#login-button:hover {
  opacity: 0.9;
}

#login-button:disabled {
  opacity: 0.5;
  cursor: default;
}

.message {
  margin: 20px 0 0;
  font-size: 0.9rem;
  min-height: 1.2em;
  color: var(--gold);
}

/* ---------- Dashboard ---------- */

#dashboard-view {
  align-items: stretch;
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
}

.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  border-bottom: 1px solid rgba(201, 168, 76, 0.3);
  padding-bottom: 20px;
  margin-bottom: 32px;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(245, 241, 232, 0.55);
}

.dash-header h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 2rem;
  margin: 0;
  color: var(--gold);
}

.ghost-button {
  padding: 10px 18px;
  border-radius: 6px;
  border: 1px solid rgba(201, 168, 76, 0.5);
  background: transparent;
  color: var(--cream);
}

.ghost-button:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.primary-button {
  padding: 10px 18px;
  border-radius: 6px;
  border: 1px solid var(--gold);
  background: var(--gold);
  color: var(--navy);
  font-weight: 500;
}

.primary-button:hover {
  background: #ddc06a;
  border-color: #ddc06a;
}

.billing-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.billing-status {
  margin: 0;
  color: rgba(245, 241, 232, 0.85);
}

#buy-passport-button {
  flex-shrink: 0;
}

.passports-section h2,
.create-section h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.4rem;
  color: var(--cream);
  margin: 0 0 16px;
}

.passports-list {
  border: 1px dashed rgba(201, 168, 76, 0.3);
  border-radius: 8px;
  padding: 32px;
  text-align: center;
}

.empty-state {
  margin: 0;
  color: rgba(245, 241, 232, 0.6);
}

.empty-state a {
  color: var(--gold);
}

/* ---------- Inline guidance & feedback ---------- */

.tip-callout {
  margin: -4px 0 18px;
  padding: 10px 14px;
  border-left: 2px solid rgba(201, 168, 76, 0.5);
  background: rgba(201, 168, 76, 0.06);
  color: rgba(245, 241, 232, 0.65);
  font-size: 0.85rem;
  line-height: 1.5;
}

.feedback-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid rgba(201, 168, 76, 0.15);
  text-align: center;
}

.feedback-footer a {
  color: rgba(245, 241, 232, 0.45);
  font-size: 0.8rem;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.feedback-footer a:hover {
  color: var(--gold);
}

/* ---------- Create passport form ---------- */

.create-section {
  border: 1px solid rgba(201, 168, 76, 0.3);
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 32px;
  background: rgba(255, 255, 255, 0.02);
}

.create-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
}

.field .hint {
  color: rgba(245, 241, 232, 0.5);
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
}

.category-fieldset {
  display: flex;
  flex-direction: column;
  gap: 16px;
  border: 1px dashed rgba(201, 168, 76, 0.3);
  border-radius: 8px;
  padding: 20px;
  margin: 0;
}

.category-fieldset legend {
  padding: 0 8px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--gold);
}

.category-coming-soon .empty-state {
  padding: 0;
  text-align: left;
}

.artist-fieldset {
  display: flex;
  flex-direction: column;
  gap: 16px;
  border: 1px dashed rgba(201, 168, 76, 0.3);
  border-radius: 8px;
  padding: 20px;
  margin: 4px 0 0;
}

.artist-fieldset legend {
  padding: 0 8px;
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--gold);
}

.custom-field-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.custom-field-row input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid rgba(201, 168, 76, 0.4);
  background: rgba(255, 255, 255, 0.05);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 1rem;
}

.custom-field-row .remove-custom-field-button {
  flex: 0 0 auto;
}

textarea {
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid rgba(201, 168, 76, 0.4);
  background: rgba(255, 255, 255, 0.05);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 1rem;
  resize: vertical;
}

textarea:focus {
  outline: none;
  border-color: var(--gold);
}

input[type="number"],
input[type="file"],
select {
  padding: 12px 14px;
  border-radius: 6px;
  border: 1px solid rgba(201, 168, 76, 0.4);
  background: rgba(255, 255, 255, 0.05);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 1rem;
}

input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: var(--gold);
}

/* The dropdown list itself doesn't inherit the select's translucent
   dark background in most browsers, leaving light text unreadable on
   a default white popup — set it explicitly. */
select option {
  background: var(--navy);
  color: var(--cream);
}

.value-row {
  display: flex;
  gap: 10px;
}

.value-row input {
  flex: 1;
}

.value-row select {
  flex: 0 0 90px;
}

#create-button {
  margin-top: 4px;
  padding: 12px 16px;
  border-radius: 6px;
  border: none;
  background: var(--gold);
  color: var(--navy);
  font-weight: 500;
}

#create-button:hover {
  opacity: 0.9;
}

#create-button:disabled {
  opacity: 0.5;
  cursor: default;
}

.category-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--row-accent, rgba(201, 168, 76, 0.4));
  color: var(--row-accent-text, var(--navy));
}

.category-badge .cat-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--row-accent-text, var(--navy));
  flex-shrink: 0;
}

.dash-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(201, 168, 76, 0.12);
}

.dash-label {
  font-size: 13px;
  color: #fff;
}

.dash-sub {
  font-size: 11px;
  color: rgba(245, 241, 232, 0.5);
  margin-top: 2px;
}

.toggle {
  width: 44px;
  height: 24px;
  border-radius: 12px;
  background: var(--alert);
  position: relative;
  flex-shrink: 0;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: background 0.15s ease;
}

.toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: right 0.15s ease, left 0.15s ease;
}

.toggle.off {
  background: rgba(245, 241, 232, 0.15);
}

.toggle.off::after {
  right: auto;
  left: 3px;
}

.toggle:disabled {
  opacity: 0.6;
  cursor: default;
}

/* For-sale uses the same switch mechanics as the theft/loss toggle, but
   "on" here means "actively listed" — a neutral/positive state, not an
   alert — so it gets gold rather than --alert red. */
.toggle.for-sale-on {
  background: var(--gold);
}

.for-sale-price-form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
}

.for-sale-price-form input[type="number"] {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  font-size: 0.9rem;
}

/* ---------- Compact passport list + detail page ---------- */

.passports-list.compact-list {
  border: 1px solid rgba(201, 168, 76, 0.22);
  border-radius: 10px;
  padding: 0;
  text-align: left;
  overflow: hidden;
}

.compact-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid rgba(201, 168, 76, 0.14);
  transition: background 0.15s ease;
}

.compact-row:last-child {
  border-bottom: none;
}

.compact-row:hover {
  background: rgba(201, 168, 76, 0.06);
}

.compact-thumb,
.compact-thumb-fallback {
  width: 52px;
  height: 52px;
  border-radius: 6px;
  flex-shrink: 0;
}

.compact-thumb {
  object-fit: cover;
  background: rgba(255, 255, 255, 0.05);
}

.compact-thumb-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.2rem;
}

.compact-info {
  flex: 1;
  min-width: 0;
}

.compact-name {
  color: var(--cream);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compact-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin-top: 4px;
}

.compact-ref {
  color: rgba(245, 241, 232, 0.5);
  font-size: 0.82rem;
}

.compact-badge-sale,
.compact-badge-flagged {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
}

.compact-badge-sale {
  background: rgba(201, 168, 76, 0.18);
  color: var(--gold);
}

.compact-badge-flagged {
  background: rgba(178, 58, 58, 0.22);
  color: #e88f8f;
}

.compact-chevron {
  color: rgba(245, 241, 232, 0.3);
  font-size: 1.4rem;
  flex-shrink: 0;
  line-height: 1;
}

/* ── Detail page ── */

.back-link {
  display: inline-block;
  color: rgba(245, 241, 232, 0.55);
  font-size: 0.85rem;
  text-decoration: none;
  margin-bottom: 20px;
}

.back-link:hover {
  color: var(--gold);
}

.detail-header {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.detail-thumb,
.detail-thumb-fallback {
  width: 96px;
  height: 96px;
  border-radius: 8px;
  flex-shrink: 0;
}

.detail-thumb {
  object-fit: cover;
  background: rgba(255, 255, 255, 0.05);
}

.detail-thumb-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 2rem;
}

.detail-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.6rem;
  color: var(--cream);
  margin: 0 0 4px;
}

.detail-ref {
  color: rgba(245, 241, 232, 0.5);
  font-size: 0.9rem;
  margin: 0 0 10px;
}

.detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.detail-section {
  margin-top: 30px;
}

.detail-section h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--gold);
  margin: 0 0 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(201, 168, 76, 0.2);
}

.detail-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 12px;
}

.detail-links a,
.detail-links button {
  align-self: flex-start;
}

.detail-links a {
  color: rgba(245, 241, 232, 0.85);
  text-decoration: underline;
}

.detail-links a:visited {
  color: rgba(245, 241, 232, 0.85);
}

.detail-links a:hover {
  color: var(--gold);
}

.transfer-pending-text {
  font-size: 0.85rem;
  color: rgba(245, 241, 232, 0.5);
}

@media (max-width: 480px) {
  .card {
    padding: 32px 20px;
  }

  .transfer-actions {
    flex-direction: column;
  }

  .detail-header {
    gap: 14px;
  }

  .detail-thumb,
  .detail-thumb-fallback {
    width: 72px;
    height: 72px;
  }
}

/* ---------- Transfer (accept/decline) page ---------- */

.transfer-photo {
  width: 100%;
  border-radius: 8px;
  margin-bottom: 20px;
  display: block;
}

.transfer-item-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.6rem;
  color: var(--gold);
  margin: 0 0 4px;
  text-align: left;
}

.transfer-category {
  color: rgba(245, 241, 232, 0.6);
  margin: 0 0 16px;
  text-align: left;
}

.transfer-from {
  margin: 0 0 24px;
  text-align: left;
}

.transfer-actions {
  display: flex;
  gap: 12px;
}

.transfer-actions button {
  flex: 1;
}

.primary-button {
  padding: 12px 16px;
  border-radius: 6px;
  border: none;
  background: var(--gold);
  color: var(--navy);
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 1rem;
}

.primary-button:hover {
  opacity: 0.9;
}

.primary-button:disabled,
.ghost-button:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ── NFC panel — shown after passport creation ── */
#nfc-panel {
  margin-top: 28px;
}

.nfc-panel-inner {
  border: 1px solid rgba(201, 168, 76, 0.45);
  border-radius: 8px;
  padding: 24px 22px;
  background: rgba(201, 168, 76, 0.05);
}

.nfc-panel-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 16px;
}

.nfc-url-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(201, 168, 76, 0.3);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 22px;
}

.nfc-url-text {
  flex: 1;
  font-size: 0.8rem;
  color: var(--cream);
  word-break: break-all;
  font-family: monospace;
}

.nfc-copy-btn {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 5px;
  border: 1px solid rgba(201, 168, 76, 0.5);
  background: transparent;
  color: var(--gold);
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.nfc-copy-btn:hover {
  background: rgba(201, 168, 76, 0.12);
}

.nfc-copy-btn.copied {
  color: #5DCAA5;
  border-color: rgba(93, 202, 165, 0.5);
}

.nfc-guide-title {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(245, 241, 232, 0.55);
  margin-bottom: 12px;
}

.nfc-steps {
  margin: 0 0 16px 18px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nfc-steps li {
  font-size: 0.9rem;
  line-height: 1.5;
  color: rgba(245, 241, 232, 0.85);
}

.nfc-note {
  font-size: 0.78rem;
  color: rgba(245, 241, 232, 0.5);
  line-height: 1.5;
  margin-bottom: 18px;
}

.nfc-explorer-link {
  display: inline-block;
  font-size: 0.78rem;
  color: rgba(201, 168, 76, 0.7);
  text-decoration: none;
  border-bottom: 1px solid rgba(201, 168, 76, 0.25);
  padding-bottom: 1px;
}

.nfc-explorer-link:hover {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

/* ── Photo list (multi-image upload) ── */
.add-photo-btn {
  align-self: flex-start;
  font-size: 0.85rem;
  padding: 8px 14px;
  cursor: pointer;
}

.photo-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(201,168,76,0.25);
  margin-bottom: 6px;
}

.photo-list-thumb {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
}

.photo-list-name {
  flex: 1;
  font-size: 0.85rem;
  color: var(--cream);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.photo-list-badge {
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1px solid rgba(201,168,76,0.4);
  border-radius: 3px;
  padding: 2px 5px;
  flex-shrink: 0;
}

.photo-list-remove {
  background: none;
  border: none;
  color: rgba(245,241,232,0.4);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  flex-shrink: 0;
}

.photo-list-remove:hover {
  color: #E06868;
}
