@import url('/app/tabelion-theme.css?v=3');

:root {
  color-scheme: light;
  font: 14px/1.5 var(--font-ui);
  --ink: var(--color-text);
  --muted: var(--color-muted);
  --teal: var(--color-primary);
  --accent: var(--color-primary);
  --border: var(--color-border);
  --bg: var(--color-background);
  --auth-radius: calc(var(--radius-card, 12px) * 2);
}
* { box-sizing: border-box; }
html { min-height: 100%; }
body { margin: 0; min-height: 100vh; color: var(--ink); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
a { color: var(--teal); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }

/* One quiet brand panel, beside the same white surface as the workspace. */
.auth-page { background: var(--color-soft); }
.auth-layout {
  display: grid;
  grid-template-columns: minmax(440px, 1.05fr) minmax(320px, .95fr);
  min-height: 100vh;
  min-height: 100dvh;
}
.auth-sheet {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 36px clamp(28px, 4vw, 72px) 24px;
  background: var(--color-surface);
  border-radius: 0 var(--auth-radius) var(--auth-radius) 0;
}
.auth-sheet-header { min-width: 0; }
.brand {
  display: inline-grid;
  grid-template-columns: 30px auto;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -.7px;
}
.brand-logo { display: block; width: 30px; height: 26px; object-fit: contain; }
.auth-content {
  width: min(100%, 380px);
  min-width: 0;
  align-self: center;
  justify-self: center;
  padding: 48px 0;
}
.auth-content--wide { width: min(100%, 500px); padding: 36px 0; }
.auth-content h1, .auth-card h1 { font-size: 29px; line-height: 1.2; letter-spacing: -.045em; font-weight: 600; margin: 0 0 12px; }
.auth-content h2, .auth-card h2 { font-size: 18px; line-height: 1.4; letter-spacing: -.02em; font-weight: 600; margin: 0 0 10px; }
.auth-intro { color: var(--muted); font-size: 14px; line-height: 1.65; margin: 0 0 28px; }
.auth-step { color: var(--muted); font-size: 12px; font-weight: 500; margin: 0 0 14px; }
.auth-identity {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 24px;
  padding: 48px;
  min-width: 0;
}
.auth-identity img { display: block; width: clamp(140px, 16vw, 250px); height: auto; }
.auth-identity-name { color: var(--ink); font-size: clamp(32px, 3.3vw, 50px); font-weight: 600; letter-spacing: -.05em; }
.auth-sheet-footer { color: var(--muted); font-size: 12px; line-height: 1.5; }
.auth-sheet-footer p { margin: 0; }
.auth-sheet-footer a { text-decoration: none; }
.auth-sheet-footer a:hover { text-decoration: underline; }

.form-stack, .auth-fields { display: grid; gap: 19px; }
.auth-fields { border: 0; padding: 0; margin: 0; min-width: 0; }
.form-stack label { display: grid; gap: 7px; font-size: 13px; font-weight: 500; color: var(--ink); min-width: 0; }
.form-stack input, .form-stack select {
  width: 100%; min-width: 0; min-height: 44px;
  background: var(--color-surface); color: var(--ink);
  border: 1px solid var(--color-input-border); border-radius: var(--radius-control, 8px);
  padding: 10px 12px; font-size: 14px;
}
.form-stack input::placeholder { color: var(--muted); opacity: 1; }
.form-stack input:focus, .form-stack select:focus { border-color: var(--teal); outline: 2px solid var(--color-selected); outline-offset: 1px; }
.form-stack input[readonly] { background: var(--color-soft); color: var(--muted); }
.form-stack input[aria-invalid="true"] { border-color: var(--color-danger); }
.password-control { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; border: 1px solid var(--color-input-border); border-radius: var(--radius-control, 8px); }
.password-control:focus-within { border-color: var(--teal); outline: 2px solid var(--color-selected); outline-offset: 1px; }
.password-control input { border: 0; background: transparent; }
.password-control input:focus { outline: 0; }
.password-toggle { color: var(--muted); background: transparent; border: 0; min-height: 42px; padding: 0 13px; border-radius: var(--radius-control, 8px); cursor: pointer; font-size: 12px; font-weight: 500; }
.password-toggle:hover { color: var(--ink); }
.field-help, .auth-help { color: var(--muted); font-size: 12px; line-height: 1.6; font-weight: 400; margin: 0; }
.auth-help { margin-top: 18px; }
.auth-code { font-size: 23px !important; letter-spacing: .32em; font-variant-numeric: tabular-nums; text-align: center; }
.auth-recipient { overflow-wrap: anywhere; color: var(--ink); font-weight: 500; }
.btn {
  display: inline-grid; place-items: center;
  min-height: 44px; padding: 10px 16px;
  border: 1px solid var(--border); border-radius: var(--radius-control, 8px);
  color: var(--ink); background: var(--color-surface); font-size: 14px; font-weight: 500;
  text-decoration: none; cursor: pointer;
}
.btn:hover:not(:disabled) { background: var(--color-hover); }
.btn-primary { background: var(--teal); border-color: var(--teal); color: white; font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--color-primary-hover); border-color: var(--color-primary-hover); }
.btn:disabled, .password-toggle:disabled { opacity: .55; cursor: not-allowed; }
.btn-wide { width: 100%; }
.auth-link { color: var(--muted); background: transparent; border: 0; padding: 5px 0; font-size: 13px; font-weight: 500; text-decoration: none; cursor: pointer; }
.auth-link:hover { color: var(--teal); text-decoration: underline; }
.auth-actions { display: grid; justify-items: start; gap: 14px; margin-top: 22px; }
.auth-methods { margin-top: 24px; display: grid; gap: 18px; }
.auth-divider { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); align-items: center; gap: 14px; color: var(--muted); font-size: 12px; }
.auth-divider::before, .auth-divider::after { content: ''; height: 1px; background: var(--border); }
.auth-mode { display: inline-block; margin-bottom: 14px; background: var(--color-selected); color: var(--color-primary-hover); font-size: 11px; font-weight: 500; border-radius: 5px; padding: 4px 8px; }
.notice, .error-message { border: 1px solid var(--border); border-radius: var(--radius-control, 8px); padding: 11px 13px; margin: 0; font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.notice { background: var(--color-selected); color: var(--color-primary-hover); }
.error-message { background: var(--color-danger-bg); color: var(--color-danger); }
.auth-state { display: grid; gap: 17px; }
.auth-state > p { margin: 0; color: var(--muted); line-height: 1.65; }
.auth-state-icon { display: grid; place-items: center; width: 42px; height: 42px; color: var(--color-success); background: var(--color-success-bg); border-radius: 10px; font-size: 24px; }
.auth-state-note { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 18px 0 0; }
.auth-status { min-height: 20px; color: var(--muted); font-size: 12px; line-height: 1.5; margin: 0 0 16px; }
.auth-form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 19px; }
.auth-form-grid > .span-2 { grid-column: 1 / -1; }
.auth-summary { display: grid; gap: 6px; padding: 13px 14px; border: 1px solid var(--border); border-radius: var(--radius-control, 8px); margin-bottom: 23px; }
.auth-summary strong { font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.auth-summary span { color: var(--muted); font-size: 12px; }
#totp-step { display: grid; gap: 16px; }
#totp-step p { margin: 0; }
#totp-step img { display: block; width: min(220px,100%); height: auto; justify-self: center; border: 1px solid var(--border); border-radius: 10px; background: var(--color-surface); padding: 8px; }
#totp-step .form-stack { width: 100%; }
.auth-bottom-message { margin-top: 18px; }
.auth-content > .error-message:not([hidden]), .auth-content > .notice:not([hidden]) { margin-bottom: 18px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Compatibility for the private operator page until its own shell is rendered. */
.auth-card { width: min(100%,480px); display: grid; gap: 0; margin: 48px auto; padding: 32px; border: 1px solid var(--border); border-radius: var(--radius-card,12px); background: var(--color-surface); }
.auth-card.setup-card { width: min(100%,620px); }
.auth-card > .brand { margin-bottom: 30px; }
.auth-card > p { color: var(--muted); font-size: 13px; line-height: 1.65; margin: 0 0 24px; }
.small-upper { color: var(--muted); font-size: 12px; margin: 0 0 8px; }
.auth-footer { margin-top: 24px; border-top: 1px solid var(--border); padding-top: 18px; font-size: 13px; }

@media (max-width: 900px) {
  .auth-layout { grid-template-columns: minmax(0,1fr); padding: 12px; }
  .auth-sheet { min-height: calc(100vh - 24px); min-height: calc(100dvh - 24px); padding: 26px 28px 22px; border-radius: var(--radius-card,12px); }
  .auth-identity { display: none; }
  .auth-content { padding: 42px 0; }
  .auth-content--wide { padding: 32px 0; }
}
@media (max-width: 480px) {
  .auth-layout { padding: 0; }
  .auth-sheet { min-height: 100vh; min-height: 100dvh; padding: 24px 22px 20px; border-radius: 0; }
  .auth-content h1 { font-size: 27px; }
  .auth-form-grid { grid-template-columns: minmax(0,1fr); }
  .auth-form-grid > .span-2 { grid-column: auto; }
  .auth-card { margin: 16px auto; width: calc(100% - 32px); padding: 26px 22px; }
}
