/* ==========================================================================
   AIDB Market（運営：株式会社Parks）公式紺の階調デザインスタイルシート
   BRAND-COLOR-NAVY.md / aidb-x-ui 準拠
   ========================================================================== */

:root {
  --bg: #ffffff;
  --bg-alt: #f2f6fc;
  --hover: rgba(10, 26, 56, 0.05);
  --hover-strong: rgba(10, 26, 56, 0.10);

  --text: #0a1a38;
  --muted: #4b5e80;
  --faint: #6f87ad;

  --border: #c3d2ea;
  --border-soft: #edf1f7;
  --rule: #0a1a38;

  --band: #0a1a38;
  --band-soft: #16315e;
  --band-text: #c3d2ea;
  --band-link: #ffffff;

  /* 差し色（青）: 面には塗らず選択中・入力中の細い罫と輪のみ */
  --accent: #3d7be0;
  --focus: rgba(61, 123, 224, 0.28);

  /* 差し色（金）: Verified（認証）の印のみ */
  --gold: #e6a700;
  --gold-ink: #7a5a00;

  /* エラー・拒否のみ最小限の落ち着いた赤枠（面塗りなし） */
  --error-border: #a63232;
  --error-ink: #8f2626;

  /* 角丸矩形（ピル型 999px 禁止） */
  --radius-label: 6px;
  --radius-control: 8px;
  --radius-card: 12px;

  --shadow-sm: 0 1px 3px rgba(10, 26, 56, 0.06);
  --shadow-md: 0 6px 20px rgba(10, 26, 56, 0.10);

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  /* 既存インライン参照との互換エイリアス */
  --ink: #0a1a38;
  --ink-secondary: #4b5e80;
  --ink-muted: #6f87ad;
  --verified-ink: #7a5a00;
  --danger-ink: #8f2626;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-color: var(--text);
}

img {
  max-width: 100%;
}

.hidden {
  display: none !important;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ---------- Top Navy Band ---------- */
.role-bar {
  background: var(--band);
  color: var(--band-text);
  font-size: 12px;
  border-bottom: 1px solid var(--band-soft);
}

.role-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding-top: 6px;
  padding-bottom: 6px;
  flex-wrap: wrap;
}

.role-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.role-bar-label {
  color: var(--band-text);
  font-weight: 600;
}

.role-switcher {
  display: inline-flex;
  background: var(--band-soft);
  padding: 2px;
  border-radius: var(--radius-control);
  border: 1px solid var(--band-soft);
  gap: 2px;
}

.role-btn {
  border: 1px solid transparent;
  background: transparent;
  color: var(--band-text);
  font-size: 12px;
  font-family: inherit;
  padding: 4px 10px;
  border-radius: var(--radius-label);
  cursor: pointer;
  font-weight: 600;
}

.role-btn:hover {
  color: var(--band-link);
}

.role-btn.active {
  background: var(--bg);
  color: var(--text);
  border-color: var(--bg);
}

.role-bar-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.auth-session-slot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.auth-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--band-soft);
  color: var(--band-link);
  padding: 4px 9px;
  border-radius: var(--radius-label);
  font-size: 11.5px;
  border: 1px solid var(--faint);
}

.auth-role-tag {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
}

.btn-bar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: 1px solid var(--band-text);
  background: var(--band-soft);
  color: var(--band-link);
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-label);
  cursor: pointer;
  text-decoration: none;
}

.btn-bar:hover {
  background: var(--bg);
  border-color: var(--bg);
  color: var(--text);
  text-decoration: none;
}

.btn-bar-accent {
  background: var(--bg);
  border-color: var(--bg);
  color: var(--text);
}

.btn-bar-accent:hover {
  background: var(--bg-alt);
  border-color: var(--bg-alt);
  color: var(--text);
}

.prod-live-pill {
  display: inline-flex;
  align-items: center;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--bg);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-label);
}

.role-bar-prod-text {
  color: var(--band-text);
  font-size: 12px;
}

.role-bar-prod-text strong {
  color: var(--band-link);
}

.btn-bar-x {
  background: var(--band-soft);
  border-color: var(--band-text);
  color: var(--band-link);
  text-decoration: none;
}

.btn-bar-x:hover {
  background: var(--bg);
  border-color: var(--bg);
  color: var(--text);
  text-decoration: none;
}

.role-bar-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--band-text);
  font-family: var(--font-mono);
  font-size: 11px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 3px;
  background: var(--band-text);
  display: inline-block;
}

.status-dot.error {
  background: var(--error-border);
}

/* ---------- Header & Official Logo Navigation ---------- */
.site-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 66px;
  flex-wrap: wrap;
  padding-top: 8px;
  padding-bottom: 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand-logo {
  height: 30px;
  width: auto;
  display: block;
}

.brand-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
  display: inline-block;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-text strong {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.brand-text small {
  font-size: 11px;
  color: var(--muted);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: var(--radius-control);
  border: 1px solid transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
}

.nav-link:hover {
  background: var(--bg-alt);
  color: var(--text);
  text-decoration: none;
}

.nav-link.active {
  background: var(--bg-alt);
  color: var(--text);
  border-color: var(--accent);
}

.nav-link-admin {
  border-color: var(--border);
  background: var(--bg-alt);
  color: var(--text);
}

.nav-link-admin.active {
  background: var(--rule);
  border-color: var(--rule);
  color: var(--bg);
}

.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-label);
  font-size: 11px;
  font-weight: 700;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
}

.nav-link-admin.active .nav-badge {
  background: var(--band-soft);
  color: var(--bg);
  border-color: var(--band-text);
}

/* ---------- Main Layout ---------- */
.main-content {
  padding: 28px 0 64px;
  min-height: calc(100vh - 190px);
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.page-title {
  margin: 0 0 6px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.015em;
  color: var(--text);
}

.page-subtitle {
  margin: 0;
  font-size: 13.5px;
  color: var(--muted);
}

/* ---------- Cards & Surfaces ---------- */
.card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 20px;
}

.card-compact {
  padding: 14px 16px;
}

.card-subtle {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  padding: 12px 14px;
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 12px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ---------- Buttons (Navy & White Only; No Color Coding by Operation) ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 15px;
  border-radius: var(--radius-control);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover:not(:disabled) {
  background: var(--bg-alt);
  border-color: var(--rule);
  text-decoration: none;
}

.btn:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus);
}

.btn:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.btn-primary,
.btn-success {
  background: var(--rule);
  border-color: var(--rule);
  color: var(--bg);
}

.btn-primary:hover:not(:disabled),
.btn-success:hover:not(:disabled) {
  background: var(--band-soft);
  border-color: var(--band-soft);
  color: var(--bg);
}

.btn-accent {
  background: var(--bg);
  border-color: var(--rule);
  color: var(--text);
}

.btn-accent:hover:not(:disabled) {
  background: var(--bg-alt);
  border-color: var(--rule);
  color: var(--text);
}

.btn-danger,
.btn-danger-solid {
  background: var(--bg);
  border-color: var(--error-border);
  color: var(--error-ink);
}

.btn-danger:hover:not(:disabled),
.btn-danger-solid:hover:not(:disabled) {
  background: var(--bg-alt);
  border-color: var(--error-border);
  color: var(--error-ink);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-block {
  width: 100%;
}

/* ---------- Badges, Tags & Filter Pills (Rounded Rectangles, Navy Gradation) ---------- */
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: var(--radius-label);
  font-size: 11.5px;
  font-weight: 600;
  background: var(--bg-alt);
  color: var(--text);
  border: 1px solid var(--border);
  line-height: 1.5;
}

/* 差し色（金）は Verified 認証印のみに使用（面塗りなし） */
.badge-verified {
  background: var(--bg);
  color: var(--gold-ink);
  border-color: var(--gold);
  font-weight: 700;
}

.badge-category {
  background: var(--rule);
  color: var(--bg);
  border-color: var(--rule);
}

.badge-pick,
.badge-early,
.badge-neutral,
.badge-warn {
  background: var(--bg-alt);
  color: var(--text);
  border-color: var(--border);
}

.badge-danger {
  background: var(--bg);
  color: var(--error-ink);
  border-color: var(--error-border);
}

.tag-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-label);
  font-size: 11.5px;
  font-weight: 500;
  background: var(--bg-alt);
  color: var(--text);
  border: 1px solid var(--border);
  font-family: var(--font-mono);
}

.tag-chip-hw {
  background: var(--bg);
  color: var(--muted);
  border-color: var(--border);
}

.filter-pill {
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text);
  border-radius: var(--radius-label);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}

.filter-pill:hover {
  border-color: var(--rule);
}

.filter-pill.active,
.filter-pill.hw.active {
  background: var(--rule);
  border-color: var(--rule);
  color: var(--bg);
}

/* ---------- Tabs (Rounded Rectangles, No Single-Side Underline Accent) ---------- */
.tabs {
  display: flex;
  gap: 6px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
  margin-bottom: 18px;
  overflow-x: auto;
}

.tab-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  padding: 8px 14px;
  border-radius: var(--radius-control);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
}

.tab-btn:hover {
  background: var(--bg-alt);
  color: var(--text);
}

.tab-btn.active,
.tab-btn-phase2.active {
  background: var(--rule);
  border-color: var(--rule);
  color: var(--bg);
}

.tab-btn-phase2 {
  color: var(--text);
  background: var(--bg-alt);
}

/* ---------- Forms ---------- */
.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 5px;
}

.form-hint {
  font-size: 11.5px;
  color: var(--faint);
  margin-top: 4px;
}

.input, .select, .textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: var(--bg);
}

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus);
}

.textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.6;
}

.input-mono {
  font-family: var(--font-mono);
}

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

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

.checkbox-label {
  display: inline-flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
  margin-top: 3px;
  accent-color: var(--rule);
}

/* ---------- Alerts & Limitations (Uniform 4-Sided Borders, No Single-Side Stripe) ---------- */
.alert {
  padding: 13px 15px;
  border-radius: var(--radius-control);
  border: 1px solid var(--border);
  background: var(--bg-alt);
  color: var(--text);
  font-size: 13px;
  margin-bottom: 14px;
}

.alert-warn,
.alert-info,
.alert-success {
  background: var(--bg-alt);
  border-color: var(--border);
  color: var(--text);
}

.alert-danger {
  background: var(--bg);
  border-color: var(--error-border);
  color: var(--error-ink);
}

.limitations-box {
  background: var(--bg-alt);
  border: 1px solid var(--rule);
  border-radius: var(--radius-card);
  padding: 16px 18px;
}

.limitations-box h3,
.limitations-box h4 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.limitations-box ul {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
  font-size: 13px;
}

.limitations-box li {
  margin-bottom: 5px;
}

/* ---------- Closed Beta Login Gate ---------- */
.beta-gate-wrap {
  max-width: 520px;
  margin: 28px auto 40px;
}

.beta-gate-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-md);
  padding: 28px;
}

.beta-gate-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 16px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border-soft);
  flex-wrap: wrap;
}

.beta-gate-notes {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}

/* ---------- Early Builder First-100 Banner (Uniform 4-Sided Border) ---------- */
.early-builder-banner {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 14px 18px;
  margin-bottom: 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.eb-main {
  flex: 1;
  min-width: 240px;
}

.eb-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.eb-progress-track {
  width: 100%;
  max-width: 360px;
  height: 7px;
  background: var(--bg);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
  border: 1px solid var(--border);
}

.eb-progress-fill {
  height: 100%;
  background: var(--rule);
  border-radius: 3px;
}

/* ---------- Market Search & Grid ---------- */
.filter-panel {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 18px;
  margin-bottom: 20px;
}

.search-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.search-input-wrap {
  flex: 1;
  min-width: 240px;
}

.filter-section {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
  flex-wrap: wrap;
}

.filter-section-label {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
  min-width: 82px;
  padding-top: 4px;
}

.filter-pills-wrap {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.b2b-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

.results-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
  gap: 8px;
}

.listings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.listing-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: pointer;
}

.listing-card:hover {
  border-color: var(--rule);
  box-shadow: var(--shadow-sm);
}

.listing-card:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus);
}

.listing-card-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--text);
}

.listing-card-summary {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.listing-card-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 10px;
}

.price-display {
  font-family: var(--font-mono);
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
}

.price-sub {
  font-size: 11px;
  color: var(--faint);
}

.seller-mini {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.seller-mini strong {
  color: var(--text);
  font-weight: 600;
}

/* ---------- Listing Detail ---------- */
.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 20px;
  align-items: start;
}

.detail-sidebar {
  position: sticky;
  top: 82px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.spec-table th,
.spec-table td {
  border-bottom: 1px solid var(--border-soft);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.spec-table th {
  width: 170px;
  color: var(--muted);
  font-weight: 600;
  background: var(--bg-alt);
}

.code-preview {
  background: var(--bg-alt);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: var(--radius-control);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

/* ---------- 4-Step Wizard ---------- */
.stepper {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.step-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.step-item.active {
  border-color: var(--accent);
  background: var(--bg-alt);
  box-shadow: 0 0 0 2px var(--focus);
}

.step-item.done {
  border-color: var(--rule);
  background: var(--bg-alt);
}

.step-num {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-label);
  background: var(--bg-alt);
  color: var(--muted);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

.step-item.active .step-num,
.step-item.done .step-num {
  background: var(--rule);
  border-color: var(--rule);
  color: var(--bg);
}

.step-title {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
}

.fee-sim-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px;
}

.fee-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border-soft);
}

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

.dynamic-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

/* ---------- Order Room ---------- */
.orders-layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.order-list-item {
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--bg);
  margin-bottom: 8px;
  cursor: pointer;
}

.order-list-item:hover {
  border-color: var(--rule);
}

.order-list-item.active {
  border-color: var(--accent);
  background: var(--bg-alt);
  box-shadow: 0 0 0 2px var(--focus);
}

.state-track {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.state-step {
  flex: 1;
  min-width: 96px;
  text-align: center;
  padding: 7px 6px;
  border-radius: var(--radius-label);
  font-size: 11.5px;
  font-weight: 600;
  background: var(--bg);
  color: var(--faint);
  border: 1px solid var(--border);
}

.state-step.reached {
  background: var(--bg-alt);
  color: var(--text);
  border-color: var(--border);
}

.state-step.current {
  background: var(--rule);
  color: var(--bg);
  border-color: var(--rule);
}

.state-step.disputed {
  background: var(--bg);
  color: var(--error-ink);
  border-color: var(--error-border);
}

.chat-box {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  padding: 12px;
  max-height: 360px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.chat-msg {
  padding: 10px 13px;
  border-radius: var(--radius-control);
  font-size: 13px;
  max-width: 88%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

.chat-msg.SYSTEM {
  max-width: 100%;
  background: var(--bg-alt);
  color: var(--muted);
  font-size: 12px;
  border-style: dashed;
}

.chat-msg.BUYER {
  align-self: flex-start;
}

.chat-msg.SELLER {
  align-self: flex-end;
  border-color: var(--rule);
}

.chat-msg.ADMIN {
  align-self: center;
  border-color: var(--rule);
  background: var(--bg-alt);
}

.chat-meta {
  font-size: 11px;
  color: var(--faint);
  margin-bottom: 4px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

/* ---------- Paper-to-Market Demo ---------- */
.paper-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.article-selector-item {
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--bg);
  margin-bottom: 8px;
  cursor: pointer;
}

.article-selector-item:hover {
  border-color: var(--rule);
}

.article-selector-item.active {
  border-color: var(--accent);
  background: var(--bg-alt);
  box-shadow: 0 0 0 2px var(--focus);
}

.article-body {
  font-size: 14px;
  line-height: 1.8;
  color: var(--muted);
}

.embed-iframe {
  width: 100%;
  min-height: 260px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--bg);
}

/* ---------- Admin Review Queue & Invite Table ---------- */
.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  align-items: start;
}

.rubric-box {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px;
  position: sticky;
  top: 82px;
}

.rubric-step {
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.rubric-step:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.rubric-step h4 {
  margin: 0 0 6px;
  font-size: 12.5px;
  color: var(--text);
}

.rubric-step ul {
  margin: 0;
  padding-left: 16px;
  font-size: 12px;
  color: var(--muted);
}

.invite-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.invite-table th,
.invite-table td {
  border-bottom: 1px solid var(--border-soft);
  padding: 9px 10px;
  text-align: left;
  vertical-align: middle;
}

.invite-table th {
  background: var(--bg-alt);
  color: var(--muted);
  font-weight: 600;
  font-size: 11.5px;
}

.code-pill {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: var(--radius-label);
  color: var(--text);
  display: inline-block;
}

/* ---------- Requests & Hardware ---------- */
.split-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.want-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--bg);
  margin-bottom: 10px;
}

.vote-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 68px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--bg-alt);
  color: var(--text);
  cursor: pointer;
  font-family: var(--font-mono);
}

.vote-btn:hover {
  border-color: var(--rule);
  background: var(--rule);
  color: var(--bg);
}

.vote-btn:hover .vote-label {
  color: var(--band-text);
}

.vote-count {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
}

.vote-label {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
}

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 26, 56, 0.56);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}

.modal-card {
  background: var(--bg);
  border-radius: var(--radius-card);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
}

.modal-header h3 {
  margin: 0;
  font-size: 16px;
  color: var(--text);
}

.modal-close {
  border: 1px solid transparent;
  border-radius: var(--radius-label);
  background: transparent;
  font-size: 20px;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 8px;
}

.modal-close:hover {
  background: var(--bg-alt);
  color: var(--text);
}

.modal-body {
  padding: 18px 20px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  background: var(--bg-alt);
}

/* ---------- Toast Notifications (Uniform 4-Sided Border, No Left Stripe) ---------- */
.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 120;
  max-width: 380px;
}

.toast {
  background: var(--band);
  color: var(--band-link);
  padding: 11px 15px;
  border-radius: var(--radius-control);
  font-size: 13px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--band-text);
}

.toast.error {
  background: var(--bg);
  color: var(--error-ink);
  border-color: var(--error-border);
}

/* ---------- Official Navy Footer ---------- */
.site-footer {
  background: var(--band);
  color: var(--band-text);
  border-top: 1px solid var(--band-soft);
  padding: 28px 0;
  font-size: 12.5px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.footer-logo {
  height: 26px;
  width: auto;
  display: block;
}

.footer-copy {
  color: var(--band-link);
  line-height: 1.5;
}

.footer-sub {
  font-size: 12px;
  color: var(--band-text);
}

.footer-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--band-text);
}

/* ---------- Utilities ---------- */
.loading-box,
.empty-box {
  text-align: center;
  padding: 36px 20px;
  color: var(--muted);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}

.mono {
  font-family: var(--font-mono);
}

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

.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 14px; }
.mt-4 { margin-top: 20px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 14px; }

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

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stack-md {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.divider-soft {
  border: none;
  height: 1px;
  background: var(--border-soft);
  margin: 18px 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .detail-layout,
  .orders-layout,
  .paper-layout,
  .admin-grid,
  .split-2 {
    grid-template-columns: 1fr;
  }
  .detail-sidebar,
  .rubric-box {
    position: static;
  }
  .stepper {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .form-grid-2,
  .form-grid-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .listings-grid {
    grid-template-columns: 1fr;
  }
  .stepper {
    grid-template-columns: 1fr;
  }
}
