:root {
  color-scheme: light;
  --ink: #13202a;
  --muted: #667987;
  --subtle: #91a1ab;
  --paper: #eef4f8;
  --surface: #fdfefe;
  --surface-raised: #ffffff;
  --row: #f7fbfd;
  --track: #dfeaf0;
  --navy: #071116;
  --navy-2: #0d1c24;
  --line: #d5e3ea;
  --cyan: #167fbf;
  --cyan-soft: #e7f3fb;
  --cyan-strong: #0d5d98;
  --amber: #d99118;
  --amber-soft: #fff4d8;
  --green: #20a66a;
  --green-soft: #e7f8ef;
  --red: #d85b4a;
  --red-soft: #fff0ed;
  --button-text: #f7fbff;
  --shadow: 0 22px 60px rgba(31, 51, 66, 0.13);
}

body[data-theme="dark"] {
  color-scheme: dark;
  --ink: #e8f0ff;
  --muted: #8ba0c4;
  --subtle: #667da5;
  --paper: #030714;
  --surface: #061026;
  --surface-raised: #08162f;
  --row: #07132b;
  --track: #172747;
  --navy: #030714;
  --navy-2: #07132b;
  --line: #172b4d;
  --cyan: #5b8dff;
  --cyan-soft: #102149;
  --cyan-strong: #91b4ff;
  --amber: #f0b95b;
  --amber-soft: #3a2b13;
  --green: #8ca8ff;
  --green-soft: #18284f;
  --red: #ff8678;
  --red-soft: #3b1e24;
  --button-text: #061022;
  --shadow: 0 22px 70px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 88% 7%, color-mix(in srgb, var(--cyan) 16%, transparent), transparent 30rem),
    linear-gradient(135deg, var(--paper) 0%, color-mix(in srgb, var(--paper) 82%, #ffffff) 48%, var(--paper) 100%);
  color: var(--ink);
  font-family: Inter, "Segoe UI", "Noto Sans JP", system-ui, sans-serif;
  letter-spacing: 0;
}

body[data-theme="dark"] {
  background:
    radial-gradient(circle at 82% 4%, rgba(91, 141, 255, 0.16), transparent 32rem),
    radial-gradient(circle at 22% 88%, rgba(31, 63, 132, 0.16), transparent 34rem),
    linear-gradient(135deg, #020511 0%, #050d21 48%, #030714 100%);
}

button {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(7, 17, 22, 0.96), rgba(7, 17, 22, 0.98)),
    radial-gradient(circle at 18% 10%, color-mix(in srgb, var(--cyan) 24%, transparent), transparent 18rem);
  color: #eaf5f4;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 78px;
  margin-bottom: 28px;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  overflow: visible;
}

.brand-logo {
  display: block;
  width: 100%;
  max-width: 232px;
  height: auto;
  border-radius: 8px;
  object-fit: contain;
  filter: drop-shadow(0 14px 24px rgba(0, 18, 54, 0.34));
}
.brand p,
.eyebrow {
  margin: 0 0 4px;
  color: var(--cyan);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 1.45rem;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 2.5vw, 2.35rem);
  line-height: 1.2;
}

h3 {
  margin-bottom: 0;
  font-size: 1.05rem;
}

.font-control {
  margin-top: 14px;
  margin-bottom: 0;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.075);
}

.font-control-head,
.font-scale-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.font-control-head span {
  color: #dce9ee;
  font-size: 0.78rem;
  font-weight: 800;
}

.font-control-head strong {
  color: var(--cyan-strong);
  font-size: 0.8rem;
}

.font-control input {
  width: 100%;
  margin: 12px 0 7px;
  accent-color: var(--cyan);
  cursor: pointer;
}

.font-scale-labels span {
  color: #8fa6b1;
  font-size: 0.66rem;
  font-weight: 800;
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-list button {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #a9bcc3;
  cursor: pointer;
  text-align: left;
}

.nav-list button span {
  color: color-mix(in srgb, var(--cyan-strong) 72%, transparent);
  font-size: 0.72rem;
  font-weight: 900;
}

.nav-list button.active,
.nav-list button:hover {
  border-color: color-mix(in srgb, var(--cyan) 42%, transparent);
  background: color-mix(in srgb, var(--cyan) 14%, transparent);
  color: #f4ffff;
}

.sidebar-card,
.panel,
.score-hero,
.action-card,
.kpi-card,
.store-switcher {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.sidebar-card {
  margin-top: 26px;
  padding: 16px;
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.075);
  color: #eaf5f4;
  box-shadow: none;
}

.card-title,
.panel-head,
.topbar,
.mini-stat,
.store-row,
.store-main,
.store-score,
.button-row {
  display: flex;
  align-items: center;
}

.card-title,
.panel-head {
  justify-content: space-between;
  gap: 12px;
}

.card-title span,
.panel-head h3 {
  font-weight: 900;
}

.card-title b,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--cyan-soft);
  color: var(--cyan-strong);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.mini-stat {
  justify-content: space-between;
  margin-top: 14px;
  color: #a9bcc3;
  font-size: 0.82rem;
}

.mini-stat strong {
  color: #ffffff;
}

.progress-line {
  height: 7px;
  margin-top: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.11);
}

.progress-line span {
  display: block;
  width: var(--value);
  height: 100%;
  background: linear-gradient(90deg, var(--cyan-strong), var(--cyan));
}

.sidebar-card p {
  margin: 12px 0 0;
  color: #a9bcc3;
  font-size: 0.78rem;
  line-height: 1.6;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.topbar-tools {
  display: grid;
  grid-template-columns: 168px minmax(292px, 1fr);
  gap: 12px;
  align-items: stretch;
}

.theme-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  min-height: 72px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.theme-toggle button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 900;
}

.theme-toggle button.active {
  border-color: color-mix(in srgb, var(--cyan) 42%, transparent);
  background: var(--cyan-soft);
  color: var(--cyan-strong);
}

.store-switcher {
  min-width: 292px;
  padding: 14px 16px;
}

.store-switcher span,
.store-switcher small {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
}

.store-switcher strong {
  display: block;
  margin: 2px 0;
  font-size: 1rem;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1.35fr) minmax(260px, 0.8fr) minmax(240px, 0.65fr);
  gap: 14px;
  margin-bottom: 14px;
}

.score-hero {
  position: relative;
  min-height: 280px;
  overflow: hidden;
  background: var(--navy);
  color: #f3ffff;
}

.hero-photo {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(7, 17, 22, 0.92), rgba(7, 17, 22, 0.58)),
    var(--photo, linear-gradient(135deg, #172b31, #3a6c72));
  background-size: cover;
  background-position: center;
}

.score-content {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: end;
  min-height: 280px;
  padding: 24px;
}

.score-content h3 {
  max-width: 680px;
  margin: 0 0 10px;
  font-size: clamp(1.6rem, 2.6vw, 2.75rem);
  line-height: 1.12;
}

.score-content p:not(.eyebrow) {
  max-width: 620px;
  margin-bottom: 0;
  color: #bed5d7;
  line-height: 1.7;
}

.score-ring {
  position: absolute;
  right: 22px;
  bottom: 22px;
  display: grid;
  place-items: center;
  width: 116px;
  height: 116px;
  border: 1px solid rgba(103, 232, 239, 0.56);
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(21, 184, 200, 0.22), rgba(7, 17, 22, 0.92) 68%),
    conic-gradient(var(--cyan) 0deg 318deg, rgba(255, 255, 255, 0.12) 318deg);
  box-shadow: 0 0 32px rgba(21, 184, 200, 0.22);
}

.score-ring span {
  font-size: 1.8rem;
  font-weight: 900;
}

.score-ring small {
  margin-top: -26px;
  color: #9fdadd;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.action-card {
  padding: 18px;
}

.priority {
  background: linear-gradient(180deg, var(--surface-raised), var(--cyan-soft));
}

.priority ol {
  display: grid;
  gap: 12px;
  margin: 18px 0 0;
  padding-left: 22px;
}

.priority li {
  color: var(--ink);
  line-height: 1.55;
}

.report-ready {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--green-soft) 84%, var(--surface)), var(--surface-raised));
}

.report-meter {
  margin: 20px 0 12px;
}

.report-meter strong {
  display: block;
  color: var(--green);
  font-size: 2.6rem;
  line-height: 1;
}

.report-meter span {
  color: var(--muted);
  font-size: 0.82rem;
}

.report-ready p {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.7;
}

.report-ready button,
.panel-head button,
.button-row button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(21, 184, 200, 0.5);
  border-radius: 8px;
  background: var(--cyan);
  color: var(--button-text);
  cursor: pointer;
  font-weight: 900;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.kpi-card {
  padding: 16px;
}

.kpi-card span,
.kpi-card small {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.kpi-card strong {
  display: block;
  margin: 7px 0 4px;
  font-size: 2rem;
  line-height: 1;
}

.kpi-card.cyan {
  background: var(--cyan-soft);
  border-color: color-mix(in srgb, var(--cyan) 34%, var(--line));
}

.kpi-card.amber {
  background: var(--amber-soft);
  border-color: color-mix(in srgb, var(--amber) 34%, var(--line));
}

.kpi-card.green {
  background: var(--green-soft);
  border-color: color-mix(in srgb, var(--green) 34%, var(--line));
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1.08fr) minmax(320px, 0.92fr);
  gap: 14px;
}

.panel {
  padding: 18px;
}

.panel-head {
  margin-bottom: 16px;
}

.pill.amber {
  background: var(--amber-soft);
  color: #845500;
}

.pill.red {
  background: var(--red-soft);
  color: #9c3326;
}

.store-list,
.diagnosis-list {
  display: grid;
  gap: 10px;
}

.store-row {
  justify-content: space-between;
  gap: 14px;
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--row);
  cursor: pointer;
}

.store-row.active {
  border-color: color-mix(in srgb, var(--cyan) 66%, var(--line));
  background: var(--cyan-soft);
  box-shadow: inset 4px 0 0 var(--cyan);
}

.store-main {
  gap: 10px;
  min-width: 0;
}

.store-avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--navy-2);
  color: var(--cyan-strong);
  font-weight: 900;
}

.store-main strong,
.store-main span {
  display: block;
}

.store-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.store-main span {
  color: var(--muted);
  font-size: 0.78rem;
}

.store-score {
  gap: 10px;
  flex: 0 0 auto;
  font-weight: 900;
}

.rank-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--track);
  color: var(--muted);
  font-size: 0.78rem;
}

.diagnosis-item {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr) 44px;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.diagnosis-item span {
  font-size: 0.84rem;
  font-weight: 800;
}

.diagnosis-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--track);
}

.diagnosis-track b {
  display: block;
  width: var(--value);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan-strong), var(--cyan));
}

.diagnosis-item.warning .diagnosis-track b {
  background: linear-gradient(90deg, var(--amber), #f5c85a);
}

.diagnosis-item.danger .diagnosis-track b {
  background: linear-gradient(90deg, var(--red), #f09280);
}

.diagnosis-item strong {
  text-align: right;
}

.board-panel,
.review-panel {
  grid-column: span 1;
}

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

.kanban div {
  min-height: 210px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--row);
}

.kanban h4 {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.78rem;
}

.kanban article {
  margin-bottom: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  font-size: 0.84rem;
  line-height: 1.45;
}

.review-box {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--row);
}

.review-box > p {
  margin-bottom: 14px;
  color: var(--ink);
  line-height: 1.7;
}

.ai-reply {
  padding: 12px;
  border-radius: 8px;
  background: var(--cyan-soft);
}

.ai-reply span {
  color: var(--cyan-strong);
  font-size: 0.72rem;
  font-weight: 900;
}

.ai-reply p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.button-row {
  gap: 8px;
  margin-top: 12px;
}

.button-row .secondary {
  background: var(--surface-raised);
  color: var(--ink);
}

.button-row .ghost {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}

@media (max-width: 1180px) {
  .hero-grid,
  .main-grid {
    grid-template-columns: 1fr;
  }

  .kpi-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .brand {
    min-height: 84px;
    margin-bottom: 20px;
  }

  .brand-logo {
    max-width: 260px;
  }

  .workspace {
    padding: 16px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-tools {
    grid-template-columns: 1fr;
  }

  .store-switcher {
    min-width: 0;
  }

  .kanban {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .kpi-row {
    grid-template-columns: 1fr;
  }

  .diagnosis-item {
    grid-template-columns: 1fr;
  }

  .score-ring {
    position: static;
    margin-top: 20px;
  }
}
