@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../fonts/inter-latin-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("../fonts/inter-latin-ext-wght-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-display: swap;
  font-weight: 400;
  src: url("../fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2");
}

:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #f3f6f9;
  --surface-3: #eaeff4;
  --border: #e2e7ee;
  --border-strong: #cdd5df;
  --text: #1c2430;
  --text-2: #4e5a6a;
  --text-3: #7c8796;
  --primary: #0a68b3;
  --primary-hover: #08579a;
  --primary-soft: #e8f2fb;
  --primary-ring: rgba(10, 104, 179, .28);
  --success: #157a3c;
  --success-soft: #eaf7ef;
  --danger: #c0262d;
  --danger-hover: #a11e24;
  --danger-soft: #fdf0f0;
  --warning: #a65b05;
  --warning-soft: #fff6e6;
  --brand-1: #8dc63f;
  --brand-2: #1fb5a6;
  --brand-3: #1c8fd4;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 32px -8px rgba(16, 24, 40, .14), 0 4px 8px -4px rgba(16, 24, 40, .06);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --header-h: 64px;
  --ease: cubic-bezier(.2, .7, .3, 1);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
[x-cloak] { display: none !important; }
img, svg { display: block; max-width: 100%; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.011em; font-weight: 650; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: .92em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -48px; background: var(--primary); color: #fff; padding: 8px 14px; border-radius: var(--radius-sm); z-index: 100; }
.skip-link:focus { top: 12px; text-decoration: none; }

.icon { width: 18px; height: 18px; flex: none; stroke-width: 1.9; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }

/* ---------- Header ---------- */
.app-header {
  position: sticky; top: 0; z-index: 40;
  height: var(--header-h);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(160%) blur(8px);
  border-bottom: 1px solid var(--border);
}
.app-header::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--brand-1), var(--brand-2) 50%, var(--brand-3));
}
.header-inner { height: 100%; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; font-size: 17px; letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand img { width: 34px; height: 34px; }
.brand small { display: block; font-size: 11px; font-weight: 500; color: var(--text-3); letter-spacing: 0; margin-top: -2px; }
.main-nav { display: flex; align-items: center; gap: 2px; margin-left: 12px; }
.nav-link {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px;
  color: var(--text-2); border-radius: 8px; font-weight: 500; border: 0; background: none; font: inherit; cursor: pointer;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link[aria-current="page"] { color: var(--primary); background: var(--primary-soft); }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 650; font-size: 12px;
  color: #fff; background: linear-gradient(135deg, var(--brand-2), var(--brand-3));
}
.user-btn { display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: 999px; border: 1px solid transparent; background: none; font: inherit; color: var(--text); cursor: pointer; }
.user-btn:hover { background: var(--surface-2); }
.user-btn .meta { text-align: left; line-height: 1.2; }
.user-btn .meta span { display: block; font-size: 12px; color: var(--text-3); }
.menu-toggle { display: none; }

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 220px; z-index: 50;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 6px;
}
.dropdown-menu.left { left: 0; right: auto; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 7px; color: var(--text);
  background: none; border: 0; font: inherit; text-align: left; cursor: pointer;
}
.dropdown-item:hover, .dropdown-item:focus-visible { background: var(--surface-2); text-decoration: none; outline: none; }
.dropdown-item.danger { color: var(--danger); }
.dropdown-sep { height: 1px; background: var(--border); margin: 6px 4px; }
.dropdown-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 6px 10px 4px; font-weight: 600; }

/* ---------- Layout ---------- */
.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: 880px; }
.page { padding: 28px 0 64px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head .lead { color: var(--text-2); margin-top: 6px; max-width: 70ch; }
.page-title-row { display: flex; align-items: center; gap: 14px; }
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.breadcrumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-3); margin-bottom: 14px; flex-wrap: wrap; }
.breadcrumbs a { color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; }
.breadcrumbs .icon { width: 14px; height: 14px; }
.stack { display: grid; gap: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.muted { color: var(--text-3); }
.text-2 { color: var(--text-2); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }

/* ---------- Cards / surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 15px; }
.card-head p { color: var(--text-3); font-size: 13px; margin-top: 2px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); display: flex; gap: 10px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); font-weight: 650; margin: 28px 0 12px; }

.icon-tile {
  --accent: var(--primary);
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; flex: none;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 11%, white);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 16%, white);
}
.icon-tile .icon { width: 22px; height: 22px; }
.icon-tile.lg { width: 56px; height: 56px; border-radius: 15px; }
.icon-tile.lg .icon { width: 28px; height: 28px; }
.icon-tile.sm { width: 32px; height: 32px; border-radius: 9px; }
.icon-tile.sm .icon { width: 17px; height: 17px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 15px; border-radius: 9px; border: 1px solid transparent;
  font: inherit; font-weight: 560; font-size: 14px; line-height: 1; cursor: pointer; white-space: nowrap;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease), color .15s;
  text-decoration: none !important;
}
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 2px rgba(10, 104, 179, .25); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 30%, white); }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; gap: 6px; }
.btn-sm .icon { width: 15px; height: 15px; }
.btn-icon { width: 34px; height: 34px; padding: 0; border-radius: 8px; color: var(--text-2); background: transparent; border: 0; display: inline-grid; place-items: center; cursor: pointer; }
.btn-icon:hover { background: var(--surface-3); color: var(--text); }
.btn-icon.sm { width: 28px; height: 28px; }
.btn-icon.sm .icon { width: 15px; height: 15px; }
.btn-icon.danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-icon[aria-pressed="true"] { color: #d9a400; }
.btn.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading::after { content: ""; position: absolute; width: 16px; height: 16px; border: 2px solid rgba(255, 255, 255, .55); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-secondary.loading::after { border-color: var(--border-strong); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 18px 16px; }
.col-12 { grid-column: span 12; } .col-8 { grid-column: span 8; } .col-6 { grid-column: span 6; } .col-4 { grid-column: span 4; } .col-3 { grid-column: span 3; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-weight: 560; font-size: 13px; color: var(--text); display: flex; align-items: center; gap: 6px; }
.label .req { color: var(--danger); }
.label .tag { font-size: 11px; font-weight: 600; color: var(--text-3); background: var(--surface-2); border: 1px solid var(--border); padding: 0 6px; border-radius: 5px; }
.help { font-size: 12.5px; color: var(--text-3); }
.error-text { font-size: 12.5px; color: var(--danger); display: flex; gap: 6px; align-items: flex-start; }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237c8796' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.input:hover, .select:hover, .textarea:hover { border-color: #b8c2ce; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-ring); }
.input[readonly], .input:disabled, .select:disabled, .textarea[readonly] { background: var(--surface-2); color: var(--text-2); }
.is-invalid { border-color: var(--danger) !important; }
.is-invalid:focus { box-shadow: 0 0 0 3px rgba(192, 38, 45, .2) !important; }
.input-sm { height: 34px; font-size: 13px; padding: 0 10px; border-radius: 8px; }
.select.input-sm { padding-right: 30px; }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { padding-right: 44px; }
.input-group .addon { position: absolute; right: 4px; }
.input-icon { position: relative; }
.input-icon > .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input-icon .input { padding-left: 38px; }
.mono-input { font-family: var(--mono); font-size: 13px; }
.check { display: inline-flex; align-items: flex-start; gap: 10px; cursor: pointer; user-select: none; }
.check input { width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--primary); flex: none; }
.check .t { font-weight: 520; }
.check .d { display: block; color: var(--text-3); font-size: 12.5px; font-weight: 400; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { appearance: none; width: 36px; height: 21px; border-radius: 999px; background: var(--border-strong); position: relative; cursor: pointer; transition: background .15s; margin: 0; flex: none; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; background: #fff; border-radius: 50%; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); transition: transform .15s var(--ease); }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { transform: translateX(15px); }
.switch input:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.choice-list { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-pill { position: relative; }
.choice-pill input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.choice-pill span { display: inline-flex; align-items: center; height: 34px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); font-weight: 500; font-size: 13px; transition: all .12s; }
.choice-pill input:checked + span { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.choice-pill input:focus-visible + span { box-shadow: 0 0 0 3px var(--primary-ring); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }

/* ---------- Alerts / badges ---------- */
.alert { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--radius); border: 1px solid; font-size: 13.5px; align-items: flex-start; }
.alert .icon { margin-top: 1px; }
.alert-title { font-weight: 600; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }
.alert-success { background: var(--success-soft); border-color: #bfe5cd; color: #0f5a2c; }
.alert-danger { background: var(--danger-soft); border-color: #f3c7c9; color: #8b1a1f; }
.alert-warning { background: var(--warning-soft); border-color: #f5d9a8; color: #7a4304; }
.alert-info { background: var(--primary-soft); border-color: #c4dcf1; color: #0b4a7f; }
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 560; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); white-space: nowrap; }
.badge .icon { width: 13px; height: 13px; }
.badge-primary { background: var(--primary-soft); color: var(--primary); border-color: #cfe2f4; }
.badge-success { background: var(--success-soft); color: var(--success); border-color: #c8e8d4; }
.badge-danger { background: var(--danger-soft); color: var(--danger); border-color: #f5cfd1; }
.badge-warning { background: var(--warning-soft); color: var(--warning); border-color: #f4dcb2; }
.kbd { font-family: var(--mono); font-size: 11px; padding: 1px 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; color: var(--text-2); background: var(--surface); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 90; display: grid; gap: 10px; width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: 12px; align-items: flex-start; padding: 13px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); border-left: 4px solid var(--primary); }
.toast.success { border-left-color: var(--success); }
.toast.success > .icon { color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.error > .icon { color: var(--danger); }
.toast p { flex: 1; font-size: 13.5px; }
.toast-enter { animation: toastIn .22s var(--ease); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(17, 24, 39, .42); z-index: 80; display: grid; place-items: center; padding: 16px; animation: fadeIn .15s ease; }
.modal { background: var(--surface); border-radius: 16px; box-shadow: 0 24px 60px -12px rgba(16, 24, 40, .35); width: min(520px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; animation: modalIn .2s var(--ease); }
.modal.wide { width: min(760px, 100%); }
.modal-head { padding: 20px 22px 6px; display: flex; gap: 14px; align-items: flex-start; }
.modal-head h2 { font-size: 17px; }
.modal-body { padding: 10px 22px 18px; overflow: auto; color: var(--text-2); }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; background: var(--surface-2); border-radius: 0 0 16px 16px; }
.modal-icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.modal-icon.danger { background: var(--danger-soft); color: var(--danger); }
.modal-icon.info { background: var(--primary-soft); color: var(--primary); }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* ---------- Catalog ---------- */
.catalog-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin-bottom: 22px; }
.catalog-hero h1 { font-size: 28px; letter-spacing: -.02em; }
.catalog-hero p { color: var(--text-2); margin-top: 6px; font-size: 15px; }
.catalog-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 20px; box-shadow: var(--shadow-sm); }
.catalog-tools .search { flex: 1 1 260px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-weight: 520; font-size: 13px; }
.chip:hover { text-decoration: none; border-color: var(--primary); color: var(--primary); }
.chip.active { background: var(--text); border-color: var(--text); color: #fff; }
.catalog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; }
.cat-card {
  --accent: var(--primary);
  position: relative; display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--border); border-radius: 16px; overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform .18s var(--ease), box-shadow .18s var(--ease), border-color .18s;
}
.cat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.cat-card:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent), var(--shadow-lg); }
.cat-media {
  position: relative; height: 136px; display: grid; place-items: center; overflow: hidden;
  background:
    radial-gradient(circle at 18% 22%, color-mix(in srgb, var(--accent) 16%, transparent) 0 2px, transparent 3px) 0 0 / 22px 22px,
    linear-gradient(160deg, color-mix(in srgb, var(--accent) 9%, white), color-mix(in srgb, var(--accent) 3%, white));
  border-bottom: 1px solid color-mix(in srgb, var(--accent) 12%, var(--border));
}
.cat-media::before, .cat-media::after { content: ""; position: absolute; border-radius: 50%; border: 1.5px solid color-mix(in srgb, var(--accent) 18%, transparent); }
.cat-media::before { width: 170px; height: 170px; right: -50px; top: -60px; }
.cat-media::after { width: 90px; height: 90px; left: -30px; bottom: -40px; }
.cat-media .glyph {
  position: relative; z-index: 1; width: 72px; height: 72px; border-radius: 20px; display: grid; place-items: center;
  background: var(--surface); color: var(--accent);
  box-shadow: 0 8px 20px -6px color-mix(in srgb, var(--accent) 40%, transparent), 0 0 0 1px color-mix(in srgb, var(--accent) 14%, white);
  transition: transform .2s var(--ease);
}
.cat-card:hover .glyph { transform: scale(1.06) rotate(-3deg); }
.cat-media .glyph .icon { width: 34px; height: 34px; stroke-width: 1.7; }
.cat-body { padding: 16px 18px 6px; flex: 1; display: flex; flex-direction: column; gap: 6px; }
.cat-type { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--accent); }
.cat-title { font-size: 16.5px; font-weight: 650; color: var(--text); }
.cat-title a { color: inherit; }
.cat-title a:hover { text-decoration: none; }
.cat-title a::after { content: ""; position: absolute; inset: 0; z-index: 2; border-radius: 16px; }
.cat-title a:focus-visible { outline: none; }
.cat-desc { color: var(--text-2); font-size: 13.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cat-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px 16px; }
.cat-count { display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 13px; font-weight: 500; }
.cat-count strong { color: var(--text); font-weight: 650; }
.cat-cta { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; font-size: 13px; color: var(--accent); }
.cat-cta .icon { width: 16px; height: 16px; transition: transform .18s var(--ease); }
.cat-card:hover .cat-cta .icon { transform: translateX(3px); }
.cat-fav { position: absolute; top: 10px; right: 10px; z-index: 3; width: 34px; height: 34px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; background: rgba(255, 255, 255, .85); color: var(--text-3); box-shadow: var(--shadow); transition: color .15s, transform .15s; }
.cat-fav:hover { color: #c99400; transform: scale(1.08); }
.cat-fav[aria-pressed="true"] { color: #e0a800; }
.cat-fav[aria-pressed="true"] .icon { fill: currentColor; }
.cat-admin { position: absolute; top: 10px; left: 10px; z-index: 3; }
.cat-admin .btn-icon { background: rgba(255, 255, 255, .85); box-shadow: var(--shadow); border-radius: 50%; }
.cat-card.archived { opacity: .82; }
.cat-card.archived .cat-media { filter: grayscale(.7); }
.cat-new { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 280px; border: 1.5px dashed var(--border-strong); border-radius: 16px; color: var(--text-2); font-weight: 600; background: transparent; transition: all .15s; }
.cat-new:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); text-decoration: none; }
.cat-new .plus { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); box-shadow: var(--shadow); }

/* ---------- Empty ---------- */
.empty { text-align: center; padding: 56px 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .art { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-3); margin-bottom: 6px; border: 1px solid var(--border); }
.empty .art .icon { width: 28px; height: 28px; }
.empty h3 { font-size: 16px; }
.empty p { color: var(--text-2); max-width: 46ch; }
.empty .row { margin-top: 8px; justify-content: center; }

/* ---------- Workspace / table ---------- */
.ws-head { display: flex; gap: 16px; align-items: flex-start; }
.ws-head h1 { font-size: 24px; }
.ws-head .lead { margin-top: 4px; }
.ws-stats { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.toolbar .search { flex: 1 1 240px; max-width: 420px; }
.filters-panel { padding: 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 12px; align-items: end; }
.bulkbar { display: flex; gap: 12px; align-items: center; padding: 10px 14px; background: var(--primary-soft); border-bottom: 1px solid #cfe2f4; color: #0b4a7f; font-weight: 520; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th { text-align: left; font-weight: 600; font-size: 12px; color: var(--text-2); background: var(--surface-2); padding: 0 12px; height: 40px; border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
.table th a { color: inherit; display: inline-flex; align-items: center; gap: 4px; }
.table th a:hover { color: var(--text); text-decoration: none; }
.table th .sort { width: 13px; height: 13px; opacity: .35; }
.table th.sorted .sort { opacity: 1; color: var(--primary); }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; max-width: 360px; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: #fafbfd; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .w-sm { min-width: 90px; } .table .w-md { min-width: 150px; } .table .w-lg { min-width: 220px; } .table .w-xl { min-width: 320px; }
.table .cell-check { width: 40px; padding-right: 0; }
.table .cell-actions { width: 1%; white-space: nowrap; text-align: right; position: sticky; right: 0; background: inherit; }
.table tbody tr .cell-actions { background: var(--surface); }
.table tbody tr:hover .cell-actions { background: #fafbfd; }
.table .truncate { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table .clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.cell-mono { font-family: var(--mono); font-size: 12.5px; }
.cell-empty { color: var(--border-strong); }
.secret { display: inline-flex; align-items: center; gap: 2px; }
.secret .val { font-family: var(--mono); font-size: 12.5px; letter-spacing: .04em; padding: 2px 6px; background: var(--surface-2); border-radius: 6px; border: 1px solid var(--border); max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.secret .val.masked { letter-spacing: .14em; color: var(--text-3); }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.pagination { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.pagination a, .pagination span { min-width: 34px; height: 34px; padding: 0 8px; border-radius: 8px; display: inline-grid; place-items: center; color: var(--text-2); font-weight: 520; font-size: 13px; border: 1px solid transparent; }
.pagination a:hover { background: var(--surface-2); text-decoration: none; }
.pagination .current { background: var(--primary); color: #fff; }
.pagination .disabled { opacity: .4; }

/* ---------- Definition / diff ---------- */
.kv { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; border-top: 1px solid var(--border); }
.kv > div { padding: 11px 16px; border-bottom: 1px solid var(--border); min-width: 0; overflow-wrap: anywhere; }
.kv > div:nth-child(odd) { color: var(--text-2); font-weight: 520; background: var(--surface-2); }
.diff-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.diff-table th { text-align: left; font-size: 12px; color: var(--text-3); font-weight: 600; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.diff-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }
.diff-table tr:last-child td { border-bottom: 0; }
.diff-old, .diff-new { display: inline-block; padding: 3px 8px; border-radius: 6px; white-space: pre-wrap; max-width: 100%; }
.diff-old { background: #fdecec; color: #8b1a1f; text-decoration: line-through; text-decoration-color: rgba(139, 26, 31, .45); }
.diff-new { background: #e6f6ec; color: #0f5a2c; }
.diff-none { color: var(--text-3); font-style: italic; font-size: 12.5px; }
.diff-row.changed { background: #fffcf2; }
.value-actions { display: inline-flex; gap: 2px; vertical-align: middle; margin-left: 4px; }

/* ---------- History timeline ---------- */
.timeline { position: relative; }
.tl-day { font-size: 12px; font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; padding: 18px 20px 8px; }
.tl-item { position: relative; display: grid; grid-template-columns: 36px 1fr auto; gap: 14px; padding: 14px 20px; border-top: 1px solid var(--border); align-items: start; }
.tl-item:hover { background: #fafbfd; }
.tl-dot { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.tl-dot.create { background: var(--success-soft); color: var(--success); border-color: #c8e8d4; }
.tl-dot.update { background: var(--primary-soft); color: var(--primary); border-color: #cfe2f4; }
.tl-dot.delete { background: var(--danger-soft); color: var(--danger); border-color: #f5cfd1; }
.tl-dot.restore { background: #f1ecfd; color: #6b3fc6; border-color: #ddd0f7; }
.tl-dot.schema { background: var(--warning-soft); color: var(--warning); border-color: #f4dcb2; }
.tl-title { font-weight: 600; }
.tl-title a { color: var(--text); }
.tl-meta { color: var(--text-3); font-size: 12.5px; margin-top: 2px; display: flex; gap: 6px 12px; flex-wrap: wrap; align-items: center; }
.tl-changes { margin-top: 8px; display: grid; gap: 4px; font-size: 13px; }
.tl-change { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.tl-change .f { color: var(--text-2); font-weight: 560; }
.tl-change .arrow { color: var(--text-3); }

/* ---------- Field builder ---------- */
.field-list { display: grid; }
.field-row { display: grid; grid-template-columns: 28px 40px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface); }
.field-row:first-child { border-top: 0; }
.field-row.dragging { opacity: .5; }
.field-row.drop-target { box-shadow: inset 0 2px 0 var(--primary); }
.field-row .grip { cursor: grab; color: var(--text-3); display: grid; place-items: center; height: 32px; border-radius: 6px; }
.field-row .grip:hover { background: var(--surface-2); color: var(--text); }
.field-row .name { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.field-row .meta { color: var(--text-3); font-size: 12.5px; display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; align-items: center; }
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.type-opt { position: relative; }
.type-opt input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.type-opt span { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border: 1px solid var(--border-strong); border-radius: 9px; font-size: 13px; font-weight: 520; background: var(--surface); transition: all .12s; }
.type-opt input:checked + span { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.type-opt input:focus-visible + span { box-shadow: 0 0 0 3px var(--primary-ring); }
.icon-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: 6px; max-height: 210px; overflow: auto; padding: 4px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.icon-picker label { position: relative; }
.icon-picker input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.icon-picker span { height: 42px; display: grid; place-items: center; border-radius: 8px; color: var(--text-2); border: 1px solid transparent; background: var(--surface); }
.icon-picker input:checked + span { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.icon-picker input:focus-visible + span { box-shadow: 0 0 0 3px var(--primary-ring); }
.color-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.color-picker label { position: relative; }
.color-picker input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.color-picker span { width: 32px; height: 32px; border-radius: 50%; display: block; border: 3px solid #fff; box-shadow: 0 0 0 1px var(--border-strong); }
.color-picker input:checked + span { box-shadow: 0 0 0 2px var(--text); }
.color-picker input:focus-visible + span { box-shadow: 0 0 0 3px var(--primary-ring), 0 0 0 1px var(--text); }

/* ---------- Permissions matrix ---------- */
.matrix th, .matrix td { text-align: center; }
.matrix th:first-child, .matrix td:first-child { text-align: left; }
.matrix th { white-space: normal; line-height: 1.25; min-width: 86px; height: auto; padding: 10px 8px; }
.matrix input[type="checkbox"] { width: 17px; height: 17px; accent-color: var(--primary); }
.matrix tr.off td:not(:first-child) { opacity: .4; }

/* ---------- Upload / import ---------- */
.dropzone { border: 2px dashed var(--border-strong); border-radius: 14px; padding: 36px 20px; text-align: center; background: var(--surface-2); transition: all .15s; display: flex; flex-direction: column; align-items: center; gap: 10px; cursor: pointer; }
.dropzone.over, .dropzone:hover { border-color: var(--primary); background: var(--primary-soft); }
.dropzone .art { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--surface); color: var(--primary); box-shadow: var(--shadow); }
.steps { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; font-size: 13px; }
.step { display: inline-flex; align-items: center; gap: 8px; color: var(--text-3); font-weight: 520; }
.step .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 650; background: var(--surface-3); color: var(--text-2); }
.step.active { color: var(--text); }
.step.active .n { background: var(--primary); color: #fff; }
.step.done .n { background: var(--success); color: #fff; }
.step-sep { width: 28px; height: 1px; background: var(--border-strong); }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { padding: 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.stat .v { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.stat .k { color: var(--text-3); font-size: 12.5px; font-weight: 520; }
.stat.ok .v { color: var(--success); }
.stat.bad .v { color: var(--danger); }
.stat.info .v { color: var(--primary); }
.map-arrow { color: var(--text-3); }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); background: var(--surface); }
.auth-aside {
  position: relative; overflow: hidden; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(155deg, #f3faf0 0%, #ecf8f6 45%, #eaf3fb 100%);
  border-right: 1px solid var(--border);
}
.auth-aside .circuit { position: absolute; inset: 0; opacity: .5; pointer-events: none; }
.auth-aside h2 { font-size: 30px; letter-spacing: -.025em; max-width: 16ch; line-height: 1.15; }
.auth-aside p { color: var(--text-2); font-size: 15px; max-width: 42ch; margin-top: 12px; }
.auth-points { display: grid; gap: 12px; margin-top: 28px; }
.auth-point { display: flex; gap: 12px; align-items: center; font-weight: 520; color: var(--text); }
.auth-point .icon-tile { width: 36px; height: 36px; border-radius: 10px; background: #fff; }
.auth-point .icon-tile .icon { width: 18px; height: 18px; }
.auth-main { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: min(400px, 100%); }
.auth-card h1 { font-size: 24px; }
.auth-card .lead { color: var(--text-2); margin: 6px 0 26px; }
.auth-logo { display: flex; align-items: center; gap: 12px; position: relative; z-index: 1; }
.auth-logo img { width: 52px; height: 52px; }
.auth-logo strong { font-size: 22px; letter-spacing: -.02em; }
.auth-foot { font-size: 12.5px; color: var(--text-3); position: relative; z-index: 1; }

/* ---------- Misc ---------- */
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: 10px 0; border-bottom: 1px solid var(--border); display: flex; gap: 10px; align-items: center; }
.list-plain li:last-child { border-bottom: 0; }
.tabs-local { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs-local a { padding: 10px 14px; color: var(--text-2); font-weight: 540; border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; gap: 8px; align-items: center; white-space: nowrap; }
.tabs-local a:hover { color: var(--text); text-decoration: none; }
.tabs-local a[aria-current="page"] { color: var(--primary); border-bottom-color: var(--primary); }
.danger-zone { border-color: #f3c7c9; }
.danger-zone .card-head { border-bottom-color: #f3c7c9; }
.progress { height: 4px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); width: 40%; animation: indet 1.1s ease-in-out infinite; }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
.page-loading { position: fixed; top: 0; left: 0; right: 0; z-index: 99; height: 3px; }
.page-loading > span { display: block; height: 100%; width: 30%; background: linear-gradient(90deg, var(--brand-2), var(--brand-3)); animation: indet 1s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media (max-width: 1024px) {
  .main-nav .nav-text { display: none; }
  .user-btn .meta { display: none; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .container { padding: 0 16px; }
  .page { padding: 20px 0 48px; }
  .menu-toggle { display: inline-grid; }
  .main-nav { display: none; position: absolute; top: var(--header-h); left: 0; right: 0; background: var(--surface); border-bottom: 1px solid var(--border); flex-direction: column; align-items: stretch; padding: 8px 16px 14px; margin: 0; box-shadow: var(--shadow-lg); }
  .main-nav.open { display: flex; }
  .main-nav .nav-text { display: inline; }
  .main-nav .dropdown-menu { position: static; box-shadow: none; border: 0; padding: 0 0 0 16px; }
  .brand small { display: none; }
  .catalog-hero h1 { font-size: 23px; }
  .catalog-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 14px; }
  .cat-media { height: 112px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .form-grid > [class^="col-"] { grid-column: span 12; }
  .ws-head h1, h1 { font-size: 21px; }
  .page-head { flex-direction: column; align-items: stretch; }
  .head-actions .btn { flex: 1 1 auto; }
  .kv { grid-template-columns: 1fr; }
  .kv > div:nth-child(odd) { padding-bottom: 4px; border-bottom: 0; }
  .tl-item { grid-template-columns: 32px 1fr; }
  .tl-item > :last-child { grid-column: 2; }
  .toolbar .search { max-width: none; }
  .modal-foot { flex-wrap: wrap; }
  .modal-foot .btn { flex: 1 1 auto; }
}
@media (max-width: 420px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .catalog-grid { grid-template-columns: 1fr; }
}

/* refinements */
.btn-icon.menu-toggle { display: none; }
.mono-input::placeholder { font-family: var(--font); font-size: 13px; letter-spacing: 0; }
.table thead .cell-actions { background: var(--surface-2); }
.table .cell-actions { box-shadow: -10px 0 10px -10px rgba(16, 24, 40, .18); }
.cat-new { min-height: 200px; }
@media (max-width: 720px) { .btn-icon.menu-toggle { display: inline-grid; } }
@media (max-width: 720px) { .btn-icon.menu-toggle { order: 3; margin-left: 4px; } .header-right { order: 2; } }
