:root {
  color-scheme: light;
  --ink: #172521;
  --muted: #63746f;
  --line: #cadbd5;
  --paper: #fffdf8;
  --deep: #123831;
  --accent: #167c72;
  --accent-strong: #0e5d55;
  --thrill: #e8913c;
  --sky: #dceef3;
  --mint: #e4f3eb;
  --sand: #fff2cc;
  --shadow: 0 22px 55px rgba(18, 56, 49, 0.13);
}

* {
  box-sizing: border-box;
}

.admin-page {
  background:
    linear-gradient(135deg, rgba(220, 238, 243, 0.78), transparent 42%),
    linear-gradient(180deg, #fbf8f0, #eaf4ee);
}

.admin-shell {
  min-height: 100vh;
  padding: 22px;
}

.admin-topbar,
.admin-panel-header,
.admin-top-actions,
.admin-action-row,
.case-card-top {
  display: flex;
  align-items: center;
}

.admin-topbar {
  justify-content: space-between;
  gap: 18px;
  max-width: 1240px;
  margin: 0 auto 14px;
}

.admin-topbar h1 {
  font-size: 1.35rem;
}

.admin-top-actions,
.admin-action-row {
  flex-wrap: wrap;
  gap: 8px;
}

.admin-home-link {
  display: inline-grid;
  place-items: center;
  text-decoration: none;
}

.admin-notice {
  max-width: 1240px;
  min-height: 42px;
  margin: 0 auto 14px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 253, 248, 0.78);
}

.admin-notice[data-tone="success"] {
  color: var(--accent-strong);
  border-color: rgba(22, 124, 114, 0.34);
}

.admin-notice[data-tone="error"] {
  color: #8a3426;
  border-color: rgba(138, 52, 38, 0.34);
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 14px;
  max-width: 1240px;
  margin: 0 auto;
}

.admin-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.9);
  box-shadow: var(--shadow);
}

.admin-panel-header {
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.admin-panel-header h2 {
  font-size: 1rem;
}

.admin-count,
.admin-chip {
  display: inline-grid;
  min-height: 28px;
  place-items: center;
  border: 1px solid rgba(22, 124, 114, 0.28);
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--accent-strong);
  font-size: 0.82rem;
  font-weight: 700;
  background: rgba(228, 243, 235, 0.72);
}

.case-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 172px);
  overflow: auto;
  padding: 10px;
}

.case-card {
  width: 100%;
  border: 1px solid rgba(202, 219, 213, 0.86);
  border-radius: 8px;
  padding: 11px;
  color: var(--ink);
  text-align: left;
  background: #fffdf8;
}

.case-card:hover,
.case-card.selected {
  border-color: rgba(22, 124, 114, 0.55);
  box-shadow: 0 10px 24px rgba(18, 56, 49, 0.1);
}

.case-card-top {
  justify-content: space-between;
  gap: 10px;
}

.case-card-top strong,
.case-card-user {
  overflow-wrap: anywhere;
}

.case-card-top em {
  flex: 0 0 auto;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 800;
  text-transform: uppercase;
}

.case-card-meta,
.case-card-user,
.case-list-empty,
.case-empty {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.88rem;
}

.detail-panel {
  min-height: 560px;
}

.case-empty {
  padding: 18px;
}

.case-detail {
  display: grid;
  gap: 16px;
  padding: 14px;
}

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

.detail-grid div,
.case-json-wrap,
.evidence-wrap,
.history-wrap {
  border: 1px solid rgba(202, 219, 213, 0.78);
  border-radius: 8px;
  padding: 11px;
  background: rgba(255, 255, 255, 0.58);
}

.detail-grid span,
.admin-action-form span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

.detail-grid strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 0.92rem;
}

.case-json-wrap h3,
.evidence-wrap h3,
.history-wrap h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.case-json-wrap pre {
  max-height: 260px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--deep);
  font-size: 0.85rem;
}

.evidence-header,
.evidence-item-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.evidence-header span,
.evidence-item-title span,
.evidence-item p,
.evidence-frame-grid figcaption {
  color: var(--muted);
  font-size: 0.82rem;
}

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

.evidence-item {
  display: grid;
  gap: 8px;
  border-top: 1px solid rgba(202, 219, 213, 0.72);
  padding-top: 10px;
}

.evidence-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.evidence-frame-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.evidence-frame-grid figure {
  min-width: 0;
  margin: 0;
  border: 1px solid rgba(202, 219, 213, 0.78);
  border-radius: 8px;
  overflow: hidden;
  background: #fffdf8;
}

.evidence-frame-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: var(--deep);
}

.evidence-frame-grid figcaption {
  padding: 7px;
  overflow-wrap: anywhere;
}

.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
}

.history-section {
  min-width: 0;
  border: 1px solid rgba(202, 219, 213, 0.72);
  border-radius: 8px;
  padding: 9px;
  background: #fffdf8;
}

.history-section h4 {
  margin: 0 0 7px;
  color: var(--deep);
  font-size: 0.9rem;
}

.history-section p,
.history-section ul {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.history-section ul {
  display: grid;
  gap: 5px;
  padding-left: 16px;
}

.history-section li {
  overflow-wrap: anywhere;
}

.admin-action-form {
  display: grid;
  gap: 12px;
  padding-top: 4px;
}

.admin-action-form label {
  display: grid;
  gap: 5px;
}

.admin-action-form select,
.admin-action-form input,
.admin-action-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fffdf8;
  font: inherit;
}

.admin-action-form textarea {
  resize: vertical;
}

@media (max-width: 840px) {
  .admin-shell {
    padding: 14px;
  }

  .admin-topbar,
  .admin-layout,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .admin-topbar {
    display: grid;
  }

  .case-list {
    max-height: none;
  }
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background:
    radial-gradient(circle at 18% 12%, rgba(232, 145, 60, 0.13), transparent 28%),
    linear-gradient(135deg, rgba(220, 238, 243, 0.78), transparent 42%),
    linear-gradient(180deg, #fbf8f0, #eaf4ee);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
p {
  margin: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 390px);
  gap: 18px;
  min-height: 100vh;
  padding: 18px;
  padding-bottom: 96px;
}

.seo-band {
  padding: 0 18px 108px;
}

.seo-band-inner {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  max-width: 1180px;
  margin: 0 auto;
  padding-top: 20px;
  border-top: 1px solid rgba(202, 219, 213, 0.76);
}

.seo-band h2 {
  margin-bottom: 10px;
  font-size: 1rem;
}

.seo-band p {
  color: var(--muted);
  line-height: 1.6;
}

.seo-band p + p {
  margin-top: 10px;
}

.quiet-seo-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.quiet-seo-link {
  color: rgba(234, 244, 238, 0.9);
  text-decoration: none;
}

.quiet-seo-link:hover,
.quiet-seo-link:focus {
  color: var(--muted);
  text-decoration: underline;
}

.legal-links {
  position: fixed;
  left: 18px;
  bottom: 14px;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  max-width: min(620px, calc(100vw - 36px));
  font-size: 0.82rem;
}

.legal-links a {
  color: var(--muted);
  text-decoration: none;
}

.legal-links a:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.call-area,
.chat-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.call-area {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 18px;
  padding: 18px;
}

.app-topbar,
.match-status,
.chat-header,
.media-actions,
.top-actions,
.match-actions {
  display: flex;
  align-items: center;
}

.app-topbar,
.match-status,
.chat-header {
  justify-content: space-between;
  gap: 16px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  color: #fffaf0;
  background: linear-gradient(145deg, var(--deep), var(--accent));
  box-shadow: 0 12px 24px rgba(18, 56, 49, 0.22);
  font-weight: 800;
}

h1 {
  font-size: 1.2rem;
  line-height: 1.1;
}

.brand-row p,
.status-line,
.eyebrow,
.participant-info p,
.chat-header p,
.empty-state {
  color: var(--muted);
}

.top-actions,
.match-actions,
.media-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.match-status {
  min-height: 64px;
  border: 1px solid rgba(202, 219, 213, 0.72);
  border-radius: 8px;
  padding: 11px;
  background: rgba(255, 253, 248, 0.72);
}

.status-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.94rem;
}

.pulse {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--thrill);
}

.pulse.live {
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(22, 113, 95, 0.13);
}

.primary,
.secondary,
.send,
.video-button,
.stop-button,
.small-control {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  font-weight: 750;
}

.primary,
.send {
  color: #fffdf8;
  background: linear-gradient(135deg, var(--accent), var(--deep));
  box-shadow: 0 10px 22px rgba(22, 124, 114, 0.18);
}

.primary:hover,
.send:hover {
  background: linear-gradient(135deg, var(--accent-strong), #0b493f);
}

.modal-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  text-decoration: none;
}

.secondary {
  color: #3c2d12;
  background: var(--sand);
}

.video-button {
  min-width: 132px;
  padding: 0 14px;
  color: #3c2d12;
  background: linear-gradient(135deg, var(--sand), rgba(232, 145, 60, 0.42));
}

.stop-button {
  min-width: 72px;
  padding: 0 16px;
  color: #fffdf8;
  background: var(--deep);
}

.menu-wrap {
  position: relative;
}

.action-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  display: grid;
  min-width: 190px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.98);
  box-shadow: 0 18px 42px rgba(18, 56, 49, 0.18);
}

.action-menu button {
  min-height: 42px;
  border: 0;
  border-bottom: 1px solid rgba(202, 219, 213, 0.76);
  padding: 0 14px;
  color: var(--ink);
  background: transparent;
  text-align: left;
  font-weight: 750;
}

.action-menu button:last-child {
  border-bottom: 0;
}

.action-menu button:hover:not(:disabled) {
  background: rgba(228, 243, 235, 0.82);
}

.account-menu {
  min-width: 210px;
}

.auth-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.8);
  font-size: 0.9rem;
  font-weight: 750;
  text-decoration: none;
}

.small-control {
  min-width: 64px;
  padding: 0 12px;
  color: #fffdf8;
  background: var(--deep);
}

.icon-button {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.8);
  font-weight: 900;
}

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

.participant-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 18px;
  align-content: center;
}

.participant-card {
  position: relative;
  display: grid;
  min-height: 360px;
  overflow: hidden;
  border: 1px solid rgba(202, 219, 213, 0.78);
  border-radius: 8px;
  padding: 18px;
  background:
    linear-gradient(160deg, rgba(255, 253, 248, 0.82), rgba(228, 243, 235, 0.72)),
    repeating-linear-gradient(135deg, rgba(18, 56, 49, 0.05) 0 1px, transparent 1px 18px);
}

.participant-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.participant-video:not([hidden]) + .media-pulse {
  background: linear-gradient(180deg, transparent, rgba(18, 37, 33, 0.28));
}

.participant-card.active {
  border-color: rgba(22, 124, 114, 0.42);
  box-shadow: inset 0 0 0 1px rgba(22, 124, 114, 0.14);
}

.media-pulse {
  position: absolute;
  inset: 50%;
  width: 170px;
  height: 170px;
  translate: -50% -50%;
}

.media-pulse span {
  position: absolute;
  inset: 0;
  border: 1px solid rgba(22, 124, 114, 0.22);
  border-radius: 50%;
  opacity: 0.48;
}

.participant-card.active .media-pulse span {
  animation: mediaWave 2.2s ease-out infinite;
}

.participant-card.active .media-pulse span:nth-child(2) {
  animation-delay: 0.55s;
}

.participant-card.active .media-pulse span:nth-child(3) {
  animation-delay: 1.1s;
}

.participant-info {
  position: relative;
  z-index: 1;
  align-self: end;
}

.participant-info h2:empty,
.participant-info p:empty,
.empty-state p:empty,
#statusText:empty,
#connectionState:empty {
  display: none;
}

.eyebrow {
  margin-bottom: 4px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.participant-info h2,
.chat-header h2 {
  font-size: clamp(1.08rem, 2vw, 1.45rem);
  line-height: 1.18;
}

.participant-info p:last-child {
  margin-top: 5px;
  font-size: 0.92rem;
}

.participant-card .small-control {
  position: relative;
  z-index: 1;
  align-self: start;
  justify-self: end;
}

.chat-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
}

.chat-header {
  min-height: 78px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, #fffdf8, #eef8f2);
}

.chat-header > p {
  max-width: none;
  text-align: left;
  font-size: 0.88rem;
  font-weight: 720;
}

.conversation {
  display: flex;
  flex-direction: column;
  gap: 11px;
  overflow-y: auto;
  padding: 16px;
  background:
    linear-gradient(rgba(255, 253, 248, 0.88), rgba(255, 253, 248, 0.9)),
    repeating-linear-gradient(135deg, rgba(18, 56, 49, 0.06) 0 1px, transparent 1px 18px);
}

.empty-state {
  display: grid;
  min-height: 260px;
  place-items: center;
  text-align: center;
}

.message {
  max-width: 88%;
  border-radius: 8px;
  padding: 11px 13px;
  line-height: 1.45;
  box-shadow: 0 8px 20px rgba(18, 56, 49, 0.07);
}

.message.them {
  align-self: flex-start;
  background: var(--sky);
}

.message.me {
  align-self: flex-end;
  color: #fffdf8;
  background: var(--deep);
}

.message.system {
  align-self: center;
  max-width: 94%;
  color: var(--muted);
  background: #f2f6ef;
  box-shadow: none;
  font-size: 0.9rem;
}

.composer {
  display: grid;
  grid-template-columns: 1fr 82px;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.82);
}

.composer input {
  min-width: 0;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  outline: none;
  background: #fffdf8;
}

.composer input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(22, 113, 95, 0.12);
}

.ad-shell {
  display: grid;
  gap: 8px;
  padding: 12px 14px 14px;
  border-top: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.7);
}

.ad-label {
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
}

.driftmeet-ad-slot {
  display: grid;
  gap: 6px;
  width: 100%;
  min-height: 90px;
  border: 1px solid rgba(202, 219, 213, 0.82);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.92);
  overflow: hidden;
  padding: 12px 14px;
  color: var(--ink);
  text-decoration: none;
}

.driftmeet-ad-slot:hover {
  border-color: rgba(22, 124, 114, 0.4);
  box-shadow: 0 10px 22px rgba(18, 56, 49, 0.08);
}

.driftmeet-ad-category {
  color: var(--accent-strong);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.driftmeet-ad-title {
  font-size: 1rem;
  line-height: 1.3;
}

.driftmeet-ad-body {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.driftmeet-ad-cta {
  color: var(--accent-strong);
  font-size: 0.9rem;
  font-weight: 800;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(18, 37, 33, 0.36);
}

.modal-backdrop[hidden] {
  display: none;
}

.premium-modal {
  position: relative;
  width: min(420px, 100%);
  border: 1px solid rgba(202, 219, 213, 0.9);
  border-radius: 8px;
  padding: 22px;
  background: var(--paper);
  box-shadow: 0 26px 70px rgba(18, 37, 33, 0.24);
}

.premium-modal h2 {
  margin-bottom: 10px;
  font-size: 1.4rem;
}

.premium-modal p:not(.eyebrow) {
  margin-bottom: 18px;
  color: var(--muted);
  line-height: 1.5;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
}

.profile-form {
  display: grid;
  gap: 12px;
}

.profile-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.profile-form input,
.profile-form select,
.profile-form textarea {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 11px;
  color: var(--ink);
  background: #fffdf8;
}

.profile-form textarea {
  resize: vertical;
}

.consent-check {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 10px;
  align-items: start;
  margin: 6px 0 18px;
  color: var(--muted);
  line-height: 1.5;
  font-size: 0.94rem;
  font-weight: 650;
}

.consent-check input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--accent);
}

.consent-check a {
  color: var(--accent-strong);
  font-weight: 800;
}

.legal-page {
  min-height: 100vh;
  padding: 28px 16px;
}

.legal-shell {
  width: min(860px, 100%);
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: clamp(22px, 5vw, 44px);
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--shadow);
}

.legal-shell h1 {
  margin-top: 14px;
  font-size: clamp(2rem, 5vw, 3.2rem);
}

.legal-shell h2 {
  margin-bottom: 10px;
  font-size: 1.12rem;
}

.legal-shell section {
  padding: 22px 0;
  border-top: 1px solid rgba(202, 219, 213, 0.76);
}

.legal-shell p,
.legal-shell li {
  color: var(--muted);
  line-height: 1.65;
}

.legal-shell p + p {
  margin-top: 12px;
}

.legal-shell ul {
  margin: 0;
  padding-left: 20px;
}

.legal-updated {
  margin: 8px 0 28px;
}

.legal-back {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.84);
  font-size: 0.9rem;
  font-weight: 750;
  text-decoration: none;
}

.legal-back:hover {
  border-color: var(--accent);
}

@keyframes mediaWave {
  0% {
    opacity: 0.42;
    scale: 0.5;
  }

  80% {
    opacity: 0;
    scale: 1.34;
  }

  100% {
    opacity: 0;
    scale: 1.34;
  }
}

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

  .chat-panel {
    min-height: 460px;
  }

  .seo-band-inner {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 10px;
  }

  .legal-links {
    position: static;
    padding: 0 14px 14px;
  }

  .app-topbar,
  .match-status,
  .chat-header {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .match-actions {
    justify-content: stretch;
  }

  .top-actions > *,
  .match-actions > * {
    flex: 1;
  }

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

  .participant-card {
    min-height: 260px;
  }

  .chat-header > p {
    max-width: none;
    text-align: left;
  }
}
