:root{
  --bg:#faf9f5;
  --ink:#1f1e1d;
  --soft:#6b6862;
  --muted:#9a9288;
  --accent:#cc785c;
  --accent-d:#b3613f;
  --accent-dark:#b3613f;
  --accent-soft:#f4dfd5;
  --line:#e6e0d6;
  --panel:#fffdf8;
  --panel-2:#fcfbf8;
  --ok:#2d8659;
  --bad:#aa4d3a;
  --rail-width:64px;
}
*{box-sizing:border-box}
html{background:var(--bg)}
body{
  min-height:100vh;
  margin:0;
  color:var(--ink);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Noto Sans SC",sans-serif;
  line-height:1.6;
  background:var(--bg);
  overflow-x:hidden;
}
#shell{
  min-height:100vh;
  --rail-width:64px;
}
#shell.rail-expanded{--rail-width:176px}
a{color:var(--accent);text-decoration:none}
button,input,textarea,select{font:inherit}
button{cursor:pointer}
.hide{display:none!important}
.admin-rail{
  position:fixed;
  inset:0 auto 0 0;
  z-index:40;
  width:var(--rail-width);
  display:flex;
  flex-direction:column;
  align-items:center;
  padding:22px 0 14px;
  border-right:1px solid var(--line);
  background:var(--panel-2);
  transition:width .2s ease;
}
.rail-brand{
  position:relative;
  display:grid;
  place-items:center;
  width:48px;
  height:48px;
  margin-bottom:18px;
  border-radius:8px;
  overflow:visible;
}
.rail-brand::after{
  content:"";
  position:absolute;
  left:50%;
  bottom:-11px;
  width:40px;
  border-top:1px solid var(--line);
  transform:translateX(-50%);
}
.rail-brand img{
  display:block;
  width:40px;
  height:40px;
  border-radius:8px;
  box-shadow:0 8px 20px rgba(204,120,92,.16);
}
.brand-wordmark{display:none}
.rail-nav{
  width:100%;
  min-height:0;
  display:flex;
  flex:1;
  flex-direction:column;
  align-items:center;
  padding-top:16px;
  overflow:visible;
  scrollbar-width:none;
}
.rail-nav::-webkit-scrollbar{display:none}
.rail-group{
  width:100%;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:2px;
}
.rail-group-label,.nav-label{
  position:absolute;
  width:1px;
  height:1px;
  padding:0;
  margin:-1px;
  overflow:hidden;
  clip:rect(0,0,0,0);
  white-space:nowrap;
  border:0;
}
.rail-nav button,.rail-action{
  position:relative;
  display:grid;
  place-items:center;
  width:48px;
  height:48px;
  flex:none;
  padding:0;
  border:1px solid transparent;
  border-radius:8px;
  background:transparent;
  color:var(--soft);
  transition:color .16s ease,background-color .16s ease,border-color .16s ease;
}
.rail-action{appearance:none}
.rail-nav button svg,.rail-action svg{
  display:block;
  place-self:center;
  width:22px;
  height:22px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.rail-nav button:hover,.rail-action:hover{
  color:var(--accent-d);
  background:#fff8f2;
  border-color:rgba(204,120,92,.18);
}
.rail-nav button.on{
  color:var(--accent-d);
  background:var(--accent-soft);
  border-color:rgba(204,120,92,.08);
}
.rail-nav button.on::before{
  content:"";
  position:absolute;
  left:-8px;
  width:3px;
  height:24px;
  border-radius:0 3px 3px 0;
  background:var(--accent);
}
.rail-nav button:focus-visible,.rail-action:focus-visible,.rail-brand:focus-visible{
  outline:3px solid rgba(204,120,92,.24);
  outline-offset:2px;
}
.rail-divider{
  width:42px;
  margin:9px 0;
  border-top:1px dashed #cfc7bc;
}
.rail-bottom{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:2px;
  width:56px;
  padding-top:10px;
  border-top:1px solid var(--line);
}
.rail-bottom button{font:inherit}
.rail-tooltip{
  position:absolute;
  left:calc(100% + 12px);
  top:50%;
  z-index:90;
  min-width:max-content;
  padding:6px 9px;
  border:1px solid var(--line);
  border-radius:6px;
  background:var(--ink);
  color:#fff;
  font-size:.76rem;
  font-weight:600;
  line-height:1.2;
  letter-spacing:0;
  opacity:0;
  pointer-events:none;
  transform:translate(4px,-50%);
  transition:opacity .12s ease,transform .12s ease;
  box-shadow:0 8px 24px rgba(31,30,29,.14);
}
.rail-brand:hover .rail-tooltip,
.rail-brand:focus-visible .rail-tooltip,
.rail-nav button:hover .rail-tooltip,
.rail-nav button:focus-visible .rail-tooltip,
.rail-action:hover .rail-tooltip,
.rail-action:focus-visible .rail-tooltip{
  opacity:1;
  transform:translate(0,-50%);
}
.workspace-shell{
  min-height:100vh;
  margin-left:var(--rail-width);
  display:flex;
  flex-direction:column;
  min-width:0;
  transition:margin-left .2s ease;
}
.rail-action .icon-collapse{display:none}
#shell.rail-expanded .rail-brand{
  width:calc(100% - 20px);
  grid-template-columns:40px minmax(0,1fr);
  justify-content:start;
  gap:10px;
}
#shell.rail-expanded .rail-brand::after{width:100%}
#shell.rail-expanded .brand-wordmark{
  display:block;
  min-width:0;
  color:var(--ink);
  font-size:.82rem;
  font-weight:750;
  white-space:nowrap;
}
#shell.rail-expanded .rail-group{
  align-items:stretch;
  padding:0 10px;
}
#shell.rail-expanded .rail-group-label{
  position:static;
  width:auto;
  height:auto;
  margin:7px 8px 4px;
  overflow:visible;
  clip:auto;
  color:var(--muted);
  font-size:.65rem;
  font-weight:700;
  line-height:1.2;
  white-space:nowrap;
}
#shell.rail-expanded .rail-nav button,
#shell.rail-expanded .rail-action{
  width:100%;
  grid-template-columns:24px minmax(0,1fr);
  justify-content:start;
  gap:9px;
  padding:0 10px;
}
#shell.rail-expanded .nav-label{
  position:static;
  width:auto;
  height:auto;
  margin:0;
  overflow:hidden;
  clip:auto;
  color:inherit;
  font-size:.82rem;
  font-weight:620;
  text-align:left;
  text-overflow:ellipsis;
  white-space:nowrap;
}
#shell.rail-expanded .rail-nav button.on::before{left:-10px}
#shell.rail-expanded .rail-divider{width:calc(100% - 20px)}
#shell.rail-expanded .rail-bottom{width:calc(100% - 20px);align-items:stretch}
#shell.rail-expanded .rail-tooltip{display:none}
#shell.rail-expanded .icon-expand{display:none}
#shell.rail-expanded .icon-collapse{display:block}
.top{
  position:sticky;
  top:0;
  z-index:30;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
  min-height:92px;
  padding:0 32px;
  border-bottom:1px solid var(--line);
  background:rgba(250,249,245,.94);
  backdrop-filter:blur(12px);
  -webkit-backdrop-filter:blur(12px);
}
.page-context{
  min-width:0;
  display:flex;
  align-items:center;
}
.page-kicker{
  display:none;
}
.page-context h1{
  margin:0;
  font-size:1.22rem;
  font-weight:720;
  line-height:1.2;
  letter-spacing:0;
}
.page-context p{
  display:none;
}
.top-actions{
  display:flex;
  align-items:center;
  gap:14px;
  min-width:0;
}
.page-refresh{
  width:42px;
  height:42px;
  display:grid;
  place-items:center;
  flex:none;
  padding:0;
  border:1px solid var(--line);
  border-radius:8px;
  background:var(--panel);
  color:var(--ink);
}
.page-refresh:hover{border-color:rgba(204,120,92,.34);color:var(--accent-d);background:#fff8f2}
.page-refresh:focus-visible{outline:3px solid rgba(204,120,92,.24);outline-offset:2px}
.page-refresh svg{
  width:21px;
  height:21px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.9;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.account-context{
  display:flex;
  align-items:center;
  gap:10px;
  max-width:min(34vw,320px);
  color:var(--soft);
  font-size:.76rem;
}
.account-avatar{
  width:42px;
  height:42px;
  display:grid;
  place-items:center;
  flex:none;
  border-radius:50%;
  background:#f7e9e3;
  color:var(--accent-d);
  font-size:1rem;
  font-weight:750;
}
.account-copy{
  min-width:0;
  display:grid;
  gap:0;
  line-height:1.25;
}
.account-label{
  color:var(--muted);
  font-size:.68rem;
  font-weight:560;
}
.account-context #who{
  display:block;
  color:var(--ink);
  font-size:.82rem;
  font-weight:700;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.link-button{
  border:0;
  padding:0;
  background:transparent;
  color:var(--accent);
  font:inherit;
  cursor:pointer;
}
.link-button:hover{color:var(--accent)}
.wrap{
  width:100%;
  max-width:1440px;
  margin:0 auto;
  padding:38px 36px 44px;
  flex:1;
}
#app{min-width:0}
.admin-footer{
  margin-top:auto;
  padding:10px 36px 18px;
  color:var(--soft);
  font-size:.78rem;
  text-align:right;
}
.admin-footer a{
  color:var(--soft);
  text-decoration:none;
}
.admin-footer a:hover{color:var(--accent)}
.tabs{
  display:flex;
  gap:8px;
  margin:0 0 14px;
  flex-wrap:wrap;
}
.tabs button{
  border:1px solid var(--line);
  background:var(--panel);
  color:var(--soft);
  padding:8px 15px;
  border-radius:8px;
  min-height:40px;
}
.tabs button.on{
  background:var(--accent-soft);
  color:var(--accent-d);
  border-color:rgba(204,120,92,.2);
}
.compact-tabs{margin:0}
.compact-tabs button{padding:7px 14px;min-height:34px}
.panel,.card,.empty{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:8px;
}
.panel{padding:20px}
.empty{padding:36px 24px;text-align:center}
.empty h2{margin:0 0 8px}
.empty p{margin:0 0 18px;color:var(--soft)}
.stats{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:0;
  margin-bottom:16px;
  overflow:hidden;
  border:0;
  border-top:1px solid var(--line);
  border-bottom:1px solid var(--line);
  border-radius:0;
  background:transparent;
}
.stat{
  min-width:0;
  background:transparent;
  border:0;
  border-right:1px solid var(--line);
  border-radius:0;
  padding:11px 16px;
}
.stat:last-child{border-right:0}
.stat .n{font-size:1.32rem;font-weight:720;line-height:1.15;overflow-wrap:anywhere}
.stat .l{color:var(--soft);font-size:.76rem;margin-top:2px}
.bar{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom:12px;
}
.sp{flex:1}
.muted{color:var(--soft);font-size:.86rem}
.status{min-height:1.4em;color:var(--soft);font-size:.88rem}
.status.ok{color:var(--ok)}
.status.bad{color:var(--bad)}
.user-search{
  width:min(260px,100%);
  min-height:38px;
  background:rgba(255,253,248,.92);
}
.user-table-region{
  min-height:120px;
}
.table-users td b{overflow-wrap:anywhere}
.btn,button.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  border:1px solid var(--accent);
  background:var(--accent);
  color:white;
  border-radius:8px;
  padding:8px 13px;
  min-height:36px;
}
.btn:hover{background:var(--accent-d);border-color:var(--accent-d)}
.btn.ghost,button.ghost{
  background:#fff;
  color:var(--ink);
  border:1px solid var(--line);
}
.btn.ghost:hover,button.ghost:hover{border-color:var(--accent);color:var(--accent)}
input,select,textarea{
  border:1px solid var(--line);
  background:#fffdf8;
  color:var(--ink);
  border-radius:8px;
  padding:8px 10px;
  outline:none;
}
input:focus,select:focus,textarea:focus{
  border-color:var(--accent);
  box-shadow:0 0 0 3px rgba(204,120,92,.12);
}
textarea{
  width:100%;
  min-height:120px;
  resize:vertical;
  font:13px/1.6 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
}
.short-area{min-height:86px}
.code-area{min-height:520px}
.table-wrap{
  overflow:auto;
  border:1px solid var(--line);
  border-radius:8px;
  background:#fff;
}
table{width:100%;border-collapse:collapse;min-width:760px}
th,td{
  text-align:left;
  padding:12px 14px;
  border-bottom:1px solid var(--line);
  vertical-align:middle;
  font-size:.92rem;
}
th{
  color:var(--soft);
  font-weight:560;
  font-size:.8rem;
  background:#fcfbf8;
}
tr:last-child td{border-bottom:0}
tbody tr:hover{background:#fffaf5}
.tag{
  display:inline-block;
  font-size:.75rem;
  color:var(--accent);
  background:rgba(204,120,92,.10);
  border:1px solid rgba(204,120,92,.18);
  padding:2px 9px;
  border-radius:999px;
  margin:1px 2px;
}
.tag-pill{
  max-width:96px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  vertical-align:bottom;
}
.pill-ok{color:var(--ok);background:rgba(45,134,89,.10);border-color:rgba(45,134,89,.16)}
.pill-bad{color:var(--bad);background:rgba(170,77,58,.10);border-color:rgba(170,77,58,.16)}
.pill-warn{color:#9a6a17;background:rgba(198,144,46,.12);border-color:rgba(198,144,46,.20)}
.access-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid transparent;
}

.access-badge svg {
  width: 14px;
  height: 14px;
  stroke-width: 2.2;
}

.access-public { color: #2f98c8; background: rgba(83, 193, 237, .14); border-color: rgba(83, 193, 237, .30); }
.access-level1 { color: #2f98c8; background: rgba(83, 193, 237, .14); border-color: rgba(83, 193, 237, .30); }
.access-level2 { color: var(--accent-dark); background: rgba(204, 120, 92, .13); border-color: rgba(204, 120, 92, .28); }
.access-admin { color: #9a4a3b; background: rgba(170, 77, 58, .12); border-color: rgba(170, 77, 58, .24); }
.access-legacy { color: #8a6a3f; background: rgba(194, 151, 84, .14); border-color: rgba(194, 151, 84, .26); }
.ops{white-space:nowrap}
.permission-stack{
  display:flex;
  flex-wrap:wrap;
  gap:4px;
  max-width:260px;
}
.icon{
  width:34px;
  height:34px;
  display:inline-grid;
  place-items:center;
  margin:0 4px 4px 0;
  padding:0;
  border:1px solid var(--line);
  border-radius:8px;
  background:#fffdf8;
  color:var(--ink);
  line-height:1;
}
.icon svg{
  width:17px;
  height:17px;
  stroke-width:2;
}
.icon:hover{border-color:var(--accent);background:#fff7ef}
.icon.danger{color:var(--bad)}
.icon:disabled{opacity:.5;cursor:not-allowed}
.btn.is-busy{
  min-width:96px;
}
.spinner{
  width:16px;
  height:16px;
  border-radius:999px;
  border:2px solid rgba(204,120,92,.24);
  border-top-color:var(--accent);
  animation:spin .75s linear infinite;
}
.spinner.light{
  border-color:rgba(255,255,255,.42);
  border-top-color:#fff;
}
@keyframes spin{to{transform:rotate(360deg)}}
.group{
  background:#fff;
  border:1px solid var(--line);
  border-radius:8px;
  overflow:hidden;
  margin-bottom:12px;
}
.group-h{
  width:100%;
  display:flex;
  align-items:center;
  gap:10px;
  border:0;
  background:#fcfbf8;
  color:var(--ink);
  padding:13px 16px;
  text-align:left;
}
.group-h>svg{
  width:18px;
  height:18px;
  flex:none;
  fill:none;
  stroke:currentColor;
  stroke-width:2;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.group table{border-radius:0}
.blog-toolbar{
  align-items:center;
}
.blog-rule{
  margin:-2px 0 14px;
  color:var(--soft);
  font-size:.84rem;
  line-height:1.65;
}
.blog-rule code{
  padding:1px 5px;
  border:1px solid rgba(230,224,214,.86);
  border-radius:6px;
  background:#fffdf8;
  color:var(--accent-d);
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size:.78rem;
}
.table-posts table{
  min-width:980px;
}
.table-posts th,
.table-posts td{
  padding:13px 16px;
}
.table-posts td:first-child{
  min-width:330px;
}
.post-title{
  display:block;
  max-width:38em;
  color:var(--ink);
  font-family:"Noto Serif SC","Songti SC",serif;
  font-size:1rem;
  font-weight:650;
  line-height:1.42;
  letter-spacing:0;
  overflow-wrap:anywhere;
}
.post-slug{
  display:block;
  margin-top:2px;
  color:var(--muted);
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size:.78rem;
  line-height:1.45;
  overflow-wrap:anywhere;
}
.post-excerpt{
  max-width:44em;
  margin:7px 0 0;
  color:var(--soft);
  font-size:.82rem;
  line-height:1.55;
}
.item-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(260px,1fr));
  gap:12px;
}
.item-card,.editor-card{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:8px;
  padding:15px;
}
.item-card{display:flex;flex-direction:column;gap:10px;min-height:216px}
.item-title{display:flex;gap:12px;align-items:center}
.item-title b{display:block;font-size:1rem}
.item-title p{margin:2px 0 0;color:var(--muted);font-size:.78rem}
.item-icon{width:38px;height:38px;border-radius:8px;background:#f5eee8;display:grid;place-items:center;font-size:1.1rem;flex:none}
.item-desc{margin:0;color:var(--soft);font-size:.9rem;min-height:2.8em}
.tag-row{display:flex;gap:4px;flex-wrap:wrap;min-height:24px}
.item-meta{display:flex;gap:10px;flex-wrap:wrap;color:var(--soft);font-size:.82rem;margin-top:auto}
.card-actions{display:flex;gap:5px;flex-wrap:wrap;border-top:1px solid var(--line);padding-top:10px}
.editor-head{
  display:flex;
  justify-content:space-between;
  gap:16px;
  align-items:flex-start;
  margin-bottom:12px;
}
.editor-head h2{margin:0 0 3px;font-size:1.02rem}
.editor-head p{margin:0;color:var(--soft);font-size:.84rem}
.preview-grid{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
}
.preview{
  border:1px solid var(--line);
  border-radius:8px;
  background:#fff;
  padding:13px 14px;
  min-height:96px;
}
.preview b{display:block;margin-bottom:4px}
.preview p{margin:0;color:var(--soft);font-size:.86rem}
.url{color:var(--soft);font-size:.82rem;max-width:250px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:inline-block;vertical-align:bottom}
.form-grid{display:grid;gap:12px}
.form-grid.two{grid-template-columns:repeat(2,minmax(0,1fr))}
.check-row{display:flex!important;align-items:center;gap:8px;color:var(--ink)!important}
.check-row input{width:auto}
.settings-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:0;
  margin-top:4px;
  border-top:1px solid var(--line);
}
.setting-card{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  min-height:72px;
  background:transparent;
  border:0;
  border-right:1px solid var(--line);
  border-bottom:1px solid var(--line);
  border-radius:0;
  padding:13px 16px;
}
.setting-card:nth-child(2n){border-right:0}
.setting-card span{display:block;min-width:0}
.setting-card b{display:block;margin-bottom:2px;font-size:.92rem}
.setting-card em{
  display:block;
  color:var(--soft);
  font-style:normal;
  font-size:.77rem;
  line-height:1.45;
}
.setting-card select{min-width:156px}
.setting-card input[type="checkbox"]{
  width:18px;
  height:18px;
  flex:none;
  accent-color:var(--accent);
}
.agent-settings-panel{
  margin-top:16px;
  overflow:hidden;
}
.agent-heading{
  display:flex;
  align-items:center;
  gap:12px;
  min-width:0;
}
.agent-heading > span:last-child{min-width:0}
.agent-heading p b{color:var(--ok);font-weight:720}
.agent-heading p b.is-off{color:var(--muted)}
.agent-status-mark{
  position:relative;
  width:40px;
  height:36px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  flex:none;
  border:1px solid rgba(45,134,89,.28);
  border-radius:6px;
  background:#eaf5ef;
  box-shadow:inset 0 -5px 0 rgba(45,134,89,.06);
}
.agent-status-mark::before,
.agent-status-mark::after{
  content:"";
  position:absolute;
  top:-5px;
  width:6px;
  height:5px;
  border:1px solid currentColor;
  border-bottom:0;
  color:var(--ok);
}
.agent-status-mark::before{left:7px}
.agent-status-mark::after{right:7px}
.agent-status-mark i{
  width:5px;
  height:7px;
  border-radius:2px;
  background:var(--ok);
}
.agent-status-mark.is-off{
  border-color:var(--line);
  background:#f1efeb;
  box-shadow:none;
}
.agent-status-mark.is-off::before,
.agent-status-mark.is-off::after{color:var(--muted)}
.agent-status-mark.is-off i{background:var(--muted);height:3px}
.agent-settings-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  border-top:1px solid var(--line);
}
.agent-settings-grid .setting-card:nth-child(2){border-right:0}
.agent-prompt-field{
  grid-column:1 / -1;
  display:grid;
  gap:10px;
  padding:16px;
  border-bottom:1px solid var(--line);
}
.agent-prompt-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:18px;
}
.agent-prompt-head > span{display:block;min-width:0}
.agent-prompt-head b{display:block;margin-bottom:2px;font-size:.92rem}
.agent-prompt-head em{
  display:block;
  color:var(--soft);
  font-size:.77rem;
  font-style:normal;
  line-height:1.45;
}
.agent-prompt-head output{
  flex:none;
  color:var(--muted);
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size:.74rem;
}
.agent-prompt-field textarea{
  width:100%;
  min-height:148px;
  resize:vertical;
  padding:12px 13px;
  border:1px solid var(--line);
  border-radius:6px;
  background:#fff;
  color:var(--ink);
  line-height:1.65;
}
.agent-prompt-field textarea:focus-visible{
  outline:3px solid rgba(204,120,92,.18);
  border-color:rgba(204,120,92,.5);
}
.toast{
  position:fixed;
  right:22px;
  bottom:22px;
  z-index:80;
  background:rgba(31,30,29,.88);
  color:#fff;
  padding:10px 14px;
  border-radius:8px;
  box-shadow:0 14px 36px rgba(31,30,29,.18);
  font-size:.9rem;
}
.mask{
  position:fixed;
  inset:0;
  z-index:50;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(31,30,29,.42);
  padding:clamp(14px,3vw,28px);
  backdrop-filter:blur(8px);
  -webkit-backdrop-filter:blur(8px);
}
.modal{
  width:min(820px,96vw);
  max-height:min(88vh,820px);
  display:flex;
  flex-direction:column;
  overflow:hidden;
  background:rgba(255,253,248,.96);
  border-radius:8px;
  border:1px solid var(--line);
  box-shadow:0 28px 80px rgba(31,30,29,.24);
  animation:modalIn .16s ease-out;
}
@keyframes modalIn{
  from{opacity:0;transform:translateY(8px) scale(.985)}
  to{opacity:1;transform:translateY(0) scale(1)}
}
.modal-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:18px;
  padding:20px 22px 16px;
  border-bottom:1px solid var(--line);
  background:var(--panel-2);
}
.modal-head h3{
  margin:0;
  font-family:"Noto Serif SC","Songti SC",serif;
  font-size:1.24rem;
  line-height:1.35;
  color:var(--ink);
}
.modal-head p{
  margin:5px 0 0;
  color:var(--soft);
  font-size:.84rem;
}
.modal-x{
  width:34px;
  height:34px;
  display:grid;
  place-items:center;
  flex:none;
  border:1px solid var(--line);
  border-radius:999px;
  background:#fffdf8;
  color:var(--soft);
  font-size:1.28rem;
  line-height:1;
  padding:0 0 2px;
}
.modal-x:hover{
  color:var(--accent);
  border-color:rgba(204,120,92,.34);
  background:#fff7ef;
}
.modal-body{
  min-height:0;
  overflow:auto;
  padding:20px 22px 18px;
}
.modal-body input,
.modal-body select,
.modal-body textarea{
  width:100%;
}
.modal-body .check-row input[type="checkbox"]{
  width:18px;
  height:18px;
  flex:none;
}
.modal-body textarea{
  background:#fff;
}
.modal-body .code-area{
  min-height:min(56vh,560px);
}
.modal label{display:block;color:var(--soft);font-size:.84rem;margin:12px 0 5px}
.resource-editor{
  display:grid;
  gap:16px;
}
.resource-editor label{
  margin:0 0 6px;
  font-weight:650;
}
.resource-editor .form-grid{
  gap:16px;
}
.resource-publish{
  width:max-content;
  max-width:100%;
  min-height:42px;
  margin-top:2px!important;
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:8px;
  background:rgba(255,253,248,.82);
}
.resource-publish span{
  color:var(--ink);
  white-space:nowrap;
}
.modal-ft{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  padding:14px 22px 18px;
  border-top:1px solid var(--line);
  background:rgba(255,255,255,.74);
}
.post-meta-editor{
  display:grid;
  grid-template-columns:minmax(0,1.05fr) minmax(220px,.95fr);
  gap:16px;
  align-items:stretch;
}
.post-meta-preview,
.post-meta-fields{
  border:1px solid var(--line);
  border-radius:8px;
  background:#fffdf8;
  padding:16px;
}
.post-meta-preview{
  display:block;
  min-width:0;
}
.post-meta-preview .access-badge,
.post-meta-preview .tag{
  margin:0 4px 8px 0;
}
.post-meta-preview h4{
  margin:8px 0 4px;
  font-family:"Noto Serif SC","Songti SC",serif;
  font-size:1.18rem;
  line-height:1.4;
  overflow-wrap:anywhere;
}
.post-meta-preview p{
  margin:0;
  color:var(--muted);
  font-size:.84rem;
  overflow-wrap:anywhere;
}
.post-meta-fields select{
  width:100%;
}
.field-help{
  margin:6px 0 10px;
  color:var(--muted);
  font-size:.82rem;
  line-height:1.55;
}
.post-meta-tags{
  margin-top:12px;
  display:flex;
  flex-wrap:wrap;
  gap:5px;
}
.gate-screen{min-height:100vh;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:32px 18px}
.gate-footer{margin-top:18px;padding:0}
.gate-card{
  width:min(560px,calc(100vw - 36px));
  background:rgba(255,255,255,.88);
  border:1px solid var(--line);
  border-radius:8px;
  padding:42px 38px 34px;
  text-align:center;
  box-shadow:0 18px 52px rgba(31,30,29,.10);
  backdrop-filter:blur(12px);
  -webkit-backdrop-filter:blur(12px);
  position:relative;
  overflow:hidden;
}
.gate-card::before{content:"";position:absolute;top:0;left:0;right:0;height:3px;background:var(--accent)}
.gate-title{font-family:"Noto Serif SC","Songti SC",serif;font-size:1.7rem;margin:0 0 10px}
.gate-sub{color:var(--soft);margin:0 auto 22px;max-width:34em}
@media(max-width:900px){
  .top{min-height:84px;padding:0 24px}
  .wrap{padding:32px 24px 40px}
  .stats{grid-template-columns:repeat(2,minmax(0,1fr))}
  .stat:nth-child(-n+2){border-bottom:1px solid var(--line)}
  .stat:nth-child(2n){border-right:0}
  .preview-grid{grid-template-columns:1fr}
  .settings-grid{grid-template-columns:1fr}
  .setting-card{border-right:0}
  .agent-settings-grid{grid-template-columns:1fr}
  .agent-settings-grid .setting-card{border-right:0}
  .agent-prompt-head{align-items:flex-end}
}
@media(max-width:600px){
  #shell,#shell.rail-expanded{--rail-width:52px}
  .admin-rail{padding:18px 0 10px}
  .rail-brand,
  #shell.rail-expanded .rail-brand{
    width:40px;
    height:40px;
    margin-bottom:10px;
    display:grid;
    grid-template-columns:none;
    place-items:center;
    gap:0;
  }
  .rail-brand img{width:36px;height:36px}
  .rail-brand::after,
  #shell.rail-expanded .rail-brand::after{width:36px;bottom:-8px}
  .rail-nav{padding-top:12px}
  #shell.rail-expanded .brand-wordmark,
  #shell.rail-expanded .rail-group-label{display:none}
  .rail-group,
  #shell.rail-expanded .rail-group{align-items:center;padding:0;gap:3px}
  .rail-nav button,.rail-action,
  #shell.rail-expanded .rail-nav button,
  #shell.rail-expanded .rail-action{
    width:44px;
    height:44px;
    grid-template-columns:none;
    place-items:center;
    gap:0;
    padding:0;
  }
  .rail-nav button svg,.rail-action svg{width:21px;height:21px}
  #shell.rail-expanded .nav-label{
    position:absolute;
    width:1px;
    height:1px;
    padding:0;
    margin:-1px;
    overflow:hidden;
    clip:rect(0,0,0,0);
    white-space:nowrap;
  }
  .rail-nav button.on::before,
  #shell.rail-expanded .rail-nav button.on::before{left:-4px;height:22px}
  .rail-divider,
  #shell.rail-expanded .rail-divider{width:36px;margin:6px 0}
  .rail-bottom,
  #shell.rail-expanded .rail-bottom{width:44px;align-items:center;gap:2px;padding-top:8px}
  #shell.rail-expanded .rail-tooltip{display:block}
  .rail-toggle{display:none!important}
  .top{min-height:76px;padding:0 12px}
  .page-context h1{font-size:1.05rem}
  .top-actions{gap:8px}
  .page-refresh{width:38px;height:38px}
  .page-refresh svg{width:19px;height:19px}
  .account-context{display:flex;max-width:none}
  .account-avatar{width:36px;height:36px;font-size:.9rem}
  .account-copy{display:none}
  .wrap{padding:24px 12px 32px}
  .panel{padding:14px}
  .agent-settings-panel .editor-head{align-items:stretch}
  .agent-settings-panel .bar{width:100%}
  .agent-settings-panel .bar .btn{width:100%}
  .agent-prompt-head{display:grid;gap:8px}
  .stats{grid-template-columns:repeat(2,minmax(0,1fr));margin-bottom:12px}
  .stat{padding:9px 10px}
  .stat .n{font-size:1.12rem}
  .stat .l{font-size:.7rem}
  .tabs button{flex:1;min-width:calc(50% - 5px)}
  .editor-head{display:block}
  .editor-head .bar{margin-top:12px}
  .form-grid.two{grid-template-columns:1fr}
  .post-meta-editor{grid-template-columns:1fr}
  .setting-card{display:block}
  .setting-card{min-height:0;padding:12px 4px}
  .setting-card select{width:100%;margin-top:8px;min-width:0}
  .setting-card input[type="checkbox"]{margin-top:10px}
  .bar{align-items:stretch}
  .bar .muted{flex:0 0 100%}
  .user-search{width:100%}
  .item-grid{grid-template-columns:minmax(0,1fr)}
  .admin-footer{padding:10px 12px 16px}
  .table-wrap{
    overflow:visible;
    border:0;
    background:transparent;
  }
  table{min-width:0}
  .table-wrap table,
  .table-wrap thead,
  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap td{display:block;width:100%}
  .table-wrap thead{display:none}
  .table-wrap tbody{display:grid;gap:10px}
  .table-wrap tr{
    border:1px solid var(--line);
    border-radius:8px;
    background:#fffdf8;
    padding:10px 12px;
  }
  .table-wrap td{
    border:0;
    padding:7px 0;
    display:grid;
    grid-template-columns:82px minmax(0,1fr);
    gap:10px;
    align-items:start;
    font-size:.88rem;
  }
  .table-wrap td::before{
    color:var(--muted);
    font-size:.76rem;
    font-weight:650;
  }
  .table-users td:nth-child(1)::before{content:"账号"}
  .table-users td:nth-child(2)::before{content:"角色"}
  .table-users td:nth-child(3)::before{content:"验证"}
  .table-users td:nth-child(4)::before{content:"权限"}
  .table-posts td:nth-child(1)::before{content:"标题"}
  .table-posts td:nth-child(2)::before{content:"日期"}
  .table-posts td:nth-child(3)::before{content:"tags"}
  .table-posts td:nth-child(4)::before{content:"权限"}
  .table-posts td:nth-child(5)::before{content:"状态"}
  .table-resources td:nth-child(1)::before{content:"名称"}
  .table-resources td:nth-child(2)::before{content:"链接"}
   .table-resources td:nth-child(3)::before{content:"权限"}
   .table-resources td:nth-child(4)::before{content:"排序"}
   .table-resources td:nth-child(5)::before{content:"状态"}
  .table-wrap td.ops{
    display:flex;
    flex-wrap:wrap;
    gap:4px;
    padding-top:10px;
    margin-top:4px;
    border-top:1px solid var(--line);
  }
  .table-wrap td.ops::before{
    content:"操作";
    flex:0 0 100%;
  }
  .url{
    max-width:100%;
    white-space:normal;
    word-break:break-all;
  }
}
.gate-mark{display:flex;align-items:center;justify-content:center;gap:9px;margin-bottom:15px;color:var(--accent-d);font-size:.72rem;font-weight:800;letter-spacing:.14em}.gate-mark img{width:34px;height:34px;border-radius:8px;box-shadow:0 8px 18px rgba(204,120,92,.16)}.gate-points{display:grid;gap:7px;margin:0 auto 24px;padding:15px 18px;max-width:390px;border:1px solid rgba(204,120,92,.18);border-radius:8px;background:rgba(255,249,241,.72);color:var(--soft);font-size:.82rem;text-align:left;list-style:none}.gate-points li::before{content:"✓";margin-right:8px;color:var(--ok);font-weight:800}.gate-back{display:block;margin-top:14px;color:var(--soft);font-size:.82rem}.gate-back:hover{color:var(--accent)}
@media(prefers-reduced-motion:reduce){
  .admin-rail,.workspace-shell,.rail-nav button,.rail-action,.rail-tooltip{transition:none}
  .modal{animation:none}
}
