/* ===========================================================================
   Aria Beta-1 Console — deterministic React surface.
   Dark theme. WhatsApp greens for the customer; cool slate for the owner.
   System font stack only (no web fonts, no CDN — fully offline).
   =========================================================================== */

:root {
  /* WhatsApp-ish customer palette */
  --wa-accent: #00a884;
  --wa-accent-deep: #008f6f;
  --wa-bg: #0b141a;
  --wa-panel: #111b21;
  --wa-surface: #202c33;
  --wa-bubble-in: #202c33;
  --wa-bubble-out: #005c4b;
  --wa-text: #e9edef;
  --wa-text-dim: #8696a0;

  /* Owner slate dashboard palette */
  --slate-bg: #0d1117;
  --slate-panel: #131922;
  --slate-card: #1a212c;
  --slate-card-hi: #202a37;
  --slate-border: #263040;
  --slate-border-soft: #1d2530;
  --slate-text: #e6edf3;
  --slate-text-dim: #9aa7b5;
  --slate-accent: #4f8cff;

  /* Verdict colors */
  --allow: #3fb950;
  --allow-bg: rgba(63, 185, 80, 0.14);
  --ask: #d8a23a;
  --ask-bg: rgba(216, 162, 58, 0.14);
  --deny: #f0556a;
  --deny-bg: rgba(240, 85, 106, 0.14);

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 2px 14px rgba(0, 0, 0, 0.35);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  background: var(--slate-bg);
  color: var(--slate-text);
  -webkit-font-smoothing: antialiased;
}

#root {
  height: 100%;
}

.boot {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--slate-text-dim);
  font-size: 14px;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ---------------------------------------------------------------- App shell */
.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-height: 0;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  background: linear-gradient(180deg, #141b26 0%, #10151e 100%);
  border-bottom: 1px solid var(--slate-border);
  flex-wrap: wrap;
  z-index: 5;
}

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

.brand .glyph {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--wa-accent), #1fc8a0);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 16px;
  color: #06231c;
  box-shadow: 0 0 0 1px rgba(0, 168, 132, 0.4) inset;
  flex: none;
}

.brand .title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2px;
  line-height: 1.1;
}

.brand .subtitle {
  font-size: 11px;
  color: var(--slate-text-dim);
  font-weight: 500;
}

.topbar .spacer {
  flex: 1 1 auto;
}

/* Hash-route tabs */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--slate-card);
  padding: 3px;
  border-radius: 11px;
  border: 1px solid var(--slate-border-soft);
}

.tabs a {
  text-decoration: none;
  color: var(--slate-text-dim);
  font-size: 12.5px;
  font-weight: 600;
  padding: 6px 13px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.tabs a:hover {
  color: var(--slate-text);
}

.tabs a.active {
  background: var(--slate-accent);
  color: #fff;
}

.ctrl {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ctrl label {
  font-size: 12px;
  color: var(--slate-text-dim);
  font-weight: 600;
}

select,
.btn {
  font-size: 12.5px;
  padding: 7px 12px;
  border-radius: 9px;
  border: 1px solid var(--slate-border);
  background: var(--slate-card);
  color: var(--slate-text);
}

select {
  cursor: pointer;
}

.btn {
  font-weight: 600;
  transition: filter 0.15s, background 0.15s, border-color 0.15s;
}

.btn:hover {
  filter: brightness(1.12);
}

.btn:active {
  filter: brightness(0.95);
}

.btn.primary {
  background: var(--wa-accent);
  border-color: var(--wa-accent);
  color: #06231c;
  font-weight: 700;
}

.btn.ghost {
  background: transparent;
}

/* ----------------------------------------------------------- Demo stage */
.stage {
  display: flex;
  gap: 14px;
  padding: 14px;
  flex: 1 1 auto;
  min-height: 0;
}

.stage .pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.stage .pane.owner {
  flex: 1.7 1 0;
}

.stage .pane.customer {
  flex: 1 1 0;
  max-width: 460px;
}

.pane-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--slate-text-dim);
  padding: 0 2px 8px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.pane-tag .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.pane-tag .dot.owner {
  background: var(--slate-accent);
}

.pane-tag .dot.cust {
  background: var(--wa-accent);
}

.pane-body {
  flex: 1 1 auto;
  min-height: 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--slate-border);
  box-shadow: var(--shadow);
}

.demo-hint {
  font-size: 12px;
  line-height: 1.5;
  color: var(--slate-text-dim);
  padding: 9px 18px;
  background: var(--slate-panel);
  border-bottom: 1px solid var(--slate-border-soft);
}

.demo-hint b {
  color: var(--slate-text);
}

/* Single-view routes fill the area */
.single {
  flex: 1 1 auto;
  min-height: 0;
  padding: 14px;
  display: flex;
}

.single > * {
  flex: 1 1 auto;
  min-height: 0;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--slate-border);
  box-shadow: var(--shadow);
}

.single .customer-surface {
  max-width: 480px;
  margin: 0 auto;
  width: 100%;
}

/* =====================================================================
   CUSTOMER SURFACE — WhatsApp style
   ===================================================================== */
.customer-surface {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background: var(--wa-bg);
  color: var(--wa-text);
  position: relative;
}

.wa-header {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 14px;
  background: var(--wa-panel);
  border-bottom: 1px solid #222d34;
  flex: none;
}

.wa-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--wa-accent), #1fc8a0);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #06231c;
  flex: none;
}

.wa-header .who {
  min-width: 0;
}

.wa-header .name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
}

.wa-header .status {
  font-size: 11.5px;
  color: var(--wa-text-dim);
  display: flex;
  align-items: center;
  gap: 5px;
}

.wa-header .status .live {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--wa-accent);
  box-shadow: 0 0 0 0 rgba(0, 168, 132, 0.6);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 168, 132, 0.6);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(0, 168, 132, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(0, 168, 132, 0);
  }
}

.wa-header .switch {
  margin-left: auto;
  font-size: 11px;
  color: var(--wa-text-dim);
}

.wa-log {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 12px 6px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  /* subtle WhatsApp doodle-free tinted backdrop */
  background:
    radial-gradient(circle at 20% 10%, rgba(0, 168, 132, 0.05), transparent 40%),
    radial-gradient(circle at 80% 90%, rgba(0, 168, 132, 0.04), transparent 40%),
    var(--wa-bg);
}

.bubble {
  max-width: 80%;
  padding: 7px 11px 8px;
  border-radius: 11px;
  font-size: 13.5px;
  line-height: 1.42;
  white-space: pre-wrap;
  word-wrap: break-word;
  position: relative;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.18);
  animation: bubble-in 0.18s ease-out;
}

@keyframes bubble-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.bubble.bot {
  align-self: flex-start;
  background: var(--wa-bubble-in);
  border-top-left-radius: 3px;
}

.bubble.me {
  align-self: flex-end;
  background: var(--wa-bubble-out);
  border-top-right-radius: 3px;
}

.bubble .meta {
  display: block;
  font-size: 10px;
  color: var(--wa-text-dim);
  margin-top: 3px;
  text-align: right;
}

.bubble.me .meta {
  color: rgba(233, 237, 239, 0.55);
}

.typing {
  align-self: flex-start;
  background: var(--wa-bubble-in);
  border-radius: 11px;
  border-top-left-radius: 3px;
  padding: 11px 13px;
  display: flex;
  gap: 4px;
}

.typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--wa-text-dim);
  animation: typing 1.2s infinite ease-in-out;
}

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

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

@keyframes typing {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

.wa-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  padding: 7px 12px;
  background: var(--wa-bg);
}

.chip {
  font-size: 12px;
  padding: 6px 11px;
  border-radius: 16px;
  border: 1px solid #2a3942;
  background: var(--wa-surface);
  color: var(--wa-text);
  font-weight: 500;
  transition: background 0.14s, border-color 0.14s;
}

.chip:hover {
  background: #2a3942;
  border-color: var(--wa-accent);
}

.wa-input {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  background: var(--wa-panel);
  border-top: 1px solid #222d34;
  flex: none;
}

.wa-input input {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 16px; /* avoid iOS zoom */
  padding: 10px 14px;
  border-radius: 21px;
  border: 1px solid #2a3942;
  background: var(--wa-surface);
  color: var(--wa-text);
  outline: none;
}

.wa-input input::placeholder {
  color: var(--wa-text-dim);
}

.wa-send {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: none;
  background: var(--wa-accent);
  color: #06231c;
  font-size: 17px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex: none;
  transition: filter 0.14s;
}

.wa-send:hover {
  filter: brightness(1.1);
}

.wa-send:disabled {
  opacity: 0.45;
  cursor: default;
}

/* Small identity form when no customer chosen */
.identity-form {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.identity-form h3 {
  margin: 0;
  font-size: 15px;
}

.identity-form input {
  font-size: 16px;
  padding: 10px 13px;
  border-radius: 10px;
  border: 1px solid #2a3942;
  background: var(--wa-surface);
  color: var(--wa-text);
  outline: none;
}

.identity-form .quick {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* =====================================================================
   OWNER SURFACE — slate dashboard
   ===================================================================== */
.owner-surface {
  display: grid;
  grid-template-columns: minmax(320px, 1.05fr) minmax(0, 1.5fr);
  height: 100%;
  min-height: 0;
  background: var(--slate-panel);
}

.owner-chat {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid var(--slate-border);
  background: var(--slate-bg);
}

.owner-chat-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--slate-border-soft);
  flex: none;
}

.owner-chat-head .avatar {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--slate-accent), #6aa8ff);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #06122b;
  flex: none;
}

.owner-chat-head .meta .l1 {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.2;
}

.owner-chat-head .meta .l2 {
  font-size: 11px;
  color: var(--slate-text-dim);
}

.owner-log {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 14px 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.o-msg {
  max-width: 88%;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
  animation: bubble-in 0.18s ease-out;
}

.o-msg.bot {
  align-self: flex-start;
  background: var(--slate-card);
  border: 1px solid var(--slate-border-soft);
  border-top-left-radius: 4px;
}

.o-msg.me {
  align-self: flex-end;
  background: var(--slate-accent);
  color: #fff;
  border-top-right-radius: 4px;
}

.owner-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  border-top: 1px solid var(--slate-border-soft);
}

.owner-chip {
  font-size: 11.5px;
  padding: 6px 10px;
  border-radius: 15px;
  border: 1px solid var(--slate-border);
  background: var(--slate-card);
  color: var(--slate-text-dim);
  font-weight: 500;
  transition: color 0.14s, border-color 0.14s;
}

.owner-chip:hover {
  color: var(--slate-text);
  border-color: var(--slate-accent);
}

.owner-input {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--slate-border-soft);
  flex: none;
}

.owner-input input {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 16px;
  padding: 9px 13px;
  border-radius: 10px;
  border: 1px solid var(--slate-border);
  background: var(--slate-card);
  color: var(--slate-text);
  outline: none;
}

.owner-input input:focus {
  border-color: var(--slate-accent);
}

/* Dashboard panels */
.owner-dash {
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-content: start;
}

.panel {
  background: var(--slate-card);
  border: 1px solid var(--slate-border-soft);
  border-radius: var(--radius);
  padding: 13px 14px;
  min-width: 0;
}

.panel.wide {
  grid-column: 1 / -1;
}

.panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--slate-text-dim);
}

.panel-head .count {
  margin-left: auto;
  font-size: 10.5px;
  background: var(--slate-card-hi);
  color: var(--slate-text-dim);
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid var(--slate-border-soft);
  font-weight: 700;
  letter-spacing: 0;
}

.panel-head .count.alert {
  background: var(--ask-bg);
  color: var(--ask);
  border-color: rgba(216, 162, 58, 0.35);
}

.empty {
  font-size: 12px;
  color: var(--slate-text-dim);
  padding: 6px 2px;
  font-style: italic;
}

/* Approval cards */
.appr-card {
  background: var(--slate-card-hi);
  border: 1px solid rgba(216, 162, 58, 0.3);
  border-left: 3px solid var(--ask);
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  margin-bottom: 10px;
}

.appr-card:last-child {
  margin-bottom: 0;
}

.appr-card .q {
  font-size: 12.5px;
  line-height: 1.5;
  margin-bottom: 10px;
}

.appr-card .who {
  font-weight: 700;
  color: var(--slate-text);
}

.appr-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.appr-actions button {
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--slate-border);
  background: var(--slate-card);
  color: var(--slate-text);
  transition: filter 0.14s, background 0.14s;
}

.appr-actions button:hover {
  filter: brightness(1.15);
}

.appr-actions button.ok {
  background: var(--allow);
  border-color: var(--allow);
  color: #04210b;
}

.appr-actions button.warn {
  background: transparent;
  border-color: var(--slate-border);
}

.appr-actions button.danger {
  background: var(--deny-bg);
  border-color: rgba(240, 85, 106, 0.4);
  color: var(--deny);
}

.appr-free {
  margin-top: 9px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--slate-text-dim);
}

.appr-free input {
  width: 74px;
  font-size: 12px;
  padding: 5px 8px;
  border-radius: 7px;
  border: 1px solid var(--slate-border);
  background: var(--slate-card);
  color: var(--slate-text);
}

/* generic dashboard rows */
.row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border-radius: var(--radius-sm);
  background: var(--slate-card-hi);
  margin-bottom: 7px;
  font-size: 12.5px;
}

.row:last-child {
  margin-bottom: 0;
}

.row .grow {
  flex: 1 1 auto;
  min-width: 0;
}

.row .l1 {
  font-weight: 600;
  line-height: 1.3;
}

.row .l2 {
  font-size: 11px;
  color: var(--slate-text-dim);
  line-height: 1.3;
  margin-top: 1px;
}

.tag-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 9px;
  letter-spacing: 0.02em;
  flex: none;
}

.tag-pill.repeat {
  background: var(--allow-bg);
  color: var(--allow);
}

.tag-pill.new {
  background: var(--ask-bg);
  color: var(--ask);
}

.tag-pill.online {
  background: rgba(79, 140, 255, 0.16);
  color: var(--slate-accent);
}

.tag-pill.inperson {
  background: var(--slate-card);
  color: var(--slate-text-dim);
  border: 1px solid var(--slate-border-soft);
}

/* verdict badges */
.verdict {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 8px;
  flex: none;
  min-width: 48px;
  text-align: center;
}

.verdict.ALLOW {
  background: var(--allow-bg);
  color: var(--allow);
}

.verdict.ASK {
  background: var(--ask-bg);
  color: var(--ask);
}

.verdict.DENY {
  background: var(--deny-bg);
  color: var(--deny);
}

.perm-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 2px;
  font-size: 12px;
  border-bottom: 1px solid var(--slate-border-soft);
}

.perm-row:last-child {
  border-bottom: none;
}

.perm-row .action {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--slate-text);
}

.override-block {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px dashed var(--slate-border);
}

.override-block .head {
  font-size: 11px;
  font-weight: 700;
  color: var(--slate-text-dim);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* pricing / pause / registry kv */
.kv {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  font-size: 12.5px;
  border-bottom: 1px solid var(--slate-border-soft);
}

.kv:last-child {
  border-bottom: none;
}

.kv .k {
  color: var(--slate-text-dim);
}

.kv .v {
  font-weight: 600;
  text-align: right;
}

.kv .v.warn {
  color: var(--ask);
}

.kv .v.muted {
  color: var(--slate-text-dim);
  font-weight: 500;
}

.discrepancy {
  margin-top: 9px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  background: var(--ask-bg);
  border: 1px solid rgba(216, 162, 58, 0.3);
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--ask);
}

.pause-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 11px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
}

.pause-banner.on {
  background: var(--deny-bg);
  color: var(--deny);
  border: 1px solid rgba(240, 85, 106, 0.35);
}

.pause-banner.off {
  background: var(--allow-bg);
  color: var(--allow);
  border: 1px solid rgba(63, 185, 80, 0.3);
}

/* audit timeline */
.audit-item {
  display: flex;
  gap: 10px;
  padding: 7px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--slate-border-soft);
}

.audit-item:last-child {
  border-bottom: none;
}

.audit-item .actor {
  flex: none;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 3px 7px;
  border-radius: 7px;
  height: fit-content;
  text-transform: uppercase;
}

.audit-item .actor.aria {
  background: var(--allow-bg);
  color: var(--allow);
}

.audit-item .actor.owner {
  background: rgba(79, 140, 255, 0.16);
  color: var(--slate-accent);
}

.audit-item .body {
  min-width: 0;
}

.audit-item .summary {
  line-height: 1.4;
}

.audit-item .ts {
  font-size: 10.5px;
  color: var(--slate-text-dim);
  margin-top: 1px;
}

/* ----------------------------------------------------------- Responsive */
@media (max-width: 1080px) {
  .owner-surface {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
  .owner-chat {
    border-right: none;
    border-bottom: 1px solid var(--slate-border);
    min-height: 420px;
  }
}

@media (max-width: 860px) {
  .stage {
    flex-direction: column;
    overflow-y: auto;
  }
  .stage .pane {
    flex: none;
  }
  .stage .pane.customer {
    max-width: none;
  }
  .stage .pane.owner .pane-body,
  .stage .pane.customer .pane-body {
    height: 78vh;
  }
  .owner-dash {
    grid-template-columns: 1fr;
  }
}

/* thin scrollbars */
::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

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

::-webkit-scrollbar-thumb {
  background: #2a3340;
  border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
  background: #36404e;
}
