:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans CJK SC", system-ui, sans-serif;
  --ink: #16382d;
  --body: #263b33;
  --muted: #566c61;
  --surface: #fff;
  --background: #f5f7f2;
  --line: #dfe7de;
  --spruce: #1d4b3b;
  --mint: #e5f0e5;
  --gold: #ffdf7a;
  --danger: #9e3528;
  background: var(--background);
  color: var(--body);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 18rem; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .48; }
button, input, select, a { outline-offset: 3px; }
:focus-visible { outline: 2px solid #147350; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { color: var(--ink); }
.muted { color: var(--muted); line-height: 1.75; }
.brand { display: flex; align-items: center; gap: .8rem; font-size: 1.21rem; font-weight: 750; letter-spacing: .06em; }
.brand small { display: block; margin-top: .28rem; color: #b5c8bc; font-size: .78rem; font-weight: 500; letter-spacing: .13em; }
.brand-mark { display: inline-grid; flex: 0 0 auto; width: 2.2rem; height: 2.2rem; place-items: center; border-radius: .72rem; background: #f4d988; box-shadow: inset 0 0 0 1px #ffefba; }
.brand-mark::after { width: .8rem; height: .8rem; border-radius: 58% 7% 58% 55%; background: var(--ink); transform: rotate(-10deg); content: ''; }

.session-loading { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: .85rem; color: var(--muted); }
.login-screen { min-height: 100vh; display: grid; grid-template-columns: 1.03fr 1fr; }
.login-brand { position: relative; isolation: isolate; overflow: hidden; padding: clamp(1.35rem, 6vw, 6rem); display: flex; flex-direction: column; justify-content: space-between; gap: 3rem; color: white; background: radial-gradient(ellipse at 80% 20%, #2d6044 0%, transparent 60%), linear-gradient(151deg, #19392d, #101f21 80%); }
.login-message { z-index: 1; margin: auto 0; }
.login-message h1 { font-size: clamp(3rem, 6vw, 6.5rem); line-height: 1.08; letter-spacing: -.085em; color: #fff5d7; margin: 1.1rem 0 1.6rem; }
.login-overline { font-size: .9rem; font-weight: 700; letter-spacing: .22em; color: #ffdf7a; }
.login-message p:last-child { color: #d2e0d0; line-height: 1.8; }
.light-field { z-index: -1; position: absolute; width: min(36rem, 84%); aspect-ratio: 1; right: -12%; bottom: -8%; border-radius: 50%; background: radial-gradient(circle, #f5dc8b3f 1%, #9aa84a24 27%, transparent 69%); transform: rotate(-13deg); }
.light-field i { position: absolute; width: .46rem; height: .46rem; border-radius: 50%; background: #ffed93; box-shadow: 0 0 1rem .23rem #f4d98870; }
.light-field i:nth-child(1) { left: 27%; top: 20%; }
.light-field i:nth-child(2) { left: 44%; top: 43%; width: .8rem; height: .8rem; }
.light-field i:nth-child(3) { left: 70%; top: 18%; }
.light-field i:nth-child(4) { left: 36%; top: 63%; width: .32rem; height: .32rem; }
.light-field i:nth-child(5) { left: 57%; top: 56%; }
.light-field i:nth-child(6) { left: 66%; top: 76%; width: .24rem; height: .24rem; }
.login-panel { display: grid; place-items: center; min-height: 24rem; padding: clamp(1.5rem, 5vw, 4rem); }
.login-form { width: min(100%, 23rem); display: grid; gap: .9rem; }
.login-form h2 { font-size: clamp(1.55rem, 3.5vw, 2.35rem); }
.login-form label { margin-top: .8rem; }
.login-form .button { width: 100%; margin-top: .28rem; min-height: 3rem; }

.workspace { min-height: 100vh; display: grid; grid-template-columns: 14.75rem minmax(0, 1fr); }
.sidebar { color: #eef4ed; background: #17382e; min-height: 100vh; padding: 1.65rem 1rem 1rem; display: flex; flex-direction: column; gap: 2.45rem; }
.sidebar .brand { padding-left: .48rem; }
.navigation { display: grid; gap: .4rem; }
.navigation button, .logout { display: flex; align-items: center; gap: .7rem; border: 1px solid transparent; background: transparent; border-radius: .56rem; text-align: left; padding: .76rem .75rem; color: inherit; }
.navigation button:hover, .logout:hover { background: #235342; }
.navigation button[aria-current='page'] { background: #2e5849; border-color: #628173; color: #fff5ce; font-weight: 700; }
.navigation span, .logout span { min-width: 1.2rem; font-size: 1.15rem; text-align: center; }
.logout { margin-top: auto; color: #d0ded6; }
.content { min-width: 0; }
.topbar { height: 4.25rem; display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: 0 clamp(1rem, 3vw, 2.75rem); background: #fbfcfa; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .92rem; }
.topbar p span { padding-inline: .42rem; color: #7d8d83; }
.operator { display: flex; white-space: nowrap; align-items: center; gap: .55rem; }
.operator > span { display: grid; border-radius: 50%; width: 2rem; height: 2rem; place-items: center; color: var(--ink); background: #f0e5ac; }
.view { margin: 0 auto; max-width: 92rem; padding: 2.25rem clamp(1rem, 3vw, 2.75rem) 3rem; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin: 0 0 1.5rem; }
.page-heading h1 { font-size: clamp(1.65rem, 3vw, 2.45rem); letter-spacing: -.075em; margin-bottom: .28rem; }
.toolbar { display: flex; flex-wrap: wrap; gap: .62rem; }
.button { border: 1px solid #c8d9cb; border-radius: .56rem; background: var(--surface); color: var(--ink); padding: .58rem .87rem; min-height: 2.5rem; line-height: 1.3; font-weight: 650; }
.button:hover:not(:disabled) { border-color: #839f90; background: #f3f7f1; }
.button-primary { background: var(--spruce); color: #fff; border-color: var(--spruce); }
.button-primary:hover:not(:disabled) { background: #17392e; border-color: #17392e; }
.button-danger { color: var(--danger); border-color: #e0beb6; }
.button-link { border: 0; min-height: auto; padding: .35rem .45rem; background: transparent; }
.banner { padding: .9rem 1rem; margin-bottom: 1rem; border: 1px solid #dfd7a3; border-radius: .65rem; display: flex; align-items: center; gap: .72rem; background: #fff8dc; color: #5b4715; line-height: 1.6; }
.banner .status { background: #f4e4ab; }
.status { display: inline-flex; align-items: center; width: max-content; border-radius: 99rem; padding: .25rem .64rem; background: var(--mint); color: #265844; font-size: .84rem; font-weight: 650; white-space: nowrap; }
.status-archived { background: #edf0eb; color: #58695d; }
.status-draft { background: #f6ebbf; color: #725422; }
.metrics { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: .75rem; margin-bottom: 1rem; }
.metric { border: 1px solid var(--line); border-radius: .7rem; background: var(--surface); padding: .95rem 1.1rem; }
.metric p { color: var(--muted); font-size: .86rem; }
.metric strong { display: block; color: var(--ink); font-size: clamp(1rem, 2vw, 1.44rem); margin-top: .38rem; overflow-wrap: anywhere; }
.catalog-grid { display: grid; grid-template-columns: minmax(18rem, 1.6fr) minmax(15rem, 1fr); gap: .9rem; align-items: start; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: .75rem; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .7rem; padding: 1rem 1.05rem; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 1.07rem; }
.panel-body { padding: 1rem 1.05rem; }
.field { display: grid; gap: .45rem; }
label { font-weight: 650; color: var(--ink); }
input, select { width: 100%; min-height: 2.65rem; border-radius: .5rem; border: 1px solid #bfcdc2; background: #fff; color: var(--body); padding: .53rem .68rem; }
select:required:invalid { color: var(--muted); }
.panel-head select { width: auto; }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree ul { padding-left: .85rem; margin-left: .85rem; border-left: 1px solid #e2e9df; }
.tree-row { display: flex; align-items: center; gap: .12rem; min-height: 2.7rem; border: 1px solid transparent; border-radius: .45rem; }
.tree-row:hover { background: #f2f7f0; }
.tree-row.selected { background: #e7f0e6; border-color: #c8ddcb; }
.tree-toggle { flex: 0 0 1.7rem; align-self: stretch; border: 0; padding: 0; border-radius: .45rem; background: transparent; color: #416955; }
.tree-toggle[aria-expanded='true'] { transform: rotate(90deg); }
.tree-toggle:hover { background: #dce9dc; }
.tree-item { display: flex; justify-content: space-between; align-items: center; gap: .5rem; width: 100%; min-height: 2.6rem; text-align: left; border: 0; background: transparent; color: var(--body); padding: .36rem .5rem .36rem .16rem; }
.tree-item strong { font-weight: 650; overflow-wrap: anywhere; }
.tree-meta { color: var(--muted); font-size: .8rem; text-align: right; white-space: nowrap; }
.empty { display: grid; gap: .55rem; padding: 1.45rem 1rem; text-align: center; }
.empty strong { color: var(--ink); }
.details h3 { font-size: 1.3rem; margin: .65rem 0 .8rem; overflow-wrap: anywhere; }
.details dl { display: grid; grid-template-columns: auto minmax(0,1fr); gap: .55rem .75rem; margin: .9rem 0 1.15rem; }
.details dt { color: var(--muted); }
.details dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.details .toolbar { padding-top: .65rem; border-top: 1px solid var(--line); }
.table-scroll { overflow-x: auto; }
.log-table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; }
.log-table th, .log-table td { padding: .82rem 1rem; border-bottom: 1px solid var(--line); }
.log-table th { font-size: .88rem; color: var(--muted); background: #f9fbf8; font-weight: 650; }
.log-table td { font-size: .92rem; }
.log-table tr:last-child td { border-bottom: 0; }
.pagination { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .6rem; border-top: 1px solid var(--line); padding: .8rem 1rem; }
.log-details { margin: 0; max-height: 60vh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
dialog { border: 1px solid var(--line); border-radius: .9rem; padding: 0; max-width: 33rem; width: calc(100% - 1.6rem); background: var(--surface); color: var(--body); box-shadow: 0 1rem 3rem #17382e29; }
dialog::backdrop { background: #132c20a0; }
.dialog-inner { padding: 1.35rem; display: grid; gap: .9rem; }
.dialog-inner h2 { font-size: 1.35rem; }
.dialog-inner .toolbar { justify-content: flex-end; }
.form-error { color: var(--danger); background: #fff1ed; border-radius: .45rem; padding: .5rem .65rem; overflow-wrap: anywhere; }
.feedback { position: fixed; z-index: 2; bottom: 1.2rem; right: 1.2rem; max-width: min(28rem, calc(100% - 2.4rem)); padding: .72rem 1.05rem; border-radius: .55rem; background: #1b4b38; color: white; box-shadow: 0 .4rem 1rem #193e2b22; }
.feedback[data-level='error'] { background: #80332b; }

@media (max-width: 62rem) {
  .workspace { grid-template-columns: 11rem minmax(0,1fr); }
  .catalog-grid { grid-template-columns: 1fr; }
}

@media (max-width: 45rem) {
  .login-screen, .workspace { grid-template-columns: minmax(0,1fr); }
  .login-brand { padding: 1.35rem; gap: 2rem; min-height: 19rem; }
  .login-message h1 { font-size: clamp(2.75rem, 10vw, 4rem); margin-bottom: .8rem; }
  .login-message h1 br { display: none; }
  .login-panel { min-height: 19rem; }
  .sidebar { padding: .8rem 1rem .65rem; gap: .7rem; min-height: auto; display: grid; grid-template-columns: 1fr auto; }
  .sidebar .brand { padding: 0; }
  .sidebar .brand small { display: none; }
  .navigation { grid-row: 2; grid-column: 1 / -1; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); }
  .navigation button { padding: .55rem .28rem; justify-content: center; font-size: .88rem; gap: .25rem; }
  .logout { margin: auto 0; padding: .42rem 0 .42rem .62rem; }
  .topbar { height: 3.45rem; }
  .view { padding-top: 1.35rem; }
  .page-heading { display: grid; gap: .65rem; }
  .metric { padding: .65rem .55rem; }
  .panel-head, .panel-body { padding: .75rem .65rem; }
}

@media (max-width: 24rem) {
  .navigation button span { display: none; }
  .tree-meta { display: none; }
  .tree ul { margin-left: .42rem; padding-left: .35rem; }
}
