:root {
  --paper: #f5f2ec;
  --surface: #fffefa;
  --surface-blue: #edf4ff;
  --surface-orange: #fff0e7;
  --ink: #111317;
  --muted: #6f706d;
  --line: #dcd8d0;
  --blue: #1461d8;
  --blue-dark: #0c47a4;
  --orange: #ff4f12;
  --orange-dark: #d93b04;
  --green: #168756;
  --red: #c63131;
  --radius: 18px;
  --shadow: 12px 12px 0 rgba(17, 19, 23, 0.07);
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--paper); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(rgba(20, 97, 216, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 97, 216, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 32px 32px;
  font-family: var(--font);
  text-rendering: optimizeLegibility;
}

button, input, select { font: inherit; }
button { cursor: pointer; }

[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 14px;
  background: var(--ink);
  color: white;
}
.skip-link:focus { top: 12px; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 0.92fr) minmax(440px, 1.08fr);
  background: var(--surface);
}

.login-brand {
  position: relative;
  overflow: hidden;
  display: flex;
  min-height: 100%;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(32px, 5vw, 76px);
  color: white;
  background: var(--blue);
}

.brand-mark {
  position: relative;
  z-index: 2;
  width: 82px;
  height: 82px;
  display: grid;
  place-items: center;
  color: white;
  background: var(--orange);
  font-size: 34px;
  font-weight: 900;
  letter-spacing: -0.08em;
  box-shadow: 8px 8px 0 rgba(7, 27, 66, 0.24);
}

.brand-copy { position: relative; z-index: 2; max-width: 560px; }
.brand-copy span { display: block; margin-bottom: 22px; font-size: 13px; font-weight: 800; letter-spacing: 0.18em; }
.brand-copy strong { display: block; max-width: 540px; font-size: clamp(38px, 5vw, 76px); line-height: 1.05; letter-spacing: -0.055em; }
.brand-copy p { max-width: 440px; margin: 24px 0 0; color: rgba(255,255,255,.8); font-size: 17px; line-height: 1.75; }

.brand-orbit { position: absolute; border: 1px solid rgba(255,255,255,.25); border-radius: 999px; }
.orbit-one { width: 560px; height: 560px; top: -240px; right: -280px; }
.orbit-two { width: 360px; height: 360px; bottom: -150px; left: -130px; border-width: 70px; opacity: .45; }

.login-panel {
  width: min(620px, calc(100% - 64px));
  align-self: center;
  justify-self: center;
  padding: 64px 0;
}

.eyebrow { color: var(--blue); font-size: 12px; font-weight: 900; letter-spacing: .16em; }
.login-panel h1 { margin: 12px 0 16px; font-size: clamp(42px, 5vw, 70px); line-height: 1.1; letter-spacing: -.06em; }
.intro { max-width: 520px; margin: 0 0 42px; color: var(--muted); line-height: 1.7; font-size: 17px; }

label { display: block; margin: 18px 0 9px; font-size: 14px; font-weight: 800; }

input, select {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 0 16px;
  color: var(--ink);
  background: var(--surface);
  outline: none;
}

input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(20,97,216,.13); }

.password-field { position: relative; }
.password-field input { padding-right: 82px; }
.password-toggle { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }

.text-button, .icon-button {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-weight: 800;
}

.primary-button, .secondary-button, .danger-button {
  min-height: 48px;
  border: 1px solid transparent;
  padding: 0 22px;
  font-weight: 900;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}
.primary-button { color: white; background: var(--orange); box-shadow: 5px 5px 0 rgba(255,79,18,.15); }
.primary-button:hover { background: var(--orange-dark); transform: translate(-1px,-1px); box-shadow: 7px 7px 0 rgba(255,79,18,.14); }
.secondary-button { border-color: var(--line); color: var(--ink); background: var(--surface); }
.secondary-button:hover { border-color: var(--blue); color: var(--blue); }
.danger-button { color: white; background: var(--red); }
.wide-button { width: 100%; margin-top: 28px; display: flex; justify-content: space-between; align-items: center; }
.compact-button { min-height: 44px; padding-inline: 17px; }
button:disabled { cursor: wait; opacity: .58; transform: none !important; box-shadow: none !important; }
button:focus-visible { outline: 3px solid rgba(20,97,216,.28); outline-offset: 3px; }

.form-error { margin: 12px 0 0; color: var(--red); font-weight: 700; line-height: 1.5; }
.security-note { display: flex; gap: 10px; margin-top: 38px; padding-top: 22px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.6; }
.security-dot { flex: 0 0 auto; width: 8px; height: 8px; margin-top: 5px; border-radius: 99px; background: var(--green); }

.dashboard { min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 4vw, 64px);
  border-bottom: 1px solid var(--line);
  background: rgba(255,254,250,.94);
  backdrop-filter: blur(16px);
}
.topbar-brand, .topbar-account { display: flex; align-items: center; gap: 16px; }
.brand-mark-small { width: 48px; height: 48px; font-size: 22px; box-shadow: 4px 4px 0 rgba(17,19,23,.12); }
.topbar-brand strong { display: block; margin-top: 3px; font-size: 18px; }
.topbar-account { gap: 24px; text-align: right; }
.topbar-account span, .topbar-account strong { display: block; }
.topbar-account span { margin-bottom: 4px; color: var(--muted); font-size: 12px; }

.workspace {
  width: min(1540px, calc(100% - 48px));
  margin: 0 auto;
  padding: clamp(28px, 4vw, 60px) 0;
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  gap: 24px;
}

.overview, .account-workbench {
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.overview { min-height: 670px; display: flex; flex-direction: column; padding: 34px; }
.overview h1 { margin: 10px 0 14px; font-size: 38px; line-height: 1.08; letter-spacing: -.055em; }
.overview p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.75; }
.metric-primary { margin: 38px 0 20px; padding: 28px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metric-primary span { display: block; color: var(--blue); font-size: 78px; line-height: 1; font-weight: 900; letter-spacing: -.07em; }
.metric-primary small { display: block; margin-top: 8px; color: var(--muted); font-weight: 700; }
.metrics { margin: 0; display: grid; grid-template-columns: repeat(2,1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.metrics div { padding: 16px; background: var(--surface); }
.metrics dt { color: var(--muted); font-size: 12px; }
.metrics dd { margin: 6px 0 0; font-size: 24px; font-weight: 900; }
.cloud-rule { margin-top: auto; padding: 20px; border-left: 5px solid var(--orange); background: var(--surface-orange); }
.cloud-rule strong { font-size: 14px; }
.cloud-rule p { margin-top: 7px; font-size: 12px; }

.account-workbench { min-width: 0; padding: 34px; }
.workbench-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.workbench-heading h2 { margin: 7px 0 0; font-size: 34px; letter-spacing: -.045em; }
.toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) 190px auto; gap: 12px; margin: 28px 0 22px; }
.search-field, .select-field { position: relative; margin: 0; }
.search-field span { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--blue); font-size: 20px; }
.search-field input { min-height: 44px; padding-left: 44px; }
.select-field { display: flex; align-items: center; border: 1px solid var(--line); background: var(--surface); }
.select-field > span { padding-left: 14px; color: var(--muted); font-size: 12px; }
.select-field select { min-height: 42px; border: 0; }

.table-wrap { overflow-x: auto; border-top: 1px solid var(--ink); }
table { width: 100%; border-collapse: collapse; }
th { padding: 14px 12px; color: var(--muted); font-size: 11px; letter-spacing: .09em; text-align: left; }
td { padding: 18px 12px; border-top: 1px solid var(--line); vertical-align: middle; }
.account-name { display: flex; align-items: center; gap: 12px; }
.avatar { width: 40px; height: 40px; display: grid; place-items: center; color: var(--blue); background: var(--surface-blue); font-weight: 900; }
.account-name strong, .account-name small { display: block; }
.account-name small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.role-label, .status-label { display: inline-flex; min-height: 26px; align-items: center; padding: 0 9px; font-size: 11px; font-weight: 800; }
.role-label { color: var(--blue); background: var(--surface-blue); }
.status-active { color: var(--green); background: #eaf7f0; }
.status-disabled { color: var(--red); background: #fff0f0; }
.last-login { color: var(--muted); font-size: 12px; }
.row-actions { display: flex; justify-content: flex-end; gap: 6px; }
.row-button { min-height: 34px; border: 1px solid var(--line); padding: 0 9px; color: var(--ink); background: var(--surface); font-size: 11px; font-weight: 800; }
.row-button:hover { border-color: var(--blue); color: var(--blue); }
.row-button-danger:hover { border-color: var(--red); color: var(--red); }
.state-panel { margin-top: 24px; min-height: 140px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; border: 1px dashed var(--line); color: var(--muted); }
.state-panel strong { color: var(--ink); }
.state-error { color: var(--red); background: #fff8f8; }

dialog { width: min(540px, calc(100% - 32px)); max-width: none; border: 0; padding: 0; color: var(--ink); background: transparent; }
dialog::backdrop { background: rgba(7, 14, 29, .58); backdrop-filter: blur(4px); }
.dialog-card { padding: 30px; border: 1px solid var(--line); background: var(--surface); box-shadow: 14px 14px 0 rgba(0,0,0,.15); }
.dialog-card-small { text-align: center; }
.dialog-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.dialog-heading h2, .dialog-card-small h2 { margin: 7px 0 0; font-size: 30px; letter-spacing: -.04em; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); color: var(--ink); font-size: 22px; }
.dialog-copy { color: var(--muted); line-height: 1.65; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 28px; }
.confirm-symbol { width: 64px; height: 64px; margin: 0 auto 16px; display: grid; place-items: center; color: white; background: var(--orange); font-size: 30px; font-weight: 900; }
.dialog-card-small .dialog-actions { justify-content: center; }

.toast { position: fixed; right: 28px; bottom: 28px; z-index: 90; max-width: min(420px, calc(100% - 56px)); padding: 15px 18px; color: white; background: var(--ink); box-shadow: 8px 8px 0 rgba(20,97,216,.22); font-weight: 700; }

@media (max-width: 920px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { min-height: 260px; padding: 28px; }
  .brand-copy { margin-top: 64px; }
  .brand-copy strong { font-size: 40px; }
  .brand-copy p, .brand-copy span { display: none; }
  .login-panel { width: min(620px, calc(100% - 40px)); padding: 48px 0 64px; }
  .workspace { grid-template-columns: 1fr; }
  .overview { min-height: auto; }
  .cloud-rule { margin-top: 24px; }
  .metrics { grid-template-columns: repeat(4,1fr); }
}

@media (max-width: 680px) {
  .topbar { min-height: 72px; padding: 0 16px; }
  .topbar-brand .eyebrow, .topbar-account > div { display: none; }
  .workspace { width: calc(100% - 24px); padding: 16px 0 32px; }
  .overview, .account-workbench { padding: 22px; box-shadow: 6px 6px 0 rgba(17,19,23,.06); }
  .overview h1 { font-size: 32px; }
  .metric-primary span { font-size: 58px; }
  .metrics { grid-template-columns: repeat(2,1fr); }
  .workbench-heading { align-items: stretch; flex-direction: column; }
  .toolbar { grid-template-columns: 1fr; }
  .select-field { min-height: 44px; }
  th:nth-child(2), td:nth-child(2), th:nth-child(4), td:nth-child(4) { display: none; }
  td { padding-inline: 6px; }
  .row-actions { flex-wrap: wrap; min-width: 94px; }
  .dialog-card { padding: 24px; }
}

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