
:root{
  --bg: #FAF7F1;
  --card: #FFFFFF;
  --line: #EAE2D4;
  --text: #221D18;
  --text-2: #6B5F52;
  --text-3: #A2948A;
  --brand: #A8201A;
  --brand-soft: #FBEEEB;
  --danger: #B3261E;
  --star: #C9941E;
  --gold: #B8860B;
  --gold-soft: #FBF3E2;
  --gold-line: #E4D2A8;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(60,42,24,.04), 0 1px 3px rgba(60,42,24,.06);
  --shadow-hover: 0 8px 24px rgba(60,42,24,.10), 0 2px 6px rgba(60,42,24,.06);
}

*{ box-sizing: border-box; }
html, body{ margin:0; padding:0; }


[hidden]{ display:none !important; }

body{
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 72px;
}

button{ font-family: inherit; cursor: pointer; }
button, a{ -webkit-tap-highlight-color: transparent; }
button, .icon-btn, .card{ touch-action: manipulation; }
input, textarea, select{ font-family: inherit; font-size: 13.5px; color: var(--text); }
code{ font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
kbd{
  font-family: inherit; font-size: 11px; color: var(--text-3);
  background: #F3EDE1; border: 1px solid var(--line);
  border-radius: 5px; padding: 1px 5px;
}
kbd.inline{ margin: 0 1px; }


.topbar{
  position: sticky; top: 0; z-index: 50;
  background: rgba(255,255,255,.84);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner{
  max-width: 1180px; margin: 0 auto;
  padding: 12px 24px;
  display: flex; align-items: center; gap: 18px;
}

.brand{ display:flex; align-items:center; gap:10px; flex-shrink:0; }
.brand-mark{
  width:32px; height:32px; border-radius:9px;
  display:block; flex-shrink:0;
  object-fit:contain;
}
.brand-name{ font-size:15px; font-weight:650; letter-spacing:-.2px; }
.brand-sub{ font-size:11px; color:var(--text-3); line-height:1.2; margin-top:-2px; }

.search{ position:relative; flex:1; max-width:400px; margin-left:auto; }
.search > svg{
  position:absolute; left:12px; top:50%; transform:translateY(-50%);
  color:var(--text-3); pointer-events:none;
}
.search input{
  width:100%; height:38px; padding:0 76px 0 36px;
  border:1px solid var(--line); border-radius:10px;
  background:#FDFBF6; font-size:13.5px; outline:none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.search input::placeholder{ color:var(--text-3); }
.search input:focus{
  background:#fff; border-color:#D9BE84;
  box-shadow:0 0 0 3px rgba(184,134,11,.14);
}
.search kbd{
  position:absolute; right:10px; top:50%; transform:translateY(-50%);
  pointer-events:none;
}

.top-actions{ display:flex; align-items:center; gap:8px; flex-shrink:0; }

.btn-ghost{
  display:inline-flex; align-items:center; gap:6px;
  height:34px; padding:0 11px;
  background:#fff; border:1px solid var(--line); border-radius:8px;
  font-size:13px; color:var(--text-2); font-weight:500;
  transition: background .14s, border-color .14s, color .14s;
}
.btn-ghost:hover{ background:#FAF5EC; border-color:#DED0B8; color:var(--text); }
.btn-ghost.active{ background:var(--gold-soft); border-color:var(--gold-line); color:#8A5A0B; }

.btn-ghost-danger{
  height:34px; padding:0 11px;
  background:#fff; border:1px solid #fecaca; border-radius:8px;
  font-size:13px; color:var(--danger); font-weight:500;
}
.btn-ghost-danger:hover{ background:#fef2f2; }

.btn-primary{
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
  height:38px; padding:0 20px;
  background:var(--brand); color:#fff; border:none; border-radius:8px;
  font-size:13.5px; font-weight:600; letter-spacing:.2px;
  transition: background .14s, transform .1s;
}
.btn-primary:hover{ background:#8C1C24; }
.btn-primary:active{ transform:translateY(1px); }
.btn-primary:disabled{ background:#D8A5A1; cursor:not-allowed; }
.btn-primary.btn-sm{ height:32px; padding:0 14px; font-size:13px; }

.btn-danger{
  display:inline-flex; align-items:center; justify-content:center;
  height:38px; padding:0 20px;
  background:var(--danger); color:#fff; border:none; border-radius:8px;
  font-size:13.5px; font-weight:600; letter-spacing:.2px;
  transition:background .14s, transform .1s;
}
.btn-danger:hover{ background:#b91c1c; }
.btn-danger:active{ transform:translateY(1px); }
.btn-danger:disabled{ background:#f0a3a3; cursor:not-allowed; }


.user-menu{ position:relative; }
.user-btn{
  display:flex; align-items:center; gap:7px;
  height:34px; padding:0 8px 0 4px;
  background:transparent; border:1px solid transparent; border-radius:9px;
  color:var(--text-2); font-size:13px;
  transition: background .14s, border-color .14s;
}
.user-btn:hover{ background:#F8F2E8; border-color:var(--line); }
.user-btn svg{ color:var(--text-3); }
.avatar{
  width:26px; height:26px; border-radius:50%;
  background:linear-gradient(135deg,#C9982A,#8C1C24);
  color:#fff; font-size:12px; font-weight:600;
  display:grid; place-items:center; flex-shrink:0;
}
.user-name{ max-width:88px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.dropdown{
  position:absolute; right:0; top:calc(100% + 8px);
  min-width:188px; padding:5px;
  background:#fff; border:1px solid var(--line); border-radius:11px;
  box-shadow:0 12px 32px rgba(60,42,24,.12), 0 2px 8px rgba(60,42,24,.06);
  opacity:0; visibility:hidden; transform:translateY(-4px);
  transition: opacity .14s, transform .14s, visibility .14s;
}
.dropdown.open{ opacity:1; visibility:visible; transform:translateY(0); }
.dd-head{ padding:8px 10px 9px; border-bottom:1px solid var(--line); margin-bottom:4px; }
.dd-name{ font-size:13px; font-weight:600; }
.dd-role{ font-size:11.5px; color:var(--text-3); }
.dropdown button{
  display:block; width:100%; text-align:left;
  padding:7px 10px; border:none; background:transparent;
  border-radius:6px; font-size:13px; color:var(--text-2);
}
.dropdown button:hover{ background:#F8F2E8; color:var(--text); }
.dropdown button.danger{ color:var(--danger); }
.dropdown button.danger:hover{ background:#fef2f2; }
.dd-sep{ height:1px; background:var(--line); margin:4px 6px; }


main{ max-width:1180px; margin:0 auto; padding:24px 24px 0; }

.hero{
  display:flex; align-items:flex-start; justify-content:space-between;
  gap:20px; margin-bottom:22px;
}
.hero h1{ font-size:21px; font-weight:650; letter-spacing:-.4px; margin:0 0 5px; }
.hero p{ margin:0; color:var(--text-2); font-size:13px; }
.hero-count{
  display:flex; align-items:baseline; gap:5px;
  color:var(--text-3); font-size:12px; flex-shrink:0; padding-top:5px;
}
.hero-count b{ font-size:20px; font-weight:650; color:var(--text); letter-spacing:-.5px; }

.live-hint{
  display:inline-flex; align-items:center; gap:7px;
  margin-bottom:18px; padding:7px 12px;
  background:#FCF4E2; border:1px solid #EFDDB8; border-radius:8px;
  font-size:12.5px; color:#8C1C24;
}
.live-hint::before{
  content:""; width:6px; height:6px; border-radius:50%;
  background:#B8860B; animation:pulse 1.4s infinite;
}
@keyframes pulse{ 0%,100%{ opacity:1; } 50%{ opacity:.3; } }


.group{ margin-bottom:26px; transition: translate .26s cubic-bezier(.2,.8,.3,1); }
.group-head{
  display:flex; align-items:center; gap:9px; margin-bottom:10px;
}
.group-head h2{
  font-size:13px; font-weight:650; letter-spacing:.2px;
  margin:0; color:var(--text-2);
}
.group-head .dot{ width:7px; height:7px; border-radius:50%; flex-shrink:0; }
.group-head .n{ font-size:11.5px; color:var(--text-3); }
.group-head .rule{ flex:1; height:1px; background:var(--line); }
.group-head .add-btn{
  display:none; align-items:center; gap:4px;
  height:25px; padding:0 9px;
  background:#fff; border:1px dashed #c7cddb; border-radius:6px;
  font-size:11.5px; color:var(--text-2);
}
.group-head .add-btn:hover{ border-color:var(--brand); color:var(--brand); background:var(--brand-soft); }
body.editing .group-head .add-btn{ display:inline-flex; }

.gedit-btn{
  display:none; place-items:center;
  width:20px; height:20px; padding:0; flex-shrink:0;
  background:transparent; border:1px solid transparent; border-radius:5px;
  color:var(--text-3);
  transition: background .14s, border-color .14s, color .14s;
}
.gedit-btn:hover{ background:#fff; border-color:var(--line); color:var(--brand); }
body.editing .gedit-btn{ display:grid; }


body.editing .group-head{ cursor:grab; }
body.editing .group-head:active{ cursor:grabbing; }
body.editing .group-head button{ cursor:pointer; }
.group.dragging-group{
  opacity:.5;
  outline:2px dashed #DFC79B;
  outline-offset:6px;
  border-radius:10px;
}
.group.dragging-group .group-head{ background:#f3f5fb; border-radius:6px; }

.add-group-bar{
  display:flex; justify-content:center;
  padding:6px 0 44px;
}
.add-group-btn{
  display:inline-flex; align-items:center; gap:7px;
  height:40px; padding:0 22px;
  background:rgba(255,255,255,.7);
  border:1px dashed #c7cddb; border-radius:10px;
  font-size:13px; color:var(--text-2); font-weight:500;
  transition: background .14s, border-color .14s, color .14s;
}
.add-group-btn:hover{
  border-color:var(--brand); color:var(--brand);
  background:var(--brand-soft); border-style:solid;
}

.grid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  gap:13px;
}
.grid.drag-target{ outline:2px dashed #DFC79B; outline-offset:6px; border-radius:10px; }


.card{
  position:relative;
  display:flex; gap:12px;
  padding:15px; padding-right:36px;
  background:var(--card);
  border:1px solid var(--line); border-radius:12px;
  text-decoration:none; color:inherit;
  box-shadow:var(--shadow);
  transition: translate .24s cubic-bezier(.2,.8,.3,1),
              transform .16s ease, box-shadow .16s ease, border-color .16s ease;
  overflow:hidden;
}
.card::before{
  content:""; position:absolute; left:0; top:0; bottom:0; width:3px;
  background:var(--accent, var(--brand)); opacity:0;
  transition:opacity .16s ease;
}
.card:hover{
  transform:translateY(-2px);
  box-shadow:var(--shadow-hover);
  border-color:#DED0B8;
}
.card:hover::before{ opacity:1; }
.card:focus-visible{ outline:2px solid var(--accent, var(--brand)); outline-offset:2px; }

.card.is-fav{ border-color:#EBD49B; }
.card.is-fav::before{ opacity:1; background:var(--star); }

.card-icon{
  width:40px; height:40px; flex-shrink:0; border-radius:10px;
  display:grid; place-items:center; position:relative;
  font-size:15px; font-weight:700; color:#fff;
  background:var(--accent, var(--brand)); letter-spacing:-.5px;
  overflow:hidden;
}
.card-icon img{
  position:absolute; inset:0;
  width:100%; height:100%;
  object-fit:contain;
  background:#fff;
  border-radius:inherit;
}
.card-body{ min-width:0; flex:1; }
.card-title{
  font-size:13.5px; font-weight:650; letter-spacing:-.1px;
  margin:0 0 2px; display:flex; align-items:center; gap:5px;
}
.card-title span{ overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.tag{
  flex-shrink:0; font-size:10px; font-weight:600;
  padding:1px 6px; border-radius:4px;
  background:var(--gold-soft); color:#8A5A0B; letter-spacing:.2px;
  border:1px solid #EFE0BE;
  font-style:normal;
}
.tag.warn{ background:#FCEDEA; color:#A8201A; border-color:#F3D3CE; }
.tag.new{ background:#EFF6EE; color:#3F6B43; border-color:#D8E5D6; }

.card-desc{
  font-size:12px; color:var(--text-2); margin:0 0 7px;
  line-height:1.55;
  display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical;
  overflow:hidden;
}
.card-meta{
  display:flex; align-items:center; gap:6px;
  font-size:10.5px; color:var(--text-3);
  min-width:0;
}
.card-meta .url{
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}


.card-actions{
  position:absolute; top:10px; right:10px;
  display:flex; gap:2px;
  opacity:0; transition:opacity .14s;
}
.card:hover .card-actions,
.card-actions:has(.fav-btn.on){ opacity:1; }
body.editing .card-actions{ opacity:1; }

.icon-btn{
  width:24px; height:24px; padding:0;
  display:grid; place-items:center;
  background:rgba(255,255,255,.92);
  border:1px solid var(--line); border-radius:6px;
  color:var(--text-3);
  transition: background .14s, color .14s, border-color .14s;
}
.icon-btn:hover{ background:#fff; color:var(--text); border-color:#DED0B8; }
.fav-btn.on{ color:var(--star); border-color:#EBD49B; background:#FDF8E9; }
.fav-btn.on:hover{ color:#A87A10; }
.edit-btn{ display:none; }
body.editing .edit-btn{ display:grid; }


body.editing .card{ padding-right:42px; }
@media (hover: hover){
  body.editing .card-actions{ flex-direction:column; top:9px; right:9px; }
  .card-actions{ top:9px; right:9px; }
}
.del-btn{ display:none; }
body.editing .del-btn{ display:grid; }
.del-btn:hover{ color:var(--danger); border-color:#fecaca; background:#fef2f2; }

body.editing .card{ cursor:grab; }
body.editing .card:active{ cursor:grabbing; }
body.editing .card.dragging{
  opacity:.5;
  transform:scale(.97);
  box-shadow:0 0 0 2px var(--brand), 0 10px 24px rgba(168,32,26,.16);
  cursor:grabbing;
}
body.editing .card .card-body{ pointer-events:none; }


body.is-dragging .card:hover{ transform:none; }
body.is-dragging .card{ will-change:translate; }
body.is-dragging .group{ will-change:translate; }


.empty{ text-align:center; padding:72px 20px; color:var(--text-3); }
.empty svg{ margin-bottom:12px; color:#DCCFB8; }
.empty p{ margin:0; font-size:13.5px; }
.empty .hint{ font-size:12px; margin-top:6px; color:#b0b6c4; }


.dlg{
  border:none; border-radius:16px; padding:0;
  width: min(600px, calc(100vw - 40px));
  background:#fff;
  box-shadow:0 24px 64px rgba(60,42,24,.20), 0 4px 12px rgba(60,42,24,.08);
  color:var(--text);
}
.dlg-sm{ width: min(400px, calc(100vw - 40px)); }
.dlg-lg{ width: min(900px, calc(100vw - 40px)); }
.dlg::backdrop{ background:rgba(60,42,24,.42); }
.dlg[open]{ animation:dlgIn .18s ease; }
@keyframes dlgIn{ from{ opacity:0; transform:translateY(8px) scale(.99); } }

.dlg-form{ display:flex; flex-direction:column; max-height: calc(100vh - 80px); }
.dlg-head{
  display:flex; align-items:center; justify-content:space-between;
  padding:18px 20px 14px; border-bottom:1px solid var(--line);
}
.dlg-head h2{ margin:0; font-size:15.5px; font-weight:650; letter-spacing:-.2px; }
.dlg-close{
  width:28px; height:28px; display:grid; place-items:center;
  background:transparent; border:none; border-radius:6px; color:var(--text-3);
}
.dlg-close:hover{ background:#F8F2E8; color:var(--text); }

.dlg-body{ padding:18px 20px; overflow:auto; }
.dlg-foot{
  display:flex; align-items:center; gap:8px;
  padding:14px 20px; border-top:1px solid var(--line);
  background:#FDFBF6; border-radius:0 0 16px 16px;
}
.dlg-foot .spacer{ flex:1; }

.row2{ display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.row3{ display:grid; grid-template-columns:1fr 1fr 1fr; gap:12px; }

.field{ display:block; margin-bottom:14px; }
.field > span{
  display:block; font-size:12px; font-weight:500;
  color:var(--text-2); margin-bottom:5px;
}
.field > span em{ color:var(--danger); font-style:normal; }
.field input, .field textarea, .field select{
  width:100%; padding:8px 11px;
  border:1px solid var(--line); border-radius:8px;
  background:#FDFBF6; outline:none;
  transition: border-color .14s, box-shadow .14s, background .14s;
}
.field input:focus, .field textarea:focus, .field select:focus{
  background:#fff; border-color:#D9BE84;
  box-shadow:0 0 0 3px rgba(184,134,11,.14);
}
.field textarea{ resize:vertical; line-height:1.55; }
.form-err{ color:var(--danger); font-size:12.5px; margin:0 0 10px; min-height:0; }


.confirm-text{
  font-size:13.5px; color:var(--text); margin:0 0 10px; line-height:1.65;
}
.confirm-text b{ font-weight:650; color:#111; }
.confirm-tip{
  font-size:12px; color:var(--text-3); margin:0; line-height:1.6;
  padding:9px 11px; background:#FAF5EC; border-radius:8px;
  border-left:2px solid #e2e5ee;
}


.icon-row{ display:flex; align-items:center; gap:9px; }
.icon-preview{
  width:38px; height:38px; flex-shrink:0;
  border:1px dashed #DED0B8; border-radius:9px;
  background:#FDFBF6; display:grid; place-items:center;
  overflow:hidden;
}
.icon-preview em{ font-style:normal; font-size:10px; color:var(--text-3); }
.icon-preview img{ width:100%; height:100%; object-fit:contain; padding:4px; }
.icon-tip{ font-size:11.5px; color:var(--text-3); margin-top:6px; }


.sect-title{
  font-size:11.5px; font-weight:650; letter-spacing:.3px;
  color:var(--text-3); text-transform:uppercase;
  margin:0 0 10px; padding-bottom:6px;
  border-bottom:1px solid var(--line);
}
.group-editor{
  display:flex; flex-direction:column; gap:7px; margin-bottom:10px;
}
.ge-row{
  display:flex; align-items:center; gap:8px;
}
.ge-row input[type="color"]{
  width:30px; height:30px; padding:2px; flex-shrink:0;
  border:1px solid var(--line); border-radius:7px;
  background:#fff; cursor:pointer;
}
.ge-row input[type="text"]{
  flex:1; min-width:0; padding:6px 10px;
  border:1px solid var(--line); border-radius:7px;
  background:#FDFBF6; outline:none;
}
.ge-row input[type="text"]:focus{ border-color:#D9BE84; background:#fff; }
.ge-row .ge-count{
  font-size:11px; color:var(--text-3); flex-shrink:0;
  min-width:38px; text-align:right;
}
.group-add{
  display:flex; align-items:center; gap:8px;
  padding-top:10px; border-top:1px dashed var(--line);
}
.group-add input[type="text"]{
  flex:1; min-width:0; padding:6px 10px;
  border:1px solid var(--line); border-radius:7px;
  background:#FDFBF6; outline:none;
}
.group-add input[type="text"]:focus{ border-color:#D9BE84; background:#fff; }
.group-add input[type="color"]{
  width:30px; height:30px; padding:2px; flex-shrink:0;
  border:1px solid var(--line); border-radius:7px; background:#fff; cursor:pointer;
}


.user-add{
  display:grid; grid-template-columns:1fr 1fr 1fr auto auto; gap:8px;
  margin-bottom:14px;
}
.user-add input, .user-add select{
  padding:7px 10px; border:1px solid var(--line); border-radius:7px;
  background:#FDFBF6; outline:none; min-width:0;
}
.user-add input:focus, .user-add select:focus{ border-color:#D9BE84; background:#fff; }

.table-wrap{ border:1px solid var(--line); border-radius:10px; overflow:auto; }
.table-wrap.scroll{ max-height: 52vh; }
.dlg-lg .table-wrap.scroll{ max-height: 64vh; }
.dlg-lg .utable{ min-width: 660px; }
.utable{ width:100%; border-collapse:collapse; font-size:12.5px; }
.utable th{
  text-align:left; font-weight:600; color:var(--text-3);
  font-size:11.5px; letter-spacing:.2px;
  padding:9px 12px; background:#FDFBF6;
  border-bottom:1px solid var(--line);
  position:sticky; top:0; white-space:nowrap;
}
.utable td{
  padding:9px 12px; border-bottom:1px solid #F4EDE0; color:var(--text-2);
  white-space:nowrap;
}
.utable tr:last-child td{ border-bottom:none; }
.utable tr:hover td{ background:#FDFAF4; }
.utable .ta-r{ text-align:right; }
.utable .uname{ color:var(--text); font-weight:600; }

.badge{
  display:inline-block; font-size:10.5px; font-weight:600;
  padding:1px 6px; border-radius:4px;
  background:#F3EDE1; color:var(--text-2);
}
.badge.admin{ background:#ede9fe; color:#6d28d9; }
.badge.off{ background:#fef2f2; color:#b91c1c; }
.badge.on{ background:#ecfdf5; color:#047857; }

.mini-btn{
  height:22px; padding:0 7px; margin-left:4px;
  background:#fff; border:1px solid var(--line); border-radius:5px;
  font-size:11.5px; color:var(--text-2);
}
.mini-btn:hover{ background:#FAF5EC; border-color:#DED0B8; }
.mini-btn.danger{ color:var(--danger); border-color:#fecaca; }
.mini-btn.danger:hover{ background:#fef2f2; }


.toasts{
  position:fixed; bottom:24px; left:50%; transform:translateX(-50%);
  z-index:200; display:flex; flex-direction:column; gap:8px;
  align-items:center; pointer-events:none;
}
.toast{
  padding:9px 16px; border-radius:9px;
  background:#2A211B; color:#fff;
  font-size:13px; box-shadow:0 8px 24px rgba(60,42,24,.24);
  animation:toastIn .2s ease;
}
.toast.ok{ background:#065f46; }
.toast.err{ background:#991b1b; }
@keyframes toastIn{ from{ opacity:0; transform:translateY(8px); } }


.login-body{
  min-height:100vh; display:grid; place-items:center;
  padding:24px;
  background:
    radial-gradient(900px 520px at 14% -12%, #FBF0D9 0%, transparent 62%),
    radial-gradient(720px 420px at 92% 112%, #FAECE8 0%, transparent 58%),
    var(--bg);
}
.login-wrap{ width:100%; max-width:372px; }
.login-card{
  background:#fff; border:1px solid var(--line); border-radius:16px;
  padding:30px 28px 24px;
  box-shadow:0 12px 40px rgba(60,42,24,.08), 0 2px 8px rgba(60,42,24,.04);
}
.login-brand{ display:flex; align-items:center; gap:11px; margin-bottom:26px; }
.login-title{ font-size:16px; font-weight:650; letter-spacing:-.2px; }
.login-sub{ font-size:12px; color:var(--text-3); margin-top:-1px; }
.login-card .field input{ height:40px; font-size:14px; }
.login-error{
  color:var(--danger); font-size:12.5px; min-height:18px;
  margin:-2px 0 10px;
}
.login-card .btn-primary{ width:100%; height:42px; font-size:14px; letter-spacing:2px; }
.login-foot{
  margin-top:18px; padding-top:14px; border-top:1px solid var(--line);
  text-align:center; font-size:11.5px; color:var(--text-3);
}




@media (hover: none){
  .card-actions{ opacity:1; }
  .icon-btn{ width:30px; height:30px; }
  .icon-btn svg{ width:14px; height:14px; }
  body.editing .card{ padding-right:106px; }
  .mini-btn{ height:28px; padding:0 9px; font-size:12px; }
  .search input, .field input, .field textarea, .field select{ font-size:16px; }
}


@media (max-width: 900px){
  .hero h1{ font-size:20px; }
  .dlg{ width: min(560px, calc(100vw - 40px)); }
  .dlg-lg{ width: calc(100vw - 40px); }
}


@media (max-width: 820px){
  .topbar-inner{ padding:11px 16px; gap:10px; flex-wrap:wrap; }
  .search{ order:3; max-width:none; flex-basis:100%; margin-left:0; }
  .top-actions{ margin-left:auto; }
  .brand-sub{ display:none; }
  main{ padding:22px 16px 0; }
  .grid{ grid-template-columns:1fr; }
  .hero-count{ display:none; }
  .row2, .row3{ grid-template-columns:1fr; gap:0; }
  .user-add{ grid-template-columns:1fr 1fr; }
  .user-name{ display:none; }
}


@media (max-width: 640px){
  body{ padding-bottom: calc(28px + env(safe-area-inset-bottom)); }

  
  .topbar-inner{ padding:10px 14px 12px; gap:8px; }
  .brand-mark{ width:28px; height:28px; border-radius:8px; }
  .brand-name{ font-size:14px; }
  .top-actions{ gap:6px; }
  .btn-ghost{ height:34px; padding:0 10px; font-size:12.5px; }
  .search input{ height:42px; font-size:16px; padding-right:14px; }
  .search kbd{ display:none; }

  main{ padding:18px 14px 0; }
  .hero{ margin-bottom:20px; }
  .hero h1{ font-size:19px; letter-spacing:-.3px; }
  .hero p{ font-size:12.5px; }
  .live-hint{ font-size:12px; padding:6px 10px; }

  .group{ margin-bottom:24px; }
  .group-head{ margin-bottom:10px; }
  .group-head h2{ font-size:12.5px; }
  .grid{ gap:10px; }

  .card{ padding:14px; padding-right:46px; border-radius:12px; gap:11px; }
  body.editing .card{ padding-right:112px; }
  .card-icon{ width:44px; height:44px; border-radius:11px; font-size:16px; }
  .card-title{ font-size:13.5px; }
  .card-desc{ font-size:12px; }
  .card-meta{ font-size:11px; }

  .add-group-bar{ padding:2px 0 28px; }
  .add-group-btn{ width:100%; height:46px; justify-content:center; }

  
  .dlg, .dlg-sm, .dlg-lg{
    width: calc(100vw - 20px);
    max-height: calc(100vh - 40px);
    border-radius:14px;
  }
  .dlg-head{ padding:15px 16px 12px; }
  .dlg-body{ padding:16px; }
  .dlg-foot{ padding:12px 16px; gap:8px; }
  .dlg-foot .spacer{ display:none; }
  .dlg-foot > button{ flex:1; min-width:0; padding:0 8px; }
  .dlg-close{ width:32px; height:32px; }

  .field input, .field textarea, .field select{ font-size:16px; padding:10px 12px; }

  
  .user-add{ grid-template-columns:1fr; gap:6px; }
  .user-add input, .user-add select{ font-size:16px; padding:9px 11px; }
  .utable th:nth-child(2), .utable td:nth-child(2),
  .utable th:nth-child(5), .utable td:nth-child(5){ display:none; }
  .table-wrap.scroll{ max-height:46vh; }

  .login-card{ padding:24px 20px 20px; }
  .login-card .field input{ height:44px; font-size:16px; }
  .toasts{ bottom: calc(18px + env(safe-area-inset-bottom)); left:14px; right:14px; transform:none; }
  .toast{ font-size:12.5px; padding:8px 14px; text-align:center; }
}
