/*
 * UNOZIM MCP pages (home, sign in, consent) in the shared UNOZIM look (crm#172).
 *
 * A layer over brand.css, which stays linked first and unchanged: everything
 * here is scoped to body.unz and takes its values from the shared design
 * values (crm#171, --unz-*, https://updates.unozim.co.zw/css/unozim-tokens/v1/tokens.css).
 * Every value has a fallback, so the pages still look right if that file is
 * missing or late. Dark mode follows the reader's system setting, through the
 * tokens file. CSS only: no script runs on these pages (see SecurityHeaders).
 */

body.unz {
  /* brand.css's own variables, pointed at the shared values, so any rule
     from brand.css that is not restyled below still matches. */
  --ink: var(--unz-foreground, #1c1917);
  --paper: var(--unz-card, #fff);
  --bg: var(--unz-background, #fafaf9);
  --border: var(--unz-border, #e3e1de);
  --border-2: var(--unz-input, #e3e1de);
  --faint: var(--unz-muted, #f2f1f0);
  --muted: var(--unz-muted-foreground, #635e59);
  --muted-2: var(--unz-muted-foreground, #635e59);
  --danger: var(--unz-destructive, #b8262f);

  color-scheme: light dark;
  font-family: var(--unz-font, ui-sans-serif, system-ui, sans-serif);
  font-size: 0.9375rem;
  line-height: 1.5;
  background: var(--unz-background, #fafaf9);
  color: var(--unz-foreground, #1c1917);
  -webkit-font-smoothing: antialiased;
}

.unz h1 { font-size: var(--unz-text-2xl, 1.5rem); font-weight: 600; letter-spacing: -0.015em; margin: 0 0 var(--unz-space-2, 0.5rem); }
.unz h2 { font-size: var(--unz-text-lg, 1.125rem); font-weight: 600; margin: 0 0 var(--unz-space-3, 0.75rem); }
.unz h1 .muted { font-size: var(--unz-text-sm, 0.875rem); font-weight: 400; }
.unz p { margin: 0 0 var(--unz-space-3, 0.75rem); }
.unz .muted { color: var(--unz-muted-foreground, #635e59); font-size: var(--unz-text-sm, 0.875rem); }
.unz a { color: inherit; text-underline-offset: 3px; }

/* Layout */
.unz .wrap { max-width: 32rem; margin: 10vh auto; padding: 0 var(--unz-space-4, 1rem); }
.unz .wrap-wide { max-width: 72rem; margin: var(--unz-space-8, 2rem) auto; padding: 0 var(--unz-space-4, 1rem); }
.unz .card {
  background: var(--unz-card, #fff);
  color: var(--unz-card-foreground, #1c1917);
  border: 1px solid var(--unz-border, #e3e1de);
  border-radius: var(--unz-radius-xl, 0.875rem);
  padding: var(--unz-space-6, 1.5rem);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.04);
}
.unz .section { margin-bottom: var(--unz-space-4, 1rem); }
.unz .toolbar { margin-bottom: var(--unz-space-6, 1.5rem); }
.unz .toolbar h1 { margin: 0; }

/* Forms */
.unz label { font-size: var(--unz-text-sm, 0.875rem); font-weight: 500; margin-bottom: 0.375rem; }
.unz input[type=email], .unz input[type=password], .unz input[type=text], .unz select {
  background: transparent;
  color: inherit;
  border: 1px solid var(--unz-input, #e3e1de);
  border-radius: var(--unz-radius-md, 0.5rem);
  font-size: var(--unz-text-sm, 0.875rem);
  min-height: 2.5rem;
  padding: 0.5rem 0.75rem;
}
.unz select option { background: var(--unz-card, #fff); color: var(--unz-foreground, #1c1917); }
.unz input:focus-visible, .unz select:focus-visible, .unz button:focus-visible, .unz summary:focus-visible, .unz .btn:focus-visible {
  outline: 2px solid var(--unz-ring, #a8a29e);
  outline-offset: 2px;
}
.unz input[type=radio], .unz input[type=checkbox] { accent-color: var(--unz-primary, #1c1917); width: 1rem; height: 1rem; vertical-align: -0.15em; margin: 0 0.35rem 0 0; }
.unz label:has(> input[type=radio]), .unz label:has(> input[type=checkbox]) { display: inline-flex; align-items: center; font-weight: 400; }

/* Buttons: primary is ink on paper (inverted in dark), secondary is an outline. */
.unz button, .unz .btn {
  background: var(--unz-primary, #1c1917);
  color: var(--unz-primary-foreground, #fafaf9);
  border: 1px solid transparent;
  border-radius: var(--unz-radius-md, 0.5rem);
  font-size: var(--unz-text-sm, 0.875rem);
  font-weight: 500;
  min-height: 2.5rem;
  padding: 0.5rem 1rem;
  transition: opacity 0.15s ease;
}
.unz button:hover, .unz .btn:hover { opacity: 0.9; }
.unz .btn-secondary {
  background: var(--unz-card, #fff);
  color: var(--unz-foreground, #1c1917);
  border-color: var(--unz-border, #e3e1de);
}
.unz .btn-secondary:hover { background: var(--unz-secondary, #f4f3f2); opacity: 1; }
.unz .btn-danger { background: var(--unz-destructive, #b8262f); color: #fff; }
.unz .btn-sm { min-height: 2.25rem; padding: 0.3rem 0.75rem; font-size: var(--unz-text-xs, 0.8125rem); }

/* Messages and badges: a tint with ink text, the same recipe as the CRM's badges. */
.unz .error {
  background: var(--unz-badge-critical-bg, #f9e7e7);
  border: 1px solid var(--unz-badge-critical-border, #ecb1b1);
  color: var(--unz-badge-critical-text, #1c1917);
  border-radius: var(--unz-radius-md, 0.5rem);
  padding: 0.625rem 0.875rem;
  font-size: var(--unz-text-sm, 0.875rem);
}
.unz .flash-success {
  background: var(--unz-badge-good-bg, #e2f4e2);
  border: 1px solid var(--unz-badge-good-border, #9eda9e);
  color: var(--unz-badge-good-text, #1c1917);
  border-radius: var(--unz-radius-md, 0.5rem);
}
.unz .badge { border: 1px solid transparent; font-weight: 500; padding: 0.1rem 0.55rem; }
.unz .badge-green { background: var(--unz-badge-good-bg, #e2f4e2); border-color: var(--unz-badge-good-border, #9eda9e); color: var(--unz-badge-good-text, #1c1917); }
.unz .badge-red { background: var(--unz-badge-critical-bg, #f9e7e7); border-color: var(--unz-badge-critical-border, #ecb1b1); color: var(--unz-badge-critical-text, #1c1917); }
.unz .badge-amber { background: var(--unz-badge-warning-bg, #fef1d6); border-color: var(--unz-badge-warning-border, #fcd580); color: var(--unz-badge-warning-text, #1c1917); }
.unz .badge-gray { background: var(--unz-badge-neutral-bg, #f2f1f0); border-color: var(--unz-badge-neutral-border, #e3e1de); color: var(--unz-badge-neutral-text, #635e59); }

/* Key/value lists and code */
.unz .kv { gap: 0.5rem 1.25rem; font-size: var(--unz-text-sm, 0.875rem); margin: 0 0 var(--unz-space-4, 1rem); }
.unz .kv dt { color: var(--unz-muted-foreground, #635e59); }
.unz code {
  background: var(--unz-muted, #f2f1f0);
  border: 1px solid var(--unz-border, #e3e1de);
  border-radius: var(--unz-radius-sm, 0.375rem);
  color: var(--unz-foreground, #1c1917);
  font-size: 0.8125rem;
}
.unz ul { margin: 0 0 var(--unz-space-3, 0.75rem); padding-left: 1.25rem; }
.unz li { margin-bottom: 0.25rem; }

/* Collapsible sections */
.unz .acc {
  background: var(--unz-card, #fff);
  border: 1px solid var(--unz-border, #e3e1de);
  border-radius: var(--unz-radius-xl, 0.875rem);
  margin-bottom: var(--unz-space-3, 0.75rem);
}
.unz .acc > summary { font-size: var(--unz-text-base, 1rem); padding: var(--unz-space-4, 1rem) var(--unz-space-6, 1.5rem); }
.unz .acc > summary::after { color: var(--unz-muted-foreground, #635e59); }
.unz .acc-body { padding: 0 var(--unz-space-6, 1.5rem) var(--unz-space-6, 1.5rem); }

/* Tables (the home page's tables carry no class of their own) */
.unz .table-wrap { overflow-x: auto; border: 1px solid var(--unz-border, #e3e1de); border-radius: var(--unz-radius-lg, 0.625rem); margin-bottom: var(--unz-space-3, 0.75rem); }
.unz .table-wrap table { width: 100%; border-collapse: collapse; font-size: var(--unz-text-sm, 0.875rem); }
.unz .table-wrap th, .unz .table-wrap td { text-align: left; padding: 0.55rem 0.85rem; border-bottom: 1px solid var(--unz-border, #e3e1de); vertical-align: top; }
.unz .table-wrap th { background: var(--unz-muted, #f2f1f0); color: var(--unz-muted-foreground, #635e59); font-weight: 500; font-size: var(--unz-text-xs, 0.75rem); }
.unz .table-wrap tr:last-child td { border-bottom: none; }
/* mcp#12: a scrolling table is keyboard-focusable (tabindex=0), so it shows focus like a control. */
.unz .table-wrap:focus-visible { outline: 2px solid var(--unz-ring, #a8a29e); outline-offset: 2px; }

/* Text for screen readers only (an action column's header). */
.unz .visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

/* The consent buttons sit side by side; on a phone they stack, in page order (Cancel first). */
@media (max-width: 30rem) {
  .unz .row-actions { flex-direction: column; }
}

/* crm#356: the whole email on the Pending sends page, as it will be sent. */
.unz pre.message {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: inherit;
  font-size: var(--unz-text-sm, 0.875rem);
  background: var(--faint, #faf9f8);
  border: 1px solid var(--border, #e3e1de);
  border-radius: var(--unz-radius-md, 0.5rem);
  padding: 0.625rem 0.875rem;
}
