:root {
  --paper: #f7f5f1;
  --card: #ffffff;
  --ink: #171715;
  --muted: #67665f;
  --line: #dedbd4;
  --soft: #efede7;
  --orange: #ef672c;
  --orange-dark: #d85018;
  --danger: #a9332b;
  --success: #216647;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, transparent 0 48%, rgba(23, 23, 21, 0.035) 48% 52%, transparent 52%) 0 0 / 12px 12px,
    var(--paper);
}

button, input { font: inherit; }

.site-header {
  width: min(1120px, calc(100% - 40px));
  height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 760;
  letter-spacing: -0.02em;
}

.brand-mark {
  width: 16px;
  height: 16px;
  background: var(--orange);
  clip-path: polygon(50% 0, 63% 18%, 85% 15%, 88% 38%, 100% 50%, 82% 63%, 85% 85%, 62% 88%, 50% 100%, 37% 82%, 15% 85%, 12% 62%, 0 50%, 18% 37%, 15% 15%, 38% 12%);
}

.product-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.page-shell {
  width: min(480px, calc(100% - 32px));
  margin: 7vh auto 40px;
}

.auth-card {
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: 0 24px 70px rgba(34, 31, 25, 0.09);
  padding: clamp(28px, 6vw, 46px);
}

.eyebrow {
  margin-bottom: 16px;
  color: var(--orange-dark);
  font-size: 0.74rem;
  font-weight: 780;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 13ch;
  font-size: clamp(2rem, 7vw, 3rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

h2 {
  margin: 0 0 14px;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.lede {
  margin: 18px 0 26px;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.55;
}

label {
  display: block;
  margin: 18px 0 7px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

input {
  width: 100%;
  height: 48px;
  border: 1px solid #c9c5bc;
  border-radius: 2px;
  padding: 0 13px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

input:focus {
  border-color: var(--ink);
  box-shadow: 0 0 0 3px rgba(239, 103, 44, 0.14);
}

.button {
  min-height: 46px;
  border: 1px solid transparent;
  border-radius: 2px;
  padding: 11px 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 720;
  text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: 0.6; }
.full { width: 100%; }

.button-primary {
  background: var(--ink);
  color: #fff;
}

.button-primary:hover:not(:disabled) { background: #2b2a26; }

.button-secondary {
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.button-link {
  margin-top: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 0.88rem;
}

.button-danger {
  min-height: 36px;
  border-color: #e6c1be;
  background: #fff;
  color: var(--danger);
  padding: 7px 12px;
}

form .button-primary { margin-top: 22px; }

.button-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
  margin-top: 22px;
}

.info-panel, .empty-state {
  margin: 24px 0;
  border-left: 3px solid var(--orange);
  background: var(--soft);
  padding: 16px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.info-panel p { margin: 6px 0 0; color: var(--muted); }

.consent-block {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 6px 0 26px;
  border: 1px solid var(--line);
  padding: 15px;
}

.consent-block strong, .consent-block span,
.grant-card strong, .grant-card span { display: block; }
.consent-block span, .grant-card span { margin-top: 3px; color: var(--muted); font-size: 0.84rem; }

.connection-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  background: var(--orange);
}

.connection-icon i {
  width: 14px;
  height: 14px;
  border: 3px solid #fff;
  border-radius: 50%;
}

.permission-list ul { list-style: none; padding: 0; margin: 0; }
.permission-list li { display: flex; gap: 11px; padding: 11px 0; border-top: 1px solid var(--line); }
.permission-list li:last-child { border-bottom: 1px solid var(--line); }
.permission-list strong, .permission-list span { display: block; }
.permission-list li div span { margin-top: 3px; color: var(--muted); font-size: 0.82rem; line-height: 1.35; }
.check { color: var(--success); font-weight: 800; }

.status {
  margin: 15px 0 0;
  border-left: 3px solid var(--success);
  background: #edf6f1;
  padding: 11px 12px;
  color: #174d36;
  font-size: 0.86rem;
  line-height: 1.4;
}

.status-error { border-color: var(--danger); background: #fbefee; color: #81251f; }
.status-warning { border-color: #ad741e; background: #fff6e7; color: #744a0c; }

.fine-print, .security-note {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.5;
  text-align: center;
}

.fine-print { margin: 22px 0 0; }
.security-note { margin: 16px auto 0; }

.grant-list { margin: 20px 0; }
.grant-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); padding: 14px 0; }
.grant-card:last-child { border-bottom: 1px solid var(--line); }

.loading-state { min-height: 220px; display: grid; place-items: center; align-content: center; color: var(--muted); }
.spinner { width: 25px; height: 25px; border: 2px solid var(--line); border-top-color: var(--orange); border-radius: 50%; animation: spin 700ms linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 520px) {
  .site-header { width: calc(100% - 28px); height: 62px; }
  .product-label { font-size: 0.68rem; }
  .page-shell { margin-top: 28px; }
  .auth-card { padding: 28px 22px; }
  .button-row { grid-template-columns: 1fr; }
  .button-row .button-primary { order: -1; }
}

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