:root {
  --ink: #17231f;
  --ink-soft: #354741;
  --muted: #60726c;
  --line: #dce7e3;
  --line-strong: #c7d8d2;
  --bg: #f2f7f5;
  --surface: #ffffff;
  --surface-muted: #f7faf9;
  --green: #0b927a;
  --green-dark: #076a59;
  --green-soft: #e5f5f0;
  --red: #c83e50;
  --red-soft: #fff0f2;
  --amber: #946200;
  --amber-soft: #fff6dc;
  --sidebar: #10251f;
  --focus: #55c9b4;
  --radius: 12px;
  --shadow: 0 6px 8px rgba(18, 58, 48, 0.06);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.52; }
button, input, select, textarea { border-radius: 8px; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  padding: 11px 12px;
  color: var(--ink);
  background: var(--surface);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
textarea { resize: vertical; }
input::placeholder, textarea::placeholder { color: #697b75; }
input:focus, select:focus, textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(11, 146, 122, 0.14);
}
button:focus-visible, a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.hidden { display: none !important; }
.primary, .secondary, .danger, .text-button {
  min-height: 40px;
  padding: 9px 16px;
  font-weight: 650;
}
.primary { color: #fff; background: var(--green); }
.primary:hover { background: var(--green-dark); }
.secondary { color: var(--ink-soft); background: #edf3f1; }
.secondary:hover { background: #e0ebe7; }
.danger { color: var(--red); background: var(--red-soft); }
.danger:hover { background: #ffe2e7; }
.text-button { min-height: auto; padding: 4px 6px; color: var(--green-dark); background: transparent; }
.wide { width: 100%; }

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background: linear-gradient(135deg, #e8f4f0 0%, #f7faf9 52%, #edf5f2 100%);
}
.login-layout {
  width: min(900px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.9fr);
  overflow: hidden;
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 8px 28px rgba(17, 61, 50, 0.12);
}
.login-intro {
  display: flex;
  min-height: 520px;
  flex-direction: column;
  justify-content: flex-end;
  padding: 56px;
  color: #fff;
  background: var(--sidebar);
}
.login-intro h1 { max-width: 12ch; margin: 10px 0 16px; font-size: 34px; line-height: 1.2; }
.login-intro p { max-width: 42ch; margin: 0; color: #c2d6cf; font-size: 15px; }
.login-intro .login-kicker { margin-top: 24px; color: #7bd9c5; font-weight: 700; }
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  flex: none;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: var(--green);
  font-weight: 800;
}
.brand-mark-large { width: 56px; height: 56px; font-size: 21px; }
.login-card { align-self: center; display: grid; gap: 9px; padding: 48px; }
.form-heading { margin-bottom: 16px; }
.form-heading h2 { margin: 0 0 6px; font-size: 24px; }
.form-heading p, .security-note { margin: 0; color: var(--muted); }
.login-card label, .dialog label, .form-grid label { margin-top: 7px; color: var(--ink-soft); font-weight: 650; }
.password-field { position: relative; }
.password-field input { padding-right: 62px; }
.password-toggle { position: absolute; top: 5px; right: 6px; }
.form-error { min-height: 21px; margin: 2px 0 0; color: var(--red); }
.security-note { margin-top: 7px; font-size: 12px; text-align: center; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
aside {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 24px 16px 16px;
  color: #fff;
  background: var(--sidebar);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 26px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; }
.brand small { margin-top: 2px; color: #9fb7af; }
nav { display: grid; gap: 4px; }
nav button {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-radius: 8px;
  padding: 10px 12px;
  color: #bdd0ca;
  background: transparent;
  text-align: left;
}
nav button span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #9dbcb2;
  background: rgba(255, 255, 255, 0.06);
  font-size: 12px;
}
nav button:hover, nav button.active { color: #fff; background: #1d3b32; }
nav button.active span { color: #fff; background: var(--green); }
.account-summary { margin-top: auto; padding: 14px 10px 4px; border-top: 1px solid rgba(255, 255, 255, 0.12); }
.account-summary strong, .account-summary small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-summary small { margin-top: 3px; color: #9fb7af; }
.account-actions { display: flex; gap: 8px; margin-top: 12px; }
.account-actions button { padding: 5px 0; color: #bdd0ca; background: transparent; font-size: 12px; }
.account-actions button:hover { color: #fff; }

.workspace { min-width: 0; padding: 0 36px 48px; }
header { min-height: 96px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
header h1 { margin: 0; font-size: 24px; line-height: 1.25; }
header p { margin: 5px 0 0; color: var(--muted); }
.secure { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; color: var(--green-dark); background: var(--green-soft); border-radius: 999px; font-size: 12px; font-weight: 650; }
.secure i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.stats { display: grid; grid-template-columns: repeat(5, minmax(130px, 1fr)); gap: 12px; }
.stat, .panel { background: var(--surface); box-shadow: var(--shadow); }
.stat { min-height: 112px; padding: 20px; border-radius: var(--radius); }
.stat span { color: var(--muted); font-size: 13px; }
.stat strong { display: block; margin-top: 12px; font-size: 28px; line-height: 1; }
.panel { margin-top: 16px; padding: 20px; border-radius: var(--radius); }
.panel:first-child { margin-top: 0; }
.panel-head, .toolbar, .section-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.panel h2, .section-heading h2 { margin: 0; font-size: 18px; }
.panel h3 { margin: 0; font-size: 15px; }
.panel-copy { margin: 6px 0 18px; color: var(--muted); }
.toolbar { margin-bottom: 18px; }
.toolbar .search { display: flex; gap: 8px; flex: 1; }
.toolbar input { width: min(360px, 100%); }
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 13px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { color: var(--muted); background: var(--surface-muted); font-weight: 650; white-space: nowrap; }
tbody tr:hover { background: #fbfdfc; }
small { color: var(--muted); }
.badge { display: inline-block; padding: 3px 7px; border-radius: 999px; color: var(--green-dark); background: var(--green-soft); font-size: 12px; }
.badge.red { color: var(--red); background: var(--red-soft); }
.badge.amber { color: var(--amber); background: var(--amber-soft); }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.actions button { min-height: 34px; padding: 6px 9px; border-radius: 7px; color: #27554a; background: #edf4f1; }
.actions button:hover { background: #dcece6; }
.empty, .loading-panel { padding: 46px 20px; color: var(--muted); text-align: center; }
.loading-panel { border-radius: var(--radius); background: var(--surface); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid button { align-self: end; }
.account-list { margin-top: 20px; }
.account-row input, .account-row select { min-width: 130px; }
.account-row .username { font-weight: 700; }

.dialog { width: min(460px, calc(100% - 32px)); border: 0; border-radius: 14px; padding: 0; color: var(--ink); box-shadow: 0 18px 48px rgba(17, 52, 43, 0.22); }
.dialog::backdrop { background: rgba(9, 24, 20, 0.48); }
.dialog form { display: grid; gap: 9px; padding: 24px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 8px; }
.dialog-heading h2 { margin: 0; font-size: 20px; }
.dialog-heading p { margin: 4px 0 0; color: var(--muted); }
.icon-button { width: 38px; height: 38px; border-radius: 50%; color: var(--muted); background: #edf3f1; font-size: 24px; line-height: 1; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 20; max-width: min(420px, calc(100% - 48px)); padding: 12px 16px; border-radius: 8px; color: #fff; background: var(--ink); opacity: 0; transform: translateY(8px); transition: opacity 180ms ease, transform 180ms ease; pointer-events: none; }
.toast.show { opacity: 1; transform: none; }

@media (max-width: 1080px) {
  .shell { grid-template-columns: 84px minmax(0, 1fr); }
  aside { padding-inline: 12px; }
  .brand { justify-content: center; padding-inline: 0; }
  .brand div, nav button { font-size: 0; }
  nav button { justify-content: center; padding-inline: 0; }
  nav button span { font-size: 12px; }
  .account-summary strong, .account-summary small { display: none; }
  .account-actions { display: grid; }
  .account-actions button { font-size: 11px; }
  .stats { grid-template-columns: repeat(3, minmax(130px, 1fr)); }
}

@media (max-width: 720px) {
  .login { padding: 16px; }
  .login-layout { grid-template-columns: 1fr; }
  .login-intro { display: none; }
  .login-card { padding: 32px 24px; }
  .shell { display: block; }
  aside { position: static; width: 100%; height: auto; padding: 12px; }
  .brand, .account-summary { display: none; }
  nav { display: flex; overflow-x: auto; }
  nav button { min-width: 76px; display: grid; justify-items: center; gap: 4px; font-size: 12px; white-space: nowrap; }
  .workspace { padding: 0 12px 32px; }
  header { min-height: 82px; }
  header h1 { font-size: 21px; }
  header p, .secure { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel { padding: 14px; }
  .toolbar, .toolbar .search { align-items: stretch; flex-direction: column; }
  .toolbar input { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  table { min-width: 760px; }
}

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