:root {
  color-scheme: light;
  --color-ink: #13202b;
  --color-ink-soft: #3e5060;
  --color-muted: #586b79;
  --color-line: #d8e1e7;
  --color-line-strong: #b8c7d1;
  --color-surface: #ffffff;
  --color-surface-soft: #f4f7f8;
  --color-canvas: #eaf0f2;
  --color-brand: #087f7a;
  --color-brand-dark: #075e5b;
  --color-brand-soft: #dff4f1;
  --color-navy: #102b3a;
  --color-success: #157347;
  --color-success-soft: #e9f7ef;
  --color-warning: #9a5900;
  --color-warning-soft: #fff5df;
  --color-danger: #b42318;
  --color-danger-soft: #fff0ee;
  --color-focus: #0b79d0;
  --shadow-panel: 0 18px 48px rgb(16 43 58 / 10%);
  --shadow-control: 0 8px 20px rgb(16 43 58 / 10%);
  --radius-panel: 18px;
  --radius-control: 10px;
  --content-width: 1480px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--color-canvas);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--color-ink);
  background: var(--color-canvas);
  line-height: 1.5;
}

body.app-page {
  background:
    radial-gradient(circle at 8% 0%, rgb(8 127 122 / 9%), transparent 31rem),
    var(--color-canvas);
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

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

button,
a.button-link,
summary {
  -webkit-tap-highlight-color: transparent;
}

button,
a.button-link {
  min-height: 44px;
  border: 0;
  border-radius: var(--radius-control);
  cursor: pointer;
  font-weight: 750;
  transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

button:hover:not(:disabled),
a.button-link:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

:where(button, a, input, select, textarea, summary):focus-visible {
  outline: 3px solid rgb(11 121 208 / 38%);
  outline-offset: 3px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--color-line-strong);
  border-radius: var(--radius-control);
  padding: 10px 12px;
  color: var(--color-ink);
  background: var(--color-surface);
  box-shadow: 0 1px 2px rgb(16 43 58 / 4%);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #8fa4b1;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--color-focus);
  box-shadow: 0 0 0 3px rgb(11 121 208 / 12%);
}

input[readonly] {
  color: var(--color-ink-soft);
  background: var(--color-surface-soft);
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 10px;
  left: 10px;
  translate: 0 -160%;
  border-radius: 8px;
  padding: 10px 14px;
  color: #fff;
  background: var(--color-navy);
  font-weight: 800;
}

.skip-link:focus {
  translate: 0;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--color-brand-dark);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.panel {
  border: 1px solid var(--color-line);
  border-radius: var(--radius-panel);
  background: var(--color-surface);
  box-shadow: var(--shadow-panel);
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button,
.button-link {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  text-align: center;
  text-decoration: none;
}

.primary-button,
.button-link.primary-button {
  color: #fff;
  background: var(--color-brand);
  box-shadow: 0 8px 20px rgb(8 127 122 / 20%);
}

.primary-button:hover:not(:disabled),
.button-link.primary-button:hover {
  background: var(--color-brand-dark);
}

.secondary-button,
.button-link.secondary-button {
  border: 1px solid var(--color-line-strong);
  color: var(--color-ink);
  background: var(--color-surface);
}

.secondary-button:hover:not(:disabled),
.button-link.secondary-button:hover {
  border-color: var(--color-brand);
  color: var(--color-brand-dark);
  background: var(--color-brand-soft);
}

.ghost-button {
  border: 1px solid transparent;
  color: var(--color-ink-soft);
  background: transparent;
}

.ghost-button:hover:not(:disabled) {
  border-color: var(--color-line);
  color: var(--color-ink);
  background: var(--color-surface-soft);
}

.danger-button {
  border: 1px solid #f0b8b3;
  color: var(--color-danger);
  background: var(--color-danger-soft);
}

.full-button {
  width: 100%;
}

.field,
.stack-form {
  display: grid;
}

.field {
  gap: 7px;
}

.stack-form {
  gap: 18px;
}

.field > label,
.field-label {
  color: var(--color-ink-soft);
  font-size: 0.82rem;
  font-weight: 800;
}

.field-hint,
.form-status {
  min-height: 1.25em;
  margin: 0;
  color: var(--color-muted);
  font-size: 0.78rem;
}

.password-control {
  position: relative;
}

.password-control input {
  padding-right: 76px;
}

.password-toggle {
  position: absolute;
  top: 5px;
  right: 5px;
  min-height: 36px;
  padding: 6px 10px;
  color: var(--color-brand-dark);
  background: transparent;
  font-size: 0.78rem;
}

.notice {
  border: 1px solid var(--color-line);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--color-ink-soft);
  background: var(--color-surface-soft);
  font-weight: 700;
}

.notice-error {
  border-color: #f0b8b3;
  color: var(--color-danger);
  background: var(--color-danger-soft);
}

.notice-success {
  border-color: #a9d9bd;
  color: var(--color-success);
  background: var(--color-success-soft);
}

.auth-page {
  display: grid;
  background:
    radial-gradient(circle at 14% 12%, rgb(70 188 177 / 24%), transparent 26rem),
    radial-gradient(circle at 90% 86%, rgb(8 127 122 / 12%), transparent 32rem),
    var(--color-navy);
}

.auth-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(390px, 480px);
  gap: clamp(40px, 8vw, 120px);
  width: min(1180px, calc(100% - 48px));
  min-height: 100vh;
  margin: 0 auto;
  align-items: center;
  padding: 48px 0;
}

.auth-shell-compact {
  grid-template-columns: minmax(0, 0.9fr) minmax(420px, 520px);
}

.auth-shell-minimal {
  grid-template-columns: minmax(280px, 440px);
  width: min(440px, calc(100% - 32px));
  justify-content: center;
}

.auth-introduction {
  max-width: 620px;
  color: #d9e6ea;
}

.auth-introduction .eyebrow {
  color: #8de0d7;
}

.auth-introduction h1 {
  max-width: 13ch;
  margin: 18px 0;
  color: #fff;
  font-size: clamp(2.2rem, 5vw, 4.5rem);
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.auth-introduction > p:not(.eyebrow) {
  max-width: 55ch;
  color: #c1d2d8;
  font-size: clamp(1rem, 1.6vw, 1.18rem);
}

.brand-mark {
  display: grid;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  place-items: center;
  color: var(--color-navy);
  background: #8de0d7;
  box-shadow: 0 16px 38px rgb(0 0 0 / 18%);
  font-size: 1.5rem;
  font-weight: 900;
}

.brand-mark-small {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  font-size: 1.05rem;
}

.auth-benefits {
  display: grid;
  gap: 10px;
  margin: 30px 0 0;
  padding: 0;
  list-style: none;
}

.auth-benefits li {
  position: relative;
  padding-left: 30px;
}

.auth-benefits li::before {
  position: absolute;
  top: 0.15em;
  left: 0;
  display: grid;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  content: "✓";
  place-items: center;
  color: var(--color-navy);
  background: #8de0d7;
  font-size: 0.75rem;
  font-weight: 900;
}

.auth-panel {
  width: 100%;
  padding: clamp(24px, 4vw, 42px);
}

.auth-panel-heading {
  margin-bottom: 24px;
}

.auth-panel-heading h2 {
  margin: 0;
  font-size: clamp(1.65rem, 3vw, 2.15rem);
  letter-spacing: -0.025em;
}

.auth-panel-minimal .auth-panel-heading h1 {
  margin: 0;
  font-size: clamp(1.65rem, 5vw, 2.15rem);
  letter-spacing: -0.025em;
}

.auth-panel-heading > p:last-child,
.auth-footnote {
  color: var(--color-muted);
}

.auth-panel-heading > p:last-child {
  margin: 8px 0 0;
}

.auth-panel > .notice {
  margin: 0 0 20px;
}

.auth-footnote {
  margin: 22px 0 0;
  font-size: 0.75rem;
  text-align: center;
}

.password-requirements {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin: -4px 0 0;
  padding: 0;
  color: var(--color-muted);
  font-size: 0.76rem;
  list-style: none;
}

.password-requirements li {
  position: relative;
  padding-left: 20px;
}

.password-requirements li::before {
  position: absolute;
  left: 0;
  content: "○";
  font-weight: 900;
}

.password-requirements li[data-valid="true"] {
  color: var(--color-success);
}

.password-requirements li[data-valid="true"]::before {
  content: "✓";
}

.site-header {
  position: relative;
  z-index: 20;
  border-bottom: 1px solid rgb(255 255 255 / 10%);
  color: #fff;
  background: var(--color-navy);
  box-shadow: 0 10px 28px rgb(16 43 58 / 18%);
}

.site-header-inner {
  display: flex;
  gap: 24px;
  width: min(var(--content-width), calc(100% - 48px));
  min-height: 76px;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
}

.site-brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: #fff;
  text-decoration: none;
}

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

.site-brand strong {
  line-height: 1.2;
}

.site-brand small {
  color: #aebfc8;
}

.session-actions,
.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.site-header .secondary-button,
.site-header .ghost-button {
  border-color: #47606d;
  color: #fff;
  background: rgb(255 255 255 / 6%);
}

.site-header .secondary-button:hover,
.site-header .ghost-button:hover {
  color: #fff;
  background: rgb(255 255 255 / 13%);
}

.signed-in-user {
  color: #bdccd3;
  font-size: 0.82rem;
}

.header-sign-out {
  display: flex;
  margin: 0;
}

.page-container {
  width: min(var(--content-width), calc(100% - 48px));
  margin: 0 auto;
  padding: 36px 0 64px;
}

.page-heading {
  max-width: 750px;
  margin-bottom: 28px;
}

.page-heading h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.1rem);
  letter-spacing: -0.035em;
}

.page-heading > p:last-child,
.panel-intro {
  color: var(--color-muted);
}

.operator-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  align-items: start;
}

.operator-panel {
  min-width: 0;
  overflow: hidden;
  padding: 24px;
}

.panel-heading {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.panel-heading h2,
.panel-heading h3 {
  margin: 0;
  letter-spacing: -0.015em;
}

.inline-create-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  border-bottom: 1px solid var(--color-line);
  padding-bottom: 22px;
}

.inline-create-form > button {
  margin-top: 27px;
}

.operator-list {
  display: grid;
  gap: 0;
}

.operator-row {
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--color-line);
  padding: 16px 0;
}

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

.operator-row > div:first-child {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.operator-row strong,
.operator-row span {
  overflow-wrap: anywhere;
}

.operator-row .row-meta {
  color: var(--color-muted);
  font-size: 0.78rem;
}

.status-chip {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  padding: 4px 9px;
  color: var(--color-success);
  background: var(--color-success-soft);
  font-size: 0.68rem;
  font-weight: 850;
  text-transform: uppercase;
}

.status-chip[data-status="blocked"] {
  color: var(--color-danger);
  background: var(--color-danger-soft);
}

.loading-placeholder,
.empty-state {
  margin: 0;
  border: 1px dashed var(--color-line-strong);
  border-radius: 12px;
  padding: 16px;
  color: var(--color-muted);
  background: var(--color-surface-soft);
  text-align: center;
}

.status-notice {
  margin: 0 0 20px;
}

.temporary-password-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 20px;
  align-items: center;
  margin-bottom: 24px;
  border: 1px solid #e8c77b;
  border-radius: var(--radius-panel);
  padding: 20px;
  background: var(--color-warning-soft);
  box-shadow: var(--shadow-control);
}

.temporary-password-panel h2,
.temporary-password-panel p {
  margin-top: 0;
}

.temporary-password-panel p:last-child {
  margin-bottom: 0;
  color: var(--color-warning);
}

.temporary-password-value {
  display: flex;
  gap: 10px;
  align-items: center;
}

.temporary-password-value code {
  border: 1px solid #d9b760;
  border-radius: 9px;
  padding: 10px 12px;
  color: var(--color-ink);
  background: #fff;
  font-size: 1rem;
  font-weight: 800;
}

.reauth-dialog {
  width: min(520px, calc(100% - 32px));
  border: 1px solid var(--color-line);
  border-radius: var(--radius-panel);
  padding: 28px;
  color: var(--color-ink);
  background: var(--color-surface);
  box-shadow: 0 28px 80px rgb(5 24 35 / 28%);
}

.reauth-dialog::backdrop {
  background: rgb(6 27 39 / 62%);
  backdrop-filter: blur(3px);
}

.dialog-heading h2 {
  margin: 0;
}

.dialog-heading p:last-child {
  color: var(--color-muted);
}

.dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

@media (max-width: 900px) {
  .auth-shell,
  .auth-shell-compact {
    grid-template-columns: 1fr;
    gap: 30px;
    width: min(620px, calc(100% - 32px));
    padding: 32px 0;
  }

  .auth-shell-minimal {
    grid-template-columns: minmax(0, 440px);
    width: min(440px, calc(100% - 32px));
  }

  .auth-introduction h1 {
    max-width: 16ch;
    font-size: clamp(2rem, 8vw, 3.2rem);
  }

  .auth-benefits {
    display: none;
  }

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

  .temporary-password-panel {
    grid-template-columns: 1fr;
  }

  .temporary-password-value {
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  .auth-page {
    align-items: start;
    background: var(--color-navy);
  }

  .auth-shell,
  .auth-shell-compact {
    width: 100%;
    gap: 20px;
    padding: 24px 14px;
  }

  .auth-shell-minimal {
    width: 100%;
  }

  .auth-introduction {
    padding: 6px 8px 0;
  }

  .auth-introduction h1 {
    margin: 12px 0 10px;
    font-size: clamp(1.8rem, 10vw, 2.6rem);
  }

  .auth-introduction > p:not(.eyebrow) {
    margin-bottom: 0;
    font-size: 0.94rem;
  }

  .brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 13px;
  }

  .auth-panel {
    padding: 24px 18px;
  }

  .password-requirements {
    grid-template-columns: 1fr;
  }

  .site-header-inner,
  .page-container {
    width: min(100% - 24px, var(--content-width));
  }

  .site-header-inner {
    min-height: 68px;
  }

  .session-actions .signed-in-user {
    display: none;
  }

  .site-brand small {
    display: none;
  }

  .page-container {
    padding: 24px 0 44px;
  }

  .operator-panel {
    padding: 18px;
  }

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

  .inline-create-form > button {
    width: 100%;
    margin-top: 0;
  }

  .operator-row {
    align-items: stretch;
    flex-direction: column;
  }

  .operator-row .header-actions,
  .operator-row .header-actions button,
  .operator-row .button-link {
    width: 100%;
  }

  .temporary-password-value,
  .temporary-password-value code,
  .temporary-password-value button {
    width: 100%;
  }

  .temporary-password-value code {
    overflow-x: auto;
  }

  .reauth-dialog {
    padding: 22px 18px;
  }

  .dialog-actions {
    flex-direction: column-reverse;
  }

  .dialog-actions button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
