:root {
  --bg: #081217;
  --panel: #0f1b22;
  --panel-soft: #13242d;
  --line: rgba(173, 214, 207, 0.18);
  --text: #edf7f4;
  --muted: #9fb8b2;
  --teal: #139c96;
  --teal-strong: #0d7f7a;
  --card: #122028;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.26);
  --body-bg-from: #071116;
  --body-bg-to: #0c171d;
}

body.light {
  --bg: #f0f5f4;
  --panel: #ffffff;
  --panel-soft: #e8f2f0;
  --line: rgba(19, 156, 150, 0.2);
  --text: #0b2622;
  --muted: #4a6e6a;
  --teal: #139c96;
  --teal-strong: #0d7f7a;
  --card: #f7fbfa;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.1);
  --body-bg-from: #e8f2f0;
  --body-bg-to: #f4f9f8;
  --eyebrow-color: #0a6e6a;
  --link-color: #0a7c78;
  --link-color-hover: #0b2622;
  --input-bg: #f2f7f6;
  --input-border: rgba(19, 156, 150, 0.3);
}

/* Light mode overrides for hardcoded colours */
body.light .summary-tile {
  background: #eef6f4;
  border-color: rgba(19, 156, 150, 0.18);
}

body.light .summary-tile--admin {
  background: linear-gradient(180deg, rgba(19, 156, 150, 0.1), #eef6f4);
  border-color: rgba(19, 156, 150, 0.28);
}

body.light .summary-tile--success {
  background: linear-gradient(180deg, rgba(48, 160, 96, 0.1), #eef6f4);
  border-color: rgba(48, 160, 96, 0.28);
}

body.light .summary-tile--warning {
  background: linear-gradient(180deg, rgba(200, 120, 20, 0.08), #eef6f4);
  border-color: rgba(200, 120, 20, 0.24);
}

body.light .user-card {
  background: #eef6f4;
  border-color: rgba(19, 156, 150, 0.18);
}

body.light .info-block {
  background: #eef6f4;
  border-color: rgba(19, 156, 150, 0.18);
}

body.light .pill {
  color: #0a6e6a;
  border-color: rgba(19, 156, 150, 0.4);
  background: rgba(19, 156, 150, 0.1);
}

body.light .role-chip--admin {
  color: #0a5a7a;
  border-color: rgba(10, 90, 122, 0.28);
  background: rgba(10, 90, 122, 0.08);
}

body.light .role-chip--user {
  color: #2d5a52;
  border-color: rgba(19, 156, 150, 0.2);
  background: rgba(19, 156, 150, 0.06);
}

body.light .status-chip--active {
  color: #1a6e40;
  border-color: rgba(48, 160, 96, 0.32);
  background: rgba(48, 160, 96, 0.1);
}

body.light .status-chip--disabled {
  color: #7a4e10;
  border-color: rgba(200, 120, 20, 0.32);
  background: rgba(200, 120, 20, 0.1);
}

body.light .button--ghost {
  background: #eef6f4;
  border-color: rgba(19, 156, 150, 0.28);
}

body.light .notice--error {
  color: #8b1a1a;
}

body.light .notice--success {
  color: #1a6e40;
}

body.light .visit-danger-btn {
  color: #8b1a1a;
  border-color: rgba(180, 40, 40, 0.34);
  background: rgba(224, 82, 82, 0.08);
}

body.light .visit-danger-btn:hover,
body.light .visit-danger-btn:focus-visible {
  color: #6f1010;
  border-color: rgba(180, 40, 40, 0.6);
  background: rgba(224, 82, 82, 0.16);
}

body.light .password-toggle {
  background: #eef6f4;
  border-color: rgba(19, 156, 150, 0.28);
}

:root {
  --eyebrow-color: #88fff7;
  --link-color: #8ef8f3;
  --link-color-hover: #edf7f4;
  --input-bg: rgba(255, 255, 255, 0.03);
  --input-border: rgba(173, 214, 207, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(19, 156, 150, 0.2), transparent 22%),
    linear-gradient(180deg, var(--body-bg-from) 0%, var(--body-bg-to) 100%);
  font-family: "Manrope", sans-serif;
  transition: background 0.25s ease, color 0.25s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

code {
  font-family: "Space Grotesk", monospace;
  font-size: 0.85em;
  padding: 2px 6px;
  border-radius: 6px;
  background: rgba(19, 156, 150, 0.1);
  border: 1px solid rgba(19, 156, 150, 0.2);
  color: var(--teal);
}

.admin-shell__header {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.admin-brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.admin-brand__mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(145deg, var(--teal), #12706c);
  font: 700 1.5rem "Space Grotesk", sans-serif;
}

.admin-brand strong,
.admin-brand small,
.admin-shell__nav a,
.eyebrow,
.button {
  font-family: "Space Grotesk", sans-serif;
}

.admin-brand span:last-child {
  display: grid;
}

.admin-brand strong {
  font-size: 1.35rem;
}

.admin-brand small {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.admin-shell__right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-shell__nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-shell__right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  margin-left: auto;
  flex: 1;
}

.admin-shell__nav a {
  padding: 11px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
}

.admin-shell__nav a.is-active,
.admin-shell__nav a:hover {
  color: var(--text);
  border-color: rgba(19, 156, 150, 0.5);
  background: rgba(19, 156, 150, 0.12);
}

.admin-shell,
.login-layout {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.admin-shell {
  padding: 16px 0 64px;
}

.login-layout {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 0;
}

.login-card,
.hero-panel,
.portal-card {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-card {
  width: min(540px, 100%);
  padding: 34px;
}

.hero-panel {
  padding: 34px;
  margin-bottom: 26px;
}

.hero-panel--compact {
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--eyebrow-color);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.82rem;
}

h1,
h2 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.6rem);
  line-height: 1.02;
}

h2 {
  font-size: 1.35rem;
  margin-bottom: 10px;
}

.lead,
.portal-card p,
.notice,
.field span {
  color: var(--muted);
}

.lead {
  max-width: 760px;
  margin: 14px 0 0;
  font-size: 1.05rem;
  line-height: 1.7;
}

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

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.summary-grid--hero {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.summary-tile {
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  border: 1px solid rgba(173, 214, 207, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.03);
}

.summary-tile__label {
  color: var(--muted);
  font: 700 0.78rem "Space Grotesk", sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.summary-tile__value {
  color: var(--text);
  font: 700 1.5rem "Space Grotesk", sans-serif;
  line-height: 1;
}

.summary-tile--admin {
  border-color: rgba(78, 224, 255, 0.2);
  background: linear-gradient(180deg, rgba(53, 122, 143, 0.18), rgba(255, 255, 255, 0.03));
}

.summary-tile--user,
.summary-tile--neutral {
  border-color: rgba(173, 214, 207, 0.12);
}

.summary-tile--success {
  border-color: rgba(74, 222, 128, 0.24);
  background: linear-gradient(180deg, rgba(48, 112, 76, 0.16), rgba(255, 255, 255, 0.03));
}

.summary-tile--warning {
  border-color: rgba(245, 158, 11, 0.24);
  background: linear-gradient(180deg, rgba(120, 76, 28, 0.16), rgba(255, 255, 255, 0.03));
}

.card-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.detail-grid {
  grid-template-columns: 280px minmax(0, 1fr);
}

.chatbot-settings-grid {
  grid-template-columns: 1fr 1fr;
  align-items: stretch;
}

.detail-grid--account {
  grid-template-columns: 280px minmax(0, 1fr);
}

.portal-card {
  padding: 24px;
}

.chatbot-card {
  display: grid;
  gap: 20px;
  align-content: start;
}

.chatbot-card h2,
.chatbot-card p,
.chatbot-card .pill,
.chatbot-card__intro .pill {
  margin-bottom: 0;
}

.chatbot-card__intro {
  display: grid;
  gap: 10px;
  justify-items: start;
}

.chatbot-card .stack {
  margin-top: 0;
}

.chatbot-card .notice {
  margin: 0;
}

.chatbot-card--prompt,
.chatbot-card--relay {
  grid-column: 1 / -1;
}

.relay-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}

.relay-steps {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 12px;
  color: var(--muted);
  line-height: 1.65;
  font-size: 0.95rem;
}

.relay-steps li strong {
  color: var(--text);
}

.webhook-url-field {
  color: var(--teal);
  font-family: "Space Grotesk", monospace;
  font-size: 0.82rem;
  cursor: pointer;
}

.chatbot-card__header {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(0, 1fr);
  gap: 18px;
  align-items: end;
}

.chatbot-card__header > div {
  display: grid;
  gap: 10px;
  justify-items: start;
}

.chatbot-card__header p {
  max-width: 620px;
}

.card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.portal-stack {
  display: grid;
  gap: 18px;
}

.pill {
  display: inline-flex;
  margin-bottom: 16px;
  padding: 8px 12px;
  border: 1px solid rgba(19, 156, 150, 0.35);
  border-radius: 999px;
  color: #9ff7f3;
  background: rgba(19, 156, 150, 0.1);
  font: 700 0.82rem "Space Grotesk", sans-serif;
}

.card-header-row .pill {
  margin-bottom: 0;
}

.role-chip,
.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 10px;
  border-radius: 999px;
  font: 700 0.74rem "Space Grotesk", sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.role-chip--admin {
  color: #b4f5ff;
  border: 1px solid rgba(78, 224, 255, 0.28);
  background: rgba(78, 224, 255, 0.09);
}

.role-chip--user {
  color: #d4e8e3;
  border: 1px solid rgba(173, 214, 207, 0.18);
  background: rgba(255, 255, 255, 0.03);
}

.status-chip--active {
  color: #bff5d7;
  border: 1px solid rgba(74, 222, 128, 0.28);
  background: rgba(74, 222, 128, 0.08);
}

.status-chip--disabled {
  color: #fdd79d;
  border: 1px solid rgba(245, 158, 11, 0.28);
  background: rgba(245, 158, 11, 0.08);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 700;
}

.button--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--teal), var(--teal-strong));
}

.button--ghost {
  color: var(--text);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.button--outline {
  color: var(--teal);
  border-color: rgba(19, 156, 150, 0.5);
  background: rgba(19, 156, 150, 0.06);
  transition: background 160ms ease, border-color 160ms ease;
}

.button--outline:hover {
  background: rgba(19, 156, 150, 0.14);
  border-color: var(--teal);
}

.button--danger {
  color: #c84646;
  border-color: rgba(200, 70, 70, 0.36);
  background: rgba(200, 70, 70, 0.06);
}

.button--danger:hover {
  color: #fff;
  border-color: rgba(200, 70, 70, 0.75);
  background: rgba(200, 70, 70, 0.82);
}

.button.is-disabled {
  opacity: 0.58;
  pointer-events: none;
}

.stack {
  display: grid;
  gap: 16px;
}

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

.password-field {
  position: relative;
  display: block;
}

.field span {
  font-size: 0.92rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--input-border);
  border-radius: 14px;
  color: var(--text);
  background: var(--input-bg);
  font: inherit;
}

select option {
  color: #102028;
  background: #f3f8f7;
}

.password-field input {
  padding-right: 82px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(173, 214, 207, 0.18);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  font: 700 0.78rem "Space Grotesk", sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.password-toggle:hover,
.password-toggle:focus-visible {
  color: var(--text);
  background: rgba(19, 156, 150, 0.12);
  border-color: rgba(19, 156, 150, 0.42);
  outline: none;
}

textarea {
  min-height: 320px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(19, 156, 150, 0.36);
  border-color: rgba(19, 156, 150, 0.65);
}

.prompt-preview {
  margin-top: 16px;
}

.status-grid {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.97rem;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot--ok      { background: #3dba72; box-shadow: 0 0 6px rgba(61, 186, 114, 0.5); }
.status-dot--err     { background: #e05252; box-shadow: 0 0 6px rgba(224, 82, 82, 0.5); }
.status-dot--neutral { background: var(--muted); }

.status-label {
  width: 120px;
  font-weight: 700;
  font-family: "Space Grotesk", sans-serif;
  flex-shrink: 0;
}

.status-value {
  color: var(--muted);
}

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

.chatbot-card__actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.chatbot-card--prompt textarea {
  min-height: 460px;
  line-height: 1.55;
}

.support-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.support-thread-list,
.support-conversation {
  display: grid;
  gap: 14px;
  align-content: start;
}

.support-thread {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.02);
  transition: border-color 160ms ease, background 160ms ease;
}

.support-thread:hover,
.support-thread.is-active {
  border-color: rgba(19, 156, 150, 0.52);
  background: rgba(19, 156, 150, 0.1);
}

.support-thread span,
.support-thread small,
.support-empty,
.support-empty-state p,
.support-conversation__header p,
.support-message span {
  color: var(--muted);
}

.support-thread small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.support-conversation__header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

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

.support-messages {
  display: grid;
  gap: 12px;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 4px;
}

.support-message {
  width: min(720px, 86%);
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.03);
}

.support-message--admin {
  justify-self: end;
  border-color: rgba(19, 156, 150, 0.34);
  background: rgba(19, 156, 150, 0.12);
}

.support-message p {
  margin: 6px 0 0;
  color: var(--text);
  line-height: 1.55;
  white-space: pre-wrap;
}

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

.support-reply-form textarea {
  min-height: 150px;
}

.support-reply-form .button {
  justify-self: start;
}

.notice {
  margin: 18px 0;
  padding: 14px 16px;
  border: 1px solid rgba(255, 110, 110, 0.28);
  border-radius: 14px;
  background: rgba(255, 110, 110, 0.08);
}

.notice--error {
  color: #ffc8c8;
}

.notice--success {
  color: #bff5d7;
  border-color: rgba(74, 222, 128, 0.28);
  background: rgba(74, 222, 128, 0.08);
}

.support-copy {
  margin-top: 14px;
  font-size: 0.94rem;
}

.info-block {
  display: grid;
  gap: 6px;
  margin-top: 18px;
  padding: 16px 18px;
  border: 1px solid rgba(173, 214, 207, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.02);
}

.info-block--inline {
  margin-top: 0;
}

.info-block__label {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.info-block__value {
  color: var(--text);
  font-size: 1.02rem;
  line-height: 1.4;
  word-break: break-word;
}

.auth-helper {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.user-list {
  display: grid;
  gap: 16px;
}

.user-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(173, 214, 207, 0.12);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.02);
}

.user-card h3 {
  margin: 0;
  font-size: 1.08rem;
}

.user-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.user-card__badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.user-card__header p,
.user-card__meta {
  margin: 6px 0 0;
  color: var(--muted);
}

.user-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.92rem;
}

.user-card__actions,
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.inline-form {
  margin: 0;
}

.text-link {
  color: var(--link-color);
  text-decoration: underline;
  text-decoration-color: rgba(142, 248, 243, 0.32);
  text-underline-offset: 0.18em;
}

.text-link:hover,
.text-link:focus-visible {
  color: var(--link-color-hover);
  text-decoration-color: rgba(142, 248, 243, 0.56);
  outline: none;
}

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

.theme-toggle--float {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 100;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 1.1rem;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
  flex-shrink: 0;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: rgba(19, 156, 150, 0.5);
  background: rgba(19, 156, 150, 0.12);
}

.health-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.health-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 15, 20, 0.72);
  backdrop-filter: blur(4px);
}

.health-modal__box {
  position: relative;
  z-index: 1;
  width: min(860px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 32px 64px rgba(0,0,0,0.3);
  padding: 28px 32px;
}

.health-modal__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
}

.health-modal__close {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color 140ms, color 140ms, background 140ms;
}

.health-modal__close:hover {
  border-color: rgba(19,156,150,0.5);
  background: rgba(19,156,150,0.1);
  color: var(--text);
}

.health-card--expandable {
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.health-card--expandable:hover {
  border-color: rgba(19, 156, 150, 0.4);
  box-shadow: 0 8px 24px rgba(19, 156, 150, 0.1);
}

.health-expand-hint {
  font-size: 0.75rem;
  color: var(--muted);
  font-family: "Space Grotesk", sans-serif;
}

.health-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.health-tab {
  padding: 10px 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: 700 0.88rem "Space Grotesk", sans-serif;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}

.health-tab:hover {
  color: var(--text);
  border-color: rgba(19, 156, 150, 0.4);
  background: rgba(19, 156, 150, 0.06);
}

.health-tab.is-active {
  color: #fff;
  border-color: var(--teal);
  background: var(--teal);
}

.health-chart-canvas {
  width: 100% !important;
  height: 160px !important;
  margin-bottom: 14px;
}

.proc-refresh-label {
  font-size: 0.82rem;
  color: var(--muted);
  font-family: "Space Grotesk", sans-serif;
}

.proc-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.proc-th {
  padding: 10px 14px;
  text-align: left;
  font: 700 0.75rem "Space Grotesk", sans-serif;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.proc-th--sortable {
  cursor: pointer;
  user-select: none;
}

.proc-th--sortable:hover { color: var(--text); }

.proc-th--sortable.is-sorted-asc::after  { content: " ↑"; color: var(--teal); }
.proc-th--sortable.is-sorted-desc::after { content: " ↓"; color: var(--teal); }

.proc-row:hover { background: rgba(19, 156, 150, 0.04); }

.proc-td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.proc-td--name {
  font-weight: 700;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.proc-td--mono {
  font-family: "Space Grotesk", monospace;
  color: var(--muted);
  font-size: 0.84rem;
}

.proc-td--stat {
  white-space: nowrap;
  min-width: 90px;
}

.proc-pct {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid;
  border-radius: 999px;
  font: 700 0.78rem "Space Grotesk", sans-serif;
  margin-bottom: 4px;
}

.proc-bar-row {
  height: 4px;
  border-radius: 99px;
  background: rgba(19, 156, 150, 0.1);
  overflow: hidden;
  width: 70px;
}

.proc-bar-fill {
  height: 100%;
  border-radius: 99px;
  min-width: 1px;
  transition: width 0.4s ease;
}

.health-live-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  font-size: 0.88rem;
}

.health-live-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
  transition: background 0.3s ease;
}

.health-live-dot--on {
  background: #3dba72;
  box-shadow: 0 0 6px rgba(61, 186, 114, 0.6);
}

.health-live-label { color: var(--muted); font-weight: 700; font-family: "Space Grotesk", sans-serif; }
.health-live-ts    { color: var(--muted); margin-left: auto; }

.health-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-bottom: 32px;
}

.health-card { padding: 24px; }

.health-card--wide {
  grid-column: 1 / -1;
}

.health-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.health-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font: 700 0.82rem "Space Grotesk", sans-serif;
  transition: color 0.3s, border-color 0.3s, background 0.3s;
}

.health-card__model {
  margin: 0 0 2px;
  font-size: 1rem;
  font-weight: 700;
  word-break: break-word;
}

.health-card__sub {
  margin: 0 0 14px;
  font-size: 0.84rem;
  color: var(--muted);
}

.health-bar-wrap {
  height: 8px;
  border-radius: 99px;
  background: rgba(19, 156, 150, 0.1);
  overflow: hidden;
  margin-bottom: 16px;
}

.health-bar {
  height: 100%;
  border-radius: 99px;
  background: #3dba72;
  transition: width 0.6s ease, background 0.6s ease;
  min-width: 2px;
}

.health-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
}

.health-sys-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 18px;
  margin-top: 8px;
}

.health-stat {
  display: grid;
  gap: 3px;
  min-width: 80px;
}

.health-stat__label {
  font: 700 0.72rem "Space Grotesk", sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.health-stat__value {
  font: 700 0.95rem "Space Grotesk", sans-serif;
  color: var(--text);
}

.visit-controls {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.analytics-recent-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.analytics-recent-heading .pill {
  margin-bottom: 16px;
}

.analytics-notice {
  margin: 0 0 14px;
  padding: 10px 12px;
  font-size: 0.85rem;
}

.visit-clear-form {
  flex-shrink: 0;
}

.visit-delete-form {
  justify-content: flex-end;
}

.visit-danger-btn {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(224, 82, 82, 0.36);
  border-radius: 10px;
  color: #ffc8c8;
  background: rgba(224, 82, 82, 0.08);
  font: 700 0.78rem "Space Grotesk", sans-serif;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}

.visit-danger-btn:hover,
.visit-danger-btn:focus-visible {
  border-color: rgba(224, 82, 82, 0.7);
  color: #fff;
  background: rgba(224, 82, 82, 0.18);
  outline: none;
}

.visit-danger-btn--small {
  min-height: 28px;
  padding: 0 10px;
  font-size: 0.72rem;
}

.visit-search {
  flex: 1;
  min-width: 140px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  font: inherit;
  font-size: 0.9rem;
}

.visit-sort {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  font: 700 0.85rem "Space Grotesk", sans-serif;
  cursor: pointer;
}

.visit-page-size {
  min-width: 96px;
}

.visit-country {
  min-width: 150px;
}

.visit-count {
  margin: 0 0 8px;
  font-size: 0.82rem;
  color: var(--teal);
  font-weight: 700;
  min-height: 1em;
}

.visit-empty {
  color: var(--muted);
  font-size: 0.92rem;
  padding: 12px 0;
  text-align: center;
}

.visit-card--clickable {
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}

.visit-card--clickable:hover {
  border-color: rgba(19, 156, 150, 0.4);
  background: rgba(19, 156, 150, 0.06);
}

.visit-card__map-hint {
  font-size: 0.75rem;
  color: var(--teal);
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
}

.visit-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.pagination-btn {
  padding: 6px 16px;
  border: 1px solid var(--input-border);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
  font: 700 0.82rem "Space Grotesk", sans-serif;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}

.pagination-btn:hover:not(:disabled) {
  border-color: var(--teal);
  background: rgba(19, 156, 150, 0.08);
  color: var(--teal-strong);
}

.pagination-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.pagination-info {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
  text-align: center;
}

.analytics-map-recent-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
  gap: 24px;
  align-items: stretch;
  margin-bottom: 24px;
}

.analytics-map-panel,
.analytics-recent-panel {
  height: 100%;
  min-width: 0;
  margin-bottom: 0;
}

.analytics-map-panel {
  overflow: hidden;
}

#map-container {
  width: 100%;
  height: clamp(560px, 68vh, 720px);
  border-radius: 16px;
  overflow: hidden;
  margin-top: 12px;
}

.analytics-recent-panel {
  display: flex;
  flex-direction: column;
  padding: 34px;
}

.analytics-recent-list {
  align-content: start;
  flex: 1;
  margin-top: 14px;
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.map-basemap-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.map-basemap-btn {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: 700 0.8rem "Space Grotesk", sans-serif;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}

.map-basemap-btn:hover {
  color: var(--text);
  border-color: rgba(19, 156, 150, 0.5);
  background: rgba(19, 156, 150, 0.08);
}

.map-basemap-btn.is-active {
  color: #fff;
  border-color: var(--teal);
  background: var(--teal);
}

.analytics-bar-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.analytics-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
}

.analytics-bar-label {
  width: 130px;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-card-note {
  margin: 4px 0 14px;
  max-width: 620px;
  font-size: 0.9rem;
}

.analytics-card-note strong {
  color: var(--text);
}

.analytics-page-label {
  display: grid;
  gap: 2px;
  width: 170px;
  white-space: normal;
}

.analytics-page-label strong,
.analytics-page-label small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.analytics-page-label strong {
  color: var(--text);
  font-size: 0.95rem;
}

.analytics-page-label small,
.analytics-path-muted {
  color: var(--muted);
  font-size: 0.78rem;
}

.analytics-bar-track {
  flex: 1;
  height: 8px;
  border-radius: 99px;
  background: rgba(19, 156, 150, 0.12);
  overflow: hidden;
}

.analytics-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--teal), var(--teal-strong));
  min-width: 4px;
}

.analytics-bar-count {
  width: 36px;
  text-align: right;
  color: var(--muted);
  font-size: 0.85rem;
  flex-shrink: 0;
}

.analytics-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 120px;
  margin-top: 16px;
}

.analytics-chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
}

.analytics-chart-count {
  font-size: 0.72rem;
  color: var(--muted);
  height: 16px;
  line-height: 1;
}

.analytics-chart-bar-wrap {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
}

.analytics-chart-bar {
  width: 100%;
  border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--teal), var(--teal-strong));
  min-height: 2px;
}

.analytics-chart-label {
  font-size: 0.68rem;
  color: var(--muted);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  height: 36px;
  overflow: hidden;
}

@media (max-width: 680px) {
  .health-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .analytics-map-recent-grid {
    grid-template-columns: 1fr;
  }

  .analytics-recent-panel {
    max-height: none;
  }

  .analytics-recent-list {
    overflow: visible;
    padding-right: 0;
  }

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

  .support-layout {
    grid-template-columns: 1fr;
  }

  .support-conversation__header,
  .support-conversation__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .chatbot-card--prompt,
  .chatbot-card--relay {
    grid-column: auto;
  }

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

  .chatbot-card__header {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .account-form-grid {
    grid-template-columns: 1fr;
  }

  .admin-shell__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .user-card__header,
  .user-card__actions,
  .inline-form,
  .analytics-recent-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .user-card__badges {
    justify-content: flex-start;
  }
}
