:root {
  color-scheme: dark;
  --bg: #080a0f;
  --sidebar: #0d1017;
  --surface: #11151d;
  --surface-2: #151a23;
  --surface-3: #090c12;
  --line: #252b36;
  --line-soft: #1c222c;
  --text: #f5f7fa;
  --muted: #8b94a3;
  --muted-2: #626b79;
  --red: #f02d45;
  --red-hover: #d9233a;
  --green: #39ca89;
  --blue: #4c8dff;
  --violet: #9a6aff;
  --sidebar-width: 282px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; min-width: 320px; overflow-x: hidden; background: var(--bg); color: var(--text); font: 16px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.dashboard-shell { min-height: 100vh; }
.app-sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; width: var(--sidebar-width); padding: 20px 14px 16px; display: flex; flex-direction: column; border-right: 1px solid var(--line-soft); background: var(--sidebar); }
.sidebar-brand { min-height: 55px; padding: 0 8px; display: grid; grid-template-columns: 43px minmax(0, 1fr) auto; align-items: center; gap: 11px; }
.brand-mark { width: 43px; height: 43px; display: grid; place-items: center; border-radius: 12px; background: var(--red); color: white; font-size: 1.2rem; font-weight: 900; box-shadow: 0 9px 25px rgba(240, 45, 69, .24); }
.sidebar-brand strong, .sidebar-brand span { display: block; }
.sidebar-brand strong { font-size: .98rem; letter-spacing: -.02em; }
.sidebar-brand span { margin-top: 1px; color: var(--muted-2); font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.sidebar-close { display: none; }

.main-navigation { margin-top: 24px; }
.nav-item { width: 100%; height: 45px; padding: 0 11px; display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 8px; border: 0; border-radius: 10px; background: transparent; color: #aab2bf; text-align: left; font-size: .82rem; font-weight: 720; }
.nav-item.active { background: #1b202a; color: white; }
.nav-item i { width: 6px; height: 6px; border-radius: 50%; background: var(--red); }
.nav-icon { color: #fa5266; font-size: 1rem; }

.source-section { min-height: 0; margin-top: 25px; display: flex; flex: 1; flex-direction: column; }
.section-label { padding: 0 8px 9px; display: flex; align-items: center; justify-content: space-between; }
.section-label > span { color: var(--muted-2); font-size: .67rem; font-weight: 850; letter-spacing: .12em; }
.section-label button { width: 27px; height: 27px; display: grid; place-items: center; border: 1px solid rgba(240, 45, 69, .3); border-radius: 8px; background: rgba(240, 45, 69, .09); color: #ff6074; font-size: 1rem; }
.section-label button:hover { background: var(--red); color: white; }
.sidebar-search, .main-search, .category-search { position: relative; display: flex; align-items: center; }
.sidebar-search > span, .main-search > span, .category-search > span { position: absolute; left: 12px; z-index: 1; color: #687181; }
.sidebar-search input, .main-search input, .category-search input, .field input, .field textarea, .auth-card input { width: 100%; border: 1px solid var(--line); outline: 0; background: var(--surface-3); color: white; transition: border-color .15s, box-shadow .15s; }
.sidebar-search input { height: 40px; padding: 0 12px 0 36px; border-radius: 9px; font-size: .78rem; }
.sidebar-search input:focus, .main-search input:focus, .category-search input:focus, .field input:focus, .field textarea:focus, .auth-card input:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(240, 45, 69, .11); }
input::placeholder, textarea::placeholder { color: #565f6d; }
.source-summary { padding: 9px 7px 7px; display: flex; justify-content: space-between; color: #555e6c; font-size: .65rem; }
.playlist-list { min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #343b48 transparent; }
.playlist-row { width: 100%; min-height: 53px; padding: 7px 8px; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 8px; border: 0; border-radius: 10px; background: transparent; color: #a7afbc; text-align: left; transition: background .15s, color .15s; }
.playlist-row:hover { background: #171c25; color: white; }
.playlist-row.active { background: #202530; color: white; box-shadow: inset 3px 0 var(--red); }
.list-icon { width: 31px; height: 31px; display: grid; place-items: center; border: 1px solid #29303b; border-radius: 8px; background: #171c25; color: #f05266; font-size: .75rem; font-weight: 900; }
.playlist-copy { min-width: 0; }
.playlist-copy strong, .playlist-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.playlist-copy strong { font-size: .78rem; }
.playlist-copy small { margin-top: 2px; color: #697281; font-size: .62rem; }
.row-actions { display: none; gap: 3px; }
.playlist-row:hover .row-actions, .playlist-row.active .row-actions { display: flex; }
.mini-btn { width: 25px; height: 25px; display: grid; place-items: center; border: 0; border-radius: 7px; background: #303743; color: #aab2bf; font-size: .74rem; }
.mini-btn:hover { background: #414958; color: white; }
.mini-btn.danger:hover { background: #5e1d28; color: #ff7587; }
.empty-inline { padding: 20px 10px; color: #6d7684; font-size: .75rem; text-align: center; }

.sidebar-footer { padding: 14px 5px 0; border-top: 1px solid var(--line-soft); }
.server-state { padding: 9px 7px 13px; display: flex; align-items: center; gap: 10px; }
.server-state > i, .secure-label i { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(57, 202, 137, .1); }
.server-state strong, .server-state span { display: block; }
.server-state strong { font-size: .73rem; }
.server-state span { color: #646d7b; font-size: .64rem; }
.logout-button { width: 100%; height: 38px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; background: transparent; color: #7c8593; font-size: .72rem; font-weight: 700; }
.logout-button:hover { background: #171c25; color: white; }

.dashboard-main { min-height: 100vh; margin-left: var(--sidebar-width); }
.app-header { position: sticky; z-index: 25; top: 0; height: 76px; padding: 0 clamp(20px, 3vw, 42px); display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line-soft); background: rgba(8, 10, 15, .94); backdrop-filter: blur(14px); }
.header-context { display: flex; align-items: center; gap: 12px; }
.header-context span, .header-context strong { display: block; }
.header-context span { color: #606978; font-size: .65rem; font-weight: 850; letter-spacing: .12em; }
.header-context strong { margin-top: 2px; font-size: .88rem; }
.menu-button { display: none; }
.header-actions, .page-actions { display: flex; align-items: center; gap: 8px; }
.secure-label { display: inline-flex; align-items: center; gap: 8px; margin-right: 4px; color: #747d8b; font-size: .7rem; font-weight: 700; }

.button { min-height: 40px; padding: 8px 14px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: 9px; color: white; font-size: .78rem; font-weight: 760; transition: background .15s, border-color .15s, transform .15s; }
.button.primary { background: var(--red); box-shadow: 0 8px 22px rgba(240, 45, 69, .17); }
.button.primary:hover { background: var(--red-hover); transform: translateY(-1px); }
.button.subtle { border-color: #2d3440; background: #171c25; color: #c0c6cf; }
.button.subtle:hover { border-color: #414958; background: #202630; color: white; }
.button.danger { background: #c92439; }
.button.full { width: 100%; margin-top: 16px; }
.button:disabled { cursor: not-allowed; opacity: .42; transform: none; }

.dashboard-content { width: min(1580px, 100%); margin: 0 auto; padding: 34px clamp(20px, 3vw, 42px) 45px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.breadcrumb { display: flex; align-items: center; gap: 7px; color: #687180; font-size: .68rem; font-weight: 700; }
.breadcrumb b { color: #3e4652; }
.breadcrumb strong { max-width: 360px; overflow: hidden; color: #a4acb8; text-overflow: ellipsis; white-space: nowrap; }
.scope-copy h1 { margin: 9px 0 4px; font-size: clamp(1.65rem, 2.4vw, 2.25rem); line-height: 1.15; letter-spacing: -.045em; }
.scope-copy p { margin: 0; color: var(--muted); font-size: .82rem; }

.metric-grid { margin-top: 26px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric-card { min-width: 0; padding: 18px; display: grid; grid-template-columns: 45px minmax(0, 1fr); align-items: center; gap: 13px; border: 1px solid var(--line-soft); border-radius: 13px; background: var(--surface); }
.metric-card.emphasized { border-color: rgba(57, 202, 137, .24); }
.metric-icon { width: 45px; height: 45px; display: grid; place-items: center; border-radius: 11px; font-size: .9rem; font-weight: 900; }
.metric-icon.red { background: rgba(240, 45, 69, .12); color: #ff5c71; }
.metric-icon.blue { background: rgba(76, 141, 255, .12); color: #6ca2ff; }
.metric-icon.violet { background: rgba(154, 106, 255, .12); color: #ad88ff; }
.metric-icon.green { background: rgba(57, 202, 137, .12); color: #55dda0; }
.metric-card span, .metric-card strong, .metric-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.metric-card span { color: #7d8694; font-size: .66rem; font-weight: 780; text-transform: uppercase; }
.metric-card strong { margin: 2px 0 0; font-size: 1.35rem; letter-spacing: -.03em; }
.metric-card small { color: #596270; font-size: .64rem; }

.catalog-card { margin-top: 18px; overflow: hidden; border: 1px solid var(--line-soft); border-radius: 14px; background: var(--surface); }
.catalog-header { min-height: 78px; padding: 17px 20px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line-soft); }
.section-kicker { color: #697280; font-size: .63rem; font-weight: 850; letter-spacing: .13em; }
.catalog-header h2, .modal-heading h2 { margin: 3px 0 0; font-size: 1.05rem; letter-spacing: -.02em; }
.results-counter { min-width: 0; text-align: right; }
.results-counter strong, .results-counter span { display: block; }
.results-counter strong { font-size: .76rem; }
.results-counter span { max-width: 280px; margin-top: 1px; overflow: hidden; color: #697280; font-size: .66rem; text-overflow: ellipsis; white-space: nowrap; }
.catalog-toolbar { padding: 13px 15px; display: flex; gap: 9px; border-bottom: 1px solid var(--line-soft); background: #0f131a; }
.main-search { flex: 1; }
.main-search input { height: 43px; padding: 0 13px 0 39px; border-radius: 9px; font-size: .78rem; }
.category-toggle { display: none; border-color: var(--line); background: #171c25; }
.category-toggle b { min-width: 22px; padding: 1px 5px; border-radius: 99px; background: #2a303a; font-size: .62rem; }

.catalog-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 460px; }
.category-panel { padding: 16px 12px; border-right: 1px solid var(--line-soft); background: #0d1117; }
.category-head { padding: 0 4px 12px; display: flex; align-items: center; justify-content: space-between; }
.category-head span, .category-head strong { display: block; }
.category-head div > span { color: #555f6e; font-size: .6rem; font-weight: 850; letter-spacing: .12em; }
.category-head strong { margin-top: 1px; font-size: .8rem; }
.count-badge { min-width: 27px; padding: 3px 7px; border: 1px solid #2b323d; border-radius: 99px; color: #8e97a5; font-size: .65rem; text-align: center; }
.category-search { margin-bottom: 8px; }
.category-search input { height: 37px; padding: 0 10px 0 34px; border-radius: 8px; font-size: .72rem; }
.category-list { max-height: 520px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #323a46 transparent; }
.category-row { width: 100%; min-height: 37px; padding: 6px 8px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; border: 0; border-radius: 8px; background: transparent; color: #8d96a4; text-align: left; }
.category-row:hover { background: #171c25; color: white; }
.category-row.active { background: rgba(240, 45, 69, .11); color: #ff6377; }
.category-row span { overflow: hidden; font-size: .72rem; font-weight: 680; text-overflow: ellipsis; white-space: nowrap; }
.category-row b { min-width: 26px; padding: 2px 5px; border-radius: 99px; background: #202630; color: #737c8a; font-size: .58rem; text-align: center; }
.category-row.active b { background: var(--red); color: white; }

.results-panel { min-width: 0; padding: 0 14px 14px; }
.results-columns { height: 43px; padding: 0 10px 0 54px; display: grid; grid-template-columns: minmax(0, 1fr) 170px 42px; align-items: center; gap: 10px; border-bottom: 1px solid var(--line-soft); color: #596271; font-size: .61rem; font-weight: 850; letter-spacing: .09em; text-transform: uppercase; }
.results-columns span:last-child { text-align: center; }
.result-list { display: grid; transition: opacity .15s; }
.result-list.is-loading { opacity: .42; }
.result-row { min-width: 0; min-height: 65px; padding: 9px 10px; display: grid; grid-template-columns: 34px minmax(0, 1fr) 35px; align-items: center; gap: 10px; border-bottom: 1px solid var(--line-soft); background: transparent; transition: background .15s; }
.result-row:hover { background: #151a22; }
.entry-index { width: 31px; height: 31px; display: grid; place-items: center; border: 1px solid #282f39; border-radius: 8px; background: #0c1016; color: #657080; font: .62rem ui-monospace, SFMono-Regular, Consolas, monospace; }
.entry-content { min-width: 0; }
.entry-title-line, .url-line { min-width: 0; display: flex; align-items: center; gap: 8px; }
.entry-title-line h3 { min-width: 0; margin: 0; overflow: hidden; font-size: .79rem; text-overflow: ellipsis; white-space: nowrap; }
.category-chip { max-width: 170px; padding: 2px 7px; overflow: hidden; border: 1px solid #303744; border-radius: 99px; color: #8c96a4; font-size: .58rem; text-overflow: ellipsis; white-space: nowrap; }
.url-line { margin-top: 4px; }
.url-line a, .url-line > span:first-child { min-width: 0; flex: 1; overflow: hidden; color: #606a79; font: .64rem ui-monospace, SFMono-Regular, Consolas, monospace; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.url-line a:hover { color: #f45a6e; }
.source-chip { width: 160px; flex: 0 0 auto; overflow: hidden; color: #7a8492; font-size: .62rem; text-align: left; text-overflow: ellipsis; white-space: nowrap; }
.copy-btn { width: 34px; height: 34px; border: 1px solid #29303a; border-radius: 8px; background: #151a22; color: #7b8593; }
.copy-btn:hover { border-color: #424b59; color: white; }
.empty-results { min-height: 375px; place-items: center; align-content: center; padding: 30px; text-align: center; }
.empty-results:not([hidden]) { display: grid; }
.empty-symbol { width: 55px; height: 55px; display: grid; place-items: center; border: 1px solid rgba(240, 45, 69, .26); border-radius: 15px; background: rgba(240, 45, 69, .07); color: #f05266; font-size: 1.5rem; }
.empty-results h3 { margin: 13px 0 3px; font-size: .95rem; }
.empty-results p { margin: 0; color: #77808e; font-size: .76rem; }
.empty-results .button { margin-top: 16px; }
.pagination { padding: 14px 5px 0; display: flex; align-items: center; justify-content: space-between; color: #6d7684; font-size: .69rem; }
.pagination > div { display: flex; align-items: center; gap: 9px; }
.pagination b { min-width: 54px; color: #a8b0bc; text-align: center; }
.page-button { width: 33px; height: 33px; border: 1px solid #2d3440; border-radius: 8px; background: #171c25; color: #aab2bf; }
.page-button:disabled { cursor: not-allowed; opacity: .35; }

.modal { width: min(610px, calc(100% - 24px)); max-height: calc(100vh - 28px); padding: 24px; overflow-y: auto; border: 1px solid #343c49; border-radius: 15px; background: #121720; color: white; box-shadow: 0 28px 100px rgba(0, 0, 0, .72); }
.modal::backdrop { background: rgba(2, 4, 8, .78); backdrop-filter: blur(5px); }
.modal-close { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border: 1px solid #303844; border-radius: 8px; background: #1a202a; color: #929ba8; font-size: 1.15rem; }
.modal-heading { padding-right: 36px; margin-bottom: 17px; }
.modal-heading p { margin: 4px 0 0; color: #7e8795; font-size: .75rem; }
.tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border: 1px solid #29313c; border-radius: 10px; background: #0b0f15; }
.tab { height: 38px; border: 0; border-radius: 7px; background: transparent; color: #7d8795; font-size: .76rem; font-weight: 750; }
.tab.active { background: #232a35; color: white; }
.tab-panel { display: none; padding-top: 15px; }
.tab-panel.active { display: block; }
.drop-zone { padding: 28px 18px; display: grid; place-items: center; border: 1px dashed #3a4350; border-radius: 12px; background: #0b0f15; text-align: center; transition: border-color .15s, background .15s; }
.drop-zone.dragging { border-color: var(--red); background: rgba(240, 45, 69, .06); }
.upload-symbol { width: 48px; height: 48px; margin-bottom: 10px; display: grid; place-items: center; border-radius: 12px; background: rgba(240, 45, 69, .1); color: #ff6074; font-size: 1.4rem; }
.drop-zone strong { font-size: .88rem; }
.drop-zone > span { margin: 3px 0 15px; color: #747e8d; font-size: .7rem; }
.selected-files { max-height: 135px; margin-top: 9px; overflow-y: auto; }
.selected-file { padding: 8px 9px; display: flex; justify-content: space-between; gap: 15px; border-bottom: 1px solid #272e38; font-size: .72rem; }
.selected-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selected-file b { color: #7a8492; white-space: nowrap; }
.field { display: grid; gap: 6px; color: #b3bac4; font-size: .74rem; font-weight: 700; }
.field input { height: 42px; padding: 0 11px; border-radius: 9px; font-size: .76rem; }
.field textarea { min-height: 150px; padding: 11px; resize: vertical; border-radius: 9px; font: .74rem/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; }
.optional { margin-left: 4px; color: #646e7c; font-size: .63rem; font-weight: 600; }
.tab-panel > small { display: block; margin-top: 8px; color: #707a88; font-size: .68rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.span-2 { grid-column: 1 / -1; }
.astra-intro { margin-bottom: 14px; padding: 12px; display: flex; align-items: center; gap: 12px; border: 1px solid rgba(76, 141, 255, .22); border-radius: 10px; background: rgba(76, 141, 255, .06); }
.astra-intro > span { padding: 6px 8px; border-radius: 6px; background: #216bc5; color: white; font-size: .58rem; font-weight: 900; letter-spacing: .08em; }
.astra-intro strong, .astra-intro small { display: block; }
.astra-intro strong { font-size: .77rem; }
.astra-intro small { margin-top: 2px; color: #748aa4; font-size: .65rem; }
.url-preview { margin-top: 12px; padding: 10px 11px; border: 1px solid #29313c; border-radius: 9px; background: #090c11; }
.url-preview span, .url-preview code { display: block; }
.url-preview span { margin-bottom: 4px; color: #66707f; font-size: .58rem; font-weight: 800; }
.url-preview code { overflow: hidden; color: #94adca; font-size: .67rem; text-overflow: ellipsis; white-space: nowrap; }
.details-modal { width: min(560px, calc(100% - 24px)); }
.details-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.details-grid > div { min-width: 0; padding: 12px; border: 1px solid #29313c; border-radius: 9px; background: #0b0f15; }
.details-grid span, .details-grid strong { display: block; }
.details-grid span { margin-bottom: 4px; color: #687281; font-size: .6rem; font-weight: 800; text-transform: uppercase; }
.details-grid strong { overflow: hidden; color: #d6dae0; font-size: .75rem; text-overflow: ellipsis; white-space: nowrap; }
.details-actions, .confirm-actions { margin-top: 15px; display: flex; justify-content: flex-end; gap: 8px; }
.confirm-modal { width: min(440px, calc(100% - 24px)); text-align: center; }
.confirm-modal h2 { margin: 11px 0 5px; font-size: 1.1rem; }
.confirm-modal p { margin: 0; color: #8b94a1; font-size: .78rem; }
.danger-symbol { width: 46px; height: 46px; margin: 0 auto; display: grid; place-items: center; border-radius: 50%; background: rgba(240, 45, 69, .12); color: #ff6074; font-weight: 900; }

.loading-layer { position: fixed; z-index: 100; inset: 0; display: grid; place-items: center; align-content: center; background: rgba(4, 6, 10, .88); backdrop-filter: blur(7px); text-align: center; }
.spinner { width: 44px; height: 44px; margin-bottom: 13px; border: 4px solid #282f39; border-top-color: var(--red); border-radius: 50%; animation: spin .75s linear infinite; }
.loading-layer strong, .loading-layer span { display: block; }
.loading-layer span { margin-top: 4px; color: #7b8593; font-size: .72rem; }
@keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; z-index: 110; right: 22px; bottom: 22px; max-width: min(430px, calc(100% - 28px)); padding: 13px 16px; border: 1px solid #35404d; border-radius: 10px; background: #171c25; box-shadow: 0 18px 55px rgba(0, 0, 0, .65); color: white; font-size: .76rem; }
.toast.error { border-color: rgba(240, 45, 69, .58); }
.toast.warning { border-color: #8a641b; }

/* Acceso y configuración inicial */
.auth-page { display: grid; place-items: center; min-height: 100vh; padding: 24px; background: #080a0f; }
.auth-card { width: min(450px, 100%); padding: 30px; border: 1px solid #29313c; border-radius: 16px; background: #11151d; box-shadow: 0 28px 90px rgba(0, 0, 0, .55); }
.auth-card.compact { width: min(410px, 100%); }
.auth-card .logo-mark { width: 48px; height: 48px; margin-bottom: 20px; display: grid; place-items: center; border-radius: 12px; background: var(--red); color: white; font-size: .7rem; font-weight: 900; }
.auth-card .eyebrow { margin: 0; color: #727c8a; font-size: .65rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.auth-card h1 { margin: 4px 0 8px; font-size: 1.65rem; letter-spacing: -.04em; }
.auth-copy { color: #8a94a2; font-size: .8rem; }
.auth-card form, .auth-card label { display: grid; gap: 8px; }
.auth-card form { gap: 14px; margin-top: 20px; }
.auth-card label { color: #b6bdc7; font-size: .75rem; font-weight: 700; }
.auth-card input { height: 44px; padding: 0 12px; border-radius: 9px; }
.auth-card .btn { min-height: 42px; border: 0; border-radius: 9px; background: var(--red); color: white; font-weight: 750; }
.auth-card small { display: block; margin-top: 15px; color: #626b79; font-size: .66rem; }
.form-error { margin-top: 14px; padding: 10px 12px; border: 1px solid rgba(240, 45, 69, .45); border-radius: 9px; background: rgba(240, 45, 69, .07); color: #ff7183; font-size: .74rem; }

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .catalog-layout { grid-template-columns: 205px minmax(0, 1fr); }
  .source-chip { width: 125px; }
  .results-columns { grid-template-columns: minmax(0, 1fr) 135px 42px; }
}

@media (max-width: 860px) {
  :root { --sidebar-width: 286px; }
  .app-sidebar { transform: translateX(-102%); transition: transform .22s ease; box-shadow: 18px 0 60px rgba(0, 0, 0, .5); }
  .app-sidebar.mobile-open { transform: translateX(0); }
  .sidebar-close { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 8px; background: #1b212b; color: #9ba4b1; font-size: 1.1rem; }
  .sidebar-backdrop:not([hidden]) { position: fixed; z-index: 35; inset: 0; display: block; border: 0; background: rgba(2, 4, 8, .68); backdrop-filter: blur(3px); }
  .dashboard-main { margin-left: 0; }
  .menu-button { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid #2c3440; border-radius: 9px; background: #151a22; color: white; font-size: 1rem; }
  .catalog-layout { display: block; }
  .category-toggle { display: inline-flex; }
  .category-panel { display: none; margin: 10px 0 0; border: 1px solid var(--line-soft); border-radius: 10px; }
  .category-panel.mobile-open { display: block; }
  .category-list { max-height: 250px; }
  .results-panel { padding-top: 8px; }
}

@media (max-width: 640px) {
  .app-header { height: 65px; padding: 0 13px; }
  .header-context > div { display: none; }
  .secure-label { display: none; }
  .header-actions .button { min-height: 39px; padding: 7px 11px; }
  .dashboard-content { padding: 22px 12px 30px; }
  .page-heading { display: block; }
  .scope-copy h1 { margin-top: 7px; font-size: 1.6rem; }
  .scope-copy p { font-size: .74rem; }
  .page-actions { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 16px; }
  .page-actions .button { min-width: 0; padding: 7px 8px; white-space: nowrap; }
  .metric-grid { margin-top: 16px; grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric-card { padding: 13px 11px; grid-template-columns: 37px minmax(0, 1fr); gap: 9px; }
  .metric-icon { width: 37px; height: 37px; border-radius: 9px; }
  .metric-card span { font-size: .57rem; }
  .metric-card strong { font-size: 1.05rem; }
  .metric-card small { display: none; }
  .catalog-card { margin-top: 12px; border-radius: 12px; }
  .catalog-header { min-height: 66px; padding: 13px 14px; }
  .catalog-header h2 { font-size: .92rem; }
  .results-counter span { max-width: 130px; }
  .catalog-toolbar { padding: 9px; align-items: stretch; flex-direction: column; }
  .category-toggle { width: 100%; }
  .results-panel { padding: 0 8px 10px; }
  .results-columns { display: none; }
  .result-row { min-height: 73px; padding: 10px 6px; grid-template-columns: 30px minmax(0, 1fr) 32px; gap: 7px; }
  .entry-index { width: 28px; height: 28px; }
  .entry-title-line { display: block; }
  .entry-title-line h3 { font-size: .75rem; }
  .category-chip { max-width: 100%; margin-top: 4px; display: inline-block; }
  .source-chip { display: none; }
  .copy-btn { width: 31px; height: 31px; }
  .pagination { align-items: flex-start; flex-direction: column; gap: 10px; }
  .pagination > div { width: 100%; justify-content: space-between; }
  .modal { padding: 20px 16px; }
  .form-grid, .details-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .details-actions, .confirm-actions { align-items: stretch; flex-direction: column; }
  .toast { right: 14px; bottom: 14px; }
}

@media (max-width: 390px) {
  .page-actions { grid-template-columns: 1fr 1fr; }
  .page-actions #listDetails:not([hidden]) { grid-column: 1 / -1; }
  .metric-card { grid-template-columns: 1fr; }
  .metric-icon { display: none; }
  .metric-card strong { margin-top: 4px; }
  .catalog-header { align-items: flex-start; }
}

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