/* Tresor – app styles (SPEC-v3 C: shadcn "zinc" look, vanilla CSS).
 * Mobile first, light + dark, no inline styles anywhere (CSP style-src 'self').
 * Tokens use the shadcn names so public/css/admin.css can share them. */

/* ------------------------------------------------------------------------------------------ */
/* Tokens                                                                                      */

:root {
  color-scheme: light;

  --background: #ffffff;
  --foreground: #09090b;
  --card: #ffffff;
  --card-foreground: #09090b;
  --popover: #ffffff;
  --popover-foreground: #09090b;
  --primary: #4f46e5;
  --primary-foreground: #ffffff;
  --secondary: #f4f4f5;
  --secondary-foreground: #18181b;
  --muted: #f4f4f5;
  --muted-foreground: #71717a;
  --accent: #f4f4f5;
  --accent-foreground: #18181b;
  --destructive: #ef4444;
  --destructive-foreground: #fafafa;
  --border: #e4e4e7;
  --input: #e4e4e7;
  --ring: #6366f1;
  --radius: 0.5rem;

  /* Accent gradient + app-frame background (v3.2 "Nexus") */
  --grad-accent: linear-gradient(90deg, #4f46e5, #7c3aed);
  --grad-accent-br: linear-gradient(135deg, #6366f1, #7c3aed);
  --accent-shadow: 0 8px 24px -4px rgb(99 102 241 / 0.4);
  --bg-gradient: linear-gradient(to bottom, #ffffff, #fafafa);
  --bubble-me-fg: #ffffff;

  /* Status colours (C.1) + readable text / soft background variants */
  --success: #22c55e;
  --success-text: #15803d;
  --success-soft: #dcfce7;
  --warn: #ca8a04;
  --warn-text: #a16207;
  --warn-soft: #fef9c3;
  --rose: #e11d48;
  --rose-text: #e11d48;
  --rose-soft: #ffe4e6;
  --neutral: #9ca3af;
  --destructive-text: #dc2626;
  --destructive-soft: #fee2e2;
  --overlay: rgb(0 0 0 / 0.8);

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.25);

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

/* Dark tokens: explicit choice, dark-only screens (body.theme-dark) and the system preference. */
:root[data-theme="dark"],
.theme-dark {
  color-scheme: dark;
  --background: #09090b;
  --foreground: #fafafa;
  --card: #18181b;
  --card-foreground: #fafafa;
  --popover: #18181b;
  --popover-foreground: #fafafa;
  --primary: #6366f1;
  --primary-foreground: #ffffff;
  --secondary: #27272a;
  --secondary-foreground: #fafafa;
  --muted: #27272a;
  --muted-foreground: rgb(255 255 255 / 0.55);
  --accent: #27272a;
  --accent-foreground: #fafafa;
  --destructive: #dc2626;
  --destructive-foreground: #fafafa;
  --border: rgb(255 255 255 / 0.10);
  --input: rgb(255 255 255 / 0.14);
  --ring: #6366f1;
  --bg-gradient: linear-gradient(to bottom, #18181b, #09090b);
  --success-text: #4ade80;
  --success-soft: rgb(34 197 94 / 0.15);
  --warn-text: #facc15;
  --warn-soft: rgb(202 138 4 / 0.2);
  --rose-text: #fb7185;
  --rose-soft: rgb(225 29 72 / 0.18);
  --destructive-text: #f87171;
  --destructive-soft: rgb(220 38 38 / 0.2);
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.4);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.55), 0 4px 6px -4px rgb(0 0 0 / 0.55);
  --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.7);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --background: #09090b;
    --foreground: #fafafa;
    --card: #18181b;
    --card-foreground: #fafafa;
    --popover: #18181b;
    --popover-foreground: #fafafa;
    --primary: #6366f1;
    --primary-foreground: #ffffff;
    --secondary: #27272a;
    --secondary-foreground: #fafafa;
    --muted: #27272a;
    --muted-foreground: rgb(255 255 255 / 0.55);
    --accent: #27272a;
    --accent-foreground: #fafafa;
    --destructive: #dc2626;
    --destructive-foreground: #fafafa;
    --border: rgb(255 255 255 / 0.10);
    --input: rgb(255 255 255 / 0.14);
    --ring: #6366f1;
    --bg-gradient: linear-gradient(to bottom, #18181b, #09090b);
    --success-text: #4ade80;
    --success-soft: rgb(34 197 94 / 0.15);
    --warn-text: #facc15;
    --warn-soft: rgb(202 138 4 / 0.2);
    --rose-text: #fb7185;
    --rose-soft: rgb(225 29 72 / 0.18);
    --destructive-text: #f87171;
    --destructive-soft: rgb(220 38 38 / 0.2);
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.4);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.5), 0 2px 4px -2px rgb(0 0 0 / 0.5);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.55), 0 4px 6px -4px rgb(0 0 0 / 0.55);
    --shadow-2xl: 0 25px 50px -12px rgb(0 0 0 / 0.7);
  }
}

/* ------------------------------------------------------------------------------------------ */
/* Base                                                                                        */

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  height: 100%;
  background: var(--background);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--bg-gradient);
  color: var(--foreground);
  font: 16px/1.5 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4, p {
  margin: 0;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

code,
kbd,
.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

[tabindex="-1"]:focus {
  outline: none;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.clipboard-proxy {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.icon {
  flex: none;
  display: inline-block;
  vertical-align: middle;
}

.muted {
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.row-center {
  justify-content: center;
}

/* Splash / noscript (index.html, before app.js runs) – always dark like the lock screen. */
.splash,
.noscript {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 2rem;
  background: #09090b;
  color: #a1a1aa;
  text-align: center;
}

.splash {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  animation: fade-in 0.3s 0.4s both;
}

.noscript {
  z-index: 10;
  color: #fafafa;
}

/* ------------------------------------------------------------------------------------------ */
/* App shell                                                                                   */

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.view {
  position: relative;
  flex: 1;
  min-height: 0;
}

.banner {
  position: relative;
  z-index: 70;
  flex: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: calc(0.5rem + env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) 0.5rem max(1rem, env(safe-area-inset-left));
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.875rem;
}

.banner-muted {
  background: var(--muted);
  color: var(--foreground);
}

.banner-danger {
  border-bottom: 1px solid color-mix(in srgb, var(--destructive) 35%, var(--border));
  background: var(--destructive-soft);
  color: var(--destructive-text);
}

/* The first visible banner already covers the status-bar inset (iOS black-translucent); the
   banners and headers below it must not add it a second time. */
.banner:not([hidden]) ~ .banner {
  padding-top: 0.5rem;
}

#app:has(> .banner:not([hidden])) .topbar {
  padding-top: 0;
}

#app:has(> .banner:not([hidden])) .chat-header {
  padding-top: 0.5rem;
}

#app:has(> .banner:not([hidden])) .admin-nav {
  top: 0.5rem;
  margin-top: 1rem;
}

.banner-text {
  flex: 1;
  min-width: 0;
}

.screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--bg-gradient);
}

.topbar {
  position: relative;
  z-index: 5;
  flex: none;
  padding-top: env(safe-area-inset-top);
  border-bottom: 1px solid var(--border);
  background: var(--background);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  max-width: 42rem;
  height: 3.5rem;
  margin: 0 auto;
  padding: 0 max(0.75rem, env(safe-area-inset-right)) 0 max(0.75rem, env(safe-area-inset-left));
}

.topbar-title {
  min-width: 0;
  overflow: hidden;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.125rem;
  margin-left: auto;
}

.page-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.page-content {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 42rem;
  margin: 0 auto;
  padding: 1rem max(1rem, env(safe-area-inset-right)) calc(2rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}

@media (min-width: 768px) {
  .page-content {
    padding-top: 1.5rem;
    gap: 1.25rem;
  }
}

.loading {
  display: flex;
  justify-content: center;
  padding: 2rem 1rem;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.loading-center {
  flex: 1;
  align-items: center;
}

/* ------------------------------------------------------------------------------------------ */
/* Button                                                                                      */

.btn {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 2.5rem;
  padding: 0 1rem;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.25rem;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition: background-color 150ms, color 150ms, border-color 150ms, box-shadow 150ms, opacity 150ms;
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}

.btn-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-default {
  background: var(--grad-accent);
  color: var(--primary-foreground);
  box-shadow: var(--accent-shadow);
}

.btn-default:hover {
  filter: brightness(1.08);
}

.btn-destructive {
  background: var(--destructive);
  color: var(--destructive-foreground);
}

.btn-destructive:hover {
  background: color-mix(in srgb, var(--destructive) 90%, transparent);
}

.btn-outline {
  border-color: var(--input);
  background: var(--background);
  color: var(--foreground);
}

.btn-outline:hover,
.btn-ghost:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}

.btn-secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
}

.btn-secondary:hover {
  background: color-mix(in srgb, var(--secondary) 80%, var(--foreground) 6%);
}

.btn-ghost {
  background: transparent;
  color: inherit;
}

.btn-link {
  height: auto;
  padding: 0;
  background: transparent;
  color: var(--primary);
  text-underline-offset: 4px;
}

.btn-link:hover {
  text-decoration: underline;
}

.btn-foreground {
  border-radius: 0.75rem;
  background: var(--foreground);
  color: var(--background);
}

.btn-foreground:hover {
  background: color-mix(in srgb, var(--foreground) 85%, transparent);
}

.btn-pill {
  height: 1.75rem;
  padding: 0 0.75rem;
  border-radius: 9999px;
  background: var(--grad-accent);
  color: var(--bubble-me-fg);
  font-size: 0.75rem;
}

.btn-pill:hover {
  filter: brightness(1.08);
}

.btn-sm {
  height: 2.25rem;
  padding: 0 0.75rem;
}

.btn-lg {
  height: 2.75rem;
  padding: 0 2rem;
}

.btn-xs {
  height: 1.75rem;
  gap: 0.25rem;
  padding: 0 0.625rem;
  font-size: 0.75rem;
}

.btn-icon {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
}

.btn-link.btn-xs,
.btn-link.btn-sm {
  height: auto;
  padding: 0;
}

.btn-block {
  width: 100%;
}

.btn-justify {
  justify-content: flex-start;
}

.btn-justify .btn-label {
  flex: 1;
  text-align: left;
}

.btn-destructive-outline {
  border-color: color-mix(in srgb, var(--destructive) 45%, var(--border));
  color: var(--destructive-text);
}

.btn-destructive-outline:hover {
  background: var(--destructive-soft);
  color: var(--destructive-text);
}

.btn-warn-outline {
  border-color: color-mix(in srgb, var(--warn) 45%, var(--border));
  color: var(--warn-text);
}

.btn-warn-outline:hover {
  background: var(--warn-soft);
  color: var(--warn-text);
}

@media (pointer: coarse) {
  .btn-icon {
    width: 2.75rem;
    height: 2.75rem;
  }
}

/* ------------------------------------------------------------------------------------------ */
/* Card                                                                                        */

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--card-foreground);
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding: 1.25rem;
}

.card-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.card-description {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.card-content {
  padding: 0 1.25rem 1.25rem;
}

.card-footer {
  display: flex;
  align-items: center;
  padding: 0 1.25rem 1.25rem;
}

@media (min-width: 640px) {
  .card-header {
    padding: 1.5rem;
  }

  .card-content,
  .card-footer {
    padding: 0 1.5rem 1.5rem;
  }
}

.section-card .card-title {
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
}

.section-card .card-header {
  padding-bottom: 1rem;
}

.danger-card {
  border-color: color-mix(in srgb, var(--destructive) 40%, var(--border));
}

.danger-card .card-title {
  color: var(--destructive-text);
}

/* ------------------------------------------------------------------------------------------ */
/* Form controls                                                                               */

.label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-width: 0;
}

.field-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.field-hint {
  color: var(--muted-foreground);
  font-size: 0.8125rem;
}

.field-error {
  color: var(--destructive-text);
  font-size: 0.8125rem;
  font-weight: 500;
}

.has-error .label {
  color: var(--destructive-text);
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input,
.textarea,
.select {
  display: block;
  width: 100%;
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  background: var(--background);
  color: var(--foreground);
  font-size: 1rem; /* ≥ 16 px: iOS does not zoom into the field */
  transition: box-shadow 150ms, border-color 150ms;
}

.input {
  height: 2.5rem;
  padding: 0.5rem 0.75rem;
}

/* Smaller text only with a mouse: iPads are ≥ 768 px wide and zoom into fields below 16 px. */
@media (min-width: 768px) and (hover: hover) and (pointer: fine) {
  .input,
  .textarea,
  .select {
    font-size: 0.875rem;
  }
}

.input::placeholder,
.textarea::placeholder {
  color: var(--muted-foreground);
  opacity: 1;
}

.input:focus-visible,
.textarea:focus-visible,
.select:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}

.input:disabled,
.textarea:disabled,
.select:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.input[aria-invalid="true"],
.textarea[aria-invalid="true"] {
  border-color: var(--destructive);
}

.has-icon .input {
  padding-left: 2.25rem;
}

.has-toggle .input {
  padding-right: 2.75rem;
}

.input-icon {
  position: absolute;
  left: 0.75rem;
  display: flex;
  color: var(--muted-foreground);
  pointer-events: none;
}

.input-toggle {
  position: absolute;
  right: 0.25rem;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: calc(var(--radius) - 4px);
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
}

.input-toggle:hover {
  color: var(--foreground);
}

.input-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--ring);
}

.input-code .input {
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.input-code .input::placeholder {
  letter-spacing: 0.08em;
}

.textarea {
  min-height: 5rem;
  padding: 0.5rem 0.75rem;
  line-height: 1.5;
  resize: vertical;
}

.select {
  height: 2.5rem;
  padding: 0 2.25rem 0 0.75rem;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 1rem;
  cursor: pointer;
}

.select option {
  background: var(--popover);
  color: var(--popover-foreground);
}

.form-error {
  margin: 0;
  color: var(--destructive-text);
  font-size: 0.875rem;
  font-weight: 500;
}

.form-status {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.form-error:empty,
.form-status:empty {
  display: none;
}

.field-state {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0;
  font-size: 0.8125rem;
}

.field-state:empty {
  display: none;
}

.field-state[data-state="ok"] {
  color: var(--success-text);
}

.field-state[data-state="bad"] {
  color: var(--destructive-text);
}

.input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.input-row > .input-wrap {
  flex: 1;
  min-width: 0;
}

/* Switch */
.switch {
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
  width: 2.75rem;
  height: 1.5rem;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 9999px;
  background: var(--input);
  cursor: pointer;
  transition: background-color 150ms;
}

.switch[aria-checked="true"] {
  background: var(--primary);
}

.switch:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}

.switch:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.switch-thumb {
  display: block;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 9999px;
  background: var(--background);
  box-shadow: var(--shadow-lg);
  transition: translate 150ms;
}

.switch[aria-checked="true"] .switch-thumb {
  translate: 1.25rem 0;
}

/* Checkbox + radio */
.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
}

.checkbox {
  width: 1rem;
  height: 1rem;
  margin: 0;
  accent-color: var(--primary);
}

.radio-group-list {
  display: grid;
  gap: 0.5rem;
}

.radio-group-list .radio-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  cursor: pointer;
  transition: border-color 150ms, background-color 150ms;
}

.radio-group-list .radio-item:hover {
  background: var(--accent);
}

.radio-group-list .radio-item:has(.radio:checked) {
  border-color: var(--primary);
}

.radio {
  display: grid;
  flex: none;
  place-content: center;
  width: 1rem;
  height: 1rem;
  margin: 0;
  border: 1px solid var(--primary);
  border-radius: 9999px;
  background: var(--background);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.radio::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 9999px;
  background: var(--primary);
  scale: 0;
  transition: scale 120ms;
}

.radio:checked::before {
  scale: 1;
}

.radio:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}

.radio:disabled {
  opacity: 0.5;
}

.radio-text {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
  min-width: 0;
}

.radio-description {
  flex-basis: 100%;
  color: var(--muted-foreground);
  font-size: 0.8125rem;
}

/* Segmented radio group (theme, timer) */
.radio-group-segmented {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  gap: 0.25rem;
  padding: 0.25rem;
  border-radius: calc(var(--radius) - 2px);
  background: var(--muted);
}

.radio-group-segmented .radio-item {
  position: relative;
  display: flex;
  cursor: pointer;
}

.radio-group-segmented .radio {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio-group-segmented .radio-text {
  flex: 1;
  justify-content: center;
  gap: 0.375rem;
  min-height: 2.25rem;
  padding: 0.375rem 0.5rem;
  border-radius: calc(var(--radius) - 4px);
  color: var(--muted-foreground);
  font-size: 0.875rem;
  font-weight: 500;
  text-align: center;
  transition: background-color 150ms, color 150ms;
}

.radio-group-segmented .radio-item:has(.radio:checked) .radio-text {
  background: var(--background);
  color: var(--foreground);
  box-shadow: var(--shadow-sm);
}

.radio-group-segmented .radio-item:has(.radio:focus-visible) .radio-text {
  box-shadow: 0 0 0 2px var(--ring);
}

.radio-group-segmented .radio-item:has(.radio:disabled) {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ------------------------------------------------------------------------------------------ */
/* Badge, status, avatar, separator, kbd, skeleton, spinner, empty state                       */

.badge {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.625rem;
  border: 1px solid transparent;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1rem;
  white-space: nowrap;
}

.badge-default {
  background: var(--grad-accent);
  color: var(--primary-foreground);
}

.badge-secondary {
  background: var(--secondary);
  color: var(--secondary-foreground);
}

.badge-outline {
  border-color: var(--border);
  color: var(--foreground);
}

.badge-destructive {
  background: var(--destructive-soft);
  color: var(--destructive-text);
}

.badge-success {
  background: var(--success-soft);
  color: var(--success-text);
}

.badge-warn {
  background: var(--warn-soft);
  color: var(--warn-text);
}

.badge-count {
  justify-content: center;
  min-width: 1.25rem;
  padding: 0.125rem 0.375rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  color: var(--muted-foreground);
  font-size: 0.75rem;
  line-height: 1rem;
}

.status-dot {
  display: inline-block;
  flex: none;
  width: 0.75rem;
  height: 0.75rem;
  border: 2px solid var(--background);
  border-radius: 9999px;
  background: var(--neutral);
}

.status-badge[data-status="online"] .status-dot,
.status-badge[data-status="verified"] .status-dot {
  background: var(--success);
}

.status-badge[data-status="warn"] .status-dot {
  background: var(--warn);
}

.status-badge[data-status="dnd"] .status-dot {
  background: var(--rose);
}

.status-badge[data-status="verified"] .status-label {
  color: var(--success-text);
}

.avatar {
  display: inline-grid;
  flex: none;
  place-items: center;
  overflow: hidden;
  border-radius: 9999px;
  color: #ffffff;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.02em;
  user-select: none;
  -webkit-user-select: none;
}

.avatar-20 { width: 1.25rem; height: 1.25rem; font-size: 0.5625rem; }
.avatar-24 { width: 1.5rem; height: 1.5rem; font-size: 0.625rem; }
.avatar-32 { width: 2rem; height: 2rem; font-size: 0.75rem; }
.avatar-40 { width: 2.5rem; height: 2.5rem; font-size: 0.875rem; }
.avatar-48 { width: 3rem; height: 3rem; font-size: 1rem; }
.avatar-64 { width: 4rem; height: 4rem; font-size: 1.25rem; }
.avatar-80 { width: 5rem; height: 5rem; font-size: 1.5rem; }

.avatar-c0 { background: #0284c7; }
.avatar-c1 { background: #7c3aed; }
.avatar-c2 { background: #b45309; }
.avatar-c3 { background: #047857; }
.avatar-c4 { background: #e11d48; }
.avatar-c5 { background: #db2777; }
.avatar-c6 { background: #4f46e5; }
.avatar-c7 { background: #0f766e; }

.separator {
  flex: none;
  background: var(--border);
}

.separator-h {
  width: 100%;
  height: 1px;
}

.separator-v {
  align-self: stretch;
  width: 1px;
  min-height: 1rem;
}

.separator-labeled {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

.separator-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.separator-text {
  color: var(--muted-foreground);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.25rem;
  border: 1px solid var(--border);
  border-radius: 0.25rem;
  background: var(--muted);
  color: var(--muted-foreground);
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1;
}

.skeleton {
  border-radius: calc(var(--radius) - 2px);
  background: var(--muted);
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.spinner {
  display: inline-block;
  flex: none;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 9999px;
  opacity: 0.85;
  animation: spin 0.7s linear infinite;
}

.spinner-xs { width: 0.75rem; height: 0.75rem; }
.spinner-sm { width: 1rem; height: 1rem; }
.spinner-md { width: 1.5rem; height: 1.5rem; }
.spinner-lg { width: 2rem; height: 2rem; border-width: 3px; }

.spinner-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 2.5rem 1rem;
  text-align: center;
}

.empty-state-icon {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  margin-bottom: 0.25rem;
  border-radius: 9999px;
  background: var(--muted);
  color: var(--muted-foreground);
}

.empty-state-title {
  font-size: 1rem;
  font-weight: 600;
}

.empty-state-text {
  max-width: 24rem;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.empty-state-action {
  margin-top: 0.75rem;
}

.callout {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  background: var(--muted);
  font-size: 0.875rem;
}

.callout > .icon {
  margin-top: 0.125rem;
  color: var(--muted-foreground);
}

.callout-success {
  border-color: color-mix(in srgb, var(--success) 35%, var(--border));
  background: var(--success-soft);
}

.callout-success > .icon {
  color: var(--success-text);
}

.callout-warn {
  border-color: color-mix(in srgb, var(--warn) 40%, var(--border));
  background: var(--warn-soft);
}

.callout-warn > .icon {
  color: var(--warn-text);
}

.countdown {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.countdown.is-urgent,
.countdown.is-expired {
  color: var(--destructive-text);
}

/* ------------------------------------------------------------------------------------------ */
/* Tabs                                                                                        */

.tabs {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.tabs-list {
  display: grid;
  grid-auto-columns: minmax(0, 1fr);
  grid-auto-flow: column;
  align-items: center;
  height: 2.5rem;
  padding: 0.25rem;
  border-radius: calc(var(--radius) - 2px);
  background: var(--muted);
  color: var(--muted-foreground);
}

.tabs-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  height: 100%;
  padding: 0 0.75rem;
  border: 0;
  border-radius: calc(var(--radius) - 4px);
  background: transparent;
  color: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms, color 150ms, box-shadow 150ms;
}

.tabs-trigger[data-state="active"] {
  background: var(--background);
  color: var(--foreground);
  box-shadow: var(--shadow-sm);
}

.tabs-trigger:focus-visible,
.tabs-content:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}

.tabs-content {
  border-radius: calc(var(--radius) - 2px);
}

.tabs-content[data-state="active"] {
  animation: fade-in 180ms ease-out;
}

/* ------------------------------------------------------------------------------------------ */
/* Dropdown menu                                                                               */

/* The menu hangs off this wrapper (absolute); ui.js picks data-side / data-align from the room
   left inside the visible part of the clipping ancestors. */
.dropdown {
  position: relative;
  display: inline-flex;
  flex: none;
  vertical-align: middle;
}

.menu {
  position: absolute;
  z-index: 60;
  top: calc(100% + 4px);
  right: 0;
  min-width: 13rem;
  max-width: min(20rem, calc(100vw - 1rem));
  max-height: min(70vh, 26rem);
  overflow-y: auto;
  padding: 0.25rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  background: var(--popover);
  color: var(--popover-foreground);
  box-shadow: var(--shadow-md);
  transform-origin: top right;
  animation: menu-in 120ms ease-out;
}

.dropdown[data-side="top"] > .menu {
  top: auto;
  bottom: calc(100% + 4px);
  transform-origin: bottom right;
}

.dropdown[data-align="start"] > .menu {
  right: auto;
  left: 0;
  transform-origin: top left;
}

.dropdown[data-align="start"][data-side="top"] > .menu {
  transform-origin: bottom left;
}

.dropdown[data-align="center"] > .menu {
  right: auto;
  left: 50%;
  translate: -50% 0;
  transform-origin: top center;
}

/* Browsers with CSS anchor positioning: the menu is a manual popover in the top layer, tied to
   the open trigger through one shared anchor name (only one menu is open at a time). */
.dropdown.is-anchored > :first-child {
  anchor-name: --tresor-menu;
}

.dropdown.is-anchored > .menu {
  position: fixed;
  inset: auto;
  top: anchor(--tresor-menu bottom);
  right: anchor(--tresor-menu right);
  bottom: auto;
  left: auto;
  margin: 4px 0 0;
  translate: none;
  position-anchor: --tresor-menu;
  position-try-fallbacks: flip-block, flip-inline, flip-block flip-inline;
}

.dropdown.is-anchored[data-align="start"] > .menu {
  right: auto;
  left: anchor(--tresor-menu left);
}

.dropdown.is-anchored[data-align="center"] > .menu {
  right: auto;
  left: anchor(--tresor-menu center);
  translate: -50% 0;
}

/* Fallback without anchor positioning when the menu fits neither below nor above its trigger
   (clipped by a short scroll container): a bottom sheet in the top layer. The attribute
   selectors outrank the data-side / data-align placement rules above. */
.dropdown[data-side][data-align] > .menu.menu-sheet {
  position: fixed;
  inset: auto 0.5rem calc(0.5rem + env(safe-area-inset-bottom)) 0.5rem;
  width: auto;
  max-width: 24rem;
  height: auto;
  margin: 0 auto;
  translate: none;
  box-shadow: var(--shadow-lg);
  transform-origin: bottom center;
}

.menu[data-state="closed"] {
  animation: menu-out 100ms ease-in forwards;
  pointer-events: none;
}

.menu:focus {
  outline: none;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 2.25rem;
  padding: 0.375rem 0.5rem;
  border: 0;
  border-radius: calc(var(--radius) - 4px);
  background: transparent;
  color: inherit;
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
}

.menu-item:hover,
.menu-item:focus {
  outline: none;
  background: var(--accent);
  color: var(--accent-foreground);
}

.menu-item-label {
  flex: 1;
  min-width: 0;
}

.menu-item[data-tone="destructive"],
.menu-item[data-tone="destructive"]:focus,
.menu-item[data-tone="destructive"]:hover {
  color: var(--destructive-text);
}

.menu-item[data-tone="destructive"]:focus,
.menu-item[data-tone="destructive"]:hover {
  background: var(--destructive-soft);
}

.menu-item[data-tone="warn"] .icon {
  color: var(--warn);
}

.menu-item[data-tone="warn"] {
  color: var(--warn-text);
}

.menu-item[data-tone="rose"],
.menu-item[data-tone="rose"]:focus,
.menu-item[data-tone="rose"]:hover {
  color: var(--rose-text);
}

.menu-item[aria-disabled="true"] {
  opacity: 0.5;
  pointer-events: none;
}

.menu-separator {
  height: 1px;
  margin: 0.25rem -0.25rem;
  background: var(--border);
}

@media (pointer: coarse) {
  .menu-item {
    min-height: 2.75rem;
  }
}

/* ------------------------------------------------------------------------------------------ */
/* Dialog + sheet (<dialog>.showModal())                                                       */

dialog {
  color: var(--foreground);
}

.dialog {
  position: fixed;
  inset: 0;
  width: calc(100% - 2rem);
  max-width: 32rem;
  max-height: calc(100dvh - 2rem);
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  box-shadow: var(--shadow-lg);
  animation: dialog-in 180ms ease-out;
}

.dialog::backdrop,
.sheet::backdrop {
  background: var(--overlay);
  animation: fade-in 150ms ease-out;
}

.dialog[data-state="closed"] {
  animation: dialog-out 150ms ease-in forwards;
}

.dialog[data-state="closed"]::backdrop,
.sheet[data-state="closed"]::backdrop {
  animation: fade-out 150ms ease-in forwards;
}

.dialog-content {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  padding: 1.5rem;
}

.dialog-header {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding-right: 2rem;
}

.dialog-title {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.dialog-description {
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.dialog-body {
  font-size: 0.875rem;
}

.dialog-footer {
  display: flex;
  flex-direction: column-reverse;
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .dialog-footer {
    flex-direction: row;
    justify-content: flex-end;
  }
}

.dialog-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 0;
  border-radius: calc(var(--radius) - 4px);
  background: transparent;
  color: var(--foreground);
  opacity: 0.7;
  cursor: pointer;
  transition: opacity 150ms;
}

.dialog-close:hover {
  opacity: 1;
}

.dialog-close:focus-visible {
  outline: none;
  opacity: 1;
  box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring);
}

.dialog-close:disabled {
  pointer-events: none;
  opacity: 0.3;
}

.sheet {
  position: fixed;
  top: 0;
  bottom: 0;
  width: min(85vw, 22.5rem);
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--background);
  box-shadow: var(--shadow-lg);
}

.sheet-right {
  right: 0;
  left: auto;
  border-left: 1px solid var(--border);
  animation: sheet-in-right 260ms cubic-bezier(0.32, 0.72, 0, 1);
}

.sheet-left {
  right: auto;
  left: 0;
  border-right: 1px solid var(--border);
  animation: sheet-in-left 260ms cubic-bezier(0.32, 0.72, 0, 1);
}

.sheet-bottom {
  top: auto;
  right: 0;
  left: 0;
  width: 100%;
  height: auto;
  max-height: 85dvh;
  border-top: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  animation: sheet-in-bottom 260ms cubic-bezier(0.32, 0.72, 0, 1);
}

.sheet-right[data-state="closed"] {
  animation: sheet-out-right 200ms ease-in forwards;
}

.sheet-left[data-state="closed"] {
  animation: sheet-out-left 200ms ease-in forwards;
}

.sheet-bottom[data-state="closed"] {
  animation: sheet-out-bottom 200ms ease-in forwards;
}

.sheet-w-240 { width: min(85vw, 15rem); }
.sheet-w-300 { width: min(85vw, 18.75rem); }
.sheet-w-360 { width: min(90vw, 22.5rem); }
.sheet-w-420 { width: min(92vw, 26.25rem); }
.sheet-w-480 { width: min(92vw, 30rem); }

.sheet-content {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 100%;
  max-height: inherit;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: calc(1.5rem + env(safe-area-inset-top)) 1.5rem calc(1.5rem + env(safe-area-inset-bottom));
}

.sheet-content > .dialog-close {
  top: calc(1rem + env(safe-area-inset-top));
}

.sheet-header {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  padding-right: 2rem;
}

.sheet-title {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.sheet-description {
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.sheet-body {
  font-size: 0.875rem;
}

/* ------------------------------------------------------------------------------------------ */
/* Toasts (manual popover in the top layer; plain fixed element as fallback)                  */

.toaster {
  position: fixed;
  z-index: 100;
  inset: auto;
  top: calc(0.75rem + env(safe-area-inset-top));
  left: 50%;
  display: none;
  flex-direction: column;
  gap: 0.5rem;
  width: min(24rem, calc(100vw - 2rem));
  margin: 0;
  padding: 0;
  overflow: visible;
  border: 0;
  background: transparent;
  color: var(--foreground);
  translate: -50% 0;
  pointer-events: none;
}

.toaster:not([popover]) {
  display: flex;
}

.toaster:popover-open {
  display: flex;
}

@media (min-width: 640px) {
  .toaster {
    top: auto;
    right: 1rem;
    bottom: calc(1rem + env(safe-area-inset-bottom));
    left: auto;
    translate: none;
  }
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  padding: 0.875rem 0.75rem 0.875rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--foreground);
  box-shadow: var(--shadow-lg);
  font-size: 0.875rem;
  pointer-events: auto;
  animation: toast-in 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.toast[data-state="closed"] {
  animation: fade-out 150ms ease-in forwards;
}

.toast-icon {
  display: flex;
  margin-top: 0.125rem;
  color: var(--muted-foreground);
}

.toast-success .toast-icon {
  color: var(--success-text);
}

.toast-error {
  border-color: color-mix(in srgb, var(--destructive) 50%, var(--border));
}

.toast-error .toast-icon {
  color: var(--destructive-text);
}

.toast-text {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.toast-close {
  display: grid;
  flex: none;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  border: 0;
  border-radius: calc(var(--radius) - 4px);
  background: transparent;
  color: var(--muted-foreground);
  cursor: pointer;
}

.toast-close:hover {
  color: var(--foreground);
}

/* ------------------------------------------------------------------------------------------ */
/* Dark full-screen layout: auth, notices, environment problems (C.4)                          */

.auth {
  position: absolute;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  background: #09090b;
  color: #fafafa;
  isolation: isolate;
}

.auth-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.auth-particles {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.auth-vignette {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 60% at 50% 45%, rgb(39 39 42 / 0.35) 0%, transparent 60%),
    radial-gradient(ellipse at center, transparent 35%, rgb(0 0 0 / 0.75) 100%);
}

.auth-line {
  position: absolute;
  background-image: linear-gradient(90deg, transparent 0%, rgb(129 140 248 / 0.05) 25%, rgb(99 102 241 / 0.3) 50%, rgb(129 140 248 / 0.05) 75%, transparent 100%);
  background-size: 200% 100%;
  opacity: 0.8;
}

.auth-line-h1,
.auth-line-h2,
.auth-line-h3 {
  right: 0;
  left: 0;
  height: 1px;
  transform-origin: left center;
  animation: line-draw-x 1.4s cubic-bezier(0.22, 1, 0.36, 1) both, line-shimmer-x 7s linear 1.4s infinite;
}

.auth-line-v1,
.auth-line-v2,
.auth-line-v3 {
  top: 0;
  bottom: 0;
  width: 1px;
  background-image: linear-gradient(180deg, transparent 0%, rgb(129 140 248 / 0.05) 25%, rgb(99 102 241 / 0.26) 50%, rgb(129 140 248 / 0.05) 75%, transparent 100%);
  background-size: 100% 200%;
  transform-origin: center top;
  animation: line-draw-y 1.6s cubic-bezier(0.22, 1, 0.36, 1) both, line-shimmer-y 9s linear 1.6s infinite;
}

.auth-line-h1 { top: 18%; animation-delay: 0.1s, 1.5s; }
.auth-line-h2 { top: 50%; animation-delay: 0.25s, 2.2s; }
.auth-line-h3 { top: 82%; animation-delay: 0.4s, 2.9s; }
.auth-line-v1 { left: 22%; animation-delay: 0.2s, 1.8s; }
.auth-line-v2 { left: 50%; animation-delay: 0.35s, 2.6s; }
.auth-line-v3 { left: 78%; animation-delay: 0.5s, 3.4s; }

.auth-scroll {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.auth-header {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.5rem;
  padding: env(safe-area-inset-top) max(1rem, env(safe-area-inset-right)) 0 max(1rem, env(safe-area-inset-left));
  border-bottom: 1px solid rgb(39 39 42 / 0.8);
  background: rgb(9 9 11 / 0.4);
}

.auth-brand {
  color: #a1a1aa;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.auth-help-btn {
  background: transparent;
}

.auth-main {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  padding: 1.5rem max(1rem, env(safe-area-inset-right)) calc(1.5rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
}

.auth-card {
  width: 100%;
  max-width: 24rem;
  border-color: #27272a;
  background: rgb(24 24 27 / 0.7);
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.6);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  animation: fade-up 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.auth-card .input {
  background: rgb(9 9 11 / 0.6);
}

.auth-card .tabs-list {
  background: rgb(39 39 42 / 0.7);
}

.auth-title {
  font-size: 1.5rem;
}

.auth-card-footer {
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
}

.auth-footnote {
  color: #a1a1aa;
  font-size: 0.75rem;
  text-align: center;
}

.auth-switch {
  margin: 0;
  color: var(--muted-foreground);
  font-size: 0.8125rem;
  text-align: center;
}

.auth-switch .btn-link {
  color: var(--foreground);
  font-size: 0.8125rem;
}

.auth-empty .empty-state {
  padding: 1rem 0.5rem;
}

.invite-detected {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid color-mix(in srgb, var(--success) 35%, var(--border));
  border-radius: calc(var(--radius) - 2px);
  background: var(--success-soft);
  color: var(--success-text);
  font-size: 0.875rem;
  font-weight: 500;
}

.invite-detected-text {
  flex: 1;
  min-width: 0;
}

.invite-detected .btn-link {
  color: inherit;
  font-weight: 400;
}

.lockout {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.lockout .countdown {
  font-weight: 600;
}

/* Password strength */
.strength {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  color: var(--muted-foreground);
  font-size: 0.8125rem;
}

.strength-bars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.25rem;
}

.strength-bars > span {
  height: 0.25rem;
  border-radius: 9999px;
  background: var(--muted);
  transition: background-color 150ms;
}

.strength[data-strength="none"] .strength-bars {
  display: none;
}

.strength[data-strength="schwach"] .strength-bars > span:nth-child(1) {
  background: var(--rose);
}

.strength[data-strength="mittel"] .strength-bars > span:nth-child(-n + 2) {
  background: var(--warn);
}

.strength[data-strength="gut"] .strength-bars > span {
  background: var(--success);
}

.notice-icon {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  margin-bottom: 0.5rem;
  border-radius: 9999px;
  background: var(--muted);
}

.notice-icon-rose {
  background: var(--rose-soft);
  color: var(--rose-text);
}

.origin-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
}

.origin-label {
  color: var(--muted-foreground);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.origin-value {
  flex: 1;
  min-width: 0;
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}

.steps {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.875rem;
}

.steps li::marker {
  color: var(--muted-foreground);
  font-weight: 600;
}

.step-highlight {
  font-weight: 600;
}

/* Help sheet */
.help {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.help-title {
  margin-top: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
}

.help-title:first-child {
  margin-top: 0;
}

.help-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
}

.help-features {
  display: grid;
  gap: 0.875rem;
}

.help-feature {
  display: flex;
  gap: 0.75rem;
}

.help-feature-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 9999px;
  background: var(--muted);
}

.help-feature-title {
  font-weight: 600;
}

.help-feature-text {
  color: var(--muted-foreground);
}

.notes {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin: 0;
  padding-left: 1.125rem;
  color: var(--muted-foreground);
}

.notes li::marker {
  color: var(--foreground);
}

/* ------------------------------------------------------------------------------------------ */
/* Chats list                                                                                  */

.conn {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 0.375rem;
  height: 2rem;
  padding: 0 0.5rem;
  border: 0;
  border-radius: 9999px;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 0.75rem;
  cursor: pointer;
}

.conn:hover {
  background: var(--accent);
}

.conn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--ring);
}

@media (max-width: 479px) {
  .conn-text {
    display: none;
  }

  .conn {
    width: 2rem;
    justify-content: center;
    padding: 0;
  }
}

.hint-card-body {
  display: flex;
  gap: 0.75rem;
  padding: 1rem !important;
  font-size: 0.875rem;
}

.hint-card-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  background: var(--muted);
}

.chat-list {
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  list-style: none;
}

.chat-row + .chat-row {
  border-top: 1px solid var(--border);
}

.chat-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 4.25rem;
  padding: 0.75rem 1rem;
  color: inherit;
  text-decoration: none;
  transition: background-color 150ms;
}

.chat-item:hover {
  background: var(--accent);
}

.chat-item:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: -2px;
}

.chat-item-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.chat-item-top,
.chat-item-bottom {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  min-width: 0;
}

.chat-name {
  overflow: hidden;
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.verified-mark {
  display: inline-flex;
  flex: none;
  color: var(--success-text);
}

.chat-time {
  flex: none;
  margin-left: auto;
  color: var(--muted-foreground);
  font-size: 0.75rem;
}

.has-unread .chat-time {
  color: var(--foreground);
  font-weight: 600;
}

.chat-item-bottom {
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

.chat-timer {
  display: inline-flex;
  flex: none;
}

.chat-last {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.has-unread .chat-last {
  color: var(--foreground);
}

/* ------------------------------------------------------------------------------------------ */
/* Chat (messaging-conversation look)                                                          */

.screen-chat {
  background: var(--bg-gradient);
}

.chat-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

@media (min-width: 768px) {
  .screen-chat {
    padding: 1rem;
    background: var(--muted);
  }

  .chat-card {
    max-width: 42rem;
    margin: 0 auto;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-lg);
  }
}

.chat-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  flex: none;
  align-items: center;
  gap: 0.375rem;
  padding: calc(0.5rem + env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right)) 0.5rem max(0.5rem, env(safe-area-inset-left));
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

.chat-peer {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  padding: 0.25rem 0.5rem 0.25rem 0.25rem;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.chat-peer:hover {
  background: var(--accent);
}

.chat-peer:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--ring);
}

.chat-peer-avatar {
  display: flex;
}

.chat-peer-avatar .avatar {
  box-shadow: 0 0 0 2px #6366f1, 0 2px 10px -2px rgb(124 58 237 / 0.5);
}

.chat-peer-text {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.chat-peer-name-line {
  overflow: hidden;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.chat-peer-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.625rem;
  color: var(--muted-foreground);
  font-size: 0.75rem;
}

.chat-peer-timer {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.chat-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.5rem max(0.75rem, env(safe-area-inset-right)) 0.75rem max(0.75rem, env(safe-area-inset-left));
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 768px) {
  .chat-scroll {
    padding: 0.5rem 1.25rem 1rem;
  }
}

.chat-log {
  display: flex;
  flex-direction: column;
}

.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  max-width: 80%;
  margin: 0.5rem 0;
}

.msg-in {
  margin-right: auto;
}

.msg-out {
  flex-direction: row-reverse;
  margin-left: auto;
}

.msg-avatar {
  margin-bottom: 1.75rem;
}

/* Own messages are right-aligned with no avatar (Nexus reference). */
.msg-out .msg-avatar {
  display: none;
}

/* Accent ring around partner avatars (indigo ring + soft violet glow). */
.msg-in .msg-avatar {
  box-shadow: 0 0 0 2px #6366f1, 0 2px 10px -2px rgb(124 58 237 / 0.5);
}

.msg-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  min-width: 0;
}

.msg-out .msg-stack {
  align-items: flex-end;
}

.msg-bubble {
  position: relative;
  max-width: 100%;
  padding: 0.5rem 0.8125rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  border-top-left-radius: 0.375rem;
  background: var(--accent);
  color: var(--accent-foreground);
  font-size: 0.875rem;
  line-height: 1.45;
}

.msg-in .msg-bubble {
  animation: bubble-in-left 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

@supports ((backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px))) {
  .msg-in .msg-bubble {
    background: color-mix(in srgb, var(--accent) 88%, transparent);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }
}

.msg-out .msg-bubble {
  border: 0;
  border-radius: 1rem;
  border-top-right-radius: 0.375rem;
  background: var(--grad-accent);
  color: var(--bubble-me-fg);
  box-shadow: var(--accent-shadow);
  animation: bubble-in-right 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

.msg-bubble.is-failed {
  box-shadow: 0 0 0 1px var(--destructive);
}

.msg-body {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.msg-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem;
  min-height: 1.5rem;
  color: var(--muted-foreground);
  font-size: 0.75rem;
}

.msg-out .msg-meta {
  justify-content: flex-end;
}

.msg-out .msg-actions {
  order: -1;
}

.msg-expiry,
.msg-status {
  display: inline-flex;
  align-items: center;
}

.msg-status-pending {
  opacity: 0.8;
}

.msg-retry,
.msg-retry.btn-link {
  color: var(--destructive-text);
  font-size: 0.75rem;
}

.msg-actions-trigger.btn-icon {
  width: 1.5rem;
  height: 1.5rem;
  color: var(--muted-foreground);
  opacity: 0;
  transition: opacity 150ms;
}

.msg-row:hover .msg-actions-trigger,
.msg-actions.is-open .msg-actions-trigger,
.msg-actions-trigger:focus-visible {
  opacity: 1;
}

@media (hover: none) {
  /* Touch: long-press the bubble or tap the time line; the menu offers "Kopieren". */
  .msg-bubble {
    -webkit-touch-callout: none;
    user-select: none;
    -webkit-user-select: none;
  }

  .msg-meta {
    cursor: pointer;
  }
}

.msg-system {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.25rem 0.5rem;
  align-self: center;
  max-width: 90%;
  margin: 0.75rem auto;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  background: var(--muted);
  color: var(--muted-foreground);
  font-size: 0.75rem;
  text-align: center;
}

.msg-system.is-failed {
  background: var(--destructive-soft);
}

.msg-system-time {
  opacity: 0.8;
}

.chat-composer {
  display: flex;
  flex: none;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.625rem max(0.75rem, env(safe-area-inset-right)) calc(0.625rem + env(safe-area-inset-bottom)) max(0.75rem, env(safe-area-inset-left));
  border-top: 1px solid var(--border);
  background: var(--card);
}

/* Rounded pill holding the attach/camera buttons and the text input; the gradient send
   button sits to its right (v3.2 "Nexus" composer). */
.composer-pill {
  display: flex;
  flex: 1;
  align-items: flex-end;
  gap: 0.125rem;
  min-width: 0;
  padding: 0.25rem 0.5rem 0.25rem 0.25rem;
  border: 1px solid var(--input);
  border-radius: 1.375rem;
  background: var(--background);
  transition: border-color 150ms, box-shadow 150ms;
}

.composer-pill:focus-within {
  border-color: var(--ring);
  box-shadow: 0 0 0 1px var(--ring);
}

.composer-input.textarea {
  flex: 1;
  min-height: 2rem;
  max-height: 10rem;
  padding: 0.3125rem 0.375rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  line-height: 1.5rem;
  resize: none;
  overflow-y: auto;
}

.composer-input.textarea:focus-visible {
  outline: none;
  box-shadow: none;
}

.composer-icon-btn.btn-icon {
  flex: none;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  color: var(--muted-foreground);
}

.composer-icon-btn.btn-icon:hover {
  color: var(--foreground);
  background: var(--accent);
}

.composer-send.btn-icon {
  flex: none;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
}

.composer-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (pointer: coarse) {
  .composer-input.textarea {
    min-height: 2.25rem;
    padding-top: 0.4375rem;
    padding-bottom: 0.4375rem;
  }

  .composer-send.btn-icon {
    width: 2.75rem;
    height: 2.75rem;
  }

  .composer-icon-btn.btn-icon {
    width: 2.5rem;
    height: 2.5rem;
  }
}

/* ------------------------------------------------------------------------------------------ */
/* Attachments (images, files, upload rows) + typing indicator (v3.2)                          */

/* File bubbles frame their content with a thin gradient/accent border instead of text padding. */
.msg-bubble-file {
  padding: 0.25rem;
}

.msg-attach {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  max-width: 15rem;
}

.msg-image-btn {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0.75rem;
  background: transparent;
  overflow: hidden;
  line-height: 0;
  cursor: pointer;
}

.msg-image-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--ring);
}

.msg-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 20rem;
  border-radius: 0.75rem;
  object-fit: cover;
}

.msg-image-frame {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 8rem;
  min-height: 6rem;
  border-radius: 0.75rem;
  background: color-mix(in srgb, currentColor 12%, transparent);
  color: inherit;
}

.msg-image-frame .spinner {
  color: currentColor;
  opacity: 0.7;
}

.msg-media-play {
  position: absolute;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 9999px;
  background: rgb(0 0 0 / 0.5);
  color: #fff;
  pointer-events: none;
}

.msg-file-card {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  width: 100%;
  min-width: 11rem;
  padding: 0.5rem 0.625rem;
  border: 0;
  border-radius: 0.75rem;
  background: color-mix(in srgb, currentColor 10%, transparent);
  color: inherit;
  text-align: left;
  font: inherit;
}

button.msg-file-card {
  cursor: pointer;
}

button.msg-file-card:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--ring);
}

.msg-file-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 0.5rem;
  background: color-mix(in srgb, currentColor 14%, transparent);
}

.msg-file-text {
  display: flex;
  flex-direction: column;
  gap: 0.0625rem;
  min-width: 0;
  flex: 1;
}

.msg-file-name {
  overflow: hidden;
  font-size: 0.8125rem;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.msg-file-meta {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.75rem;
  opacity: 0.75;
}

.msg-file-download.btn-icon {
  flex: none;
  width: 2rem;
  height: 2rem;
  color: inherit;
}

.msg-video {
  display: block;
  width: 100%;
  max-height: 20rem;
  border-radius: 0.75rem;
  background: #000;
}

.msg-audio {
  width: 100%;
  min-width: 12rem;
}

.msg-uploading {
  opacity: 0.85;
}

/* Typing indicator: three bouncing dots in a partner-style bubble. */
.typing {
  display: inline-flex;
  align-items: center;
  gap: 0.3125rem;
  padding: 0.6875rem 0.875rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  border-top-left-radius: 0.375rem;
  background: var(--accent);
}

.typing-dot {
  display: block;
  width: 0.4375rem;
  height: 0.4375rem;
  border-radius: 9999px;
  background: var(--muted-foreground);
  animation: typing-bounce 1.2s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.16s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.32s;
}

/* Full-screen media viewer */
.viewer {
  position: fixed;
  inset: 0;
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: rgb(0 0 0 / 0.94);
  color: #fafafa;
}

.viewer::backdrop {
  background: rgb(0 0 0 / 0.94);
}

.viewer-scroll {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  overflow: auto;
  overscroll-behavior: contain;
}

.viewer-img {
  display: block;
  max-width: 100%;
  max-height: 100dvh;
  margin: auto;
  object-fit: contain;
  cursor: zoom-in;
}

.viewer-img.is-zoomed {
  max-width: none;
  max-height: none;
  cursor: zoom-out;
}

.viewer-bar {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: calc(0.625rem + env(safe-area-inset-top)) max(0.75rem, env(safe-area-inset-right)) 0.625rem max(0.75rem, env(safe-area-inset-left));
  background: linear-gradient(to bottom, rgb(0 0 0 / 0.65), transparent);
}

.viewer-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  font-size: 0.9375rem;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.viewer-btn.btn {
  flex: none;
  color: #fafafa;
  background: rgb(255 255 255 / 0.12);
}

.viewer-btn.btn:hover {
  background: rgb(255 255 255 / 0.2);
}

.viewer-loading {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: #fafafa;
}

/* ------------------------------------------------------------------------------------------ */
/* Invite                                                                                      */

.invite-result:focus {
  outline: none;
}

.invite-validity {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--muted);
  font-size: 0.875rem;
}

.invite-validity .countdown {
  font-size: 0.9375rem;
  font-weight: 600;
}

.invite-validity-text {
  flex: 1;
}

.invite-validity-icon {
  display: inline-flex;
}

.invite-validity.is-expired {
  border-color: color-mix(in srgb, var(--destructive) 45%, var(--border));
  background: var(--destructive-soft);
  color: var(--destructive-text);
}

.invite-card .card-title {
  font-size: 1rem;
  letter-spacing: 0;
}

.invite-card .card-header {
  padding-bottom: 0.75rem;
}

.invite-step {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.step-no {
  display: inline-grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 9999px;
  background: var(--primary);
  color: var(--primary-foreground);
  font-size: 0.75rem;
  font-weight: 600;
}

.invite-link,
.invite-code {
  padding: 0.75rem;
  border-radius: calc(var(--radius) - 2px);
  background: var(--muted);
  user-select: all;
  -webkit-user-select: all;
}

.invite-link {
  font-size: 0.8125rem;
  word-break: break-all;
}

.invite-code {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-align: center;
}

.invite-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}

.invite-item {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
  padding: 0.875rem 0;
  border-top: 1px solid var(--border);
}

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

.invite-item:last-child {
  padding-bottom: 0;
}

.invite-item-main {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.invite-item-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-weight: 500;
}

.invite-item-label {
  min-width: 0;
  overflow-wrap: anywhere;
}

.invite-item-meta {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.375rem;
  color: var(--muted-foreground);
  font-size: 0.8125rem;
}

.invite-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.invite-item.status-expired .invite-item-main {
  opacity: 0.75;
}

@media (min-width: 640px) {
  .invite-item {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }

  .invite-item-actions {
    flex: none;
    justify-content: flex-end;
  }
}

/* ------------------------------------------------------------------------------------------ */
/* Contact info, settings                                                                      */

.profile-card .card-content.profile {
  padding: 1.25rem;
}

.profile {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.profile-avatar {
  display: flex;
}

.profile-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  min-width: 0;
}

.profile-label {
  color: var(--muted-foreground);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.profile-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}

.profile-role {
  display: inline-flex;
}

.profile-role:empty {
  display: none;
}

.profile-text > .btn {
  margin-top: 0.375rem;
}

.safety-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem 0.75rem;
  margin-bottom: 1rem;
  padding: 1rem;
  border-radius: calc(var(--radius) - 2px);
  background: var(--muted);
  font-size: 1.0625rem;
  text-align: center;
}

.fp-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 0;
}

@media (max-width: 359px) {
  .safety-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    font-size: 1rem;
  }
}

.digit-group {
  letter-spacing: 0.04em;
}

.settings-list {
  display: flex;
  flex-direction: column;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.875rem 0;
  border-top: 1px solid var(--border);
}

.setting-row:first-child {
  padding-top: 0;
  border-top: 0;
}

.setting-row:last-child {
  padding-bottom: 0;
}

.setting-text {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.setting-label {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.setting-desc {
  color: var(--muted-foreground);
  font-size: 0.8125rem;
}

.setting-row > .select {
  flex: none;
  width: auto;
  min-width: 8.5rem;
}

@media (max-width: 420px) {
  .settings-list .setting-row:has(> .select) {
    flex-wrap: wrap;
  }

  .settings-list .setting-row > .select {
    width: 100%;
  }
}

.version-line {
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
}

.version-code {
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  background: var(--muted);
}

/* Admin dashboard host (admin.js renders a self-scrolling container inside). */
.screen-admin {
  overflow: hidden;
}

.admin-host {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

/* ------------------------------------------------------------------------------------------ */
/* Animations                                                                                  */

@keyframes spin {
  to {
    rotate: 360deg;
  }
}

@keyframes pulse {
  50% {
    opacity: 0.5;
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes fade-out {
  to {
    opacity: 0;
  }
}

/* "from" keyframes only: the end state is the element's own style (no transform left behind). */
@keyframes fade-up {
  from {
    opacity: 0;
    translate: 0 12px;
  }
}

@keyframes bubble-in-left {
  from {
    opacity: 0;
    translate: -12px 8px;
    scale: 0.96;
  }
}

@keyframes bubble-in-right {
  from {
    opacity: 0;
    translate: 12px 8px;
    scale: 0.96;
  }
}

@keyframes typing-bounce {
  0%, 60%, 100% {
    translate: 0 0;
    opacity: 0.45;
  }

  30% {
    translate: 0 -0.25rem;
    opacity: 1;
  }
}

@keyframes menu-in {
  from {
    opacity: 0;
    scale: 0.95;
  }
}

@keyframes menu-out {
  to {
    opacity: 0;
    scale: 0.95;
  }
}

@keyframes dialog-in {
  from {
    opacity: 0;
    scale: 0.95;
  }
}

@keyframes dialog-out {
  to {
    opacity: 0;
    scale: 0.95;
  }
}

@keyframes sheet-in-right {
  from {
    translate: 100% 0;
  }
}

@keyframes sheet-out-right {
  to {
    translate: 100% 0;
  }
}

@keyframes sheet-in-left {
  from {
    translate: -100% 0;
  }
}

@keyframes sheet-out-left {
  to {
    translate: -100% 0;
  }
}

@keyframes sheet-in-bottom {
  from {
    translate: 0 100%;
  }
}

@keyframes sheet-out-bottom {
  to {
    translate: 0 100%;
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    translate: 0 0.5rem;
  }
}

@keyframes line-draw-x {
  from {
    opacity: 0;
    scale: 0 1;
  }
}

@keyframes line-draw-y {
  from {
    opacity: 0;
    scale: 1 0;
  }
}

@keyframes line-shimmer-x {
  from {
    background-position: 200% 0;
  }

  to {
    background-position: -200% 0;
  }
}

@keyframes line-shimmer-y {
  from {
    background-position: 0 200%;
  }

  to {
    background-position: 0 -200%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after,
  *::backdrop {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  /* A busy indicator is essential motion: keep it, slowly. */
  .spinner {
    animation-duration: 1.5s !important;
    animation-iteration-count: infinite !important;
  }
}

@media (forced-colors: active) {
  .status-dot,
  .step-no,
  .switch-thumb {
    forced-color-adjust: none;
  }

  .btn,
  .input,
  .select,
  .textarea,
  .card,
  .menu {
    border: 1px solid CanvasText;
  }
}
