:root {
  color-scheme: light;
  --canvas: #edf1f5;
  --canvas-deep: #e4eaf0;
  --surface: #ffffff;
  --surface-soft: #f6f8fa;
  --ink: #172131;
  --ink-soft: #36465a;
  --muted: #748196;
  --line: #dce3ea;
  --line-strong: #cbd5df;
  --navy: #0b1728;
  --navy-soft: #16263b;
  --teal: #218a78;
  --teal-soft: #e7f5f1;
  --blue: #346fc3;
  --blue-soft: #eaf2ff;
  --amber: #a76410;
  --amber-soft: #fff4df;
  --red: #b44552;
  --red-soft: #fff0f2;
  --shadow: 0 12px 34px rgba(28, 43, 63, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-width: 1100px;
  overflow: hidden;
  background:
    radial-gradient(circle at 9% -20%, rgba(52, 111, 195, 0.13), transparent 34%),
    linear-gradient(145deg, var(--canvas), var(--canvas-deep));
  color: var(--ink);
  font-family: Inter, "Noto Sans JP", "Hiragino Sans", "Yu Gothic UI", system-ui, sans-serif;
  font-feature-settings: "palt" 1;
  -webkit-font-smoothing: antialiased;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--teal);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

button:hover {
  transform: translateY(-1px);
  background: #197565;
}

button.secondary {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.84);
}

button.secondary:hover {
  background: rgba(255, 255, 255, 0.14);
}

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

.app-shell {
  display: grid;
  grid-template-rows: 70px 62px minmax(0, 1fr);
  gap: 10px;
  width: min(100%, 1480px);
  height: 100vh;
  margin: 0 auto;
  padding: 12px 16px 14px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) 330px auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 10px 12px 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background:
    radial-gradient(circle at 60% -80%, rgba(70, 137, 212, 0.35), transparent 46%),
    var(--navy);
  box-shadow: 0 14px 32px rgba(11, 23, 40, 0.19);
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 11px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border: 1px solid rgba(92, 220, 197, 0.42);
  border-radius: 11px;
  background: linear-gradient(145deg, rgba(33, 138, 120, 0.34), rgba(33, 138, 120, 0.08));
  color: #79e0cd;
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.brand h1 {
  margin-top: 1px;
  font-size: 1.22rem;
  line-height: 1.15;
  letter-spacing: -0.035em;
}

.eyebrow,
.label {
  display: block;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  line-height: 1.15;
  text-transform: uppercase;
}

.brand .eyebrow {
  color: rgba(255, 255, 255, 0.53);
}

.system-ready {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 10px;
  padding: 5px 8px;
  border: 1px solid rgba(121, 224, 205, 0.18);
  border-radius: 999px;
  background: rgba(33, 138, 120, 0.1);
  color: #9ce8db;
  font-size: 0.65rem;
  font-weight: 800;
  white-space: nowrap;
}

.system-ready i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #67dcc7;
  box-shadow: 0 0 0 4px rgba(103, 220, 199, 0.11);
}

.phone-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2px 12px;
  min-width: 0;
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
}

.phone-panel .label {
  grid-column: 1;
  color: rgba(255, 255, 255, 0.52);
}

.phone-panel a {
  grid-column: 1;
  color: #fff;
  text-decoration: none;
}

.phone-panel strong {
  display: block;
  overflow: hidden;
  font-size: 1.06rem;
  letter-spacing: 0.015em;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.phone-panel .hours {
  grid-column: 2;
  grid-row: 1 / span 2;
  color: #9ce8db;
  font-size: 0.65rem;
  font-weight: 750;
  line-height: 1.35;
  text-align: right;
  white-space: nowrap;
}

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  white-space: nowrap;
}

.status-strip {
  display: grid;
  grid-template-columns: 0.78fr 1fr 1.15fr 0.78fr 1fr;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
}

.status-item {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 8px 14px 8px 16px;
  border-right: 1px solid var(--line);
}

.status-item:last-child {
  border-right: 0;
}

.status-item strong {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  font-size: 0.9rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-call {
  padding-left: 25px;
}

.status-call::before {
  position: absolute;
  left: 11px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9ba7b5;
  content: "";
}

body[data-call-status="live"] .status-call::before {
  background: #36b89f;
  box-shadow: 0 0 0 5px rgba(54, 184, 159, 0.12);
  animation: pulse 1.5s infinite;
}

body[data-call-status="ended"] .status-call::before {
  background: #e9a53f;
}

.status-realtime strong {
  color: var(--teal);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(430px, 1.48fr) minmax(270px, 0.82fr) minmax(285px, 0.9fr);
  gap: 10px;
  min-height: 0;
}

.panel {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.transcript-card,
.assist-card,
.record-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 15px;
}

.panel-head {
  flex: 0 0 auto;
  margin-bottom: 12px;
}

.panel-head.inline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.panel-head h2 {
  margin-top: 3px;
  font-size: 1.03rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.conversation-legend {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 750;
}

.conversation-legend > span:not(.live-pill) {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.conversation-legend i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.legend-customer i {
  background: var(--teal);
}

.legend-ai i {
  background: var(--blue);
}

.live-pill,
.draft-badge,
.assist-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 23px;
  padding: 0 8px;
  border-radius: 999px;
  background: #edf1f5;
  color: var(--muted);
  font-size: 0.61rem;
  font-weight: 900;
  letter-spacing: 0.045em;
}

.live-pill.live,
.assist-badge {
  background: var(--teal-soft);
  color: #176d5e;
}

.transcript {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 9px;
  min-height: 0;
  margin: 0;
  padding: 3px 4px 8px;
  overflow: auto;
  list-style: none;
  scroll-behavior: smooth;
}

.transcript:empty::before {
  display: grid;
  flex: 1;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--muted);
  content: "電話が始まると、ここに会話が表示されます";
  font-size: 0.78rem;
}

.utterance {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  width: 100%;
}

.utterance.ai {
  flex-direction: row-reverse;
}

.utterance.system {
  justify-content: center;
}

.utterance-avatar {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 9px;
  color: #fff;
  font-size: 0.62rem;
  font-weight: 900;
}

.utterance.customer .utterance-avatar {
  background: var(--teal);
}

.utterance.ai .utterance-avatar {
  background: var(--blue);
}

.utterance.system .utterance-avatar {
  display: none;
}

.utterance-body {
  display: grid;
  max-width: 83%;
  gap: 3px;
}

.utterance.ai .utterance-body {
  justify-items: end;
}

.utterance.system .utterance-body {
  justify-items: center;
  max-width: 92%;
}

.utterance-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.59rem;
  font-weight: 800;
}

.utterance.ai .utterance-meta {
  flex-direction: row-reverse;
}

.utterance-bubble {
  padding: 9px 11px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 3px 10px rgba(23, 33, 49, 0.045);
}

.utterance.customer .utterance-bubble {
  border-color: #cfe5df;
  border-radius: 5px 13px 13px 13px;
  background: var(--teal-soft);
  color: #153d36;
}

.utterance.ai .utterance-bubble {
  border-color: #d0def2;
  border-radius: 13px 5px 13px 13px;
  background: var(--blue-soft);
  color: #1b3b68;
}

.utterance.system .utterance-bubble {
  padding: 6px 9px;
  border: 0;
  border-radius: 999px;
  background: #edf1f5;
  box-shadow: none;
  color: var(--muted);
}

.utterance-bubble p {
  font-size: 0.79rem;
  line-height: 1.58;
}

.meter {
  display: grid;
  flex: 0 0 auto;
  gap: 6px;
  margin-bottom: 11px;
}

.meter > span {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 800;
}

.meter-track {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ecf1;
}

.meter-track i {
  display: block;
  width: 18%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), #59bca8);
  transition: width 180ms ease;
}

.checklist {
  display: grid;
  flex: 0 0 auto;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.checklist li {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-size: 0.7rem;
  line-height: 1.35;
}

.check-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border: 1px solid #cbd4de;
  border-radius: 50%;
  background: #fff;
  color: transparent;
  font-size: 0.62rem;
}

.checklist li.done {
  border-color: #cce4de;
  background: #f2faf8;
  color: #20453e;
}

.checklist li.done .check-dot {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
}

.suggestions {
  display: grid;
  gap: 6px;
  min-height: 0;
  margin-top: 9px;
  overflow: auto;
}

.suggestion {
  padding: 8px 9px;
  border: 1px solid #d9e4f3;
  border-radius: 8px;
  background: #f6f9fd;
}

.suggestion strong {
  display: block;
  color: #315987;
  font-size: 0.67rem;
  line-height: 1.3;
}

.suggestion p {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 0.68rem;
  line-height: 1.42;
}

.suggestion.system {
  border-color: #efd1d5;
  background: var(--red-soft);
}

.suggestion.system strong {
  color: var(--red);
}

.record-column {
  min-width: 0;
  min-height: 0;
}

.record-scroll {
  display: grid;
  gap: 12px;
  min-height: 0;
  padding-right: 2px;
  overflow: auto;
}

.record-group {
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

.record-group:first-child {
  padding-top: 0;
  border-top: 0;
}

.record-group h3 {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

.kv div {
  min-width: 0;
}

.kv dt {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.59rem;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kv dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1.35;
}

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

.field {
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
}

.field span,
.field small {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.57rem;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field strong {
  display: block;
  margin: 3px 0;
  overflow-wrap: anywhere;
  font-size: 0.69rem;
  line-height: 1.32;
}

.draft-badge {
  background: var(--amber-soft);
  color: var(--amber);
}

.summary {
  color: var(--ink-soft);
  font-size: 0.69rem;
  line-height: 1.5;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
  margin: 9px 0;
}

.metrics div {
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
}

.metrics .saved {
  border-color: #c8e3dc;
  background: var(--teal-soft);
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 0.56rem;
  font-weight: 750;
}

.metrics strong {
  display: block;
  margin-top: 2px;
  font-size: 0.8rem;
}

.followup {
  padding: 8px 9px;
  border-left: 3px solid var(--teal);
  border-radius: 0 7px 7px 0;
  background: var(--teal-soft);
}

.followup .label {
  color: #397c70;
}

.followup p {
  margin-top: 3px;
  color: #20483f;
  font-size: 0.66rem;
  line-height: 1.4;
}

::-webkit-scrollbar {
  width: 7px;
  height: 7px;
}

::-webkit-scrollbar-thumb {
  border: 2px solid transparent;
  border-radius: 999px;
  background: #c6d0da;
  background-clip: padding-box;
}

::-webkit-scrollbar-track {
  background: transparent;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}
