:root {
  --ink: #172326;
  --muted: #607074;
  --line: #d9e0de;
  --paper: #fffaf4;
  --paper-strong: #ffffff;
  --teal: #0f6b68;
  --teal-dark: #0d4446;
  --coral: #cb695a;
  --gold: #d4a842;
  --sage: #d9e8df;
  --danger: #b33b36;
  --shadow: 0 18px 42px rgba(27, 45, 43, 0.14);
  font-family: Inter, "Noto Sans JP", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #f5f1ea;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #10241d;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(244, 250, 239, 0.78), rgba(244, 236, 225, 0.86)),
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.68), transparent 38%);
  backdrop-filter: blur(1px);
}

.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.95) brightness(1.08);
}

.ambient-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: transparent;
}

.reception-overlay {
  background: transparent;
}

.forest-overlay {
  background: linear-gradient(180deg, rgba(244, 250, 239, 0.16), rgba(244, 236, 225, 0.22));
}

.reception-simple {
  position: relative;
  z-index: 2;
  width: min(92vw, 680px);
  min-height: 100svh;
  margin: 0 auto;
  padding: clamp(22px, 4vw, 44px) 20px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: clamp(14px, 2.4vh, 24px);
  text-align: center;
}

.reception-simple .kicker {
  display: none;
}

.reception-simple h1 {
  margin: 0;
  max-width: 100%;
  font-size: clamp(2rem, 5vw, 4.1rem);
  line-height: 1.08;
  text-shadow: 0 2px 20px rgba(255, 255, 255, 0.82);
}

.reception-simple .field-hint {
  max-width: 28rem;
  text-shadow: 0 1px 12px rgba(255, 255, 255, 0.8);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
}

.avatar-stage {
  min-height: auto;
  padding: 32px;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  gap: 24px;
  background: rgba(255, 250, 244, 0.64);
  border-bottom: 1px solid rgba(23, 35, 38, 0.08);
}

.stage-copy {
  max-width: 560px;
}

.kicker {
  margin: 0 0 12px;
  color: var(--teal-dark);
  font-size: 0.9rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

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

h1 {
  margin-bottom: 16px;
  font-size: clamp(2.15rem, 4vw, 5.2rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.stage-copy p {
  margin-bottom: 0;
  max-width: 34rem;
  color: var(--muted);
  font-size: clamp(1rem, 1.45vw, 1.28rem);
  line-height: 1.75;
}

.avatar-frame {
  height: clamp(260px, 48vh, 480px);
  aspect-ratio: 13 / 16;
  align-self: center;
  justify-self: center;
  position: relative;
}

.reception-avatar {
  height: clamp(230px, 38vh, 360px);
}

.avatar-frame img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 24px 24px rgba(23, 35, 38, 0.16));
}

.speaking .avatar-frame {
  animation: avatarPulse 1.1s ease-in-out infinite;
}

.avatar-status {
  width: min(100%, 520px);
  justify-self: center;
  padding: 18px 20px;
  border: 1px solid rgba(23, 35, 38, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 8px 28px rgba(27, 45, 43, 0.08);
}

.avatar-status strong {
  display: block;
  margin-bottom: 6px;
  font-size: 0.9rem;
  color: var(--teal-dark);
}

.avatar-status p {
  margin: 0;
  color: var(--ink);
  line-height: 1.65;
}

.work-surface {
  min-height: auto;
  padding: 32px;
  display: grid;
  align-content: center;
}

.panel {
  width: min(100%, 760px);
  margin-inline: auto;
  padding: clamp(22px, 3vw, 38px);
  border: 1px solid rgba(23, 35, 38, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow);
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.panel-header h2 {
  margin-bottom: 8px;
  font-size: clamp(1.45rem, 2vw, 2.1rem);
  letter-spacing: 0;
}

.panel-header p,
.field-hint,
.small-note {
  color: var(--muted);
  line-height: 1.65;
}

.status-pill {
  flex: 0 0 auto;
  min-width: 112px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--sage);
  color: var(--teal-dark);
  text-align: center;
  font-size: 0.9rem;
  font-weight: 800;
}

.status-pill.warning {
  background: #f7e1d8;
  color: #8e3b30;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}

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

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: var(--ink);
  font-size: 0.93rem;
  font-weight: 800;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-strong);
  color: var(--ink);
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}

.field input {
  min-height: 48px;
  padding: 0 14px;
}

.field textarea {
  min-height: 170px;
  padding: 14px;
  resize: vertical;
  line-height: 1.6;
}

.field input:focus,
.field textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(15, 107, 104, 0.12);
}

.field-hint {
  margin: 0;
  font-size: 0.88rem;
}

.link-context {
  margin: -10px 0 6px;
  color: var(--teal-dark);
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.5;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

.icon-button,
.primary-button,
.secondary-button {
  min-height: 50px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 800;
}

.talk-panel {
  display: grid;
  gap: 22px;
}

.voice-control {
  display: grid;
  place-items: center;
  gap: 16px;
  padding: clamp(18px, 4vw, 34px) 0;
}

.voice-button {
  width: clamp(112px, 11vw, 138px);
  aspect-ratio: 1;
  border-radius: 999px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  background: var(--coral);
  color: #fff;
  box-shadow: 0 18px 34px rgba(203, 105, 90, 0.28);
  font-size: clamp(1rem, 1.5vw, 1.18rem);
  font-weight: 900;
}

.voice-button.recording {
  background: var(--danger);
  animation: recordGlow 1.2s ease-in-out infinite;
}

.text-entry {
  width: min(100%, 560px);
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(23, 35, 38, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 12px 28px rgba(27, 45, 43, 0.08);
  text-align: left;
}

.text-entry label {
  color: var(--teal-dark);
  font-weight: 900;
}

.text-entry textarea {
  width: 100%;
  min-height: 112px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  line-height: 1.6;
  resize: vertical;
  outline: none;
}

.text-entry textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(15, 107, 104, 0.12);
}

.text-entry .primary-button {
  justify-self: end;
}

.review-panel {
  width: min(100%, 560px);
  padding: 16px;
  border: 1px solid rgba(23, 35, 38, 0.12);
  border-left: 5px solid var(--teal);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 28px rgba(27, 45, 43, 0.08);
  text-align: left;
}

.review-panel.warning {
  border-left-color: var(--coral);
}

.review-panel h2 {
  margin-bottom: 8px;
  font-size: 1.05rem;
  line-height: 1.4;
}

.review-panel p {
  margin-bottom: 10px;
  line-height: 1.7;
}

.review-panel ul {
  margin: 0 0 12px;
  padding-left: 1.2rem;
  color: var(--muted);
  line-height: 1.6;
}

.review-panel .actions {
  margin-top: 12px;
}

.mic-icon {
  width: clamp(28px, 3vw, 34px);
  height: clamp(28px, 3vw, 34px);
  display: block;
  filter: brightness(0) invert(1);
}

.primary-button {
  padding: 0 22px;
  background: var(--teal);
  color: #fff;
}

.secondary-button {
  padding: 0 18px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.icon-button {
  width: 58px;
  background: var(--coral);
  color: #fff;
  position: relative;
}

.icon-button::before {
  content: "";
  width: 16px;
  height: 22px;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 9px 0 -5px currentColor;
}

.icon-button::after {
  content: "";
  position: absolute;
  width: 30px;
  height: 30px;
  border: 2px solid currentColor;
  border-top: 0;
  border-left: 0;
  border-right: 0;
  transform: translateY(9px);
}

.icon-button.recording {
  background: var(--danger);
  animation: recordGlow 1.2s ease-in-out infinite;
}

.message-line {
  margin: 0;
  min-height: 28px;
  color: var(--teal-dark);
  font-weight: 800;
}

.message-line.error {
  color: var(--danger);
}

.speech-preview {
  padding: 18px;
  border: 1px solid rgba(23, 35, 38, 0.1);
  border-radius: 8px;
  background: var(--paper);
}

.speech-preview strong {
  display: block;
  margin-bottom: 8px;
  color: var(--teal-dark);
}

.speech-preview p {
  margin: 0;
  line-height: 1.7;
}

.top-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.72);
}

.companion-shell {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  padding: 28px 20px;
  align-content: start;
}

.one-column .avatar-stage {
  width: min(92vw, 720px);
  min-height: auto;
  margin: 0 auto;
  padding: 24px;
  border: 1px solid rgba(23, 35, 38, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: var(--shadow);
}

.one-column .avatar-frame {
  height: clamp(190px, 30vh, 300px);
}

.one-column .work-surface {
  width: min(92vw, 860px);
  margin: 0 auto;
  padding: 0 0 32px;
}

.inbox {
  width: min(100%, 780px);
  margin: auto;
  display: grid;
  gap: 16px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 800;
}

.toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
}

.message-card {
  padding: 18px;
  border: 1px solid rgba(23, 35, 38, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 24px rgba(27, 45, 43, 0.08);
}

.message-card h3 {
  margin-bottom: 8px;
  font-size: 1.12rem;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--sage);
  color: var(--teal-dark);
  font-weight: 800;
}

.badge.high {
  background: #f5d3c8;
  color: #8e3b30;
}

.badge.low {
  background: #ece8dc;
  color: #6a5b43;
}

.danger-button {
  border-color: rgba(142, 59, 48, 0.28);
  color: #8e3b30;
}

.danger-button:hover {
  background: #f5d3c8;
}

.delivery-state {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-weight: 800;
}

.delivery-state.pending {
  background: #f6e2b8;
  color: #765116;
}

.delivery-state.done {
  background: #e7ece8;
  color: #5e6c65;
}

.summary-text {
  margin-bottom: 14px;
  line-height: 1.7;
}

.contact-notice {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-left: 4px solid var(--teal);
  border-radius: 8px;
  background: rgba(217, 232, 223, 0.55);
  color: var(--teal-dark);
  font-weight: 800;
  line-height: 1.6;
}

.customer-info {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 12px;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid rgba(23, 35, 38, 0.08);
  border-radius: 8px;
  background: rgba(217, 232, 223, 0.45);
  line-height: 1.5;
}

.customer-info dt {
  color: var(--teal-dark);
  font-weight: 800;
}

.customer-info dd {
  margin: 0;
}

.message-card ul {
  margin: 0 0 14px;
  padding-left: 1.2rem;
  line-height: 1.65;
}

.transcript {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  line-height: 1.65;
  font-size: 0.92rem;
}

.empty-state {
  padding: 28px;
  border: 1px dashed rgba(23, 35, 38, 0.2);
  border-radius: 8px;
  color: var(--muted);
  line-height: 1.7;
  background: rgba(255, 255, 255, 0.56);
}

.admin-shell {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  padding: 28px 20px 40px;
  background: rgba(255, 250, 244, 0.82);
}

.admin-header {
  width: min(1180px, 100%);
  margin: 0 auto 22px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.admin-header h1 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 3rem);
}

.admin-layout {
  width: min(1180px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.4fr);
  gap: 18px;
  align-items: start;
}

.admin-list-panel,
.admin-detail-panel {
  min-height: 420px;
  padding: 18px;
  border: 1px solid rgba(23, 35, 38, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 24px rgba(27, 45, 43, 0.08);
}

.panel-header.compact {
  margin-bottom: 16px;
}

.panel-header.compact h2 {
  margin: 0 0 4px;
  font-size: 1.25rem;
}

.customer-table-wrap {
  max-height: 68vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.customer-table-wrap.compact {
  max-height: 320px;
}

.customer-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

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

.customer-table th {
  position: sticky;
  top: 0;
  background: var(--sage);
  color: var(--teal-dark);
  font-size: 0.85rem;
}

.customer-table tr {
  cursor: pointer;
}

.customer-table tr.active,
.customer-table tr:hover {
  background: rgba(217, 232, 223, 0.5);
}

.customer-detail {
  display: grid;
  gap: 18px;
}

.admin-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.admin-form label {
  display: grid;
  gap: 8px;
  color: var(--ink);
  font-size: 0.93rem;
  font-weight: 800;
}

.admin-form input,
.admin-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

.admin-form input {
  min-height: 46px;
  padding: 0 12px;
}

.admin-form textarea {
  min-height: 112px;
  padding: 12px;
  line-height: 1.6;
  resize: vertical;
}

.admin-form input:focus,
.admin-form textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(15, 107, 104, 0.12);
}

.admin-form .actions,
.admin-form .full-field {
  grid-column: 1 / -1;
}

.contact-section {
  display: grid;
  gap: 14px;
}

.contact-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.85fr) minmax(0, 1.15fr);
  gap: 14px;
  align-items: start;
}

.contact-form {
  align-content: start;
}

.history-section h3 {
  margin-bottom: 12px;
}

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

@keyframes recordGlow {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(179, 59, 54, 0.28);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(179, 59, 54, 0);
  }
}

@keyframes avatarPulse {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

@media (max-width: 920px) {
  .app-shell,
  .companion-shell {
    grid-template-columns: 1fr;
  }

  .avatar-stage {
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid rgba(23, 35, 38, 0.08);
  }

  .avatar-frame {
    height: clamp(240px, 40vh, 360px);
  }

  .work-surface {
    min-height: auto;
  }
}

@media (max-width: 640px) {
  .avatar-stage,
  .work-surface {
    padding: 20px;
  }

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

  .panel-header,
  .toolbar {
    display: grid;
  }

  .status-pill {
    justify-self: start;
  }

  h1 {
    font-size: 2.2rem;
  }

  .reception-simple {
    width: min(94vw, 440px);
  }

  .reception-avatar {
    height: clamp(220px, 34vh, 320px);
  }

  .voice-button {
    width: 118px;
  }

  .admin-header,
  .admin-layout,
  .admin-form,
  .contact-layout {
    display: grid;
    grid-template-columns: 1fr;
  }
}
