:root {
  --bg: #f7f9fc;
  --panel: #ffffff;
  --panel-strong: #ffffff;
  --line: #dde4ec;
  --text: #142033;
  --muted: #5d6b79;
  --accent: #d4a94f;
  --accent-strong: #b88a32;
  --danger: #b42318;
  --ok: #2f8f5b;
  --navy-900: #07111f;
  --navy-800: #102a46;
  --navy-700: #183b5b;
  --surface-subtle: #eef2f6;
  --surface-selected: #fff3d8;
  --shadow-subtle: 0 1px 2px rgba(7, 17, 31, 0.08);
  --shadow-card: 0 8px 24px -8px rgba(7, 17, 31, 0.14);
  --radius: 12px;
}

html {
  background: var(--bg);
}

body {
  min-width: 1120px;
  overflow-x: auto;
  color: var(--text);
  background: var(--bg);
  font-family: "Noto Sans JP", "Yu Gothic UI", "Hiragino Kaku Gothic ProN", "Segoe UI", sans-serif;
  font-size: 13px;
  line-height: 1.54;
}

.background {
  display: none;
}

.shell {
  width: 100%;
  margin: 0;
}

#app-view.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  grid-template-rows: 64px minmax(calc(100vh - 64px), auto);
  background: var(--bg);
  transition: grid-template-columns 180ms ease;
}

#app-view.app.sidebar-expanded {
  grid-template-columns: 232px minmax(0, 1fr);
}

#app-view.app.hidden {
  display: none !important;
}

.app > .tabs {
  grid-column: 1;
  grid-row: 1 / -1;
}

.app > .topbar {
  grid-column: 2;
  grid-row: 1;
}

.app > .tab-panel {
  grid-column: 2;
  grid-row: 2;
  min-width: 0;
  padding: 24px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-width: 0;
  height: 64px;
  margin: 0;
  padding: 10px 16px 10px 20px;
  align-items: center;
  border-bottom: 1px solid #eef2f6;
  background: #ffffff;
}

.page-heading {
  min-width: 200px;
}

.page-heading h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 24px;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.page-heading p {
  max-width: 520px;
  margin: 1px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-actions {
  min-width: 0;
  flex-wrap: nowrap;
  justify-content: flex-end;
  gap: 8px;
}

.top-actions .store-picker {
  min-width: 150px;
  max-width: 190px;
}

.top-actions .store-picker > span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.top-actions select,
.top-actions button,
.top-actions .user-pill,
.global-job-capacity {
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 12px;
  box-shadow: var(--shadow-subtle);
  white-space: nowrap;
}

.global-job-capacity {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ok);
  background: #e8f7ef;
  font-size: 11px;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px rgba(47, 143, 91, 0.12);
}

.user-pill {
  color: var(--text);
  background: var(--surface-subtle);
  font-weight: 500;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  height: 100vh;
  margin: 0;
  padding: 76px 12px 72px;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 4px;
  overflow: hidden auto;
  background: var(--navy-900);
  box-shadow: var(--shadow-subtle);
}

.tabs::before {
  content: "";
  position: absolute;
  top: 12px;
  left: 12px;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: url("/static/assets/raxis-icon.png") center / cover no-repeat;
  transition: width 180ms ease, background-position 180ms ease;
}

.tabs::after {
  content: "運";
  position: absolute;
  bottom: 12px;
  left: 12px;
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 12px;
  color: #ffffff;
  background: var(--navy-800);
  font-size: 12px;
  font-weight: 700;
}

.tab {
  position: relative;
  display: grid;
  width: 48px;
  min-height: 44px;
  padding: 0;
  place-items: center;
  overflow: visible;
  border: 0;
  border-radius: 12px;
  color: #ffffff;
  background: transparent;
  box-shadow: none;
  transition: width 180ms ease, background-color 120ms ease, transform 120ms ease;
}

.tab::before {
  content: attr(data-icon);
  font-family: "Segoe UI Symbol", "Yu Gothic UI", sans-serif;
  font-size: 19px;
  font-weight: 500;
  line-height: 1;
}

.sidebar-toggle {
  position: absolute;
  bottom: 72px;
  left: 18px;
  z-index: 3;
  display: grid;
  width: 36px;
  height: 32px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(241, 197, 107, 0.52);
  border-radius: 10px;
  color: #ffffff;
  background: var(--navy-800);
  box-shadow: none;
  transition: left 180ms ease, width 180ms ease, background-color 120ms ease, transform 120ms ease;
}

.sidebar-closed-lock {
  position: absolute;
  bottom: 110px;
  left: 18px;
  z-index: 3;
  display: grid;
  width: 36px;
  height: 32px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 10px;
  color: #ffffff;
  background: var(--navy-800);
  box-shadow: none;
  font-size: 14px;
  transition: left 180ms ease, background-color 120ms ease, transform 120ms ease;
}

.sidebar-closed-lock:hover,
.sidebar-closed-lock:focus-visible {
  background: var(--navy-700);
  transform: translateY(-2px);
}

.sidebar-closed-lock.is-locked {
  border-color: rgba(241, 197, 107, 0.7);
  background: #6d5118;
}

.sidebar-toggle:hover,
.sidebar-toggle:focus-visible {
  background: var(--navy-700);
  transform: translateY(-2px);
}

.sidebar-toggle:active {
  transform: translateY(1px) scale(0.98);
}

.identity-state {
  display: inline-flex;
  min-width: 64px;
  padding: 4px 8px;
  justify-content: center;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.identity-state-match {
  color: #17653b;
  background: #e2f5e9;
}

.identity-state-mismatch {
  color: #9c2e2e;
  background: #fde7e7;
}

.identity-state-missing {
  color: #70591b;
  background: #fff3cf;
}

.sidebar-toggle-icon {
  font-family: "Segoe UI Symbol", sans-serif;
  font-size: 24px;
  line-height: 1;
}

#app-view.sidebar-expanded .tabs::before {
  width: 208px;
  background-image: url("/static/assets/raxis-icon.png"), url("/static/assets/raxis-logo.png");
  background-position: left center, 62px center;
  background-repeat: no-repeat;
  background-size: 48px 48px, 96px auto;
}

#app-view.sidebar-expanded .tabs::after {
  content: "運営者";
  width: 208px;
  padding: 0 14px;
  place-items: center start;
}

#app-view.sidebar-expanded .tab {
  display: flex;
  width: 208px;
  padding: 0 12px;
  justify-content: flex-start;
  gap: 12px;
}

#app-view.sidebar-expanded .tab::before {
  display: inline-grid;
  width: 24px;
  flex: 0 0 24px;
  place-items: center;
}

#app-view.sidebar-expanded .tab .tab-label {
  position: static;
  z-index: auto;
  max-width: 160px;
  padding: 0;
  overflow: hidden;
  opacity: 1;
  color: #ffffff;
  background: transparent;
  box-shadow: none;
  font-size: 12px;
  font-weight: 500;
  text-overflow: ellipsis;
  transform: none;
}

#app-view.sidebar-expanded .sidebar-toggle {
  left: 184px;
}

#app-view.sidebar-expanded .sidebar-closed-lock {
  left: 184px;
}

.tab .tab-label {
  position: fixed;
  left: 66px;
  z-index: 60;
  display: block;
  max-width: 240px;
  padding: 7px 10px;
  border-radius: 8px;
  opacity: 0;
  color: #ffffff;
  background: var(--navy-900);
  box-shadow: 0 8px 24px rgba(7, 17, 31, 0.22);
  font-size: 12px;
  pointer-events: none;
  transform: translateX(-4px);
  transition: opacity 120ms ease, transform 120ms ease;
  white-space: nowrap;
}

.tab:hover .tab-label,
.tab:focus-visible .tab-label {
  opacity: 1;
  transform: translateX(0);
}

.tab.active {
  color: #ffffff;
  background: var(--navy-700);
}

.tab.active::after {
  content: "";
  position: absolute;
  top: 10px;
  left: 0;
  width: 3px;
  height: 24px;
  border-radius: 2px;
  background: #f1c56b;
}

.panel,
.soft-panel,
.inset-panel,
.stat-card,
.orders-summary-card,
.orders-analysis-card,
.strategy-group,
.health-metric-card,
.orders-item-card,
.vps-health-heading,
.admin-operation-card {
  color: var(--text);
  border: 1px solid #dde4ec;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: var(--shadow-subtle);
  backdrop-filter: none;
}

.panel {
  padding: 16px;
}

.panel .panel,
.soft-panel,
.inset-panel {
  box-shadow: none;
}

h1,
h2,
h3,
h4 {
  color: var(--text);
}

h1 { font-size: 24px; line-height: 34px; }
h2 { font-size: 20px; line-height: 30px; }
h3 { font-size: 16px; line-height: 24px; }

.eyebrow {
  color: var(--accent-strong);
  letter-spacing: 0.08em;
}

.hint,
.lead,
label span,
.field-note {
  color: var(--muted);
}

input,
textarea,
select {
  border: 1px solid #dde4ec;
  border-radius: 8px;
  color: var(--text);
  background: #ffffff;
  box-shadow: inset 0 1px 1px rgba(7, 17, 31, 0.03);
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(212, 169, 79, 0.14);
}

button,
.tab,
.subtab,
summary,
[role="button"] {
  transition: transform 70ms ease, box-shadow 140ms ease, border-color 140ms ease, background-color 140ms ease;
}

button:not(:disabled):hover,
.subtab:not(:disabled):hover,
[role="button"]:not([aria-disabled="true"]):hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px -8px rgba(7, 17, 31, 0.34);
}

button:not(:disabled):active,
.subtab:not(:disabled):active,
[role="button"]:not([aria-disabled="true"]):active {
  transform: translateY(1px) scale(0.98);
  box-shadow: var(--shadow-subtle);
}

button:focus-visible,
.subtab:focus-visible,
.tab:focus-visible {
  outline: 3px solid rgba(212, 169, 79, 0.34);
  outline-offset: 2px;
}

button:disabled,
select:disabled {
  color: #9fb0c3;
  border-color: #dde4ec;
  background: #eef2f6;
  box-shadow: none;
}

.primary {
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: var(--navy-900);
  background: var(--accent);
  box-shadow: var(--shadow-subtle);
}

.ghost {
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: var(--text);
  background: #ffffff;
  box-shadow: var(--shadow-subtle);
}

.danger {
  border: 1px solid #f0b4ad;
  border-radius: 8px;
  color: var(--danger);
  background: #fff4f2;
  box-shadow: var(--shadow-subtle);
}

.subtabs {
  gap: 6px;
  padding: 4px;
  border: 1px solid #eef2f6;
  border-radius: 10px;
  background: #ffffff;
}

.subtab {
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  color: var(--text);
  background: #ffffff;
  box-shadow: var(--shadow-subtle);
}

.subtab.active {
  color: var(--navy-900);
  background: var(--accent);
}

.store-check {
  border-color: #dde4ec;
  background: #ffffff;
}

.store-check.is-selected {
  border-color: var(--accent);
  background: var(--surface-selected);
}

.store-check.is-running {
  border-color: #d4a94f;
  background: #fffaf0;
  box-shadow: inset 3px 0 0 var(--accent);
}

.store-runtime-badge {
  color: #7a560d;
  background: #f5d985;
}

.table-wrap {
  border-radius: 10px;
  background: #ffffff;
}

table {
  color: var(--text);
  font-size: 12px;
}

th,
td {
  padding: 9px 10px;
  border-bottom: 1px solid #eef2f6;
}

th {
  color: var(--muted);
  background: #eef2f6;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  white-space: nowrap;
}

.table-wrap tbody tr:nth-child(even):not(.is-selected):not([aria-selected="true"]):not([data-status="paid"]):not([data-status="assigned"]) {
  background: #f8fafc;
}

.table-wrap tbody tr:hover:not(.is-selected):not([aria-selected="true"]):not([data-status="paid"]):not([data-status="assigned"]) {
  background: #fffaf0;
}

.table-wrap tbody tr.is-selected,
.table-wrap tbody tr[aria-selected="true"] {
  background: var(--surface-selected);
}

td,
.score-card strong,
.stat-card strong,
.orders-summary-card strong,
.health-metric-summary,
.job-phase-cell {
  font-variant-numeric: tabular-nums;
}

.json-box,
.log-box {
  color: #dce7f4;
  background: var(--navy-900);
}

.source-badge-local {
  color: var(--text);
  background: var(--surface-subtle);
}

.source-badge-zisbank,
.source-badge-mixed {
  color: #8a651f;
  background: var(--surface-selected);
}

.job-status-running,
.ops-state-online,
.ops-state-done,
.health-pill.good {
  color: var(--ok);
  border-color: #b9e5cc;
  background: #e8f7ef;
}

.job-status-claimed,
.job-status-queued,
.job-status-maintenance_queued,
.ops-state-draining,
.ops-state-queued,
.ops-state-claimed,
.ops-state-running,
.health-pill.warn {
  color: #a96c00;
  border-color: #ecd394;
  background: #fff3d8;
}

.job-status-done {
  color: #315f9b;
  background: #eaf2ff;
}

.job-status-failed,
.job-status-stopped,
.ops-state-failed,
.ops-state-stopped,
.ops-state-offline,
.health-pill.bad {
  color: var(--danger);
  border-color: #f0b4ad;
  background: #fff4f2;
}

.job-status.job-customer-tone-info,
.ops-state.job-customer-tone-info {
  color: #315f9b;
  border-color: #bdd2ed;
  background: #eaf2ff;
}

.job-status.job-customer-tone-success,
.ops-state.job-customer-tone-success {
  color: var(--ok);
  border-color: #b9e5cc;
  background: #e8f7ef;
}

.job-status.job-customer-tone-warning,
.ops-state.job-customer-tone-warning {
  color: #a96c00;
  border-color: #ecd394;
  background: #fff3d8;
}

.job-status.job-customer-tone-error,
.ops-state.job-customer-tone-error {
  color: var(--danger);
  border-color: #f0b4ad;
  background: #fff4f2;
}

.job-customer-detail {
  display: block;
  margin-top: 6px;
  max-width: 34rem;
  color: var(--text-muted);
  white-space: normal;
}

.orders-pie::after {
  background: #ffffff;
}

.orders-month-bar-wrap {
  background: #eef2f6;
}

.admin-subtabs {
  border-color: #dde4ec;
  background: #ffffff;
}

.login-panel {
  width: min(1180px, calc(100% - 48px));
  margin: 48px auto;
  color: var(--text);
  background: #ffffff;
  box-shadow: var(--shadow-card);
}

.login-panel .brand-logo-large {
  height: 48px;
  object-fit: contain;
}

.brand-lockup-login {
  width: 196px;
  min-height: 68px;
  margin: 0 auto 18px;
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--navy-900);
  box-shadow: var(--shadow-card);
}

.login-panel .inset-panel,
.pricing-card,
.pricing-interval-row div {
  color: var(--text);
  border-color: #dde4ec;
  background: #ffffff;
}

.pricing-card-featured {
  border-color: var(--accent);
}

.pricing-summary,
.pricing-audience,
.pricing-hero span {
  color: var(--muted);
}

.bank-scope-tabs {
  margin-top: 4px;
}

.bank-brand-extract-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.78fr) minmax(480px, 1.22fr);
  gap: 16px;
}

.bank-registered-brands-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.bank-registered-brands-head,
.bank-registered-brands-footer,
.bank-owned-asins-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.bank-registered-brands-head h3,
.bank-owned-asins-head h3 {
  margin: 0 0 4px;
}

.bank-registered-brands-footer {
  min-height: 36px;
}

.bank-registered-brand-button {
  min-width: 0;
  padding: 6px 10px;
  font-weight: 700;
}

.bank-registered-brands-table td,
.bank-registered-brands-table th {
  white-space: nowrap;
}

.bank-brand-extract-form,
.bank-brand-extract-result {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
}

#bank-brand-extract-output {
  min-height: 320px;
  margin-top: 12px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  line-height: 1.55;
  white-space: pre;
}

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

.bank-brand-extract-metrics > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-subtle);
}

.bank-brand-extract-metrics span {
  color: var(--muted);
  font-size: 12px;
}

.bank-brand-extract-metrics strong {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1280px) {
  .page-heading p,
  .global-job-capacity {
    display: none;
  }

  .app > .tab-panel {
    padding: 18px;
  }

  .bank-brand-extract-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1120px) {
  body {
    min-width: 960px;
  }

  #app-view.app {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .tabs {
    padding-right: 8px;
    padding-left: 8px;
  }

  .tabs::before,
  .tabs::after,
  .tab {
    left: auto;
    width: 48px;
  }
}
