:root {
  --ink: #2f2118;
  --muted: #745f52;
  --soft: #f7f2ea;
  --paper: #fffdf8;
  --line: #ead9c4;
  --brown: #3a2416;
  --brown-2: #573617;
  --orange: #e47600;
  --orange-2: #f59a18;
  --green: #9cc31b;
  --green-soft: #edf6cf;
  --shadow: 0 22px 60px rgba(58, 36, 22, .1);
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--soft);
  line-height: 1.45;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--soft);
}

[hidden] {
  display: none !important;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.brand-logo,
.sidebar-logo {
  display: block;
  object-fit: contain;
}

.eyebrow {
  color: #cf7000;
  display: inline-block;
  font-size: .73rem;
  font-weight: 850;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(420px, 46vw) minmax(420px, 1fr);
  min-height: 100vh;
  background: var(--paper);
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  padding: clamp(36px, 7vw, 96px);
}

.login-panel .brand-logo {
  height: 54px;
  margin-bottom: 72px;
  width: 144px;
}

.login-panel h1 {
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: clamp(3rem, 6vw, 4.7rem);
  font-weight: 500;
  letter-spacing: 0;
  line-height: .94;
  margin: 14px 0 22px;
  max-width: 570px;
}

.login-copy {
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.7;
  margin: 0 0 32px;
  max-width: 440px;
}

.login-form {
  display: grid;
  gap: 18px;
  max-width: 390px;
  width: 100%;
}

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

.login-form input,
.search-box input {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  outline: none;
  padding: 14px 15px;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.login-form input:focus,
.search-box input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 4px rgba(228, 118, 0, .14);
}

.login-form button {
  background: linear-gradient(180deg, var(--orange-2), var(--orange));
  border: 0;
  border-radius: 8px;
  box-shadow: 0 18px 38px rgba(228, 118, 0, .28);
  color: #fff;
  font-weight: 900;
  min-height: 48px;
  padding: 13px 18px;
}

.error {
  color: #a83b27;
  font-size: .9rem;
  min-height: 22px;
}

.login-visual {
  align-items: center;
  background:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px),
    radial-gradient(circle at 88% 13%, rgba(196, 116, 20, .38) 0 10%, transparent 10.5%),
    radial-gradient(circle at 24% 86%, rgba(156, 195, 27, .32) 0 12%, transparent 12.5%),
    linear-gradient(110deg, #69421d, #2f1d12 72%);
  background-size: 56px 56px, 56px 56px, auto, auto, auto;
  display: grid;
  min-height: 100vh;
  overflow: hidden;
  padding: clamp(42px, 7vw, 110px);
  position: relative;
}

.voice-card {
  align-items: center;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 26px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .18);
  display: flex;
  gap: 14px;
  height: 212px;
  justify-content: center;
  justify-self: center;
  max-width: 460px;
  width: 100%;
}

.voice-card span {
  background: linear-gradient(180deg, #ffd084, var(--orange-2));
  border-radius: 999px;
  display: block;
  width: 11px;
}

.voice-card span:nth-child(1),
.voice-card span:nth-child(7) { height: 36px; }
.voice-card span:nth-child(2),
.voice-card span:nth-child(6) { height: 70px; }
.voice-card span:nth-child(3),
.voice-card span:nth-child(5) { height: 104px; }
.voice-card span:nth-child(4) { height: 110px; }

.visual-caption {
  align-self: end;
  color: rgba(255, 255, 255, .8);
  display: grid;
  gap: 4px;
  max-width: 320px;
}

.visual-caption strong {
  color: #fff8e8;
  font-family: var(--font-serif);
  font-size: 1.45rem;
}

.dashboard-shell {
  background: var(--soft);
  display: grid;
  grid-template-columns: 212px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: var(--brown);
  color: #fff8e8;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 28px 19px;
  position: sticky;
  top: 0;
}

.sidebar-logo {
  height: 58px;
  margin: 4px 0 43px 4px;
  width: 132px;
}

.sidebar nav {
  display: grid;
  gap: 8px;
}

.sidebar-link {
  align-items: center;
  background: rgba(228, 118, 0, .26);
  border: 0;
  border-radius: 8px;
  color: #ffdcae;
  display: flex;
  font-size: .9rem;
  font-weight: 900;
  gap: 10px;
  min-height: 40px;
  padding: 10px 13px;
  text-align: left;
}

.sidebar-link span {
  border: 2px solid currentColor;
  border-radius: 999px;
  display: block;
  height: 10px;
  position: relative;
  width: 10px;
}

.sidebar-link span::after {
  background: currentColor;
  border-radius: 999px;
  content: "";
  height: 3px;
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 3px;
}

.sidebar-status {
  align-items: center;
  color: #e7dccf;
  display: flex;
  font-size: .78rem;
  gap: 9px;
  margin-top: auto;
  padding: 10px 8px;
}

.sidebar-status span {
  background: var(--green);
  border-radius: 999px;
  box-shadow: 0 0 0 5px rgba(156, 195, 27, .16);
  display: block;
  height: 9px;
  width: 9px;
}

.workspace {
  margin: 0 auto;
  max-width: 1120px;
  padding: 38px 56px 48px;
  width: 100%;
}

.dashboard-header {
  align-items: center;
  display: flex;
  gap: 24px;
  justify-content: space-between;
  margin-bottom: 30px;
}

.dashboard-header h1 {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 4vw, 3.25rem);
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1;
  margin: 10px 0 8px;
}

.dashboard-header p {
  color: var(--muted);
  margin: 0;
}

.header-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

#last-updated {
  color: var(--muted);
  font-size: .82rem;
}

.secondary,
.filter {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--brown);
  font-weight: 800;
  min-height: 40px;
  padding: 9px 14px;
}

.secondary:hover,
.filter:hover {
  border-color: #e1b98d;
}

.secondary.strong {
  color: #25150d;
}

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

.stats article {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 13px;
  box-shadow: var(--shadow);
  padding: 22px 18px 20px;
}

.stats span,
.stats small {
  color: var(--muted);
  display: block;
  font-size: .82rem;
}

.stats strong {
  color: #1c120c;
  display: block;
  font-family: var(--font-serif);
  font-size: clamp(1.85rem, 3vw, 2.25rem);
  line-height: 1.1;
  margin: 12px 0 12px;
}

.stats strong span {
  color: inherit;
  display: inline;
  font: inherit;
}

.history-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.history-head {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 20px;
  justify-content: space-between;
  padding: 26px 24px;
}

.history-head h2 {
  font-family: var(--font-serif);
  font-size: 1.55rem;
  font-weight: 500;
  margin: 0 0 6px;
}

.history-head p {
  color: var(--muted);
  font-size: .9rem;
  margin: 0;
}

.search-box {
  position: relative;
  width: min(320px, 42vw);
}

.search-box span {
  height: 1px;
  overflow: hidden;
  position: absolute;
  width: 1px;
}

.search-box input {
  padding-left: 40px;
  width: 100%;
}

.search-box::before {
  border: 1.8px solid #b08f79;
  border-radius: 999px;
  content: "";
  height: 11px;
  left: 16px;
  position: absolute;
  top: 50%;
  transform: translateY(-55%);
  width: 11px;
  z-index: 1;
}

.search-box::after {
  background: #b08f79;
  content: "";
  height: 7px;
  left: 27px;
  position: absolute;
  top: 50%;
  transform: rotate(45deg) translateY(3px);
  width: 2px;
  z-index: 1;
}

.filters {
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 8px;
  padding: 14px 24px;
}

.filter {
  background: #fff8ef;
  color: var(--muted);
  min-height: 36px;
}

.filter.active {
  background: var(--brown);
  border-color: var(--brown);
  color: #fff8e8;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(360px, .95fr) minmax(430px, 1.05fr);
  min-height: 560px;
}

.conversation-list,
.detail {
  align-self: stretch;
  max-height: none;
  min-height: 0;
  overflow: auto;
}

.conversation-list {
  border-right: 1px solid var(--line);
}

.conversation-item {
  align-items: flex-start;
  background: transparent;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 0 16px;
  grid-template-columns: 38px minmax(0, 1fr);
  padding: 22px 24px;
}

.conversation-item:hover,
.conversation-item.selected {
  background: #fff8ef;
}

.conversation-select {
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  display: block;
  font: inherit;
  min-width: 0;
  padding: 0;
  text-align: left;
  width: 100%;
}

.conversation-select:focus-visible,
.play-button:focus-visible {
  outline: 3px solid rgba(228, 118, 0, .42);
  outline-offset: 3px;
}

.play-button {
  align-items: center;
  background: #fff1d9;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  display: flex;
  height: 38px;
  justify-content: center;
  margin-top: 3px;
  width: 38px;
}

.play-button::before {
  border-bottom: 7px solid transparent;
  border-left: 10px solid var(--orange);
  border-top: 7px solid transparent;
  content: "";
  margin-left: 3px;
}

.play-button.is-playing {
  background: var(--orange);
}

.play-button.is-playing::before {
  background: #fff8e8;
  border: 0;
  box-shadow: 7px 0 0 #fff8e8;
  height: 14px;
  margin-left: -7px;
  width: 4px;
}

.play-button:disabled {
  cursor: not-allowed;
  opacity: .38;
}

.conversation-top {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.conversation-title {
  color: #1f140e;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  background: var(--green-soft);
  border-radius: 999px;
  color: #5f7e00;
  flex: none;
  font-size: .68rem;
  font-weight: 900;
  padding: 4px 8px;
}

.badge.text {
  background: #fff1d9;
  color: #a75d00;
}

.summary {
  color: var(--muted);
  display: -webkit-box;
  font-size: .9rem;
  grid-column: 2;
  line-height: 1.55;
  margin: 7px 0 9px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.meta {
  color: #8a7669;
  display: flex;
  flex-wrap: wrap;
  font-size: .76rem;
  gap: 12px;
  grid-column: 2;
}

.detail {
  background: #fffaf3;
  padding: 24px;
}

.detail.empty {
  align-items: center;
  color: var(--muted);
  display: flex;
  justify-content: center;
  min-height: 420px;
  text-align: center;
}

.detail.empty p {
  border: 1px dashed #dfc5a8;
  border-radius: 14px;
  margin: 0;
  max-width: 310px;
  padding: 28px;
}

.detail-head {
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
  padding-bottom: 18px;
}

.detail-head h2 {
  font-family: var(--font-serif);
  font-size: 1.55rem;
  font-weight: 500;
  margin: 0 0 8px;
}

.message {
  border-radius: 14px;
  margin: 12px 0;
  max-width: 86%;
  overflow-wrap: anywhere;
  padding: 13px 15px;
}

.message-text {
  white-space: pre-wrap;
}

.message.user {
  background: var(--brown);
  border-bottom-right-radius: 5px;
  color: #fff8e8;
  margin-left: auto;
}

.message.assistant {
  background: #fff;
  border: 1px solid var(--line);
  border-bottom-left-radius: 5px;
  color: var(--ink);
}

.message small {
  display: block;
  font-size: .7rem;
  margin-top: 7px;
  opacity: .65;
}

.product-source-link {
  color: #a85d00;
  font-weight: 850;
  text-decoration: underline;
  text-decoration-color: rgba(228, 118, 0, .58);
  text-underline-offset: 2px;
}

.product-source-link:hover {
  color: #7d4300;
  text-decoration-color: currentColor;
}

.product-images {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 12px;
}

.product-image-button {
  appearance: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: zoom-in;
  overflow: hidden;
  padding: 0;
}

.product-image-button:focus-visible {
  outline: 3px solid rgba(228, 118, 0, .42);
  outline-offset: 3px;
}

.product-image {
  display: block;
  height: 118px;
  object-fit: cover;
  width: 118px;
}

.product-image-lightbox {
  align-items: center;
  background: rgba(25, 14, 8, .78);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 28px;
  position: fixed;
  z-index: 40;
}

.product-lightbox-image {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .45);
  max-height: calc(100vh - 56px);
  max-width: min(760px, calc(100vw - 56px));
  object-fit: contain;
}

.product-lightbox-close {
  align-items: center;
  background: #fffdf8;
  border: 0;
  border-radius: 999px;
  color: var(--brown);
  cursor: pointer;
  display: flex;
  font-size: 2rem;
  height: 42px;
  justify-content: center;
  line-height: 1;
  position: absolute;
  right: 22px;
  top: 18px;
  width: 42px;
}

.empty-list {
  color: var(--muted);
  padding: 70px 22px;
  text-align: center;
}

.playback-status {
  background: var(--brown);
  border: 1px solid rgba(255, 239, 213, .34);
  border-radius: 10px;
  bottom: 22px;
  box-shadow: 0 14px 35px rgba(57, 33, 15, .25);
  color: #fff8e8;
  font-size: .88rem;
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 15px;
  position: fixed;
  right: 22px;
  z-index: 20;
}

@media (max-width: 1080px) {
  .dashboard-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    align-items: center;
    flex-direction: row;
    gap: 22px;
    min-height: auto;
    padding: 14px 18px;
    position: static;
  }

  .sidebar-logo {
    height: 44px;
    margin: 0;
    width: 112px;
  }

  .sidebar-status {
    margin-left: auto;
    margin-top: 0;
  }

  .workspace {
    padding: 28px 22px 38px;
  }

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

  .conversation-list {
    border-right: 0;
  }

  .conversation-list,
  .detail {
    max-height: none;
  }
}

@media (max-width: 860px) {
  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-panel {
    min-height: auto;
    padding: 38px 24px;
  }

  .login-panel .brand-logo {
    margin-bottom: 42px;
  }

  .login-visual {
    min-height: 360px;
  }

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

  .header-actions {
    justify-content: flex-start;
  }

  .search-box {
    width: 100%;
  }

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

@media (max-width: 560px) {
  .sidebar {
    align-items: flex-start;
    flex-direction: column;
  }

  .sidebar-status {
    margin-left: 0;
  }

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

  .filters {
    overflow-x: auto;
  }

  .conversation-item {
    grid-template-columns: 34px minmax(0, 1fr);
    padding: 18px 16px;
  }

  .detail {
    padding: 18px 16px;
  }
}
