:root {
  color-scheme: light;
  --background: #f5f7f6;
  --surface: #fff;
  --text: #172c25;
  --muted: #68776f;
  --accent: #176b51;
  --accent-hover: #11513d;
  --border: #e3e9e5;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--background); color: var(--text); }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; }
button, input { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible {
  outline: 3px solid #92c8ae;
  outline-offset: 3px;
}

.page-shell {
  display: flex;
  flex-direction: column;
  width: min(1080px, 100% - 64px);
  min-height: 100svh;
  margin: 0 auto;
}
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 116px;
  gap: 20px;
}
.brand { display: flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 750; letter-spacing: -.7px; }
.brand img { flex-shrink: 0; }
.brand-light { margin-left: 5px; font-weight: 450; }
.header-caption { color: var(--muted); font-size: 13px; }
main { display: grid; flex: 1; place-items: center; padding: 36px 0 64px; }
.auth-view { width: min(440px, 100%); animation: appear .3s ease-out; }
.auth-intro { margin-bottom: 28px; text-align: center; }
.eyebrow { color: var(--accent); font-size: 10px; font-weight: 750; letter-spacing: 1.8px; }
h1 { margin: 14px 0 10px; font-size: clamp(28px, 5vw, 34px); font-weight: 650; letter-spacing: -1.1px; line-height: 1.2; }
.auth-intro p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; }
.auth-card {
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 12px 35px #183e2c05, 0 2px 5px #183e2c03;
}
.auth-tabs { display: flex; gap: 4px; padding: 4px; margin-bottom: 28px; border-radius: 11px; background: #f1f4f2; }
.auth-tab {
  flex: 1;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  transition: background .15s, color .15s;
}
.auth-tab[aria-selected="true"] { background: white; color: var(--text); box-shadow: 0 1px 5px #183e2c10; }
.auth-tab:not(:disabled):hover { color: var(--accent); }
.field { margin-bottom: 20px; }
label { display: block; margin-bottom: 9px; font-size: 13px; font-weight: 600; }
input {
  width: 100%;
  height: 49px;
  padding: 0 14px;
  border: 1px solid #dce4df;
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: #8c9691; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #176b510b; outline: none; }
input:disabled { background: #fafbf9; color: var(--muted); }
.password-field { position: relative; }
.password-field input { padding-right: 89px; }
.password-toggle {
  position: absolute;
  right: 6px;
  top: 7px;
  height: 35px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}
.password-toggle:hover { background: #f1f5f2; color: var(--accent); }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  transition: background .15s, transform .15s;
}
.button-primary { width: 100%; margin-top: 3px; background: var(--accent); color: white; }
.button-primary:not(:disabled):hover { background: var(--accent-hover); }
.button-primary:not(:disabled):active { transform: translateY(1px); }
.button-secondary { min-height: 40px; border-color: var(--border); background: white; color: var(--text); font-size: 12px; }
.button-secondary:not(:disabled):hover { background: #edf3ef; }
.button:disabled { opacity: .72; }
.button[aria-busy="true"]::before, .spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  content: "";
  animation: spin .7s linear infinite;
}
.button[aria-busy="true"] .button-arrow { display: none; }
.card-note { display: flex; justify-content: center; align-items: center; gap: 7px; padding-top: 22px; margin-top: 24px; border-top: 1px solid #edf0ee; color: var(--muted); font-size: 11px; }
.auth-footnote { margin: 21px 0 0; color: var(--muted); font-size: 11px; text-align: center; line-height: 1.6; }
.message { padding: 12px 14px; margin: 0 0 20px; border: 1px solid #f0d5ce; border-radius: 9px; background: #fff5f1; color: #973e2d; font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.message[data-kind="success"] { border-color: #cfe5d7; background: #edf8f1; color: #256044; }
.loading-view { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.loading-view .spinner { width: 20px; height: 20px; color: var(--accent); }
.welcome-view { width: min(720px, 100%); animation: appear .35s ease-out; }
.welcome-card {
  position: relative;
  overflow: hidden;
  padding: 56px 56px 48px;
  border: 1px solid var(--border);
  border-radius: 26px;
  background: white;
  text-align: center;
  box-shadow: 0 18px 60px #183e2c05;
}
.welcome-decoration { position: absolute; top: -180px; left: calc(50% - 240px); width: 480px; height: 350px; border-radius: 50%; background: #f2f8f4; pointer-events: none; }
.status-badge { position: relative; display: inline-flex; align-items: center; gap: 7px; padding: 6px 11px; border: 1px solid #d9e9df; border-radius: 99px; background: #f5fbf7; color: var(--accent); font-size: 11px; font-weight: 600; }
.status-dot { width: 5px; height: 5px; border-radius: 50%; background: #398a65; }
.user-avatar { position: relative; display: grid; place-items: center; width: 72px; height: 72px; margin: 28px auto 22px; border: 5px solid white; border-radius: 24px; background: #e3f0e9; color: var(--accent); box-shadow: 0 3px 15px #264e3210; font-size: 28px; font-weight: 600; }
.welcome-card h1 { position: relative; margin-top: 0; font-size: clamp(28px, 5vw, 40px); }
.welcome-description { margin: 16px 0 32px; color: var(--muted); font-size: 14px; line-height: 1.8; }
.account-card { display: flex; align-items: center; gap: 15px; padding: 18px 20px; border: 1px solid var(--border); border-radius: 14px; background: #fafcfb; text-align: left; }
.account-icon { display: grid; place-items: center; flex-shrink: 0; width: 44px; height: 44px; border: 1px solid var(--border); border-radius: 11px; background: white; color: var(--muted); }
.account-details { display: grid; min-width: 0; gap: 5px; }
.account-label { color: var(--muted); font-size: 11px; }
.account-email { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.account-check { flex-shrink: 0; margin-left: auto; color: var(--accent); }
.integration-card { display: flex; align-items: center; gap: 24px; padding: 20px; margin-top: 16px; border: 1px solid var(--border); border-radius: 14px; background: #fafcfb; text-align: left; }
.integration-copy { display: grid; flex: 1; gap: 6px; }
.integration-title { font-size: 14px; font-weight: 650; }
.integration-status { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 600; }
.integration-status-dot { flex-shrink: 0; width: 7px; height: 7px; border-radius: 50%; background: #89948e; }
.integration-status[data-state="connected"] { color: var(--accent); }
.integration-status[data-state="connected"] .integration-status-dot { background: #398a65; }
.integration-status[data-state="refresh-required"], .integration-status[data-state="expired"] { color: #9a651e; }
.integration-status[data-state="refresh-required"] .integration-status-dot, .integration-status[data-state="expired"] .integration-status-dot { background: #cf8a2c; }
.integration-status[data-state="error"] { color: #973e2d; }
.integration-status[data-state="error"] .integration-status-dot { background: #c85f4a; }
.integration-description { color: var(--muted); font-size: 11px; line-height: 1.55; }
.integration-button { flex-shrink: 0; width: auto; min-width: 156px; margin-top: 0; }
.footer { display: flex; justify-content: space-between; gap: 20px; padding: 24px 0; border-top: 1px solid var(--border); color: var(--muted); font-size: 11px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes appear { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 560px) {
  .page-shell { width: calc(100% - 36px); }
  .header { min-height: 92px; gap: 12px; }
  .brand { gap: 8px; font-size: 16px; }
  .brand img { width: 34px; height: 34px; }
  .header-caption { display: none; }
  .header .button { min-height: 36px; padding: 0 11px; font-size: 11px; }
  main { padding: 24px 0 44px; }
  .auth-card { padding: 24px; border-radius: 18px; }
  .eyebrow { font-size: 9px; letter-spacing: 1.4px; }
  .auth-intro { margin-bottom: 24px; }
  .welcome-card { padding: 36px 22px 28px; border-radius: 20px; }
  .account-card { gap: 11px; padding: 14px; }
  .account-icon { width: 36px; height: 36px; }
  .account-email { font-size: 12px; }
  .account-check { width: 18px; }
  .integration-card { align-items: stretch; flex-direction: column; gap: 16px; padding: 16px; }
  .integration-button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
