:root {
  --ink: #15231f;
  --ink-soft: #263630;
  --muted: #697671;
  --muted-dark: #9eaaa4;
  --paper: #edf1ee;
  --paper-deep: #e0e7e2;
  --panel: #f9fbf8;
  --white: #ffffff;
  --line: #d3dcd6;
  --line-dark: #b8c4bd;
  --accent: #d85c3f;
  --accent-hover: #c24c31;
  --accent-soft: #f3e0da;
  --danger: #b84530;
  --success: #37765e;
  --serif: "Noto Serif SC", "Songti SC", serif;
  --sans: "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --mono: "DM Mono", "SFMono-Regular", Consolas, monospace;
  --sidebar-width: 250px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a, label { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }
svg { display: block; }
::selection { color: white; background: var(--accent); }
.is-hidden { display: none !important; }
.admin-grain {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.24;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.1'/%3E%3C/svg%3E");
}
.mono-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 13px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.11em;
}
.mono-label span { width: 19px; height: 1px; background: var(--accent); }
.brand-mark {
  width: 33px;
  height: 33px;
  flex: 0 0 33px;
  position: relative;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
}
.brand-mark::before, .brand-mark::after { content: ""; position: absolute; background: currentColor; }
.brand-mark::before { width: 1px; height: 43px; }
.brand-mark::after { width: 43px; height: 1px; }
.brand-mark i { width: 4px; height: 4px; position: absolute; border-radius: 50%; background: var(--accent); }
.brand-mark i:nth-child(1) { transform: translateY(-15px); }
.brand-mark i:nth-child(2) { transform: translateX(-15px); }
.brand-mark i:nth-child(3) { transform: translate(11px, 11px); width: 5px; height: 5px; }

/* Login */
.login-view {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(420px, 1.1fr);
}
.login-brand-panel {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 46px clamp(32px, 6vw, 86px) 37px;
  color: #f0f5f1;
  background: var(--ink);
}
.login-brand { display: inline-flex; align-items: center; gap: 13px; width: fit-content; color: #f0f5f1; text-decoration: none; }
.login-brand > span:last-child { display: flex; align-items: center; gap: 16px; font-family: var(--serif); font-size: 18px; letter-spacing: 0.12em; }
.login-brand small { color: #9aaba0; font-family: var(--mono); font-size: 10px; letter-spacing: 0.09em; }
.login-intro { max-width: 410px; }
.login-intro .mono-label { color: #95a099; }
.login-intro h1 {
  margin: 0 0 22px;
  color: #f0f5f1;
  font-family: var(--serif);
  font-size: clamp(39px, 5vw, 66px);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0;
}
.login-intro > p:last-child {
  max-width: 350px;
  margin: 0;
  color: #aeb8af;
  font-size: 15px;
  line-height: 1.95;
}
.login-footnote { margin: 0; color: #79867c; font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; }
.login-form-panel {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 42px;
  background: var(--paper);
}
.login-form { width: min(365px, 100%); }
.login-form h2 { margin-bottom: 8px; font-family: var(--serif); font-size: 31px; line-height: 1.4; }
.login-help { margin-bottom: 31px; color: var(--muted); font-size: 14px; }
.field { display: grid; gap: 8px; min-width: 0; }
.field > span { color: #505951; font-size: 13px; font-weight: 500; }
.field em { margin-left: 4px; color: var(--accent); font-style: normal; font-size: 12px; }
.field input, .field textarea, .field select, .compact-select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 0;
  outline: 0;
  color: var(--ink);
  background: var(--white);
  padding: 11px 12px;
  font-size: 14px;
  transition: border-color 150ms, box-shadow 150ms;
}
.field textarea { resize: vertical; line-height: 1.7; }
.field input:focus, .field textarea:focus, .field select:focus, .compact-select:focus {
  border-color: var(--ink-soft);
  box-shadow: 0 0 0 2px rgba(23, 32, 28, 0.08);
}
.field small { justify-self: end; margin-top: -3px; color: var(--muted); font-family: var(--mono); font-size: 11px; }
.password-input { position: relative; }
.password-input input { padding-right: 45px; }
.password-input button {
  width: 39px;
  height: calc(100% - 2px);
  position: absolute;
  right: 1px;
  top: 1px;
  display: grid;
  place-items: center;
  border: 0;
  color: var(--muted);
  background: transparent;
}
.password-input svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.check-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 17px 0 20px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}
.check-field input { width: 14px; height: 14px; accent-color: var(--accent); }
.form-error, .dialog-error {
  margin: 0 0 14px;
  padding: 9px 11px;
  color: var(--danger);
  background: #f7e5df;
  font-size: 13px;
  line-height: 1.6;
}
.button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 15px;
  border: 1px solid transparent;
  border-radius: 0;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  text-decoration: none;
  transition: background 150ms, border-color 150ms, color 150ms;
}
.button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.button-primary { color: #fffaf2; background: var(--ink); }
.button-primary:hover { background: #35403a; }
.button-secondary { color: var(--ink); border-color: var(--line-dark); background: transparent; }
.button-secondary:hover { border-color: var(--ink); background: rgba(255, 255, 255, 0.35); }
.button-ghost { color: var(--muted); border-color: transparent; background: transparent; }
.button-ghost:hover { color: var(--ink); background: var(--paper-deep); }
.button-danger { color: white; background: var(--danger); }
.button-danger:hover { background: #9b3826; }
.button:disabled { cursor: wait; opacity: 0.65; }
.button-wide { width: 100%; justify-content: space-between; padding-inline: 17px; }
.back-home { display: block; margin-top: 24px; color: var(--muted); font-size: 13px; text-decoration: none; text-align: center; }
.back-home:hover { color: var(--ink); }

/* Workspace shell */
.admin-shell {
  min-height: 100vh;
  position: relative;
  z-index: 1;
  display: flex;
}
.sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  min-height: 100vh;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  color: #d5ddd7;
  background: var(--ink);
}
.sidebar-head { padding: 29px 22px 21px; }
.sidebar-brand { display: inline-flex; align-items: center; gap: 11px; color: #edf2ee; text-decoration: none; }
.sidebar-brand > span:last-child { display: grid; gap: 2px; }
.sidebar-brand strong { font-family: var(--serif); font-size: 18px; letter-spacing: 0.16em; }
.sidebar-brand small { color: #8fa097; font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; }
.sidebar-close { display: none !important; color: #bcc7bf !important; margin-left: auto; }
.side-nav { padding: 10px 13px; }
.sidebar-tools { padding: 12px 13px; margin-top: 4px; border-top: 1px solid #344039; }
.sidebar-tools .nav-section-label { padding-top: 5px; }
.nav-section-label { margin: 0 12px 8px; color: #68776e; font-family: var(--mono); font-size: 10px; letter-spacing: 0.13em; }
.nav-item {
  position: relative;
  width: 100%;
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border: 0;
  color: #aeb9b0;
  background: transparent;
  font-size: 13px;
  text-align: left;
  text-decoration: none;
  transition: color 150ms, background 150ms;
}
.nav-item > svg { width: 17px; height: 17px; flex: 0 0 17px; fill: none; stroke: currentColor; stroke-width: 1.35; }
.nav-item:hover { color: #eff5f0; background: #25352e; }
.nav-item.is-active { color: #f4f9f5; background: #2b3b33; }
.nav-item.is-active::before { content: ""; width: 2px; height: 15px; position: absolute; margin-left: -12px; background: var(--accent); }
.nav-item .nav-count { margin-left: auto; color: #86958b; font-family: var(--mono); font-size: 11px; }
.nav-item .external-icon { margin-left: auto; width: 13px; }
.sidebar-footer { margin-top: auto; padding: 16px 13px 20px; border-top: 1px solid #344039; }
.account-row {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px;
  border: 0;
  color: #d8dfd9;
  background: transparent;
  text-align: left;
}
.account-row:hover { background: #25322b; }
.account-avatar { display: grid; place-items: center; width: 28px; height: 28px; color: var(--ink); background: #dbe5db; font-family: var(--mono); font-size: 11px; }
.account-row > span:nth-child(2) { display: grid; gap: 3px; }
.account-row strong { font-size: 13px; font-weight: 500; }
.account-row small { color: #8c9b91; font-size: 11px; }
.account-row > svg { width: 13px; margin-left: auto; fill: none; stroke: #7d8e83; stroke-width: 1.5; }
.sidebar-scrim { display: none; }

.workspace { flex: 1; min-width: 0; }
.workspace-header {
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 clamp(22px, 4vw, 54px);
  border-bottom: 1px solid var(--line);
  background: rgba(237, 241, 238, 0.9);
}
.menu-toggle { display: none !important; }
.breadcrumb { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.breadcrumb i { color: var(--line-dark); font-style: normal; }
.breadcrumb strong { color: var(--ink); font-weight: 500; }
.header-actions { display: flex; align-items: center; gap: 20px; }
.save-state { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.save-state i { width: 5px; height: 5px; display: block; border-radius: 50%; background: #89968d; }
.save-state.is-dirty { color: #a16b24; }
.save-state.is-dirty i { background: var(--accent); }
.button-save { min-width: 108px; }
.workspace-main { width: min(1120px, calc(100% - 88px)); margin: 0 auto; padding: 46px 0 72px; }
.view { animation: appear 180ms ease-out; }
@keyframes appear { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.page-heading { min-height: 91px; display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; }
.page-heading h1 { margin: 0 0 8px; font-family: var(--serif); font-size: clamp(26px, 3.2vw, 37px); line-height: 1.35; letter-spacing: 0; font-weight: 700; }
.page-subtitle { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.page-heading > .button { margin-top: 17px; flex: 0 0 auto; }
.heading-actions { display: flex; gap: 9px; margin-top: 17px; flex: 0 0 auto; }
.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 0.7fr)) minmax(180px, 1.3fr);
  margin: 31px 0 38px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.stat-item { padding: 17px 20px 18px; border-right: 1px solid var(--line); }
.stat-item:last-child { border-right: 0; }
.stat-label { display: block; margin-bottom: 11px; color: var(--muted); font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; }
.stat-item strong { display: inline-block; margin-right: 5px; color: var(--ink); font-family: var(--serif); font-size: 25px; font-weight: 600; line-height: 1.1; }
.stat-item > span:last-child { color: var(--muted); font-size: 12px; }
.stat-wide strong { display: block; margin-bottom: 5px; font-family: var(--mono); font-size: 16px; font-weight: 400; }
.overview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 41px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-head .mono-label { margin-bottom: 8px; }
.section-head h2 { margin: 0; font-family: var(--serif); font-size: 21px; font-weight: 700; }
.text-link { padding: 3px 0; border: 0; color: var(--muted); background: transparent; font-size: 12px; white-space: nowrap; }
.text-link:hover { color: var(--ink); }
.category-bars { border-top: 1px solid var(--line); }
.category-bar { display: grid; grid-template-columns: 88px 1fr 24px; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.category-bar-label { display: flex; align-items: center; gap: 7px; min-width: 0; }
.category-bar-label i { width: 5px; height: 5px; flex: 0 0 5px; border-radius: 50%; }
.category-bar-label span { overflow: hidden; color: #4d584f; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 3px; background: var(--paper-deep); }
.bar-fill { height: 100%; min-width: 2px; transition: width 250ms; }
.category-bar b { color: var(--muted); font-family: var(--mono); font-size: 11px; font-weight: 400; text-align: right; }
.quick-actions { border-top: 1px solid var(--line); }
.quick-actions button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 3px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  background: transparent;
  text-align: left;
}
.quick-actions button:hover { background: rgba(255, 255, 255, 0.28); }
.quick-actions button > svg { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: var(--muted); stroke-width: 1.3; }
.quick-actions button > span { display: grid; gap: 3px; }
.quick-actions strong { font-size: 13px; font-weight: 500; }
.quick-actions small { color: var(--muted); font-size: 12px; }
.quick-actions b { margin-left: auto; color: var(--muted); font-family: var(--mono); font-size: 12px; font-weight: 400; }

/* Link library */
.content-toolbar { display: flex; gap: 9px; align-items: center; margin: 27px 0 21px; }
.admin-search {
  height: 39px;
  flex: 1;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 11px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.admin-search:focus-within { border-color: var(--ink-soft); }
.admin-search svg { width: 15px; height: 15px; fill: none; stroke: var(--muted); stroke-width: 1.5; }
.admin-search input { min-width: 0; flex: 1; padding: 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 13px; }
.admin-search input::placeholder { color: #969c96; }
.compact-select { width: auto; min-width: 119px; height: 39px; padding: 0 27px 0 11px; color: var(--muted); background-color: var(--panel); font-size: 12px; }
.result-count { margin-left: auto; color: var(--muted); font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.category-stack { display: grid; gap: 26px; }
.category-panel { border: 1px solid var(--line); background: rgba(249, 251, 248, 0.68); }
.category-panel-head {
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
}
.category-color-block { width: 4px; height: 25px; flex: 0 0 4px; }
.category-panel-title { display: grid; gap: 4px; min-width: 0; }
.category-panel-title h3 { margin: 0; font-family: var(--serif); font-size: 18px; font-weight: 600; }
.category-panel-title p { margin: 0; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.category-panel-count { margin-left: 7px; color: var(--muted); font-family: var(--mono); font-size: 11px; }
.panel-head-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.icon-button {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  color: var(--muted);
  background: transparent;
}
.icon-button:hover { border-color: var(--line); color: var(--ink); background: var(--panel); }
.icon-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.panel-link-list { padding: 0 7px; }
.admin-link-row {
  min-height: 63px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 9px;
  border-bottom: 1px solid var(--line);
}
.admin-link-row:last-child { border-bottom: 0; }
.admin-link-row:hover { background: rgba(255, 255, 255, 0.47); }
.admin-link-row.is-dragging { opacity: 0.4; }
.admin-link-row.is-drag-over { border-top: 2px solid var(--accent); }
.drag-handle { width: 20px; height: 32px; display: grid; place-items: center; border: 0; color: #b0aaa0; background: transparent; cursor: grab; }
.drag-handle svg { width: 15px; height: 15px; fill: currentColor; }
.link-admin-icon { width: 28px; height: 28px; flex: 0 0 28px; display: grid; place-items: center; color: white; font-family: var(--mono); font-size: 11px; }
.link-admin-main { display: grid; gap: 3px; min-width: 150px; flex: 1; }
.link-admin-title { display: flex; align-items: center; gap: 7px; min-width: 0; }
.link-admin-title strong { overflow: hidden; font-size: 13px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.pin-badge { flex: 0 0 auto; padding: 2px 5px; color: var(--accent); background: var(--accent-soft); font-family: var(--mono); font-size: 10px; letter-spacing: 0.03em; }
.link-admin-url { overflow: hidden; color: var(--muted); font-family: var(--mono); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.link-admin-description { display: flex; flex: 1.2; min-width: 90px; overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.link-admin-tags { display: flex; gap: 4px; flex: 0 1 auto; overflow: hidden; }
.link-admin-tags span { padding: 3px 5px; color: var(--muted); background: var(--paper-deep); font-size: 10px; white-space: nowrap; }
.row-actions { display: flex; gap: 1px; margin-left: 3px; flex: 0 0 auto; }
.row-actions .icon-button { width: 28px; height: 28px; }
.row-actions .delete-action:hover { color: var(--danger); border-color: #ecc8bf; background: #f8eae5; }
.add-link-inline {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 11px 12px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  text-align: left;
}
.add-link-inline:hover { color: var(--ink); }
.add-link-inline svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.empty-admin { padding: 50px 15px; text-align: center; border-top: 1px solid var(--line); }
.empty-admin > span { color: var(--line-dark); font-family: var(--serif); font-size: 38px; }
.empty-admin h3 { margin: 8px 0; font-family: var(--serif); font-size: 18px; }
.empty-admin p { margin: 0; color: var(--muted); font-size: 13px; }

/* Settings */
.settings-layout { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 47px; margin-top: 31px; }
.settings-section { min-width: 0; }
.settings-section + .settings-section { border-left: 1px solid var(--line); padding-left: 45px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px 15px; }
.field-full { grid-column: 1 / -1; }
.section-description { margin: -5px 0 19px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.button-row { display: flex; flex-wrap: wrap; gap: 8px; }
.file-button { position: relative; cursor: pointer; }
.publish-bar {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-top: 42px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  background: rgba(249, 251, 248, 0.76);
}
.publish-icon { width: 27px; height: 27px; display: grid; place-items: center; color: var(--accent); border: 1px solid #e6c5b8; border-radius: 50%; }
.publish-icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.4; }
.publish-bar > div:nth-child(2) { display: grid; gap: 3px; flex: 1; }
.publish-bar strong { font-size: 13px; font-weight: 500; }
.publish-bar p { margin: 0; color: var(--muted); font-size: 12px; }

/* Dialogs */
dialog {
  max-width: calc(100vw - 28px);
  padding: 0;
  border: 1px solid var(--line-dark);
  border-radius: 0;
  color: var(--ink);
  background: var(--panel);
  box-shadow: 0 20px 60px rgba(18, 27, 22, 0.24);
}
dialog::backdrop { background: rgba(22, 31, 25, 0.46); backdrop-filter: blur(2px); }
.editor-dialog { width: 560px; }
.dialog-small { width: 440px; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; padding: 23px 25px 18px; border-bottom: 1px solid var(--line); }
.dialog-head .mono-label { margin-bottom: 8px; }
.dialog-head h2 { margin: 0; font-family: var(--serif); font-size: 25px; }
.dialog-body { max-height: min(65vh, 580px); overflow-y: auto; padding: 22px 25px; }
.dialog-body .form-grid { gap: 17px 13px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 7px; padding: 13px 25px; border-top: 1px solid var(--line); }
.dialog-error { margin-top: 17px; margin-bottom: 0; }
.color-field { display: flex; align-items: center; gap: 7px; }
.color-field input[type="color"] { width: 35px; height: 37px; flex: 0 0 35px; padding: 3px; cursor: pointer; }
.color-field input[type="text"] { min-width: 0; flex: 1; font-family: var(--mono); font-size: 12px; }
.switch-row { display: flex; align-items: center; gap: 9px; padding: 3px 0; cursor: pointer; }
.switch-row > input { position: absolute; opacity: 0; pointer-events: none; }
.switch {
  width: 31px;
  height: 17px;
  position: relative;
  display: block;
  flex: 0 0 31px;
  border-radius: 10px;
  background: #c9c5ba;
  transition: background 150ms;
}
.switch::after {
  content: "";
  width: 13px;
  height: 13px;
  position: absolute;
  top: 2px;
  left: 2px;
  border-radius: 50%;
  background: white;
  transition: transform 150ms;
}
.switch-row input:checked + .switch { background: var(--accent); }
.switch-row input:checked + .switch::after { transform: translateX(14px); }
.switch-row > span:last-child { display: grid; gap: 3px; }
.switch-row strong { font-size: 13px; font-weight: 500; }
.switch-row small { color: var(--muted); font-size: 11px; }
.confirm-dialog { width: 360px; padding: 27px; text-align: center; }
.confirm-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  margin: 0 auto 13px;
  color: var(--danger);
  border: 1px solid #e5c0b6;
  border-radius: 50%;
  font-family: var(--serif);
  font-size: 18px;
}
.confirm-dialog h2 { margin: 0 0 9px; font-family: var(--serif); font-size: 20px; }
.confirm-dialog p { margin: 0 0 22px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.confirm-actions { display: flex; justify-content: center; gap: 7px; }

.admin-toast {
  position: fixed;
  z-index: 100;
  bottom: 25px;
  left: 50%;
  transform: translate(-50%, 12px);
  opacity: 0;
  pointer-events: none;
  padding: 10px 16px;
  color: #f7faf7;
  background: var(--ink);
  font-size: 13px;
  transition: opacity 160ms, transform 160ms;
}
.admin-toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 1000px) {
  .sidebar { width: 222px; flex-basis: 222px; }
  .workspace-main { width: calc(100% - 58px); }
  .overview-grid { grid-template-columns: 1fr; gap: 31px; }
  .settings-layout { grid-template-columns: 1fr; gap: 33px; }
  .settings-section + .settings-section { padding-left: 0; border-left: 0; padding-top: 28px; border-top: 1px solid var(--line); }
  .link-admin-description { display: none; }
  .link-admin-tags { display: none; }
}
@media (max-width: 760px) {
  .login-view { display: block; }
  .login-brand-panel { min-height: 0; padding: 28px 24px 35px; }
  .login-intro { margin-top: 49px; }
  .login-intro h1 { font-size: 40px; margin-bottom: 14px; }
  .login-intro > p:last-child { font-size: 14px; }
  .login-footnote { display: none; }
  .login-form-panel { min-height: auto; padding: 40px 24px 51px; }
  .login-form { max-width: 390px; }
  .sidebar {
    width: min(285px, calc(100vw - 50px));
    position: fixed;
    z-index: 30;
    transform: translateX(-101%);
    transition: transform 200ms ease;
    box-shadow: 15px 0 40px rgba(0, 0, 0, 0.15);
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-close { display: grid !important; }
  .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 29; background: rgba(21, 29, 24, 0.35); opacity: 0; pointer-events: none; transition: opacity 160ms; }
  .sidebar-scrim.is-open { opacity: 1; pointer-events: auto; }
  .menu-toggle { display: grid !important; }
  .workspace-header { height: 62px; padding: 0 18px; gap: 11px; }
  .breadcrumb { flex: 1; font-size: 12px; }
  .save-state { display: none; }
  .button-save { min-width: 38px; width: 38px; padding: 0; }
  .button-save span { display: none; }
  .workspace-main { width: calc(100% - 34px); padding: 30px 0 50px; }
  .page-heading { display: block; min-height: 0; }
  .page-heading h1 { font-size: 28px; }
  .page-heading > .button, .heading-actions { margin-top: 17px; }
  .stat-strip { grid-template-columns: repeat(3, 1fr); margin: 26px 0 29px; }
  .stat-item { padding: 13px 11px; }
  .stat-item strong { font-size: 22px; }
  .stat-item > span:last-child { display: block; margin-top: 3px; font-size: 11px; }
  .stat-wide { grid-column: 1 / -1; border-top: 1px solid var(--line); border-right: 0; }
  .stat-wide strong { display: inline-block; margin-right: 6px; font-size: 14px; }
  .content-toolbar { flex-wrap: wrap; margin-top: 22px; }
  .admin-search { flex-basis: 100%; }
  .result-count { margin-left: 0; }
  .category-panel-head { padding: 10px 11px; }
  .panel-link-list { padding: 0 4px; }
  .admin-link-row { gap: 8px; padding-inline: 5px; }
  .drag-handle { display: none; }
  .link-admin-row .link-admin-main { min-width: 0; }
  .link-admin-title strong { font-size: 13px; }
  .row-actions { gap: 0; }
  .settings-layout { margin-top: 23px; }
  .form-grid { gap: 16px 11px; }
  .publish-bar { align-items: flex-start; flex-wrap: wrap; margin-top: 31px; }
  .publish-bar .button { width: 100%; margin-top: 3px; }
  .dialog-head { padding: 18px 18px 15px; }
  .dialog-body { padding: 18px; }
  .dialog-foot { padding: 12px 18px; }
}
@media (max-width: 420px) {
  .login-brand small { display: none; }
  .login-intro h1 { font-size: 35px; }
  .page-heading h1 { font-size: 25px; }
  .heading-actions { width: 100%; }
  .heading-actions .button { flex: 1; padding-inline: 8px; font-size: 12px; }
  .icon-button { width: 27px; }
  .toast { width: calc(100% - 30px); text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
