:root {
  --bg: #f3f8fb;
  --surface: #ffffff;
  --surface-soft: #f7fbfd;
  --ink: #18333f;
  --muted: #637b88;
  --muted-2: #8ba0aa;
  --line: #d9e7ee;
  --line-strong: #c5d8e2;
  --teal: #0e9f9a;
  --teal-dark: #087d7b;
  --teal-soft: #e2f7f5;
  --blue: #2563eb;
  --blue-soft: #e8f0ff;
  --green: #138a55;
  --green-soft: #e7f7ef;
  --gold: #b7791f;
  --gold-soft: #fff3d8;
  --red: #c73d47;
  --red-soft: #fff0f1;
  --gray: #64748b;
  --gray-soft: #eef3f6;
  --shadow: 0 18px 44px rgba(24, 51, 63, 0.11);
  --shadow-soft: 0 10px 28px rgba(24, 51, 63, 0.08);
  --radius: 8px;
  --radius-lg: 16px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--bg);
}

body {
  min-height: 100%;
  max-width: 100%;
  overflow-x: hidden;
  margin: 0;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", "YuGothic", "Meiryo", sans-serif;
  letter-spacing: 0;
  line-height: 1.65;
  background:
    linear-gradient(180deg, rgba(232, 248, 247, 0.72), rgba(243, 248, 251, 0) 360px),
    var(--bg);
}

body.app-page {
  background: var(--bg);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  max-width: 100%;
  height: auto;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  border-bottom: 1px solid rgba(217, 231, 238, 0.9);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  width: min(1180px, calc(100% - 32px));
  min-height: 68px;
  margin: 0 auto;
}

.topbar-inner > nav {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}

.brand {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  min-width: 210px;
  font-weight: 800;
  color: var(--ink);
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  color: #ffffff;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  box-shadow: 0 8px 20px rgba(14, 159, 154, 0.22);
}

.nav-list {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.nav-link:hover,
.nav-link.is-active {
  color: var(--teal-dark);
  background: var(--teal-soft);
}

.top-actions {
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  justify-content: flex-end;
  min-width: 138px;
  max-width: 100%;
}

.account-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px 7px 30px;
  border-radius: 999px;
  background: #eef5f4;
  color: #2c5c58;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  position: relative;
}

.account-badge::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22a06b;
  box-shadow: 0 0 0 3px rgba(34, 160, 107, 0.18);
}

.ghost-button,
.primary-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  max-width: 100%;
  padding: 10px 14px;
  font-weight: 800;
  text-align: center;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.ghost-button {
  color: var(--muted);
  border-color: var(--line);
  background: #ffffff;
}

.ghost-button:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
}

.primary-button {
  color: #ffffff;
  background: var(--teal);
  box-shadow: 0 12px 24px rgba(14, 159, 154, 0.2);
}

.primary-button:hover {
  background: var(--teal-dark);
  transform: translateY(-1px);
}

.secondary-button {
  color: var(--teal-dark);
  border-color: rgba(14, 159, 154, 0.24);
  background: var(--teal-soft);
}

.secondary-button:hover {
  border-color: rgba(14, 159, 154, 0.38);
  background: #d2f1ef;
}

.danger-button {
  color: var(--red);
  border-color: rgba(199, 61, 71, 0.22);
  background: var(--red-soft);
}

.small-button {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}

.page {
  width: min(1180px, calc(100% - 32px));
  max-width: 100%;
  margin: 0 auto;
  padding: 38px 0 72px;
}

.wide-page {
  width: min(1280px, calc(100% - 32px));
}

.page-heading {
  display: grid;
  gap: 12px;
  margin-bottom: 30px;
}

.eyebrow {
  margin: 0;
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 900;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.22;
  font-weight: 900;
}

h2 {
  margin-bottom: 14px;
  font-size: 24px;
  line-height: 1.35;
}

h3 {
  margin-bottom: 10px;
  font-size: 17px;
  line-height: 1.4;
}

.lead {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
}

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

.demo-note {
  margin: 12px 0 0;
  color: var(--muted-2);
  font-size: 12px;
}

.home-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 30px 0;
}

.home-actions > * {
  min-width: 0;
}

.feature-card {
  display: grid;
  gap: 16px;
  min-height: 240px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.feature-card:hover {
  border-color: rgba(14, 159, 154, 0.34);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.feature-icon {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 16px;
  color: var(--teal-dark);
  background: var(--teal-soft);
  font-size: 24px;
  font-weight: 900;
}

.feature-card h2 {
  margin-bottom: 0;
}

.feature-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.link-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  color: var(--teal-dark);
  font-weight: 900;
}

.feature-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: auto;
}

.feature-links > * {
  min-width: 0;
}

.flow-section,
.panel,
.form-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.flow-section {
  padding: 28px;
}

.flow-grid {
  display: grid;
  grid-template-columns: 1.1fr auto 0.9fr auto 1fr;
  align-items: stretch;
  gap: 12px;
  margin-top: 22px;
}

.flow-grid > * {
  min-width: 0;
}

.flow-output-grid {
  grid-template-columns: 1fr auto 1fr;
  margin-top: 12px;
}

.flow-node {
  display: grid;
  gap: 10px;
  min-height: 140px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.flow-node strong {
  display: block;
  font-size: 16px;
}

.flow-node span {
  color: var(--muted);
  font-size: 13px;
}

.flow-arrow {
  display: grid;
  min-width: 34px;
  place-items: center;
  color: var(--teal-dark);
  font-size: 24px;
  font-weight: 900;
}

.flow-output {
  display: grid;
  gap: 10px;
}

.flow-chip {
  display: flex;
  align-items: center;
  min-width: 0;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: var(--radius);
  color: var(--teal-dark);
  background: var(--teal-soft);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.reception-layout {
  display: grid;
  grid-template-columns: minmax(375px, 1fr) 310px;
  align-items: start;
  gap: 32px;
}

.reception-layout > * {
  min-width: 0;
}

.phone-stage {
  display: grid;
  justify-items: center;
  gap: 14px;
  min-width: 0;
}

.phone-caption {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.phone-frame {
  width: 375px;
  max-width: 100%;
  padding: 12px;
  border-radius: 38px;
  background: #1f2937;
  box-shadow: 0 24px 60px rgba(17, 24, 39, 0.24);
}

.phone-screen {
  position: relative;
  overflow: hidden;
  min-width: 0;
  min-height: 730px;
  border-radius: 28px;
  background: #f7fbfd;
}

.phone-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 26px;
  padding: 0 18px;
  color: #4b6170;
  font-size: 11px;
  font-weight: 800;
}

.phone-app-header {
  display: grid;
  gap: 8px;
  padding: 14px 18px 12px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.phone-app-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.phone-app-title h1 {
  font-size: 19px;
  line-height: 1.3;
}

.phone-date {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.tabbar {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  padding: 10px 18px;
  background: #ffffff;
}

.tab-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #ffffff;
  font-size: 13px;
  font-weight: 900;
}

.tab-button.is-active {
  color: #ffffff;
  border-color: var(--teal);
  background: var(--teal);
}

.phone-content {
  height: 556px;
  overflow-y: auto;
  padding: 16px 16px 24px;
}

.phone-section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.phone-section-title h2 {
  margin-bottom: 2px;
  font-size: 16px;
}

.phone-section-title p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
}

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

.appointment-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(24, 51, 63, 0.05);
}

.appointment-card.is-closed {
  color: #687985;
  background: #eef3f6;
  box-shadow: none;
}

.appointment-main {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 12px;
}

.appointment-main > * {
  min-width: 0;
}

.appointment-time {
  display: grid;
  height: 54px;
  place-items: center;
  border-radius: 14px;
  color: var(--teal-dark);
  background: var(--teal-soft);
  font-size: 14px;
  font-weight: 900;
}

.appointment-title {
  margin: 0;
  font-size: 15px;
  font-weight: 900;
}

.appointment-meta {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.appointment-note {
  display: inline-flex;
  width: fit-content;
  margin-top: 7px;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 11px;
  font-weight: 800;
}

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

.status-button {
  display: grid;
  min-height: 48px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
}

.status-button.visit {
  color: #ffffff;
  border-color: var(--teal);
  background: var(--teal);
}

.status-button.cancel {
  color: var(--gold);
  border-color: rgba(183, 121, 31, 0.2);
  background: var(--gold-soft);
}

.status-button.no-show {
  color: var(--red);
  border-color: rgba(199, 61, 71, 0.2);
  background: var(--red-soft);
}

.status-pill {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--ink);
  background: #ffffff;
  font-size: 12px;
  font-weight: 900;
}

.result-summary {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  background: #ffffff;
  color: var(--ink);
  font-size: 12px;
}

.result-action {
  width: 100%;
  min-height: 44px;
}

.wizard-card {
  display: grid;
  gap: 16px;
  min-height: 505px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
}

.wizard-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.wizard-question h2 {
  margin-bottom: 6px;
  font-size: 19px;
}

.wizard-question p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.choice-grid {
  display: grid;
  gap: 10px;
}

.choice-grid.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice-button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 900;
  text-align: center;
}

.choice-button:hover,
.choice-button.is-selected {
  color: var(--teal-dark);
  border-color: rgba(14, 159, 154, 0.44);
  background: var(--teal-soft);
}

.wizard-fields {
  display: grid;
  gap: 10px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--ink);
  background: #ffffff;
}

.wizard-summary {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-soft);
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: 13px;
}

.summary-row > * {
  min-width: 0;
}

.summary-row strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.wizard-footer {
  display: grid;
  gap: 14px;
  margin-top: auto;
}

.wizard-controls {
  display: flex;
  gap: 10px;
}

.wizard-controls > * {
  flex: 1;
}

.progress-dots {
  display: flex;
  justify-content: center;
  gap: 7px;
}

.progress-dots span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--line-strong);
}

.progress-dots span.is-active,
.progress-dots span.is-done {
  background: var(--teal);
}

.complete-state {
  display: grid;
  min-height: 505px;
  place-items: center;
  gap: 20px;
  padding: 28px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
  text-align: center;
}

.complete-check {
  display: grid;
  width: 92px;
  height: 92px;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  background: var(--teal);
  font-size: 48px;
  font-weight: 900;
  animation: checkPop 0.44s ease-out both;
}

@keyframes checkPop {
  0% {
    transform: scale(0.58);
    opacity: 0;
  }
  70% {
    transform: scale(1.08);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.callout-stack {
  display: grid;
  gap: 14px;
  padding-top: 98px;
}

.callout {
  position: relative;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.callout::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 28px;
  width: 18px;
  height: 18px;
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  transform: rotate(45deg);
}

.callout strong {
  display: block;
  margin-bottom: 5px;
  font-size: 16px;
}

.callout p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  align-items: end;
  justify-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.28);
}

.bottom-sheet {
  width: min(375px, calc(100vw - 32px));
  padding: 18px;
  border-radius: 22px 22px 18px 18px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.32);
}

.sheet-handle {
  width: 48px;
  height: 5px;
  margin: 0 auto 14px;
  border-radius: 999px;
  background: var(--line-strong);
}

.sheet-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.sheet-title h2 {
  margin-bottom: 4px;
  font-size: 18px;
}

.sheet-title p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
}

.sheet-actions {
  display: grid;
  gap: 10px;
}

.dashboard-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.dashboard-head > * {
  min-width: 0;
}

.dashboard-head h1 {
  font-size: 32px;
}

.month-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 100%;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
}

.month-switch button {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  padding: 7px 12px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}

.month-switch button.is-active {
  color: #ffffff;
  background: var(--teal);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.kpi-grid > * {
  min-width: 0;
}

.kpi-card {
  display: grid;
  gap: 8px;
  min-height: 112px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #ffffff;
  box-shadow: var(--shadow-soft);
}

.kpi-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.kpi-card strong {
  font-size: 22px;
  line-height: 1.2;
}

.kpi-card.blue {
  border-top: 4px solid var(--blue);
}

.kpi-card.teal {
  border-top: 4px solid var(--teal);
}

.kpi-card.green {
  border-top: 4px solid var(--green);
}

.kpi-card.gold {
  border-top: 4px solid var(--gold);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 18px;
}

.dashboard-grid > * {
  min-width: 0;
}

.panel {
  min-width: 0;
  padding: 20px;
}

.panel.full-span {
  grid-column: 1 / -1;
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-head > * {
  min-width: 0;
}

.panel-head h2 {
  margin-bottom: 2px;
  font-size: 20px;
}

.panel-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.segment-panel {
  margin: 0 0 18px;
}

.segment-controls {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(320px, 1.2fr) 300px;
  gap: 14px;
  align-items: end;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.segment-controls > * {
  min-width: 0;
}

.segment-control-group {
  display: grid;
  gap: 8px;
}

.segment-control-group select,
.segment-period-control select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  color: var(--ink);
  background: #ffffff;
  font-weight: 800;
}

.control-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

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

.segment-axis-grid.secondary {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

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

.segment-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  color: var(--muted);
  background: #ffffff;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.segment-button:hover,
.segment-button.is-active {
  color: #ffffff;
  border-color: var(--teal);
  background: var(--teal);
  box-shadow: 0 10px 22px rgba(14, 159, 154, 0.15);
}

.segment-notice {
  margin: 10px 0 -2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.segment-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.segment-summary > * {
  min-width: 0;
}

.segment-summary-card {
  min-height: 74px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.segment-summary-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.segment-summary-card strong {
  display: block;
  margin-top: 5px;
  font-size: 16px;
  line-height: 1.25;
}

.segment-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0 0 12px;
}

.segment-chart-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: -2px 0 10px;
}

.segment-period-control {
  display: grid;
  gap: 6px;
  width: min(220px, 100%);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.legend-item i {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 4px;
}

.legend-item.zero i {
  border: 1px solid var(--line-strong);
  background: var(--gray-soft);
}

.segment-chart {
  min-width: 0;
  min-height: 260px;
}

.segment-heatmap-table {
  min-width: 900px;
}

.segment-heatmap-table th,
.segment-heatmap-table td {
  text-align: center;
  vertical-align: middle;
}

.segment-heatmap-table th:first-child {
  min-width: 128px;
}

.segment-total-cell {
  color: var(--ink);
  background: #f8fbfd;
  font-weight: 900;
}

.segment-grand-cell {
  color: var(--ink);
  background: #eef3f6;
  font-weight: 900;
}

.segment-svg {
  display: block;
  width: 100%;
  height: auto;
}

.donut-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.donut-grid > * {
  min-width: 0;
}

.donut-grid.single {
  grid-template-columns: minmax(260px, 420px);
}

.donut-card {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-height: 248px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.donut-card.large {
  min-height: 340px;
}

.donut-card svg {
  width: 100%;
  max-width: 320px;
  height: auto;
}

.donut-card.large svg {
  max-width: 430px;
}

.donut-card h3 {
  width: 100%;
  margin: 0;
  text-align: center;
  font-size: 13px;
}

.donut-card strong {
  color: var(--teal-dark);
  font-size: 13px;
}

.donut-values {
  display: grid;
  gap: 4px;
  width: 100%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.funnel-wrap {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.funnel-svg {
  width: 100%;
  height: auto;
  display: block;
}

.data-table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
}

.data-table {
  width: 100%;
  min-width: 860px;
  max-width: none;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.data-table th,
.data-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
  font-size: 13px;
}

.data-table th:first-child,
.data-table td:first-child {
  text-align: left;
}

.data-table th {
  color: var(--muted);
  background: var(--surface-soft);
  font-weight: 900;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.visitors-head p {
  font-size: 14px;
  font-weight: 900;
}

.visitor-controls {
  display: grid;
  grid-template-columns: 180px 160px minmax(260px, 1fr);
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.visitor-controls > * {
  min-width: 0;
}

.visitor-filter {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.visitor-filter select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
  color: var(--ink);
  background: #ffffff;
  font-weight: 800;
}

.visitor-table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  max-height: 600px;
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.visitor-table {
  min-width: 920px;
  max-width: none;
  border: 0;
  border-radius: 0;
}

.visitor-table th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.visitor-table th button {
  appearance: none;
  border: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.visitor-table td,
.visitor-table th {
  text-align: left;
}

.visitor-table td:last-child,
.visitor-table th:last-child {
  text-align: right;
}

.amount-cell {
  color: var(--teal-dark);
  font-weight: 900;
}

.diff-cell {
  color: var(--red);
  background: var(--red-soft);
  font-weight: 900;
}

.good-cell {
  color: var(--green);
  background: var(--green-soft);
  font-weight: 900;
}

.lost-bars {
  display: grid;
  gap: 14px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(84px, 112px) minmax(0, 1fr) 44px;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.bar-track {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--gray-soft);
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--blue));
}

.heatmap-table {
  width: 100%;
  max-width: none;
  border-collapse: separate;
  border-spacing: 7px;
}

.heatmap-table th {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.heatmap-table th:first-child {
  text-align: left;
}

.heatmap-table td {
  min-width: 84px;
  height: 48px;
  border-radius: var(--radius);
  text-align: center;
  font-size: 13px;
  font-weight: 900;
}

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

.pending-list > * {
  min-width: 0;
}

.pending-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.pending-card strong {
  font-size: 16px;
}

.pending-meta {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
}

.inline-note {
  margin: 14px 0 0;
  padding: 12px 14px;
  border-radius: var(--radius);
  color: var(--teal-dark);
  background: var(--teal-soft);
  font-size: 13px;
  font-weight: 800;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  max-width: 320px;
  padding: 12px 14px;
  border-radius: var(--radius);
  color: #ffffff;
  background: #1f2937;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.24);
  font-size: 13px;
  font-weight: 800;
}

.diagnosis-layout {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  align-items: start;
  gap: 24px;
}

.diagnosis-layout > * {
  min-width: 0;
}

.form-panel {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.form-panel h2 {
  margin-bottom: 0;
  font-size: 22px;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.radio-row,
.check-list {
  display: grid;
  gap: 8px;
}

.radio-row > *,
.check-list > * {
  min-width: 0;
}

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

.option-tile {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--ink);
  font-weight: 900;
}

.option-tile input {
  position: absolute;
  opacity: 0;
}

.option-tile:has(input:checked) {
  color: var(--teal-dark);
  border-color: rgba(14, 159, 154, 0.42);
  background: var(--teal-soft);
}

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

.report-shell {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.report-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.report-placeholder,
.loading-card {
  display: grid;
  min-height: 560px;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.62);
  text-align: center;
}

.loading-steps {
  display: grid;
  gap: 12px;
  width: min(360px, 100%);
}

.loading-step {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--muted);
  font-weight: 800;
}

.loading-step.is-active {
  color: var(--teal-dark);
  border-color: rgba(14, 159, 154, 0.38);
  background: var(--teal-soft);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 3px solid rgba(14, 159, 154, 0.18);
  border-top-color: var(--teal);
  border-radius: 999px;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.report-paper {
  width: min(794px, 100%);
  max-width: 100%;
  min-height: 1123px;
  margin: 0 auto;
  padding: 44px 48px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.report-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 20px;
  border-bottom: 3px solid var(--teal);
}

.report-header h1 {
  font-size: 28px;
}

.report-date {
  color: var(--muted);
  white-space: nowrap;
  font-size: 13px;
  font-weight: 900;
}

.report-section {
  margin-top: 28px;
}

.report-section h2 {
  margin-bottom: 12px;
  font-size: 20px;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
  align-items: center;
}

.summary-grid > * {
  min-width: 0;
}

.map-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.map-card svg {
  display: block;
  width: 100%;
  height: auto;
}

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

.score-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.score-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.score-item strong {
  font-size: 20px;
  overflow-wrap: anywhere;
}

.stars {
  color: #f5a524;
  font-size: 20px;
  letter-spacing: 0;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--line);
}

.report-table th,
.report-table td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  font-size: 13px;
}

.report-table th:first-child,
.report-table td:first-child {
  text-align: left;
}

.report-table th {
  color: var(--muted);
  background: var(--surface-soft);
}

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

.comment-item {
  padding: 14px 16px;
  border-left: 4px solid var(--teal);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--surface-soft);
}

.comment-item h3 {
  margin-bottom: 6px;
  font-size: 15px;
}

.comment-item p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.report-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 34px;
  padding: 18px 20px;
  border-radius: var(--radius);
  color: #ffffff;
  background: linear-gradient(135deg, var(--teal-dark), var(--blue));
}

.report-cta p {
  margin-bottom: 0;
  opacity: 0.88;
}

.report-cta strong {
  display: block;
  font-size: 18px;
}

@media (max-width: 1060px) {
  .topbar-inner {
    flex-wrap: wrap;
    padding: 12px 0;
  }

  .brand,
  .top-actions {
    min-width: auto;
  }

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

  .segment-controls {
    grid-template-columns: 1fr;
  }

  .segment-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .visitor-controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .donut-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .reception-layout,
  .dashboard-grid,
  .diagnosis-layout {
    grid-template-columns: 1fr;
  }

  .callout-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-top: 0;
  }

  .callout::before {
    display: none;
  }
}

@media (max-width: 760px) {
  .page,
  .wide-page {
    width: min(100% - 20px, 1180px);
    padding-top: 24px;
  }

  /* スマホではサマリーをグラフの下に回し、グラフを先に見せる */
  .segment-panel {
    display: flex;
    flex-direction: column;
  }
  .segment-panel > .panel-head { order: 0; }
  .segment-panel > .segment-controls { order: 1; }
  .segment-panel > .segment-notice { order: 2; }
  .segment-panel > .segment-legend { order: 3; }
  .segment-panel > .segment-chart-toolbar { order: 4; }
  .segment-panel > .segment-chart { order: 5; }
  .segment-panel > .segment-summary { order: 6; margin-top: 16px; }

  /* サマリーカードは2列にして高さを抑える */
  .segment-summary {
    grid-template-columns: 1fr 1fr;
  }

  .topbar-inner > nav {
    flex-basis: 100%;
    order: 3;
  }

  .nav-list {
    flex-wrap: wrap;
    width: 100%;
    justify-content: flex-start;
    overflow-x: visible;
  }

  .home-actions,
  .flow-grid,
  .flow-output-grid,
  .summary-grid,
  .pending-list,
  .callout-stack {
    grid-template-columns: 1fr;
  }

  .flow-arrow {
    min-height: 22px;
    transform: rotate(90deg);
  }

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

  .visitor-controls,
  .donut-grid,
  .donut-grid.single {
    grid-template-columns: 1fr;
  }

  /* ボタン群・サマリーは2列でコンパクトに（縦の長さを抑える） */
  .segment-axis-grid,
  .segment-axis-grid.secondary,
  .chart-toggle,
  .segment-summary {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .phone-frame {
    width: 375px;
  }

  .report-paper {
    padding: 30px 22px;
  }

  .report-table {
    table-layout: fixed;
  }

  .report-table th,
  .report-table td {
    padding: 8px 6px;
    font-size: 11px;
    overflow-wrap: anywhere;
  }

  .report-header,
  .report-cta {
    flex-direction: column;
  }

  .check-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .topbar-inner {
    width: min(100% - 18px, 1180px);
    gap: 10px;
  }

  .nav-link {
    min-height: 36px;
    padding: 7px 10px;
    font-size: 13px;
  }

  .phone-screen {
    min-height: 700px;
  }

  .phone-content {
    height: 526px;
  }

  .status-actions {
    grid-template-columns: 1fr;
  }

  .toast {
    right: 12px;
    bottom: 12px;
    max-width: calc(100vw - 24px);
  }
}

@media print {
  body {
    background: #ffffff;
  }

  body * {
    visibility: hidden;
  }

  .print-area,
  .print-area * {
    visibility: visible;
  }

  .topbar,
  .page-heading,
  .form-panel,
  .report-toolbar,
  .report-placeholder,
  .loading-card {
    display: none !important;
  }

  .page,
  .wide-page,
  .diagnosis-layout,
  .report-shell {
    width: auto;
    margin: 0;
    padding: 0;
    display: block;
  }

  .print-area {
    position: absolute;
    inset: 0 auto auto 0;
    width: 100%;
  }

  .report-paper {
    width: 100%;
    min-height: auto;
    margin: 0;
    padding: 22mm 18mm;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
}
