:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --text: #182026;
  --muted: #65717b;
  --line: #d9e0e5;
  --accent: #14785f;
  --accent-soft: #dff1ec;
  --warn-soft: #fff1d4;
  --warn: #9b641d;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.shell {
  width: min(100vw, 1080px);
  min-height: 100svh;
  margin: 0 auto;
  background: var(--bg);
}

.list-panel,
.detail-panel,
.listing-feed-panel,
.recording-detail-panel,
.promotion-panel {
  padding: max(16px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
}

.call-queue-panel,
.call-detail-panel,
.recording-detail-panel,
.promotion-panel,
.view-tabs {
  max-width: 480px;
  margin-inline: auto;
}

.view-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: max(12px, env(safe-area-inset-top)) 14px 0;
}

.view-tabs button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 800;
}

.view-tabs button.is-active {
  background: var(--text);
  color: #ffffff;
}

.topbar,
.detail-header,
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar p,
.detail-header p,
.section-header p,
.muted {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

h1,
h2 {
  margin: 3px 0 0;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: 0;
}

h2 {
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}

.summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0 12px;
}

.summary article,
.queue-card,
.phone-grid > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.summary article {
  min-height: 66px;
  padding: 10px;
}

.summary strong {
  display: block;
  font-size: 22px;
  line-height: 1;
}

.summary span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

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

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

.queue-card {
  overflow: hidden;
  color: inherit;
}

.queue-open {
  width: 100%;
  padding: 12px;
  border: 0;
  background: transparent;
  text-align: left;
  color: inherit;
}

.queue-card h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

.queue-meta,
.source-row,
.price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.queue-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
}

.source-row {
  margin-top: 10px;
}

.mini-call {
  display: grid;
  place-items: center;
  min-height: 40px;
  border-top: 1px solid var(--line);
  color: var(--accent);
  font-weight: 800;
  text-decoration: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.chip.description {
  background: var(--warn-soft);
  color: var(--warn);
}

.chip.danger {
  background: #fde7e4;
  color: #a43326;
}

.chip.warning {
  background: var(--warn-soft);
  color: var(--warn);
}

.chip.success {
  background: var(--accent-soft);
  color: var(--accent);
}

.detail-body {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.hero {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 8px;
  background: #e8edf0;
}

.price-row strong {
  font-size: 22px;
}

.phone-grid {
  display: grid;
  gap: 8px;
  margin: 0;
}

.phone-grid > div {
  display: grid;
  grid-template-columns: 126px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
}

dt {
  color: var(--muted);
  font-size: 12px;
}

dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 700;
}

a {
  color: inherit;
}

.call-button {
  display: grid;
  place-items: center;
  min-height: 48px;
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font-weight: 800;
  text-decoration: none;
}

.placeholder-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.placeholder-actions button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
}

.empty,
.error {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}

.search-row {
  display: grid;
  gap: 6px;
  margin: 14px 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.search-row input {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.search-row input:focus,
.listing-card:focus-visible,
.view-tabs button:focus-visible,
.open-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.listing-layout {
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

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

.listing-card,
.listing-detail-card,
.promotion-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.listing-card {
  width: 100%;
  padding: 12px;
  color: inherit;
  text-align: left;
}

.listing-card.is-active {
  border-color: var(--accent);
}

.listing-card h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.listing-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.listing-detail-card {
  padding: 14px;
}

.promotion-card {
  padding: 12px;
}

.promotion-card-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.promotion-card-header p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
}

.promotion-card-header h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.promotion-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.promotion-actions textarea {
  grid-column: 1 / -1;
  width: 100%;
  min-height: 72px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.promotion-actions button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
}

.promotion-actions button:disabled {
  color: var(--muted);
}

.inline-error {
  margin-top: 10px;
}

.listing-detail-header {
  margin-bottom: 12px;
}

.open-link {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.gallery {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(210px, 60%);
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.gallery img,
.image-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e8edf0;
  object-fit: cover;
}

.image-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
}

.listing-section {
  padding: 14px 0 0;
  margin-top: 14px;
  border-top: 1px solid var(--line);
}

.listing-section h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.detail-grid > div {
  grid-template-columns: 132px minmax(0, 1fr);
}

.description-text {
  margin: 0;
  color: var(--text);
  line-height: 1.45;
  white-space: pre-wrap;
}

.recordings-section {
  margin-top: 22px;
}

.recordings-summary {
  margin-top: 12px;
}

.recordings-list,
.turns-list {
  display: grid;
  gap: 10px;
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.turns-section h3 {
  margin: 0 0 10px;
  font-size: 16px;
  line-height: 1.2;
}

.turn-row {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.turn-row p {
  margin: 0;
  line-height: 1.4;
}

@media (max-width: 760px) {
  .shell {
    width: min(100vw, 480px);
  }

  .listing-layout {
    grid-template-columns: 1fr;
  }

  .gallery {
    grid-auto-columns: minmax(210px, 82%);
  }

  .view-tabs button {
    font-size: 12px;
  }
}
