:root {
  color-scheme: light;
  --ink: #182c25;
  --muted: #52665e;
  --line: #dce7e1;
  --surface: #fff;
  --canvas: #f3f7f4;
  --green: #136747;
  --green-dark: #0d5036;
  --sidebar: #142b24;
  --soft: #e8f4ed;
  --danger: #92342b;
  --radius: 14px;
  font: 15px/1.55 system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); }
[hidden] { display: none !important; }
a { color: var(--green); }
button, input, select, textarea { font: inherit; }
button, .button {
  min-height: 40px;
  padding: .45rem .85rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
button:hover, .button:hover { background: var(--soft); }
button:disabled { opacity: .55; cursor: default; }
.primary { background: var(--green); border-color: var(--green); color: white; }
.primary:hover { background: var(--green-dark); }
:focus-visible { outline: 3px solid #53a387; outline-offset: 3px; }
input, select, textarea {
  display: block;
  min-height: 42px;
  width: 100%;
  min-width: 0;
  padding: .55rem .7rem;
  border: 1px solid #b9cbc0;
  border-radius: 8px;
  color: var(--ink);
  background: white;
}
label { display: block; font-weight: 600; }
label :is(input, select, textarea) { margin-top: .35rem; }
textarea { resize: vertical; }
p { margin: .45rem 0 .85rem; }
small { color: var(--muted); }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: clamp(1.7rem, 3vw, 2.4rem); letter-spacing: -.035em; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
.skip { position: fixed; left: 1rem; top: -5rem; z-index: 5; background: white; padding: .6rem; }
.skip:focus { top: 1rem; }
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  background: var(--sidebar);
  color: white;
  padding: 26px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand small, .brand strong { display: block; }
.brand small, .sidebar footer { color: #acc6b9; font-size: .8rem; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 11px;
  background: #b8efd0;
  color: #123c2c;
  font-weight: 800;
}
.sidebar nav { display: grid; gap: 6px; }
.sidebar nav a { color: #dfede5; padding: .7rem .85rem; border-radius: 8px; text-decoration: none; }
.sidebar nav a:hover, .sidebar nav a[aria-current] { background: #294c3f; color: white; }
.sidebar nav a[aria-current] { box-shadow: inset 3px 0 #a7e5c2; font-weight: 700; }
.sidebar footer { margin-top: auto; padding-inline: 6px; }
.workspace { min-width: 0; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .65rem;
  min-height: 64px;
  padding: .65rem clamp(16px, 3vw, 42px);
  background: white;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}
.topbar strong { color: var(--ink); }
.top-actions, .toolbar, .split { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.top-actions { font-size: .85rem; }
.split { justify-content: space-between; }
main { max-width: 1600px; margin: auto; padding: clamp(14px, 3vw, 42px); }
.page-head { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.page-head p { color: var(--muted); margin-bottom: 0; }
.panel, .account-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(14px, 2vw, 22px);
  box-shadow: 0 2px 5px #173c2710;
  min-width: 0;
}
.notice { border: 1px solid var(--line); border-radius: 9px; padding: .65rem .85rem; background: var(--soft); }
.error { color: var(--danger); background: #fff4f1; }
.badge { display: inline-block; color: #214d3c; background: var(--soft); border-radius: 99px; padding: .25rem .65rem; font-size: .83rem; }
.account-layout { display: grid; grid-template-columns: 248px minmax(0, 1fr); gap: 16px; align-items: start; }
.groups { position: sticky; top: 16px; }
.groups label { margin-top: 12px; }
.group-list { list-style: none; padding: 0; margin: .7rem 0 0; }
.group-list li { display: flex; align-items: center; gap: 4px; margin-top: 4px; }
.group-list button { padding-inline: .4rem; }
.group-list .group-select { flex: 1; min-width: 0; overflow-wrap: anywhere; justify-content: flex-start; text-align: left; }
.group-select[aria-pressed="true"] { background: var(--soft); color: var(--green-dark); border-color: #a7cdb9; font-weight: 700; }
.account-content, .account-card, .identity { min-width: 0; }
#assign-form textarea { margin-block: .45rem .75rem; }
.account-cards, .stack, .auth-result { display: grid; gap: 12px; }
.card-head { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: start; }
.avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: var(--soft); display: grid; place-items: center; color: var(--green-dark); font-weight: 700; }
.identity p { margin: .2rem 0; }
.identity h3, .break { overflow-wrap: anywhere; }
.card-actions { justify-content: flex-end; }
.metrics { display: flex; flex-wrap: wrap; gap: .45rem 1rem; padding: 0; margin: .8rem 0 0; }
.metrics div { display: grid; gap: 1px; }
.metrics dt { font-size: .8rem; color: var(--muted); }
.metrics dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metrics button { padding: 0; min-height: auto; color: var(--green); background: none; border: 0; text-decoration: underline; text-align: left; }
.works { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; }
.work-strip { display: grid; grid-auto-flow: column; grid-auto-columns: 150px; gap: 10px; overflow-x: auto; padding: 5px 3px 10px; margin-top: 8px; scroll-snap-type: x proximity; }
.work { position: relative; scroll-snap-align: start; min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 7px; display: grid; align-content: start; gap: 5px; }
.work h4 { font-size: .9rem; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.work a { color: inherit; text-decoration: none; }
.work a::after { content: ""; position: absolute; inset: 0; border-radius: 10px; }
.work a:focus-visible::after { outline: 3px solid #53a387; }
.cover { position: relative; aspect-ratio: 3 / 4; overflow: hidden; border-radius: 7px; background: #e5eee8; display: grid; place-items: center; color: var(--muted); }
.cover img { width: 100%; height: 100%; position: absolute; inset: 0; object-fit: cover; }
.rank, .cover-stat { position: absolute; background: #142b24eb; color: white; border-radius: 5px; padding: .2rem .35rem; font-size: .75rem; }
.rank { right: 5px; top: 5px; }
.cover-stat { inset: auto 5px 5px; overflow-wrap: anywhere; }
.spark { border-top: 1px solid var(--line); padding-top: 5px; font-size: .79rem; }
.spark code { display: block; overflow-wrap: anywhere; position: relative; user-select: all; }
.form-grid { display: grid; grid-template-columns: minmax(160px, 1.5fr) repeat(2, minmax(125px, 1fr)) auto; gap: 10px; align-items: end; }
.dashboard, .publish-layout { display: grid; gap: 14px; align-items: start; }
.dashboard { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.publish-layout { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.dashboard h2, .session h2 { margin-bottom: 12px; }
.session form { margin-top: 16px; }
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: .88rem; }
th, td { padding: .55rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); }
dialog {
  width: min(560px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  box-shadow: 0 20px 80px #13261c45;
  overflow: auto;
}
dialog::backdrop { background: #102219a6; }
.dialog-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.dialog-head button { min-width: 40px; font-size: 1.25rem; }
.auth-result, #social-bind { margin-top: 12px; }
.qr { width: fit-content; max-width: 100%; background: white; padding: 12px; margin-inline: auto; border: 1px solid var(--line); }
.qr img, .qr canvas { max-width: 100%; height: auto; }

@media (max-width: 1050px) {
  .card-head { grid-template-columns: 56px minmax(0, 1fr); }
  .card-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 790px) {
  .shell { display: block; }
  .sidebar { position: static; height: auto; gap: 12px; padding: 12px 14px; }
  .sidebar nav { display: flex; flex-wrap: wrap; }
  .sidebar footer { display: none; }
  .account-layout, .publish-layout, .dashboard { grid-template-columns: minmax(0, 1fr); }
  .groups { position: static; }
  input, select, textarea { font-size: 16px; }
}
@media (max-width: 420px) {
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .topbar { align-items: start; }
}
