/* TASK-JH-054 — Japan Audio Studio (internal editorial) */

.jas-page {
  --jas-border: rgba(15, 23, 42, 0.1);
  --jas-muted: #64748b;
  --jas-ink: #0f172a;
  --jas-chip: #f1f5f9;
  max-width: 1280px;
  margin: 0 auto;
  padding: 8px 4px 48px;
  color: var(--jas-ink);
}

.jas-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.jas-head h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
}

.jas-head p {
  margin: 4px 0 0;
  color: var(--jas-muted);
  font-size: 0.9rem;
}

.jas-azure {
  border: 1px solid #f59e0b;
  background: #fffbeb;
  color: #92400e;
  border-radius: 10px;
  padding: 10px 12px;
  max-width: 420px;
  font-size: 0.85rem;
}

.jas-azure strong {
  display: block;
  margin-bottom: 4px;
}

.jas-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.jas-metric {
  border: 1px solid var(--jas-border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #fff;
  min-width: 0;
}

.jas-metric span {
  display: block;
  color: var(--jas-muted);
  font-size: 0.75rem;
}

.jas-metric strong {
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
}

.jas-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  align-items: center;
}

.jas-filters input,
.jas-filters select {
  border: 1px solid var(--jas-border);
  border-radius: 8px;
  padding: 7px 10px;
  font: inherit;
  min-height: 36px;
  background: #fff;
}

.jas-filters input[type="search"] {
  min-width: 220px;
  flex: 1 1 220px;
}

.jas-table-wrap {
  border: 1px solid var(--jas-border);
  border-radius: 12px;
  overflow: auto;
  background: #fff;
}

.jas-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.jas-table th,
.jas-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--jas-border);
  text-align: left;
  vertical-align: top;
  min-width: 0;
}

.jas-table th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  font-weight: 600;
  z-index: 1;
}

.jas-table tr {
  cursor: pointer;
}

.jas-table tr:hover td {
  background: #f8fafc;
}

.jas-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--jas-chip);
  font-size: 0.75rem;
  white-space: nowrap;
}

.jas-chip--draft { background: #e2e8f0; }
.jas-chip--needsReview { background: #fef3c7; color: #92400e; }
.jas-chip--changesRequested { background: #ffedd5; color: #9a3412; }
.jas-chip--approved { background: #dcfce7; color: #166534; }
.jas-chip--renderDirty { background: #e0e7ff; color: #3730a3; }
.jas-chip--rendered { background: #dbeafe; color: #1e40af; }
.jas-chip--failed { background: #fee2e2; color: #991b1b; }

.jas-article-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  border: 1px solid var(--jas-border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.jas-article-head h2 {
  margin: 0 0 6px;
  font-size: 1.15rem;
}

.jas-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  color: var(--jas-muted);
  font-size: 0.85rem;
}

.jas-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.jas-btn {
  border: 1px solid var(--jas-border);
  background: #fff;
  border-radius: 8px;
  padding: 7px 12px;
  font: inherit;
  cursor: pointer;
  min-height: 36px;
}

.jas-btn:hover {
  background: #f8fafc;
}

.jas-btn--primary {
  background: #0f172a;
  color: #fff;
  border-color: #0f172a;
}

.jas-btn--primary:hover {
  background: #1e293b;
}

.jas-btn--azure {
  background: #0f766e;
  border-color: #0f766e;
  color: #fff;
}
.jas-btn--azure:hover {
  background: #115e59;
}
.jas-real-probe {
  margin-top: 12px;
  padding: 12px;
  border: 1px dashed rgba(15, 23, 42, 0.25);
  border-radius: 10px;
  background: #f8fafc;
}
.jas-probe-card strong {
  display: block;
  margin-bottom: 6px;
}

.jas-btn--danger {
  color: #991b1b;
  border-color: #fecaca;
}

.jas-chapter {
  border: 1px solid var(--jas-border);
  border-radius: 12px;
  margin-bottom: 10px;
  background: #fff;
  overflow: hidden;
}

.jas-chapter__sum {
  display: grid;
  grid-template-columns: 40px minmax(0, 1.4fr) repeat(5, minmax(0, 0.7fr)) auto;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  cursor: pointer;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  font: inherit;
}

.jas-chapter__body {
  border-top: 1px solid var(--jas-border);
  padding: 12px;
  display: none;
}

.jas-chapter.is-open .jas-chapter__body {
  display: block;
}

.jas-grid2 {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 12px;
}

.jas-card {
  border: 1px solid var(--jas-border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #f8fafc;
  min-width: 0;
}

.jas-card h3 {
  margin: 0 0 8px;
  font-size: 0.9rem;
}

.jas-card pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.78rem;
  max-height: 220px;
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  padding: 8px;
  border: 1px solid var(--jas-border);
}

.jas-ssml[hidden] {
  display: none !important;
}

.jas-list {
  margin: 0;
  padding-left: 18px;
  font-size: 0.88rem;
}

.jas-scores {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  font-size: 0.82rem;
}

.jas-scores div {
  background: #fff;
  border-radius: 8px;
  padding: 6px 8px;
  border: 1px solid var(--jas-border);
}

.jas-preview--sim {
  opacity: 0.92;
  background: #f8fafc;
  border: 1px dashed rgba(15, 23, 42, 0.18);
}
.jas-preview__help {
  margin: 0 0 8px;
  font-size: 0.82rem;
  color: #64748b;
}
.jas-real {
  margin-top: 12px;
  padding: 14px;
  border-radius: 12px;
  border: 2px solid #0f766e;
  background: #f0fdfa;
}
.jas-real h3 {
  margin: 0 0 8px;
  color: #0f766e;
}
.jas-real--empty {
  border-style: dashed;
  background: #f8fafc;
}
.jas-real--flash {
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.45);
}
.jas-real__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 8px 0;
}
.jas-real__vol {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
}
.jas-real__time {
  margin: 0 0 6px;
  font-variant-numeric: tabular-nums;
  font-size: 0.9rem;
}
.jas-real__probe {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(15, 118, 110, 0.2);
  font-size: 0.82rem;
}
.jas-real__err {
  color: #991b1b;
  font-size: 0.85rem;
}

.jas-preview {
  border: 1px dashed #94a3b8;
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}

.jas-preview__label {
  font-size: 0.8rem;
  color: #92400e;
  background: #fffbeb;
  border-radius: 8px;
  padding: 6px 8px;
  margin-bottom: 8px;
}

.jas-preview__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.jas-preview__meter {
  flex: 1 1 160px;
  min-width: 120px;
}

.jas-preview__meter input[type="range"] {
  width: 100%;
}

.jas-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.jas-note-pill {
  border: 1px solid var(--jas-border);
  background: #fff;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  cursor: pointer;
}

.jas-plan {
  border: 1px solid #c7d2fe;
  background: #eef2ff;
  border-radius: 12px;
  padding: 12px;
  margin-top: 12px;
}

.jas-empty {
  padding: 24px;
  text-align: center;
  color: var(--jas-muted);
}

.jas-back {
  margin-bottom: 10px;
}

@media (max-width: 900px) {
  .jas-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .jas-grid2 {
    grid-template-columns: 1fr;
  }
  .jas-chapter__sum {
    grid-template-columns: 32px minmax(0, 1fr) auto;
  }
  .jas-chapter__sum .jas-hide-sm {
    display: none;
  }
}

@media (max-width: 430px) {
  .jas-metrics {
    grid-template-columns: 1fr 1fr;
  }
  .jas-filters input[type="search"] {
    min-width: 0;
    width: 100%;
  }
}

/* TASK-1263 — mobile catalog is a list; desktop table stays */
.jas-decision,
.jas-decision__sub,
.jas-mobile-list,
.jas-more-filters {
  display: none;
}

.jas-filters__more {
  display: contents;
}

@media (max-width: 900px) {
  .jas-page {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }

  .jas-metrics,
  .jas-table-wrap {
    display: none;
  }

  .jas-decision {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--jas-border);
    border-radius: 14px;
    padding: 10px 12px;
    margin-bottom: 6px;
  }

  .jas-decision strong {
    display: block;
    font-size: 22px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
  }

  .jas-decision span {
    font-size: 11px;
    font-weight: 700;
    color: var(--jas-muted);
  }

  .jas-decision__side {
    text-align: right;
    font-size: 12px;
    font-weight: 800;
    line-height: 1.35;
  }

  .jas-decision__sub {
    display: block;
    margin: 0 0 8px;
    font-size: 11px;
    font-weight: 700;
    color: var(--jas-muted);
  }

  .jas-mobile-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .jas-filters {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .jas-filters::-webkit-scrollbar {
    display: none;
  }

  .jas-filters input[type="search"] {
    flex: 1 1 140px;
    min-width: 120px;
    width: auto;
  }

  .jas-filters select,
  .jas-more-filters {
    flex: 0 0 auto;
  }

  .jas-more-filters {
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--jas-border);
    border-radius: 8px;
    background: #fff;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    color: #334155;
  }

  .jas-more-filters.is-active {
    color: #c2410c;
    background: #fff7ed;
  }

  .jas-filters__more {
    display: none;
  }

  .jas-filters__more.is-open {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
  }

  .jas-row {
    display: flex;
    gap: 8px;
    width: 100%;
    text-align: left;
    background: #fff;
    border: 1px solid var(--jas-border);
    border-radius: 14px;
    padding: 8px 10px;
    font: inherit;
    color: inherit;
    cursor: pointer;
  }

  .jas-row__main {
    flex: 1 1 auto;
    min-width: 0;
  }

  .jas-row__title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.3;
  }

  .jas-row__ctx,
  .jas-row__audio {
    display: block;
    margin-top: 2px;
    font-size: 11px;
    font-weight: 700;
    color: var(--jas-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .jas-row__audio.is-real {
    color: #c2410c;
  }

  .jas-row__score {
    flex: 0 0 auto;
    text-align: right;
  }

  .jas-row__score b {
    display: block;
    font-size: 15px;
    font-variant-numeric: tabular-nums;
  }

  .jas-row__score small {
    font-size: 10px;
    font-weight: 800;
    color: var(--jas-muted);
  }
}
