/* BizTeman – sign-in screen and team admin ("Ledger" style). All classes prefixed auth-.
   Colours come from CSS variables with fallbacks so the app theme can override them. */

.auth-screen, .auth-admin {
  --auth-accent: var(--x-accent, #0B6E99);
  --auth-accent-ink: var(--x-accent-ink, #FFFFFF);
  --auth-ink: var(--x-ink, #101828);
  --auth-muted: var(--x-muted, #667085);
  --auth-line: var(--x-line, #E4E7EC);
  --auth-bg: var(--x-bg, #F8F9FB);
  --auth-surface: var(--x-surface, #FFFFFF);
  --auth-danger: var(--x-danger, #B42318);
  --auth-danger-bg: var(--x-danger-bg, #FEF3F2);
  --auth-ok: var(--x-ok, #067647);
  --auth-ok-bg: var(--x-ok-bg, #ECFDF3);
  --auth-warn: var(--x-warn, #B54708);
  --auth-warn-bg: var(--x-warn-bg, #FFFAEB);
  --auth-radius: var(--x-radius, 8px);
  font-family: var(--x-font, 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif);
  color: var(--auth-ink);
  font-size: 14px;
  line-height: 1.5;
}

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--auth-bg);
  box-sizing: border-box;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--auth-surface);
  border: 1px solid var(--auth-line);
  border-radius: var(--auth-radius);
  padding: 32px 28px;
  box-sizing: border-box;
}

.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; margin-bottom: 24px; }
.auth-brand-mark {
  width: 28px; height: 28px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--auth-accent); color: var(--auth-accent-ink); font-size: 14px; font-weight: 700;
}

.auth-title { font-size: 20px; font-weight: 600; margin: 0 0 4px; letter-spacing: -0.01em; }
.auth-subtitle { color: var(--auth-muted); margin: 0 0 24px; }

.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-form--inline { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.auth-form--inline .auth-field { flex: 1 1 200px; }
.auth-form--inline .auth-msg { flex-basis: 100%; }

.auth-field { display: flex; flex-direction: column; gap: 6px; }
.auth-label { font-weight: 500; font-size: 13px; }
.auth-hint { color: var(--auth-muted); font-size: 12px; margin: 0; }
.auth-muted { color: var(--auth-muted); }
.auth-nowrap { white-space: nowrap; }

.auth-input {
  font: inherit; color: inherit; background: var(--auth-surface);
  border: 1px solid var(--auth-line); border-radius: var(--auth-radius);
  padding: 9px 12px; min-height: 40px; box-sizing: border-box; width: 100%;
}
.auth-input:focus { outline: none; border-color: var(--auth-accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--auth-accent) 18%, transparent); }
.auth-input--compact { min-height: 32px; padding: 4px 8px; width: auto; }

.auth-btn {
  font: inherit; font-weight: 500; cursor: pointer; border-radius: var(--auth-radius);
  border: 1px solid var(--auth-line); background: var(--auth-surface); color: var(--auth-ink);
  padding: 9px 16px; min-height: 40px; transition: background-color 120ms ease, border-color 120ms ease;
}
.auth-btn:hover { background: var(--auth-bg); }
.auth-btn:focus-visible { outline: 2px solid var(--auth-accent); outline-offset: 2px; }
.auth-btn:disabled { opacity: 0.6; cursor: progress; }
.auth-btn--primary { background: var(--auth-accent); border-color: var(--auth-accent); color: var(--auth-accent-ink); }
.auth-btn--primary:hover { background: color-mix(in srgb, var(--auth-accent) 88%, #000); }
.auth-btn--danger { background: var(--auth-danger); border-color: var(--auth-danger); color: #FFFFFF; }
.auth-btn--danger:hover { background: color-mix(in srgb, var(--auth-danger) 88%, #000); }
.auth-btn--ghost { background: transparent; border-color: transparent; }
.auth-btn--small { padding: 4px 10px; min-height: 30px; font-size: 13px; }
.auth-btn--block { width: 100%; }

.auth-msg { margin: 0; padding: 10px 12px; border-radius: var(--auth-radius); font-size: 13px; }
.auth-msg[hidden] { display: none; }
.auth-msg--error { background: var(--auth-danger-bg); color: var(--auth-danger); }
.auth-msg--ok { background: var(--auth-ok-bg); color: var(--auth-ok); }
.auth-footnote { color: var(--auth-muted); font-size: 12px; margin: 4px 0 0; text-align: center; }

/* ---------- admin panel ---------- */

.auth-admin { display: flex; flex-direction: column; gap: 20px; max-width: 1040px; }
.auth-section { background: var(--auth-surface); border: 1px solid var(--auth-line); border-radius: var(--auth-radius); padding: 20px; }
.auth-section-title { font-size: 15px; font-weight: 600; margin: 0 0 4px; }
.auth-section > .auth-muted { margin: 0 0 16px; }

.auth-table-wrap { overflow-x: auto; margin-top: 8px; }
.auth-table { width: 100%; border-collapse: collapse; }
.auth-table th {
  text-align: left; font-size: 12px; font-weight: 500; color: var(--auth-muted);
  text-transform: uppercase; letter-spacing: 0.04em; padding: 8px 12px; border-bottom: 1px solid var(--auth-line);
}
.auth-table td { padding: 10px 12px; border-bottom: 1px solid var(--auth-line); vertical-align: middle; }
.auth-table tr:last-child td { border-bottom: 0; }
.auth-table--dense td { padding: 6px 12px; font-size: 13px; }
.auth-row--warn td { background: var(--auth-warn-bg); }
.auth-actions { white-space: nowrap; }
.auth-actions .auth-btn + .auth-btn { margin-left: 6px; }

.auth-chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; border: 1px solid transparent; }
.auth-chip--ok { background: var(--auth-ok-bg); color: var(--auth-ok); }
.auth-chip--warn { background: var(--auth-warn-bg); color: var(--auth-warn); }
.auth-chip--off { background: var(--auth-bg); color: var(--auth-muted); border-color: var(--auth-line); }
.auth-chip--owner { background: color-mix(in srgb, var(--auth-accent) 10%, transparent); color: var(--auth-accent); }

.auth-confirm { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.auth-confirm-q { font-size: 13px; }

.auth-secret {
  border: 1px solid var(--auth-accent); border-radius: var(--auth-radius); padding: 16px 20px;
  background: color-mix(in srgb, var(--auth-accent) 5%, var(--auth-surface));
  display: flex; flex-direction: column; gap: 8px; align-items: flex-start;
}
.auth-secret-title { font-weight: 600; }
.auth-secret-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.auth-code {
  font-family: var(--x-mono, 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 15px; padding: 6px 10px; background: var(--auth-surface); border: 1px solid var(--auth-line);
  border-radius: 6px; user-select: all; letter-spacing: 0.03em;
}

@media (max-width: 640px) {
  .auth-card { padding: 24px 20px; }
  .auth-section { padding: 16px; }
  .auth-form--inline { flex-direction: column; align-items: stretch; }
}
