:root {
  --header-bg: rgba(251, 250, 247, 0.96);
  --image-count-bg: rgba(23, 23, 23, 0.78);
  --dialog-backdrop: rgba(23, 23, 23, 0.54);
  --dialog-bg: rgba(251, 250, 247, 0.95);
  --gallery-overlay-bg: rgba(23, 23, 23, 0.74);
  --nav-active-bg: #fff;
  --input-bg: #fff;
  --bg-body-1: #e8ece9;
  --bg-body-2: #f7f6f2;
  --bg-body-3: #ece7df;
  --white: #fff;
  --button-secondary-bg: #ebe7de;
  --pill-success-bg: #dff0ec;
  --img-placeholder: #f1eee7;
  --text-error: #7f2c1d;
  --pill-error-bg: #ffe1d7;
  --border-error: #efb2a4;
  --panel-error-bg: #fff1ed;
  --scan-surface: #151515;
  --border-warning: #ead9bd;
  --bg-warning: #fff8eb;
  --text-warning: #8a5a00;
  --border-success: #b9d9d3;
  --bg-success: #eef8f5;
  --toast-bg: #171717;
  --toast-fg: #ffffff;
  --bg-soft-alt: #f8f6f0;
  --bg-button-hover: #ebe7df;
  --focus-ring: rgba(8, 124, 114, 0.14);
  --icon-button-shadow: 0 6px 16px rgba(23, 23, 23, 0.08);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2362615c' d='M6 8.825a.7.7 0 0 1-.5-.2L2.2 5.3a.7.7 0 0 1 1-1L6 7.125l2.8-2.8a.7.7 0 0 1 1 1L6.5 8.625a.7.7 0 0 1-.5.2z'/%3E%3C/svg%3E");

  color-scheme: light;
  --ink: #171717;
  --muted: #62615c;
  --line: #dedbd2;
  --paper: #fbfaf7;
  --surface: #ffffff;
  --soft: #f2f5f3;
  --teal: #087c72;
  --teal-dark: #075b54;
  --gold: #b98525;
  --coral: #bf5b45;
  --plum: #584071;
  --danger: #a23131;
  --shadow: 0 18px 45px rgba(23, 23, 23, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg-body-1);
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background: linear-gradient(180deg, var(--bg-body-1) 0%, var(--bg-body-2) 48%, var(--bg-body-3) 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--paper);
  position: relative;
  overflow-x: hidden;
  box-shadow: 0 0 60px rgba(23, 23, 23, 0.1);
}

.scan-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  cursor: pointer;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: calc(14px + env(safe-area-inset-top)) 18px 12px;
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.app-header h1,
.section-head h2,
.settings-block h3 {
  margin: 0;
  letter-spacing: 0;
}

.app-header h1 {
  font-size: 24px;
  line-height: 1.05;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.icon-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--icon-button-shadow);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.app-main {
  padding: 14px 14px 96px;
}

.catalog-link-mode .app-main {
  padding-bottom: 24px;
}

.rate-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.rate-strip article,
.dealer-bar,
.settings-block,
.scan-surface,
.result-panel,
.order-summary,
.notification-feed,
.orders-list:empty::before {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.rate-strip article {
  min-width: 0;
  padding: 10px;
}

.rate-strip span,
.order-summary span,
.meta-label {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.rate-strip strong {
  display: block;
  margin-top: 4px;
  font-size: 14px;
  white-space: nowrap;
}

.dealer-bar {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 10px;
}

.dealer-bar label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.catalog-login-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.catalog-login-bar[hidden] {
  display: none;
}

.catalog-login-bar span,
.catalog-login-bar strong {
  display: block;
  min-width: 0;
  line-height: 1.25;
}

.catalog-login-bar span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.catalog-login-bar strong {
  margin-top: 2px;
  font-size: 12px;
}

.catalog-back-button {
  margin-top: 10px;
}

select,
input,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--input-bg);
  outline: none;
}

select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: var(--select-arrow);
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

textarea {
  min-height: 76px;
  padding-top: 10px;
  resize: vertical;
}

select:focus,
input:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--ink);
  -webkit-box-shadow: 0 0 0 1000px var(--input-bg) inset;
  border-color: var(--teal);
  transition: background-color 5000s ease-in-out 0s;
}

.small-button,
.primary-button,
.secondary-button,
.danger-button {
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 800;
}

.small-button {
  color: var(--white);
  background: var(--plum);
}

.primary-button {
  width: 100%;
  color: var(--white);
  background: var(--teal);
}

.secondary-button {
  color: var(--ink);
  background: var(--button-secondary-bg);
  border: 1px solid var(--line);
}

.danger-button {
  color: var(--white);
  background: var(--danger);
}

.panel {
  display: none;
  padding-top: 18px;
}

.panel.is-active {
  display: block;
}

.panel-tabs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  scrollbar-width: none;
}

.panel-tabs::-webkit-scrollbar {
  display: none;
}

.panel-tabs button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 13px;
  color: var(--muted);
  background: var(--surface);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.panel-tabs button.is-active {
  color: var(--paper);
  background: var(--ink);
  border-color: var(--ink);
}

.panel-tab-content {
  display: none;
}

.panel-tab-content.is-active {
  display: block;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-head h2 {
  font-size: 23px;
  line-height: 1.1;
}

.status-pill {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 168px;
  padding: 0 9px;
  border-radius: 999px;
  color: var(--teal-dark);
  background: var(--pill-success-bg);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.search-row {
  margin-bottom: 10px;
}

.segment-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}

.segment-row::-webkit-scrollbar {
  display: none;
}

.segment-row button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 13px;
  color: var(--muted);
  background: var(--surface);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.segment-row button.is-active {
  color: var(--paper);
  background: var(--ink);
  border-color: var(--ink);
}

.product-list {
  display: grid;
  gap: 12px;
}

.product-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  min-height: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(23, 23, 23, 0.06);
}

.product-media {
  position: relative;
  width: 100%;
  min-height: 0;
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  overflow: hidden;
  background: var(--img-placeholder);
}

.product-media-button {
  display: block;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.product-media-button:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.image-count {
  position: absolute;
  right: 6px;
  bottom: 6px;
  min-width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: var(--white);
  background: var(--image-count-bg);
  font-size: 11px;
  font-weight: 900;
}

.video-pill {
  position: absolute;
  left: 6px;
  top: 6px;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 9px;
  color: var(--white);
  background: var(--image-count-bg);
  font-size: 11px;
  font-weight: 900;
}

.product-media img {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
  object-fit: cover;
}

.product-video-preview img {
  transition: transform 180ms ease, filter 180ms ease;
}

.product-video-preview:hover img {
  transform: scale(1.03);
  filter: saturate(1.08);
}

.video-preview-play {
  position: absolute;
  inset: 0;
  width: 46px;
  height: 46px;
  margin: auto;
  display: block;
  border-radius: 999px;
  background: rgba(23, 23, 23, 0.7);
  box-shadow: 0 10px 24px rgba(23, 23, 23, 0.22);
}

.video-preview-play::before {
  content: "";
  position: absolute;
  top: 14px;
  left: 18px;
  width: 0;
  height: 0;
  border-top: 9px solid transparent;
  border-bottom: 9px solid transparent;
  border-left: 14px solid var(--white);
}

.product-body {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.product-title-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.product-title-row h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
}

.stock-pill {
  flex: 0 0 auto;
  height: 26px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 8px;
  color: var(--teal-dark);
  background: var(--pill-success-bg);
  font-size: 11px;
  font-weight: 900;
}

.stock-pill.is-low {
  color: var(--text-error);
  background: var(--pill-error-bg);
}

.product-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 6px;
}

.product-meta div,
.price-line {
  min-width: 0;
  padding: 8px;
  border-radius: 8px;
  background: var(--soft);
}

.product-meta strong,
.price-line strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.price-line strong {
  overflow: visible;
  font-size: 12px;
  text-overflow: clip;
}

.price-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.group-price-stack {
  display: grid;
  gap: 5px;
}

.group-price-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px;
  border-radius: 8px;
  background: var(--soft);
}

.group-price-row span,
.group-price-row strong {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.price-error {
  display: grid;
  gap: 3px;
  padding: 9px;
  border: 1px solid var(--border-error);
  border-radius: 8px;
  color: var(--text-error);
  background: var(--panel-error-bg);
}

.price-error strong,
.price-error span {
  display: block;
  font-size: 12px;
  line-height: 1.25;
}

.product-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
}

.product-actions button {
  min-height: 40px;
  border-radius: 8px;
  font-size: 13px;
}

@media (max-width: 430px) {
  .app-main {
    padding-inline: 14px;
  }

  .product-card {
    gap: 8px;
    padding: 8px;
  }

  .product-media {
    width: 100%;
  }

  .product-meta {
    gap: 5px;
  }

  .product-meta div,
  .price-line {
    padding: 7px;
  }

  .product-title-row h3 {
    font-size: 15px;
  }

  .product-actions button {
    font-size: 12px;
  }
}

.scan-surface {
  height: 210px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--scan-surface);
}

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

.scan-placeholder {
  display: grid;
  justify-items: center;
  gap: 10px;
  color: var(--white);
  text-align: center;
  padding: 20px;
}

.scan-placeholder span {
  font-size: 42px;
  line-height: 1;
}

.form-grid {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.form-grid label.inline-check {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 12px;
}

.inline-check input {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.image-preview-panel {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.image-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.image-preview-head strong {
  min-width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: var(--white);
  background: var(--image-count-bg);
  font-size: 11px;
}

.image-preview-items {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.image-preview-items img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--img-placeholder);
}

.field-hint {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.result-panel {
  display: none;
  margin-top: 12px;
  padding: 12px;
}

.result-panel.is-visible {
  display: block;
}

.order-error-panel {
  margin-top: 0;
  border: 1px solid var(--border-error);
  color: var(--text-error);
  background: var(--panel-error-bg);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.barcode-product {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.barcode-product > img {
  width: 92px;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--img-placeholder);
}

.barcode-product h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.2;
}

.barcode-product p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.order-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 10px;
  margin-bottom: 12px;
}

.order-summary div {
  padding: 10px;
  border-radius: 8px;
  background: var(--soft);
}

.order-summary strong {
  display: block;
  margin-top: 4px;
  font-size: 26px;
  line-height: 1;
}

.orders-list {
  display: grid;
  gap: 10px;
}

.orders-list:empty::before {
  content: "Henüz sipariş yok. Katalogdan ürün seçerek panel siparişi oluşturabilirsiniz.";
  display: block;
  padding: 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.order-card,
.notification-item,
.group-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.order-card {
  padding: 12px;
}

.order-card header,
.notification-item header,
.group-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.order-card h3,
.notification-item h3,
.group-card h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.25;
}

.order-card p,
.notification-item p,
.group-card p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.notification-feed {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 10px;
}

.notification-feed:empty {
  display: none;
}

.notification-item {
  padding: 10px;
  border-color: var(--border-warning);
  background: var(--bg-warning);
}

.settings-block {
  padding: 12px;
  margin-bottom: 12px;
}

.settings-block h3 {
  font-size: 16px;
}

.settings-block > .primary-button,
.product-form > .primary-button {
  margin-top: 12px;
}

.api-status {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--border-success);
  border-radius: 8px;
  color: var(--teal-dark);
  background: var(--bg-success);
}

.api-status.is-error {
  border-color: var(--border-error);
  color: var(--text-error);
  background: var(--panel-error-bg);
}

.api-status strong {
  display: block;
  margin-top: 3px;
  font-size: 16px;
}

.api-status p {
  margin: 0;
  font-size: 13px;
  line-height: 1.35;
}

.group-editor {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.auth-form[hidden],
[hidden] {
  display: none !important;
}

.group-card {
  padding: 10px;
}

.group-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 10px;
}

.group-controls label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.admin-product-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.admin-product-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.admin-product-card {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.admin-product-card h4 {
  margin: 0;
  font-size: 15px;
  line-height: 1.25;
}

.admin-product-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.admin-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.dealer-card-expanded {
  gap: 0;
}

.dealer-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.dealer-card-header > div {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dealer-card-header .status-pill {
  font-size: 10px;
  padding: 2px 8px;
}

.dealer-card-header .status-pill.is-warning {
  background: var(--bg-warning);
  border: 1px solid var(--border-warning);
  color: var(--text-warning);
}

.dealer-card-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.dealer-detail-row {
  display: grid;
  gap: 2px;
}

.dealer-detail-row span:last-child {
  font-size: 13px;
  word-break: break-all;
}

.dealer-group-select-row {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.dealer-group-select-row label {
  display: grid;
  gap: 4px;
}

.dealer-card-expanded .admin-card-actions {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 20;
  width: min(100%, 520px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  transform: translateX(-50%);
  padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
  background: var(--header-bg);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.nav-item {
  min-width: 0;
  height: 58px;
  display: grid;
  place-items: center;
  gap: 3px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
}

.nav-item span {
  font-size: 19px;
  line-height: 1;
}

.nav-item strong {
  font-size: 11px;
  line-height: 1;
}

.nav-item.is-active {
  color: var(--paper);
  background: var(--ink);
}

.product-dialog {
  width: min(100% - 20px, 500px);
  max-height: min(86vh, 760px);
  border: 0;
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
  background: var(--paper);
  box-shadow: var(--shadow);
  overflow: auto;
}

.product-dialog::backdrop {
  background: var(--dialog-backdrop);
}

.dialog-close-row {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  padding: 8px;
  background: var(--dialog-bg);
}

.detail-wrap {
  padding: 0 14px 16px;
}

.detail-hero {
  display: grid;
  gap: 12px;
}

.detail-gallery {
  display: grid;
  gap: 10px;
}

.detail-gallery-frame {
  position: relative;
  display: grid;
  place-items: center;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft-alt);
  overflow: hidden;
}

.detail-gallery-main {
  width: 100%;
  aspect-ratio: 16 / 11;
  display: block;
  object-fit: contain;
  background: var(--bg-soft-alt);
}

.detail-gallery-frame figcaption {
  position: absolute;
  right: 8px;
  bottom: 8px;
  min-width: 48px;
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 9px;
  color: var(--white);
  background: var(--gallery-overlay-bg);
  font-size: 12px;
  font-weight: 900;
}

.detail-gallery-strip {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 72px;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}

.detail-gallery-strip::-webkit-scrollbar {
  display: none;
}

.gallery-thumb {
  width: 72px;
  aspect-ratio: 1;
  padding: 3px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: var(--bg-button-hover);
  scroll-snap-align: start;
}

.gallery-thumb.is-active {
  border-color: var(--teal);
  background: var(--pill-success-bg);
}

.gallery-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  border-radius: 6px;
  background: var(--white);
}

.detail-wrap h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.1;
}

.detail-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.detail-list div {
  min-width: 0;
  padding: 10px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.detail-videos {
  margin: 12px 0;
  display: grid;
  gap: 12px;
}

.detail-video {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}

.detail-video iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  border: 0;
  background: var(--scan-surface);
}

.detail-form {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.detail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom));
  z-index: 40;
  width: min(100% - 28px, 492px);
  min-height: 44px;
  display: grid;
  place-items: center;
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--toast-fg);
  background: var(--toast-bg);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  text-align: center;
  font-weight: 800;
}

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

@media (min-width: 700px) {
  body {
    padding: 18px 0;
  }

  .app-shell {
    min-height: calc(100vh - 36px);
    border-radius: 18px;
  }

  .bottom-nav {
    bottom: 18px;
    border-radius: 0 0 18px 18px;
  }
}


:root.dark-theme {
  color-scheme: dark;
  --ink: #e8e8e8;
  --muted: #9a9a9a;
  --line: #333333;
  --paper: #18181b;
  --surface: #27272a;
  --soft: #3f3f46;
  --teal: #10b981;
  --teal-dark: #34d399;
  --gold: #f59e0b;
  --coral: #f43f5e;
  --plum: #a78bfa;
  --danger: #ef4444;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.4);
  
  --header-bg: rgba(24, 24, 27, 0.96);
  --image-count-bg: rgba(0, 0, 0, 0.78);
  --dialog-backdrop: rgba(0, 0, 0, 0.7);
  --dialog-bg: rgba(24, 24, 27, 0.95);
  --gallery-overlay-bg: rgba(0, 0, 0, 0.74);
  --nav-active-bg: #27272a;
  --input-bg: #18181b;
  --bg-body-1: #09090b;
  --bg-body-2: #18181b;
  --bg-body-3: #09090b;
  --white: #e8e8e8;
  --button-secondary-bg: #3f3f46;
  --pill-success-bg: #064e3b;
  --img-placeholder: #27272a;
  --text-error: #fca5a5;
  --pill-error-bg: #450a0a;
  --border-error: #7f1d1d;
  --panel-error-bg: #450a0a;
  --scan-surface: #000;
  --border-warning: #78350f;
  --bg-warning: #451a03;
  --text-warning: #fbbf24;
  --border-success: #065f46;
  --bg-success: #022c22;
  --toast-bg: #f4f4f5;
  --toast-fg: #18181b;
  --bg-soft-alt: #27272a;
  --bg-button-hover: #52525b;
  --focus-ring: rgba(16, 185, 129, 0.28);
  --icon-button-shadow: 0 6px 16px rgba(0, 0, 0, 0.25);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239a9a9a' d='M6 8.825a.7.7 0 0 1-.5-.2L2.2 5.3a.7.7 0 0 1 1-1L6 7.125l2.8-2.8a.7.7 0 0 1 1 1L6.5 8.625a.7.7 0 0 1-.5.2z'/%3E%3C/svg%3E");
}

.dark-theme select,
.dark-theme input,
.dark-theme textarea {
  border-color: #3f3f46;
}
