:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #17202a;
  background: #f4f6f8;
  --page-bg: #f4f6f8;
  --panel: #ffffff;
  --panel-soft: #f8fbfc;
  --border: #dce3e6;
  --border-strong: #cbd8dc;
  --text: #17202a;
  --muted: #6c7880;
  --teal: #1f6f78;
  --teal-dark: #173d43;
  --teal-soft: #e8f1f2;
  --blue-soft: #eaf0f8;
  --gold-soft: #f7efe0;
  --success: #1f7a4d;
  --success-soft: #e9f5ef;
  --warning: #9a5a12;
  --warning-soft: #fff6e8;
  --danger: #a53b32;
  --danger-soft: #fcecea;
  --shadow: 0 8px 22px rgba(33, 49, 58, .07);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: var(--page-bg); color: var(--text); }
button, input { font: inherit; }
a { color: inherit; }
h1, h2, h3, p { margin-top: 0; }

.topbar {
  min-height: 78px;
  padding: 12px 28px;
  background: #fff;
  border-bottom: 1px solid #dfe5e8;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(300px, 440px) minmax(260px, 1fr);
  align-items: center;
  gap: 18px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.auth-topbar { grid-template-columns: 1fr; position: static; }
.topbar-brand { display: flex; align-items: center; gap: 12px; }
.topbar-brand h1 { margin: 0 0 2px; font-size: 23px; }
.topbar-brand p { margin: 0; color: var(--muted); font-size: 14px; }
.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: var(--teal);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: .04em;
  box-shadow: 0 7px 16px rgba(31, 111, 120, .2);
}

.topbar-context {
  justify-self: center;
  width: 100%;
  min-height: 50px;
  padding: 7px 16px;
  border: 1px solid #dce5e8;
  border-radius: 14px;
  background: #f8fbfc;
  display: grid;
  align-content: center;
  gap: 1px;
  text-align: center;
}
.topbar-context span, .eyebrow {
  color: #61757b;
  font-size: 11px;
  font-weight: 850;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.topbar-context strong { font-size: 19px; line-height: 1.1; }
.topbar-context small { color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.topbar-actions form { margin: 0; }

button, .button {
  border: 0;
  border-radius: 9px;
  padding: 11px 16px;
  cursor: pointer;
  background: var(--teal);
  color: white;
  font-weight: 750;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
button:disabled { opacity: .5; cursor: default; background: #d7dfe2; color: #617078; }
.primary-button { background: var(--teal); color: #fff; }
.secondary-button { background: #e8eef0; color: var(--teal-dark); }
.full-width { width: 100%; }

.portal-main { max-width: 1440px; margin: 0 auto; padding: 26px 28px 42px; }
.panel, .welcome-panel, .tool-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 15px;
  box-shadow: var(--shadow);
}
.welcome-panel {
  padding: 22px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 27px;
}
.welcome-panel h2 { margin: 6px 0 6px; font-size: 25px; }
.welcome-panel p { margin: 0; color: var(--muted); line-height: 1.5; max-width: 850px; }
.section-heading { margin-bottom: 16px; display: flex; justify-content: space-between; gap: 18px; align-items: end; }
.section-heading h2 { margin: 5px 0 5px; font-size: 23px; }
.section-heading p { margin: 0; color: var(--muted); }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  align-items: stretch;
}
.tool-card {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 390px;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.tool-card:hover { transform: translateY(-2px); border-color: #c8d8dc; box-shadow: 0 12px 28px rgba(33,49,58,.1); }
.tool-art {
  min-height: 170px;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.tool-art::before, .tool-art::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(59, 83, 90, .15);
  background: rgba(255,255,255,.34);
  transform: rotate(45deg);
}
.tool-art::before { width: 116px; height: 116px; right: 24px; bottom: -48px; }
.tool-art::after { width: 58px; height: 58px; right: 116px; bottom: 25px; }
.tool-art-teal { background: linear-gradient(180deg, #f0f7f7 0%, #e4eff0 100%); }
.tool-art-blue { background: linear-gradient(180deg, #f2f6fb 0%, #e5edf7 100%); }
.tool-art-gold { background: linear-gradient(180deg, #fbf7ef 0%, #f2e9d9 100%); }
.tool-symbol {
  width: 82px;
  height: 82px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid rgba(72, 99, 106, .2);
  box-shadow: 0 8px 18px rgba(33,49,58,.08);
  color: var(--teal-dark);
  font-size: 24px;
  font-weight: 900;
  letter-spacing: .04em;
  position: relative;
  z-index: 1;
}
.tool-copy { padding: 20px; flex: 1; display: flex; flex-direction: column; }
.tool-copy h3 { margin: 0 0 9px; font-size: 20px; }
.tool-copy p { margin: 0; color: #657179; line-height: 1.5; }
.tool-note {
  margin: 16px 0;
  padding: 10px 11px;
  border-radius: 9px;
  background: #f7fafb;
  border: 1px solid #e2e8ea;
  color: #52646b;
  font-size: 13px;
  line-height: 1.4;
}
.tool-copy button, .tool-copy .button { margin-top: auto; }
.status-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1;
  font-weight: 850;
  position: relative;
  z-index: 2;
}
.status-active { background: var(--success-soft); color: var(--success); }
.status-muted { background: rgba(255,255,255,.72); color: #5e6f75; border: 1px solid rgba(77,100,106,.14); }

.account-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
  gap: 22px;
  margin-top: 30px;
  scroll-margin-top: 102px;
}
.account-panel, .information-panel { padding: 22px; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.panel-heading h2 { margin: 5px 0 0; font-size: 21px; }
.account-list { margin: 0; border-top: 1px solid var(--border); }
.account-list > div {
  display: grid;
  grid-template-columns: minmax(150px, .5fr) minmax(0, 1fr);
  gap: 20px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.account-list dt { color: var(--muted); font-weight: 700; }
.account-list dd { margin: 0; font-weight: 700; text-align: right; overflow-wrap: anywhere; }
.information-panel h2 { margin: 6px 0 9px; font-size: 21px; }
.information-panel p { color: var(--muted); line-height: 1.55; }
.helper-text { color: var(--muted); font-size: 13px; line-height: 1.5; }
.notice { padding: 13px 15px; border-radius: 10px; margin-bottom: 20px; border: 1px solid transparent; }
.notice-info { background: #eef5f6; color: var(--teal-dark); border-color: #d7e7e9; }
.notice-error { background: var(--danger-soft); color: var(--danger); border-color: #f2d4d0; }
.notice-warning { background: var(--warning-soft); color: var(--warning); border-color: #f0dfbf; }
.empty-state { padding: 22px; }
.site-footer { max-width: 1440px; margin: 0 auto; padding: 0 28px 28px; display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }

.auth-page { min-height: 100vh; background: linear-gradient(135deg, #f4f6f8 0%, #edf3f4 100%); }
.auth-main {
  width: min(1060px, calc(100% - 32px));
  margin: 56px auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 460px);
  gap: 42px;
  align-items: center;
}
.auth-intro { padding: 18px; }
.auth-intro h2 { margin: 10px 0 13px; max-width: 650px; font-size: clamp(32px, 5vw, 50px); line-height: 1.04; letter-spacing: -.03em; }
.auth-intro > p { max-width: 650px; color: var(--muted); font-size: 18px; line-height: 1.6; }
.auth-feature-list { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 24px; }
.auth-feature-list span { padding: 8px 11px; border-radius: 999px; background: rgba(255,255,255,.8); border: 1px solid var(--border); color: #4e6268; font-size: 13px; font-weight: 750; }
.auth-card { padding: 24px; }
.form-stack { display: grid; gap: 15px; }
.form-stack label { display: grid; gap: 7px; font-weight: 750; }
.form-stack input {
  width: 100%;
  min-height: 46px;
  border: 1px solid #cbd5d9;
  border-radius: 9px;
  padding: 10px 12px;
  color: var(--text);
  background: #fff;
  outline: none;
}
.form-stack input:focus { border-color: #6b9da3; box-shadow: 0 0 0 3px rgba(31,111,120,.11); }
.auth-card .helper-text { margin: 16px 0 0; }

@media (max-width: 1050px) {
  .topbar { grid-template-columns: 1fr auto; }
  .topbar-context { display: none; }
  .tool-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 780px) {
  .topbar { position: static; padding: 12px 16px; grid-template-columns: 1fr; }
  .topbar-actions { justify-content: flex-start; }
  .portal-main { padding: 20px 16px 34px; }
  .welcome-panel { align-items: flex-start; flex-direction: column; }
  .tool-grid, .account-layout, .auth-main { grid-template-columns: 1fr; }
  .auth-main { margin: 28px auto; gap: 18px; }
  .auth-intro { padding: 4px; }
  .tool-card { min-height: 350px; }
  .site-footer { padding: 0 16px 22px; flex-direction: column; gap: 4px; }
}
@media (max-width: 520px) {
  .tool-grid { grid-template-columns: 1fr; }
  .account-list > div { grid-template-columns: 1fr; gap: 4px; }
  .account-list dd { text-align: left; }
}
