:root {
  --ink: #102135;
  --ink-soft: #4a5a6c;
  --paper: #f4f8fb;
  --white: #ffffff;
  --line: #d9e3ea;
  --line-strong: #b8c8d3;
  --cobalt: #254bd8;
  --cobalt-dark: #173495;
  --aqua: #14b8a6;
  --aqua-pale: #dff8f4;
  --amber: #e19a20;
  --amber-pale: #fff4d9;
  --danger: #bf3b46;
  --shadow: 0 18px 50px rgb(20 49 78 / 10%);
  --display: "Bahnschrift Condensed", "Arial Narrow", sans-serif;
  --body: "Aptos", "Segoe UI", sans-serif;
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
}

button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .62; }
a { color: inherit; }
[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid rgb(37 75 216 / 30%);
  outline-offset: 3px;
}

.shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.routing-rail {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 34px 30px 28px;
  overflow: hidden;
  background: var(--ink);
  color: #e9f2f8;
}

.routing-rail::after {
  position: absolute;
  right: -78px;
  bottom: 10%;
  width: 160px;
  height: 160px;
  border: 1px solid rgb(148 188 218 / 15%);
  border-radius: 50%;
  box-shadow: 0 0 0 32px rgb(148 188 218 / 4%), 0 0 0 64px rgb(148 188 218 / 3%);
  content: "";
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 13px;
  color: #fff;
  font-family: var(--display);
  font-size: 1.18rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  grid-template-columns: repeat(3, 5px);
  align-items: end;
  gap: 3px;
  width: 21px;
  height: 22px;
}

.brand-mark span { display: block; border-radius: 5px; background: var(--aqua); }
.brand-mark span:nth-child(1) { height: 9px; }
.brand-mark span:nth-child(2) { height: 20px; }
.brand-mark span:nth-child(3) { height: 14px; }
.brand-mark.large { grid-template-columns: repeat(3, 7px); gap: 4px; width: 29px; height: 34px; }
.brand-mark.large span:nth-child(1) { height: 14px; }
.brand-mark.large span:nth-child(2) { height: 32px; }
.brand-mark.large span:nth-child(3) { height: 21px; }

.route-map { position: relative; margin-top: 104px; }
.rail-label, .section-kicker, .eyebrow {
  margin: 0 0 12px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.rail-label { color: #87a0b5; }
.route-line {
  position: absolute;
  top: 45px;
  bottom: 27px;
  left: 7px;
  width: 1px;
  background: linear-gradient(#7091aa, var(--aqua));
}
.route-node {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  gap: 17px;
  margin: 31px 0;
}
.node-dot {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  border: 4px solid var(--ink);
  border-radius: 50%;
  background: #89a3b8;
  box-shadow: 0 0 0 1px #89a3b8;
}
.route-engine .node-dot { background: #fff; box-shadow: 0 0 0 1px #fff; }
.route-destination .node-dot { background: var(--aqua); box-shadow: 0 0 0 1px var(--aqua), 0 0 18px rgb(20 184 166 / 65%); }
.route-node strong { display: block; margin-top: -2px; font-size: .94rem; }
.route-node small { display: block; margin-top: 5px; color: #8da4b7; font-size: .76rem; line-height: 1.45; }
.rail-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  color: #94aabd;
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .04em;
}
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--aqua); box-shadow: 0 0 0 5px rgb(20 184 166 / 12%); }

.workspace { min-width: 0; padding: 52px clamp(28px, 5vw, 78px) 80px; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; }
.topbar h1, .login-card h1, .consent-card h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(2.7rem, 5vw, 4.8rem);
  font-stretch: condensed;
  font-weight: 650;
  letter-spacing: -.035em;
  line-height: .92;
}
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.text-button, .icon-button {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: .88rem;
  font-weight: 650;
  text-decoration: none;
}
.text-button:hover { color: var(--cobalt); }
.primary-button, .secondary-button {
  width: 100%;
  min-height: 50px;
  border: 0;
  border-radius: 8px;
  padding: 0 22px;
  font-weight: 750;
  transition: transform .16s ease, background .16s ease, box-shadow .16s ease;
}
.primary-button { background: var(--cobalt); color: #fff; box-shadow: 0 8px 22px rgb(37 75 216 / 22%); }
.primary-button:hover { transform: translateY(-1px); background: var(--cobalt-dark); box-shadow: 0 11px 25px rgb(37 75 216 / 27%); }
.primary-button.compact { width: auto; min-height: 44px; }
.secondary-button { width: auto; border: 1px solid var(--line-strong); background: #fff; color: var(--ink); }
.secondary-button:hover { border-color: var(--cobalt); color: var(--cobalt); }

.connection-strip {
  display: grid;
  grid-template-columns: minmax(180px, .7fr) minmax(320px, 1.3fr);
  align-items: center;
  gap: 28px;
  margin: 54px 0 58px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--aqua);
  border-radius: 8px;
  padding: 20px 22px;
  background: rgb(255 255 255 / 65%);
}
.connection-copy { margin: 0; color: var(--ink-soft); font-size: .86rem; }
.endpoint-box { display: flex; align-items: center; min-width: 0; border: 1px solid var(--line); border-radius: 6px; background: #eaf1f6; }
.endpoint-box code { flex: 1; min-width: 0; overflow: hidden; padding: 13px 14px; font-family: var(--mono); font-size: .76rem; text-overflow: ellipsis; white-space: nowrap; }
.endpoint-box button { align-self: stretch; border: 0; border-left: 1px solid var(--line); padding: 0 16px; background: #fff; color: var(--cobalt); font-size: .78rem; font-weight: 700; }

.section-heading-row { display: flex; justify-content: space-between; gap: 28px; align-items: end; margin-bottom: 24px; }
.section-heading-row h2, .dialog-head h2 { margin: 0 0 4px; font-family: var(--display); font-size: 1.85rem; letter-spacing: -.015em; }
.section-heading-row p { margin: 0; color: var(--ink-soft); font-size: .9rem; }
.legend { display: flex; gap: 16px; color: var(--ink-soft); font-size: .74rem; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.status-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.status-dot.ready { background: var(--aqua); }
.status-dot.warning { background: var(--amber); }

.account-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(285px, 1fr)); gap: 16px; }
.account-card {
  position: relative;
  min-height: 230px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 22px;
  background: #fff;
  box-shadow: 0 7px 23px rgb(20 49 78 / 5%);
}
.account-card::after { position: absolute; right: -24px; bottom: -29px; width: 92px; height: 92px; border: 18px solid var(--paper); border-radius: 50%; content: ""; }
.card-top { display: flex; justify-content: space-between; gap: 18px; }
.provider-glyph {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 9px;
  font-family: var(--display);
  font-size: 1.12rem;
  font-weight: 800;
}
.provider-glyph.gmail { background: #e8edff; color: #3756c7; }
.provider-glyph.neo { background: #e6f9f5; color: #087f72; }
.provider-glyph.hostinger { background: #eeeaff; color: #6946c7; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; align-self: flex-start; border-radius: 999px; padding: 6px 9px; background: var(--aqua-pale); color: #087469; font-size: .7rem; font-weight: 750; text-transform: capitalize; }
.status-pill.warning { background: var(--amber-pale); color: #875b0f; }
.account-card h3 { margin: 23px 0 4px; font-size: 1.03rem; }
.account-email { margin: 0; color: var(--ink-soft); font-family: var(--mono); font-size: .77rem; overflow-wrap: anywhere; }
.account-warning { margin: 15px 0 0; color: #875b0f; font-size: .78rem; line-height: 1.45; }
.card-footer { position: absolute; z-index: 1; right: 22px; bottom: 20px; left: 22px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-footer small { color: #7a8b9a; font-family: var(--mono); font-size: .65rem; }
.card-actions { display: flex; gap: 4px; }
.card-actions button { border: 0; padding: 6px 7px; background: transparent; color: var(--ink-soft); font-size: .74rem; font-weight: 700; }
.card-actions button:hover { color: var(--cobalt); }
.card-actions .remove:hover { color: var(--danger); }

.empty-state { border: 1px dashed var(--line-strong); border-radius: 10px; padding: 68px 30px; text-align: center; background: rgb(255 255 255 / 45%); }
.empty-state h3 { margin: 20px 0 7px; font-family: var(--display); font-size: 1.55rem; }
.empty-state p { max-width: 470px; margin: 0 auto 22px; color: var(--ink-soft); line-height: 1.6; }
.empty-envelope { position: relative; width: 70px; height: 48px; margin: 0 auto; border: 2px solid var(--line-strong); border-radius: 4px; }
.empty-envelope::before, .empty-envelope::after { position: absolute; top: 7px; width: 42px; height: 2px; background: var(--line-strong); content: ""; }
.empty-envelope::before { left: 1px; transform: rotate(32deg); transform-origin: left; }
.empty-envelope::after { right: 1px; transform: rotate(-32deg); transform-origin: right; }

.login-screen, .consent-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  overflow: hidden;
  padding: 28px;
  background: var(--ink);
}
.login-screen { position: relative; }
.login-route { position: absolute; inset: 0; opacity: .25; }
.login-route::before { position: absolute; top: 50%; left: -4%; width: 108%; height: 1px; background: linear-gradient(90deg, transparent, #6e91aa 20%, var(--aqua) 75%, transparent); content: ""; }
.login-route span { position: absolute; top: calc(50% - 7px); width: 14px; height: 14px; border: 3px solid var(--ink); border-radius: 50%; background: #8ca9bc; box-shadow: 0 0 0 1px #8ca9bc; }
.login-route span:nth-child(1) { left: 8%; }.login-route span:nth-child(2) { left: 32%; }.login-route span:nth-child(3) { left: 68%; background: #fff; }.login-route span:nth-child(4) { left: 90%; background: var(--aqua); box-shadow: 0 0 20px var(--aqua); }
.login-card, .consent-card {
  position: relative;
  z-index: 1;
  width: min(100%, 470px);
  border-radius: 12px;
  padding: 42px;
  background: var(--white);
  box-shadow: 0 30px 80px rgb(0 0 0 / 35%);
}
.login-card .eyebrow, .consent-card .eyebrow { margin-top: 30px; color: var(--cobalt); }
.login-card h1, .consent-card h1 { font-size: 3.4rem; }
.login-card > p:not(.eyebrow), .consent-copy { color: var(--ink-soft); line-height: 1.6; }
form label { display: grid; gap: 7px; margin: 22px 0 0; color: var(--ink); font-size: .78rem; font-weight: 700; }
input {
  width: 100%;
  min-height: 45px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  padding: 9px 11px;
  background: #fff;
  color: var(--ink);
}
input:focus { border-color: var(--cobalt); outline: 3px solid rgb(37 75 216 / 12%); }
label small { color: var(--ink-soft); font-size: .7rem; font-weight: 400; }
form .primary-button { margin-top: 24px; }
.form-error { margin: 13px 0 0; color: var(--danger); font-size: .78rem; line-height: 1.45; }

.account-dialog {
  width: min(760px, calc(100% - 32px));
  max-height: calc(100vh - 40px);
  border: 0;
  border-radius: 13px;
  padding: 0;
  overflow: auto;
  color: var(--ink);
  box-shadow: 0 30px 90px rgb(9 29 48 / 32%);
}
.account-dialog::backdrop { background: rgb(10 28 45 / 68%); backdrop-filter: blur(3px); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 27px 30px 10px; }
.icon-button { font-size: 1.8rem; font-weight: 300; line-height: 1; }
.provider-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 15px 30px 24px; }
.provider-choice { display: grid; grid-template-columns: 38px 1fr; grid-template-rows: auto auto; gap: 1px 10px; border: 1px solid var(--line); border-radius: 9px; padding: 14px; background: #fff; color: var(--ink); text-align: left; }
.provider-choice .provider-glyph { grid-row: 1 / 3; }
.provider-choice strong { align-self: end; font-size: .79rem; }
.provider-choice small { color: var(--ink-soft); font-size: .67rem; }
.provider-choice.selected { border-color: var(--cobalt); box-shadow: inset 0 0 0 1px var(--cobalt), 0 5px 16px rgb(37 75 216 / 10%); }
.provider-panel { border-top: 1px solid var(--line); padding: 26px 30px 30px; background: #f8fafc; }
.oauth-explainer { display: flex; gap: 18px; align-items: flex-start; padding: 18px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.oauth-explainer h3 { margin: 0 0 6px; font-size: .95rem; }
.oauth-explainer p { margin: 0; color: var(--ink-soft); font-size: .8rem; line-height: 1.55; }
.shield-glyph { display: grid; place-items: center; width: 37px; height: 37px; flex: 0 0 auto; border-radius: 50%; background: var(--aqua-pale); color: #087469; font-size: 1.35rem; }
.setup-warning { margin-top: 14px; border-left: 3px solid var(--amber); padding: 11px 13px; background: var(--amber-pale); color: #6f4b0c; font-size: .78rem; line-height: 1.5; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.span-two { grid-column: 1 / -1; }
.advanced-settings { margin-top: 22px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.advanced-settings summary { display: flex; justify-content: space-between; padding: 14px 15px; cursor: pointer; font-size: .78rem; font-weight: 750; }
.advanced-settings summary span { color: var(--ink-soft); font-weight: 400; }
.server-grid { border-top: 1px solid var(--line); padding: 0 15px 16px; }
.toggle-label { display: flex; grid-template-columns: 18px 1fr; align-items: center; gap: 9px; }
.toggle-label input { width: 17px; min-height: 17px; margin: 0; accent-color: var(--cobalt); }
.toast-region { position: fixed; z-index: 10; right: 22px; bottom: 22px; display: grid; gap: 10px; }
.toast { max-width: 360px; border-left: 4px solid var(--aqua); border-radius: 7px; padding: 13px 16px; background: var(--ink); color: #fff; box-shadow: var(--shadow); font-size: .8rem; animation: toast-in .2s ease-out; }
.toast.error { border-left-color: #ee6671; }

.permission-list { margin: 23px 0; border-top: 1px solid var(--line); }
.permission-list div { display: flex; align-items: center; gap: 14px; border-bottom: 1px solid var(--line); padding: 13px 0; }
.permission-list span { color: var(--aqua); font-family: var(--mono); font-size: .67rem; }
.permission-list strong { font-size: .84rem; }
.fine-print { margin: 18px 0 0; color: var(--ink-soft); font-size: .68rem; line-height: 1.45; }

@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .routing-rail { position: static; min-height: 0; padding: 22px 24px; }
  .route-map { display: none; }
  .rail-footer { margin-top: 25px; }
  .workspace { padding: 35px 22px 60px; }
  .topbar { align-items: flex-start; }
  .topbar-actions .text-button { display: none; }
  .connection-strip { grid-template-columns: 1fr; }
}

@media (max-width: 580px) {
  .topbar { display: grid; }
  .topbar h1 { font-size: 3rem; }
  .topbar-actions { justify-content: space-between; }
  .connection-strip { margin: 38px 0 42px; padding: 17px; }
  .section-heading-row { align-items: flex-start; flex-direction: column; }
  .provider-picker { grid-template-columns: 1fr; }
  .provider-choice { grid-template-columns: 38px 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .span-two { grid-column: auto; }
  .login-card, .consent-card { padding: 30px 24px; }
  .login-card h1, .consent-card h1 { font-size: 2.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
