:root{
  --bg:#f6f7f4;--surface:#fff;--text:#1f2328;--sub:#5c646c;--muted:#98a0a7;
  --line:#e9ece6;--accent:#ffd43b;--accent-deep:#f0b400;
  --shadow:0 1px 2px rgba(16,24,40,.04),0 8px 26px rgba(16,24,40,.06);
}
*{box-sizing:border-box;margin:0;padding:0}
body{
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;
  color:var(--text);background:var(--bg);-webkit-font-smoothing:antialiased;
}
button,input,select{font:inherit}
button{cursor:pointer}
a{color:inherit;text-decoration:none}
[hidden]{display:none !important}

.shell{display:flex;min-height:100vh}
.sidebar{
  width:232px;flex-shrink:0;background:#fff;border-right:1px solid var(--line);
  display:flex;flex-direction:column;padding:26px 18px 20px;position:sticky;top:0;height:100vh;
}
.side-brand{display:flex;align-items:center;gap:11px;padding:0 8px 28px}
.side-logo{width:36px;height:36px;border-radius:11px;background:linear-gradient(135deg,#fff3c4,#ffe27a);display:flex;align-items:center;justify-content:center}
.side-logo svg{width:26px;height:26px}
.side-brand strong{display:block;font-size:16px;font-weight:700;letter-spacing:-.3px;line-height:1.2}
.side-brand small{display:block;font-size:11px;color:var(--muted);margin-top:3px}
.side-nav{display:flex;flex-direction:column;gap:4px}
.side-nav button{
  text-align:left;padding:11px 14px;border:none;background:transparent;border-radius:10px;
  font-size:14px;color:var(--sub);transition:.16s;
}
.side-nav button:hover{background:#f7f8f5;color:var(--text)}
.side-nav button.active{background:#fff5d6;color:#2b2200;font-weight:650}
.side-foot{margin-top:auto;padding:0 8px;display:flex;flex-direction:column;gap:10px}
.side-foot a,.side-foot button{
  text-align:left;font-size:13px;color:var(--sub);padding:8px 0;border:none;background:transparent;
}
.side-foot a:hover,.side-foot button:hover{color:var(--text)}
.side-foot p{font-size:11px;color:#b9c0c5;line-height:1.6}

.main{flex:1;min-width:0;padding:34px 36px 60px;max-width:1280px}
.main-head{display:flex;align-items:flex-start;justify-content:space-between;gap:20px;margin-bottom:26px}
.main-head h1{font-size:24px;font-weight:700;letter-spacing:-.6px}
.main-head p{margin-top:6px;font-size:13px;color:var(--muted)}
.head-right{display:flex;align-items:center;gap:14px}
.stat{font-size:12px;color:var(--muted);white-space:nowrap}

.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:6px;
  padding:9px 17px;border-radius:9px;border:1px solid var(--line);background:#fff;
  color:var(--sub);font-size:13px;transition:.16s;white-space:nowrap;
}
.btn:hover{border-color:#ffd97a;color:var(--text)}
.btn.primary{background:linear-gradient(135deg,#ffdd63,#ffc93c);border-color:#ffcf4d;color:#2b2200;font-weight:650;box-shadow:0 3px 10px rgba(240,180,0,.22)}
.btn.primary:hover{box-shadow:0 5px 16px rgba(240,180,0,.36)}
.btn.danger{color:#c25b5b}
.btn.danger:hover{border-color:#f0b4b4;background:#fff6f6}
.btn:disabled{opacity:.55;cursor:not-allowed}
.btn.wide{width:100%;height:42px;margin-top:6px}
.btn.sm{padding:6px 11px;font-size:12px;border-radius:8px}

.boot-state{text-align:center;padding:80px 20px;color:var(--muted);font-size:14px}

/* ---------- 登录 ---------- */
.center-view{display:flex;align-items:flex-start;justify-content:center;padding:34px 0}
.login-card{
  width:100%;max-width:400px;background:#fff;border:1px solid var(--line);
  border-radius:18px;box-shadow:var(--shadow);padding:34px 30px 30px;text-align:center;
}
.login-logo{width:52px;height:52px;margin:0 auto 16px;border-radius:16px;background:linear-gradient(135deg,#fff3c4,#ffe27a);display:flex;align-items:center;justify-content:center}
.login-logo svg{width:38px;height:38px}
.login-card h2{font-size:20px;font-weight:700;letter-spacing:-.4px}
.login-tip{margin-top:9px;font-size:12.5px;color:var(--muted);line-height:1.7}
.tabs{display:flex;gap:6px;background:#f7f8f5;border-radius:10px;padding:4px;margin:24px 0 20px}
.tabs button{flex:1;padding:8px;border:none;background:transparent;border-radius:8px;font-size:13px;color:var(--sub)}
.tabs button.active{background:#fff;color:var(--text);font-weight:650;box-shadow:0 1px 4px rgba(16,24,40,.07)}
.field{display:block;text-align:left;margin-bottom:8px}
.field span{display:block;font-size:12px;color:var(--sub);margin-bottom:7px;font-weight:600}
.field input,.field select{
  width:100%;height:42px;padding:0 12px;border:1px solid var(--line);border-radius:9px;
  background:#fff;color:var(--text);font-size:14px;outline:none;transition:.16s;
}
.field input:focus,.field select:focus{border-color:#ffd97a;box-shadow:0 0 0 3px rgba(255,212,59,.18)}
.field input::placeholder{color:#b9c0c5}
.field-error{min-height:18px;text-align:left;font-size:12px;color:#c25b5b;margin-bottom:4px}
.code-row{display:flex;gap:8px;margin-top:6px}
.code-row input{
  flex:1;min-width:0;height:42px;padding:0 12px;border:1px solid var(--line);
  border-radius:9px;outline:none;font-size:14px;
}
.code-row input:focus{border-color:#ffd97a;box-shadow:0 0 0 3px rgba(255,212,59,.18)}
.code-row .btn{flex-shrink:0;height:42px}
.login-msg{min-height:20px;margin-top:12px;font-size:12.5px;color:#c25b5b;line-height:1.6}
.login-msg.ok{color:#2f9e6b}
.denied-icon{
  width:52px;height:52px;margin:0 auto 16px;border-radius:50%;background:#fff2d9;
  display:flex;align-items:center;justify-content:center;font-size:26px;font-weight:700;color:#d99a00;
}

/* ---------- 工具栏与表格 ---------- */
.toolbar{display:flex;align-items:center;gap:10px;margin-bottom:14px;flex-wrap:wrap}
.toolbar select,.toolbar input{
  height:38px;padding:0 12px;border:1px solid var(--line);border-radius:9px;
  background:#fff;color:var(--text);font-size:13px;outline:none;
}
.toolbar input{min-width:210px}
.toolbar select:focus,.toolbar input:focus{border-color:#ffd97a}
.toolbar-spacer{flex:1}
.table-card{background:#fff;border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow);overflow:hidden}
.table-scroll{overflow-x:auto}
table{width:100%;border-collapse:collapse;min-width:760px}
th{
  text-align:left;font-size:12px;font-weight:600;color:var(--muted);
  padding:13px 16px;background:#fbfcfa;border-bottom:1px solid var(--line);white-space:nowrap;
}
td{padding:13px 16px;border-bottom:1px solid #f1f3ef;font-size:13px;color:var(--sub);vertical-align:middle}
tr:last-child td{border-bottom:none}
tr:hover td{background:#fdfdf9}
.cell-main{display:flex;align-items:center;gap:10px;min-width:0}
.cell-icon{width:30px;height:30px;border-radius:9px;background:#f2f4ef;display:flex;align-items:center;justify-content:center;font-size:13px;font-weight:700;color:#fff;flex-shrink:0;overflow:hidden}
.cell-icon img{width:100%;height:100%;object-fit:contain}
.cell-name{display:block;font-size:13.5px;font-weight:650;color:var(--text);white-space:nowrap}
.cell-url{color:var(--muted);font-size:12px;max-width:240px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.cell-desc{max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tag{display:inline-block;padding:4px 10px;border-radius:999px;background:#f4f6f1;color:var(--sub);font-size:12px;white-space:nowrap}
.row-actions{display:flex;gap:6px;white-space:nowrap}
.sort-btns{display:flex;gap:3px}
.sort-btns button{
  width:24px;height:24px;border:1px solid var(--line);border-radius:6px;background:#fff;
  color:var(--muted);font-size:12px;line-height:1;
}
.sort-btns button:hover:not(:disabled){border-color:#ffd97a;color:var(--text)}
.sort-btns button:disabled{opacity:.32;cursor:not-allowed}
.empty-row td{text-align:center;padding:56px 20px;color:var(--muted)}

/* ---------- 弹窗 ---------- */
.mask{position:fixed;inset:0;z-index:50;background:rgba(24,28,26,.42);display:flex;align-items:center;justify-content:center;padding:20px}
.modal{width:100%;max-width:460px;background:#fff;border-radius:16px;box-shadow:0 24px 70px rgba(16,24,40,.24);overflow:hidden;max-height:90vh;overflow-y:auto}
.modal-head{display:flex;align-items:center;justify-content:space-between;padding:20px 24px 6px}
.modal-head h3{font-size:17px;font-weight:700}
.modal-head button{border:none;background:transparent;font-size:24px;color:var(--muted);line-height:1;padding:0 4px}
.modal-head button:hover{color:var(--text)}
#modalForm{padding:14px 24px 24px}
.form-note{font-size:11.5px;color:var(--muted);line-height:1.6;margin:-2px 0 4px}
.modal-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:20px}

.toast{
  position:fixed;left:50%;bottom:34px;transform:translate(-50%,16px);z-index:80;
  padding:11px 22px;border-radius:999px;background:#252a26;color:#fff;font-size:13px;
  box-shadow:0 8px 26px rgba(16,24,40,.24);opacity:0;pointer-events:none;transition:.22s;
  max-width:calc(100vw - 40px);text-align:center;
}
.toast.show{opacity:1;transform:translate(-50%,0)}
.toast.ok{background:#2f9e6b}
.toast.err{background:#c25b5b}

@media (max-width:900px){
  .sidebar{width:70px;padding:20px 10px}
  .side-brand strong,.side-brand small,.side-nav button,.side-foot a,.side-foot button,.side-foot p{display:none}
  .side-brand{justify-content:center;padding:0 0 24px}
  .side-nav button{display:block;width:44px;height:44px;margin:0 auto;font-size:0;position:relative}
  .side-nav button::first-letter{font-size:16px}
  .main{padding:24px 18px 48px}
  .main-head{flex-direction:column;align-items:flex-start}
}
@media (max-width:560px){
  .main-head h1{font-size:21px}
  .toolbar input{min-width:0;flex:1}
}
