:root {
  --bg: #0f1115;
  --surface: #15181f;
  --surface-2: #1b1f28;
  --ink: #e8e6e1;
  --muted: #9a958b;
  --line: rgba(232, 230, 225, 0.1);
  --accent: #5ee6c4;
  --accent-dim: rgba(94, 230, 196, 0.12);
  --glass: rgba(20, 22, 28, 0.72);
  --glass-line: rgba(255, 255, 255, 0.12);
  --danger: #e07070;
  --radius: 14px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
  --mono: "SFMono-Regular", "JetBrains Mono", Consolas, Menlo, monospace;
  --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --sidebar-width: 16rem;
  --admin-header-h: 65px;
  --sidebar-bg: #12141a;
  --sidebar-fg: #e8e6e1;
  --sidebar-muted: #8b909a;
  --sidebar-accent: rgba(255, 255, 255, 0.06);
  --sidebar-accent-fg: #fafafa;
  --sidebar-border: rgba(255, 255, 255, 0.08);
  --sidebar-active: rgba(94, 230, 196, 0.14);
  --sidebar-active-fg: #5ee6c4;
}

html[data-theme="light"] {
  --bg: #eef0f4;
  --surface: #ffffff;
  --surface-2: #f5f6f8;
  --ink: #1a1d24;
  --muted: #6b7280;
  --line: rgba(26, 29, 36, 0.1);
  --accent: #0d9488;
  --accent-dim: rgba(13, 148, 136, 0.1);
  --glass: rgba(255, 255, 255, 0.82);
  --glass-line: rgba(255, 255, 255, 0.9);
  --danger: #c0392b;
  --shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
  --sidebar-bg: #fafafa;
  --sidebar-fg: #18181b;
  --sidebar-muted: #71717a;
  --sidebar-accent: rgba(24, 24, 27, 0.06);
  --sidebar-accent-fg: #18181b;
  --sidebar-border: rgba(24, 24, 27, 0.08);
  --sidebar-active: rgba(13, 148, 136, 0.12);
  --sidebar-active-fg: #0d9488;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
}

body { min-height: 100vh; }
a { color: inherit; text-decoration: none; }

.glass {
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(1.15);
  -webkit-backdrop-filter: blur(20px) saturate(1.15);
  border-bottom: 1px solid var(--glass-line);
}

@supports not ((backdrop-filter: blur(20px)) or (-webkit-backdrop-filter: blur(20px))) {
  .glass { background: var(--surface); }
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 24px;
  min-height: 58px;
}

.brand {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.spacer { flex: 1; min-width: 0; }

.topbar .spacer { flex: 1; }

.topbar-end {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.topbar .theme-btn {
  flex-shrink: 0;
}

.search-wrap {
  position: relative;
  width: min(320px, 32vw);
  flex: 0 1 320px;
}

.search {
  width: 100%;
  height: 38px;
  margin: 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  padding: 0 14px;
  line-height: 1;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search::placeholder { color: var(--muted); }
.search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.theme-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  padding: 0;
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  font-family: inherit;
  cursor: pointer;
  border-radius: 10px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.theme-btn svg {
  display: block;
  width: 18px;
  height: 18px;
}

.theme-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  padding: 8px 14px;
  cursor: pointer;
  border-radius: 10px;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.topbar .btn {
  height: 38px;
  padding: 0 14px;
}

.btn.primary {
  background: var(--accent);
  color: #0a0d10;
  border-color: var(--accent);
  font-weight: 600;
}

html[data-theme="light"] .btn.primary { color: #fff; }
.btn.primary:hover { opacity: 0.92; color: inherit; }
.btn.danger { color: var(--danger); border-color: rgba(224, 112, 112, 0.35); }
.btn.danger:hover { background: rgba(224, 112, 112, 0.08); }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: 0.45; cursor: default; }

.wrap {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.page-head {
  padding: 36px 0 24px;
}

.page-head h1 {
  margin: 0;
  font-size: clamp(28px, 4vw, 36px);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.page-head p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.cat-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  margin-bottom: 20px;
  border-radius: var(--radius);
}

.cat-nav button {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.cat-nav button:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.cat-nav button[aria-current="true"] {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* ---- 首页卡片 ---- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  padding-bottom: 48px;
}

.tool-card {
  display: flex;
  flex-direction: column;
  min-height: 148px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
}

.tool-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.22);
}

html[data-theme="light"] .tool-card:hover {
  box-shadow: 0 14px 36px rgba(13, 148, 136, 0.12);
}

.tool-card .name {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.tool-card .cat {
  display: inline-block;
  margin-bottom: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.tool-card .desc {
  flex: 1;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tool-card .foot {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
}

.empty-box {
  grid-column: 1 / -1;
  text-align: center;
  padding: 64px 24px;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

.list-meta {
  padding-bottom: 20px;
  color: var(--muted);
  font-size: 13px;
}

/* ---- 登录 ---- */
.auth-card {
  width: min(420px, calc(100% - 40px));
  margin: 10vh auto 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
}

.auth-card h1 {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
}

.auth-card > p {
  color: var(--muted);
  margin: 0 0 24px;
  font-size: 14px;
}

.auth-card .field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 8px;
}

.auth-card .field input {
  width: 100%;
  height: 40px;
  margin-bottom: 0;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 14px;
}

.auth-card .field {
  margin-bottom: 16px;
}

.auth-card .field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
  outline: none;
}

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin: 0 0 6px;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="search"],
textarea,
select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  padding: 10px 12px;
  outline: none;
  margin-bottom: 16px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.topbar .search-wrap input,
.panel-toolbar .search-wrap input,
input.search {
  width: 100%;
  height: 38px;
  margin: 0;
  padding: 0 14px;
  line-height: 1;
}

textarea { min-height: 88px; resize: vertical; }

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.hint {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  margin: -8px 0 16px;
}

.status {
  font-size: 13px;
  margin: 0 0 14px;
  min-height: 1.2em;
}

.status.err { color: var(--danger); }
.status.ok { color: var(--accent); }

.hidden { display: none !important; }

/* ---- 后台 shadcn 式侧栏 ---- */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  width: var(--sidebar-width);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  color: var(--sidebar-fg);
  border-right: 1px solid var(--sidebar-border);
}

.sidebar-header {
  display: flex;
  align-items: center;
  height: var(--admin-header-h);
  padding: 0 16px;
  border-bottom: 1px solid var(--sidebar-border);
  box-sizing: border-box;
  flex-shrink: 0;
}

.sidebar-brand {
  display: block;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--sidebar-fg);
  text-decoration: none;
}

.sidebar-brand span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  font-weight: 500;
  color: var(--sidebar-muted);
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 12px 10px;
}

.sidebar-group-label {
  padding: 0 10px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
}

.sidebar-menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-menu-item { margin-bottom: 2px; }

.sidebar-menu-item.sub .sidebar-menu-btn {
  padding-left: 34px;
  min-height: 32px;
  font-size: 13px;
}

.sidebar-menu-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--sidebar-muted);
  font-family: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  box-sizing: border-box;
}

.sidebar-menu-btn:hover {
  background: var(--sidebar-accent);
  color: var(--sidebar-accent-fg);
}

.sidebar-menu-btn[aria-current="true"] {
  background: var(--sidebar-active);
  color: var(--sidebar-active-fg);
  font-weight: 600;
}

.sidebar-icon {
  width: 18px;
  text-align: center;
  font-size: 14px;
  opacity: 0.85;
}

.sidebar-footer {
  padding: 12px 10px 16px;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-user {
  padding: 8px 10px 10px;
  font-size: 12px;
  color: var(--sidebar-muted);
  word-break: break-all;
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(0, 0, 0, 0.45);
}

.sidebar-inset {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.inset-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--admin-header-h);
  padding: 0 24px;
  box-sizing: border-box;
  flex-shrink: 0;
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.inset-header h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.02em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inset-header .theme-btn {
  margin-left: 0;
  flex-shrink: 0;
}

.account-link {
  display: inline-flex;
  align-items: center;
  max-width: 140px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 0;
}

.account-link:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.account-link[aria-current="page"] {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}

.inset-content {
  flex: 1;
  padding: 24px;
  max-width: 1200px;
  width: 100%;
}

.sidebar-inset.form-mode .inset-content {
  padding-bottom: 88px;
}

.form-actions-fixed {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-width);
  right: 0;
  z-index: 25;
  display: flex;
  gap: 10px;
  padding: 14px 24px;
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}

#tab-tool-form .form-box-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

#tab-tool-form .form-box-head {
  margin-bottom: 4px;
}

.sidebar-toggle { display: none; }

.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.auth-shell .auth-card {
  margin: 0 auto 48px;
}

.auth-top {
  display: flex;
  justify-content: flex-end;
  padding: 16px 24px;
}

.admin-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.panel-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}

.panel-toolbar .search-wrap { width: min(280px, 100%); flex: 1; }

.toolbar-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.toolbar-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.toolbar-filter select {
  width: auto;
  min-width: 108px;
  height: 38px;
  margin: 0;
  padding: 0 32px 0 12px;
  font-size: 13px;
}

.filter-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-group button {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
}

.filter-group button[aria-current="true"] {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 12px;
  padding: 12px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.table td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: var(--accent-dim); }

.table .url {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
}

.tag.own { color: var(--accent); background: var(--accent-dim); }
.tag.off { color: var(--danger); background: rgba(224, 112, 112, 0.1); }

.actions { display: flex; gap: 6px; flex-wrap: wrap; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.pagination .info { color: var(--muted); font-size: 13px; }

.pagination .pages { display: flex; gap: 6px; align-items: center; }

.page-size select {
  width: auto;
  margin: 0;
  padding: 6px 10px;
  font-size: 13px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 20px;
}

.form-grid .span2 { grid-column: 1 / -1; }

.tool-form-card {
  margin-top: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  overflow: hidden;
}

.form-box-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 0;
}

.form-box-head h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.form-box-desc {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.form-back {
  display: inline-block;
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
}

.form-back:hover {
  color: var(--accent);
}

.tool-form-card > .status {
  margin: 12px 24px 0;
}

.tool-form-card form {
  padding: 20px 24px 24px;
}

.form-section + .form-section {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.form-section-title {
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 8px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  height: 40px;
  margin-bottom: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 14px;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.field textarea {
  height: auto;
  min-height: 96px;
  padding: 10px 12px;
  line-height: 1.55;
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder {
  color: var(--muted);
  opacity: 0.75;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
  outline: none;
}

.field-hint {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.mono-input {
  font-family: var(--mono);
  font-size: 13px !important;
}

.segmented {
  display: flex;
  padding: 3px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  gap: 2px;
}

.segmented-btn {
  flex: 1;
  height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.segmented-btn[aria-pressed="true"] {
  background: var(--surface-2);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

html[data-theme="light"] .segmented-btn[aria-pressed="true"] {
  background: #fff;
}

.field-switch .switch {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  cursor: pointer;
  user-select: none;
}

.field-switch .switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-track {
  position: relative;
  width: 42px;
  height: 24px;
  background: var(--line);
  border-radius: 999px;
  transition: background 0.2s;
  flex-shrink: 0;
}

.switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}

.switch input:checked + .switch-track {
  background: var(--accent);
}

.switch input:checked + .switch-track .switch-thumb {
  transform: translateX(18px);
}

.switch-label {
  font-size: 14px;
  color: var(--muted);
}

.form-footer {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0 16px;
  font-size: 14px;
}

.check input { width: auto; margin: 0; }

.form-box {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.form-box h3 {
  margin: 0 0 16px;
  font-size: 16px;
  font-weight: 650;
}

.section-title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 650;
}

.section-desc {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 14px;
}

.cat-add-row {
  display: flex;
  gap: 10px;
  min-width: 0;
  flex: 0 1 320px;
}

.cat-add-row input {
  flex: 1;
  margin-bottom: 0;
  min-width: 0;
}

.cat-edit-input {
  width: 100%;
  height: 34px;
  margin: 0;
  padding: 0 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
}

.cat-edit-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
  outline: none;
}

.cat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.cat-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.cat-item:last-child { border-bottom: 0; }

.cat-name {
  flex: 1;
  font-weight: 600;
}

.cat-count {
  font-size: 12px;
  color: var(--muted);
}

.cat-empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 12px;
}

.field-hint a {
  color: var(--accent);
  text-decoration: none;
}

.field-hint a:hover { text-decoration: underline; }

@media (max-width: 768px) {
  .topbar {
    padding: 10px 16px;
    flex-wrap: wrap;
    row-gap: 10px;
  }
  .topbar-end {
    order: 3;
    width: 100%;
  }
  .topbar .theme-btn {
    order: 1;
  }
  .topbar .search-wrap {
    flex: 1;
    width: auto;
    max-width: none;
  }
  .wrap { width: calc(100% - 32px); }
  .page-head { padding: 24px 0 16px; }
  .card-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .admin-panel { padding: 16px; }
  .panel-toolbar { flex-direction: column; align-items: stretch; }
  .sidebar-toggle { display: inline-flex; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }
  .admin-layout.sidebar-open .sidebar {
    transform: translateX(0);
  }
  .admin-layout.sidebar-open .sidebar-backdrop {
    display: block;
  }
  .sidebar-inset { margin-left: 0; }
  .inset-content { padding: 16px; }
  .form-actions-fixed { left: 0; }
}
