    :root {
      --bg: #f6f7fb;
      --card: #ffffff;
      --text: #172033;
      --muted: #667085;
      --border: #e6eaf0;
      --primary: #111827;
      --soft: #f8fafc;
      --line: #111827;
      --shadow: 0 10px 28px rgba(17, 24, 39, 0.08);
      --shadow-soft: 0 3px 12px rgba(17, 24, 39, 0.05);
      --radius: 20px;
      --timeline-left: 18px;
      --nav-width: 420px;
    }
    * { box-sizing: border-box; }
    html { scroll-behavior: smooth; }
    body {
      margin: 0;
      font-family: Arial, Helvetica, sans-serif;
      background:
        radial-gradient(circle at top left, rgba(238,242,255,.75), transparent 28%),
        linear-gradient(180deg, #fbfcff 0%, var(--bg) 100%);
      color: var(--text);
      line-height: 1.45;
    }
    .page {
      width: 100%;
      max-width: 560px;
      margin: 0 auto;
      padding: 16px 10px 56px;
    }
    .site-header {
      background: rgba(255,255,255,.92);
      border: 1px solid var(--border);
      border-radius: 22px;
      box-shadow: var(--shadow);
      padding: 15px 14px 13px;
      margin-bottom: 18px;
      backdrop-filter: blur(8px);
    }
    .site-header h1 {
      margin: 0;
      font-size: 22px;
      line-height: 1.15;
      letter-spacing: -0.4px;
      color: #111827;
    }
    .site-header p {
      margin: 7px 0 0;
      font-size: 13.5px;
      color: var(--muted);
    }
    .quick-links {
      display: flex;
      gap: 8px;
      overflow-x: auto;
      padding-top: 13px;
      -webkit-overflow-scrolling: touch;
      scrollbar-width: none;
    }
    .quick-links::-webkit-scrollbar { display: none; }
    .quick-link {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      flex: 0 0 auto;
      min-height: 34px;
      padding: 8px 11px;
      border-radius: 999px;
      background: #f2f4f7;
      border: 1px solid #eaecf0;
      color: #111827;
      font-size: 12px;
      font-weight: 900;
      text-decoration: none;
      white-space: nowrap;
    }
    .timeline {
      position: relative;
      padding-left: 0;
    }

    .timeline-search {
      margin-top: 20px;
      margin-bottom: 8px;
      position: relative;
      width: min(100%, var(--nav-width));
      margin-left: auto;
      margin-right: auto;
    }

    .timeline-search label {
      position: absolute;
      width: 1px;
      height: 1px;
      padding: 0;
      margin: -1px;
      overflow: hidden;
      clip: rect(0, 0, 0, 0);
      white-space: nowrap;
      border: 0;
    }

    .timeline-search input {
      width: 100%;
      min-height: 38px;
      border: 1px solid #d7dde8;
      border-radius: 999px;
      background: #ffffff;
      color: #111827;
      font: inherit;
      font-size: 14px;
      font-weight: 500;
      outline: none;
      padding: 9px 12px 9px 38px;
      box-shadow: var(--shadow-soft);
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='19' height='19' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m21 21-4.34-4.34'/%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-position: 14px center;
      background-size: 16px 16px;
    }

    .timeline-search input::placeholder {
      color: #b4bdc9;
      font-weight: 400;
    }

    .timeline-search input:focus {
      border-color: #111827;
      box-shadow: 0 0 0 3px rgba(17, 24, 39, .08);
    }

    .timeline-search-count {
      min-height: 18px;
      margin-top: 7px;
      color: #667085;
      font-size: 12px;
      font-weight: 800;
    }

    .timeline-filters {
      width: min(100%, var(--nav-width));
      margin: 0 auto 16px;
      display: flex;
      justify-content: center;
      gap: 8px;
    }

    .tag-filter {
      flex: 0 0 auto;
      min-height: 30px;
      border: 1px solid #d7dde8;
      border-radius: 999px;
      background: #ffffff;
      color: #475467;
      cursor: pointer;
      font-family: inherit;
      font-size: 11.5px;
      font-weight: 900;
      padding: 7px 11px;
      box-shadow: var(--shadow-soft);
      text-align: center;
      white-space: nowrap;
    }

    .tag-filter.active {
      background: #111827;
      border-color: #111827;
      color: #ffffff;
    }

    .timeline-item.is-hidden {
      display: none;
    }

    .timeline-month {
      position: relative;
      margin-bottom: 13px;
      margin-left: 0;
      border: 1px solid #d7dde8;
      border-radius: 18px;
      background: rgba(255,255,255,.82);
      box-shadow: var(--shadow-soft);
      overflow: visible;
    }

    .timeline-month.is-hidden {
      display: none;
    }

    .timeline-month-summary {
      list-style: none;
      cursor: pointer;
      min-height: 52px;
      padding: 13px 14px;
      display: grid;
      grid-template-columns: 1fr auto auto;
      gap: 10px;
      align-items: center;
      user-select: none;
      position: relative;
      z-index: 2;
    }

    .timeline-month-summary::-webkit-details-marker {
      display: none;
    }

    .timeline-month-summary::after {
      content: "▾";
      color: #667085;
      font-size: 23px;
      line-height: 1;
      transition: transform .18s ease;
    }

    .timeline-month[open] .timeline-month-summary::after {
      transform: rotate(180deg);
    }

    .timeline-month-summary span {
      color: #111827;
      font-size: 15px;
      font-weight: 900;
    }

    .timeline-month-summary strong {
      border: 1px solid #e6eaf0;
      border-radius: 999px;
      background: #f8fafc;
      color: #667085;
      font-size: 11.5px;
      font-weight: 900;
      padding: 6px 9px;
      white-space: nowrap;
    }

    .timeline-month-body {
      padding: 0 10px 12px 42px;
      position: relative;
      z-index: 2;
    }
    .timeline-item {
      position: relative;
      margin-bottom: 22px;
      scroll-margin-top: 16px;
    }
    .timeline-item:last-child { margin-bottom: 0; }
    .timeline-item::before,
    .timeline-item::after {
      content: "";
      position: absolute;
      left: calc(var(--timeline-left) + 1px - 42px);
      width: 3px;
      background: linear-gradient(180deg, rgba(17,24,39,.94), rgba(17,24,39,.62));
      border-radius: 999px;
      z-index: 1;
    }
    .timeline-item::before { top: -22px; height: 36px; }
    .timeline-item::after { top: 54px; bottom: -22px; }
    .timeline-item:first-child::before { display: none; }
    .timeline-item:last-child::after { display: none; }
    .timeline-dot {
      position: absolute;
      left: calc(var(--timeline-left) - 8px - 42px);
      top: 24px;
      width: 19px;
      height: 19px;
      border-radius: 50%;
      background: var(--line);
      border: 4px solid #f6f7fb;
      box-shadow: 0 0 0 3px rgba(17,24,39,.16);
      z-index: 3;
    }
    .timeline-card {
      position: relative;
      background: var(--card);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      box-shadow: var(--shadow);
      overflow: hidden;
    }
    .card-accent {
      height: 5px;
      background: linear-gradient(90deg, #111827, #475569);
    }
    .card-body { padding: 14px; }
    .event-meta {
      display: flex;
      gap: 8px;
      align-items: center;
      flex-wrap: wrap;
      margin-bottom: 10px;
    }
    .date-pill,
    .type-pill,
    .flag-pill {
      display: inline-flex;
      align-items: center;
      width: fit-content;
      border-radius: 999px;
      font-size: 12px;
      font-weight: 800;
      padding: 7px 10px;
    }
    .date-pill {
      color: #111827;
      background: #eef2ff;
      border: 1px solid #dfe7ff;
    }
    .type-pill {
      color: #475467;
      background: #f2f4f7;
      border: 1px solid #eaecf0;
    }
    .flag-pill {
      color: #854a0e;
      background: #fffaeb;
      border: 1px solid #fedf89;
    }
    .flag-critical {
      color: #b42318;
      background: #fef3f2;
      border-color: #fecdca;
    }
    .flag-important {
      color: #854a0e;
      background: #fffaeb;
      border-color: #fedf89;
    }
    .event-title {
      margin: 0;
      font-size: 18px;
      line-height: 1.22;
      letter-spacing: -0.2px;
      color: #111827;
    }
    .summary {
      margin: 10px 0 0;
      font-size: 14.5px;
      color: #344054;
    }
    .points-box {
      margin-top: 12px;
      border-radius: 16px;
      background: #f8fafc;
      border: 1px solid #e8edf5;
      overflow: hidden;
    }

    .points-title {
      list-style: none;
      cursor: pointer;
      padding: 11px 12px;
      font-size: 11.5px;
      letter-spacing: .06em;
      font-weight: 900;
      color: #667085;
      text-transform: uppercase;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 10px;
      user-select: none;
    }

    .points-title::-webkit-details-marker {
      display: none;
    }

    .points-title::after {
      content: "▾";
      font-size: 14px;
      color: #475467;
      line-height: 1;
      transition: transform .18s ease;
    }

    .points-box[open] .points-title::after {
      transform: rotate(180deg);
    }

    .points-box ul {
      margin: 0;
      padding: 0 12px 12px 30px;
      color: #344054;
      font-size: 13.5px;
    }

    .points-box li + li { margin-top: 5px; }
    .evidence-section { margin-top: 14px; }
    .section-label {
      margin-bottom: 8px;
      color: #667085;
      font-size: 11.5px;
      letter-spacing: .06em;
      font-weight: 900;
      text-transform: uppercase;
    }
    .evidence-list {
      display: grid;
      gap: 9px;
    }
    .evidence {
      background: #fbfcff;
      border: 1px solid #e6eaf0;
      border-radius: 17px;
      padding: 10px;
      box-shadow: var(--shadow-soft);
    }
    .evidence-top {
      display: grid;
      grid-template-columns: 34px 1fr;
      gap: 9px;
      align-items: center;
    }
    .evidence-icon {
      width: 34px;
      height: 34px;
      border-radius: 12px;
      background: #111827;
      color: white;
      display: grid;
      place-items: center;
      font-size: 16px;
    }
    .evidence-name {
      font-size: 13.7px;
      font-weight: 900;
      line-height: 1.25;
      color: #111827;
    }
    .evidence-actions {
      display: grid;
      grid-template-columns: 1fr;
      gap: 8px;
      margin-top: 10px;
    }
    button.action,
    a.action {
      border: none;
      border-radius: 13px;
      min-height: 44px;
      padding: 12px 10px;
      font-size: 13px;
      font-weight: 900;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      text-align: center;
      background: #111827;
      color: white;
      box-shadow: 0 4px 10px rgba(17, 24, 39, .18);
      width: 100%;
      text-decoration: none;
      font-family: inherit;
    }
    button.action:active,
    a.action:active {
      transform: scale(.985);
    }

    .viewer {
      display: none;
      margin-top: 10px;
      border-radius: 16px;
      overflow: hidden;
      border: 1px solid #d7dde8;
      background: #111827;
    }
    .viewer.active {
      display: block;
      animation: reveal .18s ease-out;
    }
    @keyframes reveal {
      from { opacity: 0; transform: translateY(-4px); }
      to { opacity: 1; transform: translateY(0); }
    }
    .viewer iframe {
      width: 100%;
      height: 330px;
      border: none;
      display: block;
      background: #111827;
    }

    .viewer.loading::after {
      content: "Carregando mídia...";
      display: block;
      padding: 12px;
      color: #dbe4f0;
      background: #111827;
      font-size: 12px;
      font-weight: 700;
      text-align: center;
    }
    .viewer.audio iframe { height: 245px; }
    .viewer.pdf iframe { height: 500px; }
    .viewer-label {
      padding: 9px 10px;
      background: #0b1220;
      color: #dbe4f0;
      font-size: 12px;
      font-weight: 700;
      border-bottom: 1px solid rgba(255,255,255,.08);
    }

    .email-text-box {
      max-height: 310px;
      overflow-y: auto;
      padding: 14px;
      background: #ffffff;
      color: #1f2937;
      font-size: 13.5px;
      line-height: 1.62;
      font-style: italic;
      white-space: pre-wrap;
      word-break: break-word;
    }
    .email-text-box::-webkit-scrollbar { width: 7px; }
    .email-text-box::-webkit-scrollbar-thumb {
      background: #cbd5e1;
      border-radius: 999px;
    }
    @media (max-width: 380px) {
      :root { --timeline-left: 14px; }
      .page { padding-left: 8px; padding-right: 8px; }
      .timeline { padding-left: 34px; }
      .timeline-item::before,
      .timeline-item::after { left: calc(var(--timeline-left) + 1px - 34px); }
      .timeline-dot { left: calc(var(--timeline-left) - 8px - 34px); }
      .card-body { padding: 13px 12px; }
      .event-title { font-size: 17px; }
      .summary { font-size: 14px; }
      .viewer iframe { height: 300px; }
      .viewer.audio iframe { height: 230px; }
      .viewer.pdf iframe { height: 450px; }
    }


.app-shell {
  width: 100%;
}

.topbar {
  background: rgba(246, 247, 251, .88);
  backdrop-filter: blur(14px);
}

.topbar-inner {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 18px 10px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.brand-link {
  color: #111827;
  font-size: 11px;
  font-weight: 900;
  text-decoration: none;
  letter-spacing: .02em;
}

.main-nav {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(100%, var(--nav-width));
  gap: 3px;
  padding: 4px;
  border: 1px solid #d9e0ea;
  border-radius: 16px;
  background: rgba(255, 255, 255, .72);
  box-shadow: 0 8px 22px rgba(17, 24, 39, .06), inset 0 1px 0 rgba(255, 255, 255, .74);
}

.main-nav a {
  min-height: 34px;
  padding: 8px 7px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: #475467;
  font-size: 11.5px;
  font-weight: 900;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1.15;
}

.main-nav a.active {
  background: #111827;
  border-color: #111827;
  color: #ffffff;
  box-shadow: 0 7px 18px rgba(17, 24, 39, .18);
}

.timeline-page {
  padding-top: 8px;
}

.page-wide {
  max-width: 980px;
}

.workbench {
  display: grid;
  gap: 14px;
}

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

.panel-body {
  padding: 15px;
}

.panel-title {
  margin: 0;
  color: #111827;
  font-size: 18px;
  line-height: 1.2;
}

.panel-copy {
  margin: 8px 0 0;
  color: #475467;
  font-size: 14px;
}

.status-grid,
.evidence-catalog {
  display: grid;
  gap: 10px;
}

.status-card {
  border: 1px solid #e6eaf0;
  border-radius: 16px;
  background: #fbfcff;
  padding: 12px;
}

.status-card h3,
.evidence-group h2 {
  margin: 0;
  color: #111827;
  font-size: 15px;
  line-height: 1.25;
}

.status-card p,
.evidence-group p {
  margin: 7px 0 0;
  color: #475467;
  font-size: 13.5px;
}

.status-list {
  margin: 10px 0 0;
  padding-left: 18px;
  color: #344054;
  font-size: 13.5px;
  line-height: 1.5;
}

.status-list li + li {
  margin-top: 5px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 11px;
  font-weight: 900;
  margin-bottom: 8px;
}

.status-ok { background: #ecfdf3; color: #027a48; border: 1px solid #abefc6; }
.status-warn { background: #fffaeb; color: #b54708; border: 1px solid #fedf89; }
.status-fail { background: #fef3f2; color: #b42318; border: 1px solid #fecdca; }
.status-open { background: #eef2ff; color: #3538cd; border: 1px solid #c7d7fe; }
.status-muted { background: #f2f4f7; color: #475467; border: 1px solid #d0d5dd; }
.status-blocked { background: #fff6ed; color: #c4320a; border: 1px solid #f9dbaf; }
.status-audit { background: #f4f3ff; color: #5925dc; border: 1px solid #d9d6fe; }

.assessment-section {
  margin-top: 16px;
  border: 1px solid #e6eaf0;
  border-radius: 16px;
  background: #ffffff;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.assessment-summary {
  list-style: none;
  cursor: pointer;
  padding: 13px;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  user-select: none;
}

.assessment-summary::-webkit-details-marker {
  display: none;
}

.assessment-summary::after {
  content: "▾";
  color: #667085;
  font-size: 22px;
  line-height: 1;
  transition: transform .18s ease;
}

.assessment-section[open] .assessment-summary::after {
  transform: rotate(180deg);
}

.assessment-summary span {
  color: #111827;
  font-size: 16px;
  font-weight: 900;
  line-height: 1.2;
}

.assessment-summary strong {
  border: 1px solid #d7dde8;
  border-radius: 999px;
  background: #f8fafc;
  color: #111827;
  padding: 7px 9px;
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
}

.assessment-list {
  display: grid;
  gap: 8px;
  padding: 0 11px 11px;
}

.assessment-item {
  border: 1px solid #e6eaf0;
  border-radius: 15px;
  background: #fbfcff;
  padding: 11px;
  box-shadow: var(--shadow-soft);
}

.assessment-item > div {
  display: grid;
  gap: 8px;
}

.assessment-item strong {
  color: #111827;
  font-size: 13.8px;
  line-height: 1.28;
}

.assessment-item .status-badge {
  margin: 0;
}

.assessment-item p {
  margin: 8px 0 0;
  color: #475467;
  font-size: 13.4px;
  line-height: 1.46;
}

.overall-score {
  border: 1px solid #d7dde8;
  border-radius: 18px;
  background: #111827;
  color: #ffffff;
  box-shadow: var(--shadow);
  padding: 16px;
}

.overall-score span {
  display: block;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #dbe4f0;
}

.overall-score strong {
  display: block;
  margin-top: 6px;
  font-size: 34px;
  line-height: 1;
}

.overall-score p {
  margin: 8px 0 0;
  color: #cbd5e1;
  font-size: 13px;
  line-height: 1.45;
}

.video-frame {
  margin-top: 12px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid #d7dde8;
  background: #111827;
}

.video-frame video,
.video-frame iframe {
  width: 100%;
  min-height: 280px;
  border: 0;
  display: block;
  background: #111827;
}

.evidence-group {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  scroll-margin-top: 86px;
}

.evidence-group + .evidence-group {
  margin-top: 12px;
}

.evidence-meta-line {
  margin-top: 6px;
  color: #667085;
  font-size: 12px;
  font-weight: 800;
}

.timeline-backlink {
  color: #111827;
  font-weight: 900;
}

@media (min-width: 760px) {
  :root {
    --nav-width: 620px;
  }

  .topbar-inner {
    align-items: center;
  }

  .main-nav {
    width: min(100%, var(--nav-width));
  }

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

  .assessment-item > div {
    grid-template-columns: 1fr auto;
    align-items: start;
  }
}

/* ── IA Tab ── */

.main-nav a.ia-tab {
  gap: 5px;
  position: relative;
}

.main-nav a.ia-tab .ia-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  filter: brightness(0) saturate(100%) invert(22%) sepia(85%) saturate(5000%) hue-rotate(258deg) brightness(95%) contrast(95%);
}

.main-nav a.ia-tab.active .ia-icon {
  filter: brightness(0) invert(1);
}

.main-nav a.ia-tab:not(.active) {
  color: #6d28d9;
  font-weight: 900;
}

.main-nav a.ia-tab.active {
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  border-color: transparent;
  box-shadow: 0 7px 22px rgba(124, 58, 237, .28);
}

/* ── Chat page ── */

.chat-page {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 70px);
  max-width: 780px;
  margin: 0 auto;
  padding: 0 12px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.chat-messages::-webkit-scrollbar {
  width: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}

.chat-welcome {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}

.chat-welcome .welcome-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 16px;
  filter: brightness(0) saturate(100%) invert(22%) sepia(85%) saturate(5000%) hue-rotate(258deg) brightness(95%) contrast(95%);
}

.chat-welcome h2 {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 8px;
}

.chat-welcome p {
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
  max-width: 400px;
  margin-inline: auto;
}

.chat-bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 13.5px;
  line-height: 1.55;
  word-wrap: break-word;
  animation: chatFadeIn .25s ease;
}

@keyframes chatFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-bubble.user {
  align-self: flex-end;
  background: #111827;
  color: #fff;
  border-bottom-right-radius: 6px;
}

.chat-bubble.assistant {
  align-self: flex-start;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 6px;
  box-shadow: var(--shadow-soft);
}

.chat-bubble.assistant p {
  margin: 0 0 8px;
}

.chat-bubble.assistant p:last-child {
  margin-bottom: 0;
}

.chat-bubble.assistant strong {
  font-weight: 700;
}

.chat-bubble.assistant ul,
.chat-bubble.assistant ol {
  margin: 4px 0;
  padding-left: 20px;
}

.chat-typing {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 12px 18px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  border-bottom-left-radius: 6px;
  box-shadow: var(--shadow-soft);
}

.chat-typing span {
  width: 7px;
  height: 7px;
  background: #9ca3af;
  border-radius: 50%;
  animation: typingDot 1.2s ease-in-out infinite;
}

.chat-typing span:nth-child(2) { animation-delay: .15s; }
.chat-typing span:nth-child(3) { animation-delay: .3s; }

@keyframes typingDot {
  0%, 60%, 100% { opacity: .3; transform: scale(.85); }
  30% { opacity: 1; transform: scale(1); }
}

.chat-input-area {
  padding: 12px 0 16px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.chat-input-wrap {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: #fff;
  border: 1px solid #d1d5db;
  border-radius: 16px;
  padding: 6px 6px 6px 16px;
  box-shadow: var(--shadow-soft);
  transition: border-color .15s;
}

.chat-input-wrap:focus-within {
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, .1), var(--shadow-soft);
}

.chat-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.45;
  resize: none;
  max-height: 120px;
  min-height: 22px;
  padding: 6px 0;
  background: transparent;
  color: var(--text);
}

.chat-input::placeholder {
  color: #9ca3af;
}

.chat-send-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity .15s, transform .1s;
}

.chat-send-btn:hover {
  opacity: .9;
}

.chat-send-btn:active {
  transform: scale(.94);
}

.chat-send-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}

.chat-send-btn svg {
  width: 18px;
  height: 18px;
}

.chat-mic-btn {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, transform .1s, box-shadow .2s;
}

.chat-mic-btn:hover {
  opacity: .9;
}

.chat-mic-btn:active {
  transform: scale(.94);
}

.chat-mic-btn.recording {
  background: #ef4444;
  animation: micPulse 1.2s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(239, 68, 68, .4);
}

@keyframes micPulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, .45); }
  70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

.chat-mic-btn svg {
  width: 18px;
  height: 18px;
}

.chat-send-btn.hidden,
.chat-mic-btn.hidden {
  display: none;
}

.chat-disclaimer {
  text-align: center;
  font-size: 11px;
  color: #9ca3af;
  margin-top: 6px;
}

/* ── Login page ── */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 20px;
  padding: 40px 28px;
  box-shadow: var(--shadow);
  text-align: center;
}

.login-logo {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
}

.login-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 4px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 28px;
}

.login-step label {
  display: block;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.login-step input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color .15s;
  box-sizing: border-box;
}

.login-step input:focus {
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, .1);
}

.login-step input::placeholder {
  color: #9ca3af;
}

.login-btn {
  width: 100%;
  margin-top: 14px;
  padding: 12px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s;
}

.login-btn:hover {
  opacity: .9;
}

.login-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.login-info {
  font-size: 13px;
  color: var(--muted);
  margin: 0 0 18px;
}

.login-info strong {
  color: var(--text);
}

.login-link {
  display: block;
  margin-top: 12px;
  background: none;
  border: none;
  color: #7c3aed;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
}

.login-error {
  font-size: 12px;
  color: #dc2626;
  margin: 8px 0 0;
  min-height: 18px;
}

/* ── User bar ── */

.user-bar {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 10px;
  padding: 4px 12px;
  margin: -18px -10px 14px;
  width: calc(100% + 20px);
  background: rgba(230, 234, 240, .55);
  border-bottom: 1px solid rgba(0,0,0,.04);
  padding-top: 14px;
}

.user-bar-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin-right: auto;
}

.user-bar-name::before {
  content: "";
  display: inline-block;
  width: 18px;
  height: 18px;
  background: currentColor;
  opacity: .35;
  border-radius: 50%;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E") center/contain no-repeat;
}

.logout-btn {
  padding: 5px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #fff;
  color: #dc2626;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s, color .15s;
}

.logout-btn:hover {
  background: #dc2626;
  color: #fff;
}

/* ── Admin Panel ── */

.admin-header-title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  color: #7c3aed;
}

.admin-page {
  max-width: 900px;
}

.admin-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.admin-select {
  flex: 1;
  min-width: 140px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
}

.admin-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  color: #fff;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s;
}

.admin-btn:hover { opacity: .9; }
.admin-btn:disabled { opacity: .5; cursor: not-allowed; }

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
  box-shadow: var(--shadow-soft);
}

.stat-card strong {
  display: block;
  font-size: 26px;
  font-weight: 800;
  color: #7c3aed;
}

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

.admin-table-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.admin-table thead {
  background: #f9fafb;
}

.admin-table th {
  padding: 12px 14px;
  text-align: left;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.admin-table td {
  padding: 10px 14px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: top;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

.col-date { white-space: nowrap; color: var(--muted); font-size: 12px; }
.col-user { font-weight: 600; }
.col-detail { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 12px; }

.admin-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-login { background: #ecfdf5; color: #059669; }
.badge-page { background: #eff6ff; color: #2563eb; }
.badge-media { background: #fef3c7; color: #b45309; }
.badge-chat { background: #f3e8ff; color: #7c3aed; }

.admin-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 14px;
}

.admin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  background: #f3f4f6;
  border-radius: 12px;
  padding: 4px;
}

.admin-tab {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: 10px;
  background: transparent;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s, color .15s;
}

.admin-tab.active {
  background: #fff;
  color: #7c3aed;
  box-shadow: var(--shadow-soft);
}

.chat-report {
  max-height: 70vh;
  overflow-y: auto;
  padding: 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-soft);
}

.chat-report-separator {
  text-align: center;
  margin: 24px 0 12px;
  position: relative;
}

.chat-report-separator::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: var(--border);
}

.chat-report-separator span {
  position: relative;
  background: var(--card);
  padding: 0 14px;
  font-size: 12px;
  font-weight: 800;
  color: #7c3aed;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.chat-report-time {
  text-align: center;
  font-size: 11px;
  color: #9ca3af;
  margin: 12px 0 6px;
}

.chat-report-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  margin-bottom: 6px;
  font-size: 13px;
  line-height: 1.5;
}

.chat-report-bubble strong {
  display: block;
  font-size: 11px;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: .3px;
}

.chat-report-bubble p {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.user-bubble {
  background: #f3e8ff;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

.user-bubble strong {
  color: #7c3aed;
}

.ai-bubble {
  background: #f0f4f8;
  margin-right: auto;
  border-bottom-left-radius: 4px;
}

.ai-bubble strong {
  color: #4b5563;
}

@media (max-width: 600px) {
  .admin-table th:nth-child(4),
  .admin-table td:nth-child(4) { display: none; }
  .admin-filters { flex-direction: column; }
  .chat-report-bubble { max-width: 95%; }
}
