:root {
  --ink: #15221f;
  --muted: #66756f;
  --paper: #f4f5ef;
  --surface: #fffefa;
  --line: #dfe4dc;
  --brand: #0f6b4f;
  --brand-dark: #084d3a;
  --brand-soft: #dceee6;
  --amber: #a85d00;
  --amber-soft: #fff1d6;
  --danger: #a53a33;
  --danger-soft: #fbe8e5;
  --shadow: 0 22px 64px rgb(32 53 46 / 10%);
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: radial-gradient(circle at 10% 0%, #e3efe9 0, transparent 34rem), var(--paper); }
button, input { font: inherit; }
a { color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #58a88d; outline-offset: 3px; }

.eyebrow { margin: 0 0 .65rem; color: var(--brand); font-size: .72rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.lede { color: var(--muted); font-size: 1rem; line-height: 1.65; }
.fine-print { color: var(--muted); font-size: .78rem; line-height: 1.55; }
.brand-mark { display: inline-grid; width: 2.5rem; height: 2.5rem; place-items: center; border-radius: .8rem; color: white; background: var(--brand); font-family: Georgia, serif; font-size: 1.3rem; font-weight: 800; box-shadow: 0 8px 24px rgb(15 107 79 / 23%); }

.button { display: inline-flex; min-height: 2.55rem; align-items: center; justify-content: center; gap: .45rem; padding: .68rem 1rem; border: 1px solid transparent; border-radius: .7rem; font-weight: 750; text-decoration: none; cursor: pointer; transition: transform .18s ease, background .18s ease, border-color .18s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: .58; cursor: wait; transform: none; }
.button--primary { color: white; background: var(--brand); }
.button--primary:hover { background: var(--brand-dark); }
.button--ghost { border-color: var(--line); background: rgb(255 255 255 / 55%); }
.button--danger-ghost { color: var(--danger); border-color: #e6bcb6; background: white; }

.auth-layout { display: grid; min-height: 100vh; grid-template-columns: minmax(20rem, 30rem) minmax(24rem, 1fr); align-items: stretch; }
.auth-panel { display: flex; flex-direction: column; justify-content: center; padding: clamp(2rem, 7vw, 6rem); background: var(--surface); box-shadow: var(--shadow); z-index: 1; }
.auth-panel h1 { margin: .4rem 0; font-family: Georgia, "Noto Serif SC", serif; font-size: clamp(2rem, 4vw, 3.15rem); line-height: 1.06; }
.auth-panel .brand-mark { margin-bottom: 2rem; }
.auth-form { display: grid; gap: .72rem; margin-top: 1.5rem; }
.auth-form label { margin-top: .45rem; font-size: .85rem; font-weight: 750; }
.auth-form input { width: 100%; padding: .78rem .88rem; border: 1px solid #cbd4cd; border-radius: .65rem; color: var(--ink); background: white; }
.auth-form .button { margin-top: .75rem; width: 100%; }
.auth-context { display: flex; flex-direction: column; justify-content: flex-end; padding: clamp(3rem, 9vw, 8rem); color: white; background: linear-gradient(145deg, rgb(8 77 58 / 96%), rgb(15 107 79 / 88%)), radial-gradient(circle at 85% 10%, #75bfa7, transparent 34rem); }
.auth-context .eyebrow { color: #bde8d8; }
.auth-context h2 { max-width: 18ch; margin: 0 0 2rem; font-family: Georgia, "Noto Serif SC", serif; font-size: clamp(2.1rem, 5vw, 4.3rem); line-height: 1.04; }
.auth-context ul { display: grid; gap: 1rem; padding-left: 1.2rem; color: #e0f2eb; line-height: 1.5; }

.notice { padding: .8rem .9rem; border-radius: .6rem; font-size: .85rem; }
.notice--danger { color: #7b2d27; background: var(--danger-soft); }
.state-layout { display: grid; min-height: 100vh; place-content: center; justify-items: start; max-width: 45rem; margin: auto; padding: 2rem; }
.state-layout h1 { margin: .3rem 0; font-family: Georgia, serif; font-size: clamp(2rem, 5vw, 3.6rem); }
.state-layout > p { max-width: 40rem; color: var(--muted); line-height: 1.65; }
.spinner { width: 2.5rem; height: 2.5rem; margin-bottom: 1rem; border: 3px solid var(--brand-soft); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.app-shell { min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem clamp(1rem, 4vw, 3.5rem); border-bottom: 1px solid rgb(208 218 211 / 72%); background: rgb(250 251 246 / 88%); backdrop-filter: blur(18px); }
.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; }
.brand span:last-child { display: grid; gap: .08rem; }
.brand small { color: var(--muted); font-size: .7rem; }
.topbar__actions { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; justify-content: flex-end; }
.environment, .role-badge { padding: .36rem .58rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: white; font-size: .72rem; font-weight: 800; text-transform: uppercase; }
.role-badge { color: var(--brand-dark); background: var(--brand-soft); text-transform: none; }
.dashboard { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; padding: clamp(2rem, 5vw, 4.5rem) 0 5rem; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; margin-bottom: 2rem; }
.hero h1 { max-width: 22em; margin: 0; font-family: Georgia, "Noto Serif SC", serif; font-size: clamp(2rem, 5vw, 4rem); line-height: 1.05; }
.hero p:last-child { color: var(--muted); font-size: .8rem; }
.banner { display: flex; padding: 1rem 1.15rem; border: 1px solid var(--line); border-left-width: .35rem; border-radius: .8rem; background: var(--surface); }
.banner p { margin: .35rem 0 0; color: var(--muted); line-height: 1.5; }
.banner--warning { border-color: #e9c786; border-left-color: var(--amber); background: var(--amber-soft); }
.banner--success { border-left-color: var(--brand); background: #eef8f4; }
.empty-state, .viewer-note { margin-top: 1rem; padding: 1rem 1.15rem; border: 1px dashed #a8b9af; border-radius: .8rem; background: rgb(255 255 255 / 48%); }
.empty-state p, .viewer-note p { margin: .3rem 0 0; color: var(--muted); }

.attention-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 1rem 0 2.5rem; }
.attention-grid article { display: grid; grid-template-columns: 1fr auto; gap: .4rem 1rem; padding: 1.15rem; border: 1px solid var(--line); border-radius: .8rem; background: var(--surface); box-shadow: 0 8px 26px rgb(38 56 49 / 5%); }
.attention-grid span { color: var(--muted); font-size: .78rem; font-weight: 750; }
.attention-grid strong { grid-row: span 2; font-family: Georgia, serif; font-size: 2.25rem; }
.attention-grid p { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.module-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1rem; }
.module-card { grid-column: span 2; min-height: 12rem; padding: 1.2rem; border: 1px solid var(--line); border-radius: .9rem; background: var(--surface); box-shadow: 0 10px 34px rgb(38 56 49 / 6%); }
.module-card:nth-child(4), .module-card:nth-child(5) { grid-column: span 3; }
.module-card[data-tone="danger"] { border-top: 4px solid var(--danger); }
.module-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.module-card h2 { margin: 1.8rem 0 1rem; font-family: Georgia, "Noto Serif SC", serif; font-size: 1.45rem; }
.metric { font-family: Georgia, serif; font-size: 1.4rem; font-weight: 800; white-space: nowrap; }
.text-link, .back-link { color: var(--brand); font-weight: 800; text-decoration-thickness: .08em; text-underline-offset: .2em; }
.table-card { margin-top: 1rem; overflow: hidden; border: 1px solid var(--line); border-radius: .9rem; background: var(--surface); }
.section-head { display: flex; align-items: center; justify-content: space-between; padding: 1.15rem 1.25rem; border-bottom: 1px solid var(--line); }
.section-head h2 { margin: 0; font-family: Georgia, serif; }
.section-head > span { color: var(--muted); font-size: .8rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .9rem 1.25rem; text-align: left; border-bottom: 1px solid #edf0eb; }
th { color: var(--muted); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; }
td { font-size: .86rem; }
td small { display: block; margin-top: .18rem; color: var(--muted); }
.status { display: inline-flex; padding: .3rem .52rem; border-radius: 999px; font-size: .72rem; font-weight: 800; }
.status--connected { color: var(--brand-dark); background: var(--brand-soft); }
.status--disconnected { color: #7b2d27; background: var(--danger-soft); }
.status--expiring { color: #744200; background: var(--amber-soft); }

.detail-layout { display: grid; min-height: 100vh; align-content: center; width: min(820px, calc(100% - 2rem)); margin: auto; padding: 3rem 0; }
.detail-card { margin-top: 1.4rem; padding: clamp(1.5rem, 5vw, 3.5rem); border: 1px solid var(--line); border-radius: 1rem; background: var(--surface); box-shadow: var(--shadow); }
.detail-card h1 { margin: .3rem 0 1.5rem; font-family: Georgia, serif; font-size: clamp(2.2rem, 5vw, 3.8rem); }
.detail-metric { color: var(--brand-dark); font-size: clamp(1.3rem, 3vw, 2rem); font-weight: 800; }
.next-step { display: grid; gap: .4rem; margin: 1.5rem 0; padding: 1rem; border-left: 4px solid var(--brand); background: var(--brand-soft); line-height: 1.55; }

@media (max-width: 820px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-context { min-height: 50vh; }
  .topbar { align-items: flex-start; }
  .brand small { display: none; }
  .hero { align-items: flex-start; flex-direction: column; }
  .attention-grid { grid-template-columns: 1fr; }
  .module-grid { grid-template-columns: 1fr; }
  .module-card, .module-card:nth-child(4), .module-card:nth-child(5) { grid-column: auto; }
}

@media (max-width: 560px) {
  .auth-panel, .auth-context { padding: 2rem 1.25rem; }
  .topbar { position: static; flex-direction: column; }
  .topbar__actions { justify-content: flex-start; }
  .topbar__actions .button { min-height: 2.2rem; padding: .5rem .68rem; font-size: .75rem; }
  .dashboard { width: min(100% - 1.2rem, 1180px); }
}

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