:root {
  --ink: #17251f;
  --ink-soft: #506159;
  --paper: #f4f1e8;
  --paper-deep: #e8e4d8;
  --panel: rgba(255, 255, 252, 0.9);
  --line: rgba(23, 37, 31, 0.15);
  --forest: #174f3a;
  --forest-bright: #1f6b4d;
  --moss: #a6bc83;
  --lime: #d4e46f;
  --rust: #b04b35;
  --shadow: 0 28px 70px rgba(34, 47, 40, 0.13);
  --radius: 6px;
  font-family: "Avenir Next", Avenir, "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(90deg, transparent 49.94%, rgba(23, 37, 31, 0.04) 50%, transparent 50.06%),
    radial-gradient(circle at 85% 10%, rgba(166, 188, 131, 0.27), transparent 28rem),
    var(--paper);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.035'/%3E%3C/svg%3E");
  content: "";
  pointer-events: none;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

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

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--ink);
  border-radius: 50%;
  font-family: Georgia, "Yu Mincho", serif;
  font-size: 1.05rem;
}

.site-header nav {
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 0.78rem;
  font-weight: 600;
}

.site-header nav a,
.nav-form button {
  border: 0;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
  text-decoration: none;
}

.site-header nav a:hover,
.nav-form button:hover {
  color: var(--forest);
}

.nav-form {
  margin: 0;
}

.environment-badge {
  padding: 5px 8px 4px;
  border: 1px solid rgba(176, 75, 53, 0.35);
  border-radius: 999px;
  color: var(--rust);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.64rem;
  letter-spacing: 0.08em;
}

.site-footer {
  display: flex;
  width: min(1180px, calc(100% - 48px));
  min-height: 72px;
  margin: 32px auto 0;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}

.auth-shell {
  display: grid;
  width: min(1180px, calc(100% - 48px));
  min-height: calc(100vh - 188px);
  margin: 0 auto;
  grid-template-columns: minmax(0, 1.1fr) minmax(380px, 0.9fr);
  align-items: center;
  gap: clamp(48px, 8vw, 120px);
  padding: 72px 0 84px;
}

.auth-story {
  position: relative;
  padding-left: clamp(0px, 5vw, 68px);
}

.auth-story::before {
  position: absolute;
  top: -58px;
  left: 0;
  width: 1px;
  height: 210px;
  background: linear-gradient(var(--forest), transparent);
  content: "";
}

.eyebrow,
.step-label {
  color: var(--forest);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.2em;
}

.auth-story h1,
.page-heading h1,
.consent-card h1,
.message-card h1 {
  margin: 22px 0 24px;
  font-family: Georgia, "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-weight: 500;
  letter-spacing: -0.045em;
}

.auth-story h1 {
  max-width: 650px;
  font-size: clamp(3rem, 6vw, 5.7rem);
  line-height: 1.05;
}

.auth-story > p {
  max-width: 540px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.98rem;
  line-height: 2;
}

.trust-line {
  display: flex;
  margin-top: 36px;
  align-items: center;
  gap: 10px;
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--forest-bright);
  box-shadow: 0 0 0 6px rgba(31, 107, 77, 0.09);
}

.auth-panel {
  position: relative;
  padding: clamp(32px, 5vw, 58px);
  border: 1px solid rgba(23, 37, 31, 0.18);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.auth-panel::after {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 68px;
  height: 68px;
  border-right: 3px solid var(--forest);
  border-bottom: 3px solid var(--forest);
  content: "";
  pointer-events: none;
}

.panel-heading h2 {
  margin: 10px 0 6px;
  font-family: Georgia, "Yu Mincho", serif;
  font-size: 1.7rem;
  font-weight: 500;
}

.panel-heading p {
  margin: 0 0 28px;
  color: var(--ink-soft);
  font-size: 0.83rem;
}

.form-stack {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.field input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid rgba(23, 37, 31, 0.24);
  border-radius: 3px;
  outline: none;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.76);
  font-size: 0.94rem;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.field input:focus {
  border-color: var(--forest-bright);
  box-shadow: 0 0 0 3px rgba(31, 107, 77, 0.11);
}

.button {
  display: inline-flex;
  min-height: 48px;
  padding: 0 20px;
  align-items: center;
  justify-content: center;
  gap: 11px;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: transform 130ms ease, background 160ms ease, border-color 160ms ease;
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

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

.button-primary:hover {
  background: var(--forest-bright);
}

.button-secondary,
.button-ghost {
  border-color: rgba(23, 37, 31, 0.26);
  color: var(--forest);
  background: transparent;
}

.button-secondary:hover,
.button-ghost:hover {
  border-color: var(--forest);
  background: rgba(23, 79, 58, 0.05);
}

.button-partner {
  width: 100%;
  border-color: rgba(23, 37, 31, 0.22);
  color: var(--ink);
  background: #fff;
}

.button-partner:hover {
  border-color: var(--forest-bright);
  background: #fbfcf8;
}

.partner-mark,
.provider-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--forest);
  font-family: Georgia, serif;
  font-size: 0.67rem;
}

.partner-mark {
  width: 27px;
  height: 27px;
}

.divider {
  display: flex;
  margin: 22px 0;
  align-items: center;
  gap: 12px;
  color: #86938d;
  font-size: 0.65rem;
}

.divider::before,
.divider::after {
  height: 1px;
  flex: 1;
  background: var(--line);
  content: "";
}

.fine-print,
.card-note {
  color: var(--ink-soft);
  font-size: 0.68rem;
  line-height: 1.75;
}

.fine-print {
  margin: 24px 0 0;
}

.alert {
  margin: 0 0 20px;
  padding: 12px 14px;
  border: 1px solid;
  border-radius: 3px;
  font-size: 0.76rem;
  line-height: 1.6;
}

.alert-error {
  border-color: rgba(176, 75, 53, 0.28);
  color: #813624;
  background: rgba(176, 75, 53, 0.08);
}

.alert-success {
  border-color: rgba(31, 107, 77, 0.28);
  color: var(--forest);
  background: rgba(31, 107, 77, 0.08);
}

.account-shell {
  width: min(1080px, calc(100% - 48px));
  min-height: calc(100vh - 188px);
  margin: 0 auto;
  padding: 72px 0 84px;
}

.page-heading {
  display: flex;
  margin-bottom: 42px;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
}

.page-heading h1 {
  margin: 12px 0 10px;
  font-size: clamp(2.6rem, 5vw, 4.5rem);
  line-height: 1;
}

.page-heading p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.identity-chip {
  display: flex;
  min-width: 290px;
  padding: 14px 16px;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.38);
}

.identity-chip > span {
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--forest);
  font-family: Georgia, serif;
  font-size: 0.77rem;
}

.identity-chip div,
.list-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.identity-chip strong,
.list-copy strong {
  overflow: hidden;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.identity-chip small,
.list-copy small {
  color: var(--ink-soft);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.62rem;
}

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

.management-card {
  min-height: 410px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 12px 38px rgba(34, 47, 40, 0.07);
}

.card-header {
  display: flex;
  padding-bottom: 22px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.card-header > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.card-header h2 {
  margin: 0;
  font-family: Georgia, "Yu Mincho", serif;
  font-size: 1.3rem;
  font-weight: 500;
}

.section-index {
  color: var(--forest-bright);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.62rem;
}

.status-pill {
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--ink-soft);
  background: var(--paper-deep);
  font-size: 0.62rem;
}

.card-list {
  display: grid;
}

.list-row {
  display: flex;
  min-width: 0;
  padding: 18px 0;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(23, 37, 31, 0.09);
}

.provider-mark {
  width: 36px;
  height: 36px;
}

.list-copy {
  flex: 1;
}

.connected-label {
  color: var(--forest-bright);
  font-size: 0.63rem;
  font-weight: 700;
}

.connected-label::before {
  margin-right: 5px;
  content: "●";
  font-size: 0.45rem;
}

.card-action {
  margin-top: 22px;
}

.card-action .button {
  width: 100%;
}

.card-note {
  margin-top: 22px;
}

.grant-row {
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(23, 37, 31, 0.09);
}

.grant-row .list-row {
  border-bottom: 0;
}

.grant-link {
  color: var(--forest-bright);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.scope-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.scope-cloud span {
  padding: 4px 7px;
  border: 1px solid rgba(23, 79, 58, 0.16);
  border-radius: 2px;
  color: var(--forest);
  background: rgba(166, 188, 131, 0.11);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.58rem;
}

.text-button {
  margin-top: 12px;
  padding: 0;
  border: 0;
  color: var(--rust);
  background: transparent;
  cursor: pointer;
  font-size: 0.68rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.empty-state {
  margin: 24px 0;
  color: var(--ink-soft);
  font-size: 0.76rem;
}

.boundary-note {
  display: grid;
  margin-top: 24px;
  padding: 20px 24px;
  grid-template-columns: 140px 1fr;
  gap: 20px;
  border-left: 3px solid var(--moss);
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.32);
  font-size: 0.73rem;
  line-height: 1.7;
}

.boundary-note strong {
  color: var(--ink);
}

.boundary-note p {
  margin: 0;
}

.consent-shell,
.message-shell {
  display: grid;
  width: min(720px, calc(100% - 48px));
  min-height: calc(100vh - 188px);
  margin: 0 auto;
  place-items: center;
  padding: 64px 0 80px;
}

.consent-card,
.message-card {
  position: relative;
  width: 100%;
  padding: clamp(34px, 7vw, 64px);
  border: 1px solid rgba(23, 37, 31, 0.18);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.consent-route {
  display: flex;
  margin-bottom: 36px;
  align-items: center;
}

.route-node {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--forest);
  border-radius: 50%;
  font-family: Georgia, serif;
  font-weight: 700;
}

.route-qu {
  color: #fff;
  background: var(--forest);
}

.route-client {
  color: var(--forest);
  background: var(--paper);
}

.route-line {
  position: relative;
  height: 1px;
  flex: 1;
  background: var(--line);
}

.route-line::after {
  position: absolute;
  top: -3px;
  left: calc(50% - 3px);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lime);
  content: "";
}

.consent-card h1 {
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.14;
}

.consent-lead {
  margin: 0 0 26px;
  color: var(--ink-soft);
  font-size: 0.82rem;
  line-height: 1.8;
}

.consent-lead strong {
  color: var(--ink);
}

.permission-list {
  display: grid;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--line);
}

.permission-list li {
  display: flex;
  padding: 16px 0;
  align-items: center;
  gap: 13px;
  border-bottom: 1px solid var(--line);
}

.permission-icon {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: var(--forest);
  background: rgba(166, 188, 131, 0.25);
  font-size: 0.72rem;
  font-weight: 700;
}

.permission-list div {
  display: grid;
  gap: 3px;
}

.permission-list strong {
  font-size: 0.78rem;
}

.permission-list small {
  color: var(--ink-soft);
  font-size: 0.68rem;
}

.client-facts {
  display: grid;
  margin: 24px 0 30px;
  gap: 8px;
}

.client-facts > div {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 12px;
  color: var(--ink-soft);
  font-size: 0.67rem;
}

.client-facts strong,
.client-facts code {
  overflow: hidden;
  color: var(--ink);
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.65rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.decision-row {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 12px;
}

.message-card {
  text-align: center;
}

.message-card h1 {
  margin: 12px 0 14px;
  font-size: clamp(2rem, 5vw, 3.2rem);
}

.message-card p {
  color: var(--ink-soft);
  font-size: 0.84rem;
  line-height: 1.8;
}

.message-card small {
  display: block;
  margin: 18px 0;
  color: #839087;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.6rem;
}

.message-card .button {
  margin-top: 18px;
}

.error-code {
  display: block;
  margin-bottom: 24px;
  color: rgba(23, 79, 58, 0.14);
  font-family: Georgia, serif;
  font-size: 7rem;
  line-height: 0.75;
}

:focus-visible {
  outline: 3px solid rgba(31, 107, 77, 0.35);
  outline-offset: 3px;
}

@media (max-width: 860px) {
  .auth-shell {
    grid-template-columns: 1fr;
    gap: 42px;
    padding-top: 54px;
  }

  .auth-story {
    padding-left: 24px;
  }

  .auth-story h1 {
    font-size: clamp(2.8rem, 13vw, 4.6rem);
  }

  .page-heading {
    align-items: start;
    flex-direction: column;
  }

  .identity-chip {
    width: 100%;
  }

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

@media (max-width: 560px) {
  .site-header,
  .site-footer,
  .auth-shell,
  .account-shell,
  .consent-shell,
  .message-shell {
    width: min(100% - 28px, 1180px);
  }

  .site-header {
    min-height: 70px;
  }

  .site-header nav {
    gap: 12px;
  }

  .site-footer {
    align-items: start;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
  }

  .auth-shell,
  .account-shell,
  .consent-shell,
  .message-shell {
    min-height: auto;
    padding: 42px 0 56px;
  }

  .auth-panel,
  .management-card,
  .consent-card,
  .message-card {
    padding: 26px 22px;
  }

  .auth-story {
    padding-left: 15px;
  }

  .auth-story::before {
    top: -22px;
    height: 136px;
  }

  .auth-story > p {
    line-height: 1.75;
  }

  .page-heading h1 {
    font-size: 2.7rem;
  }

  .boundary-note,
  .client-facts > div {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .decision-row {
    grid-template-columns: 1fr;
  }

  .decision-row .button-primary {
    grid-row: 1;
  }
}

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