:root {
  color-scheme: dark;
  --bg: #0a0c10;
  --panel: #11141a;
  --panel-2: #161a21;
  --panel-3: #1b2029;
  --line: #262c36;
  --line-soft: #1d222b;
  --text: #f4f6f8;
  --muted: #8f98a6;
  --muted-2: #68717f;
  --accent: #7aa2ff;
  --accent-2: #a9c0ff;
  --danger: #ff7b86;
  --success: #70d49a;
  --shadow: 0 20px 60px rgba(0, 0, 0, .42);
  --radius: 16px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% -10%, rgba(69, 93, 150, .14), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { outline: none; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

.app-shell { min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 250px minmax(320px, 720px) 1fr;
  gap: 24px;
  align-items: center;
  min-height: 82px;
  padding: 14px 26px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  background: rgba(10, 12, 16, .88);
  backdrop-filter: blur(18px);
}
.brand { display: inline-flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid #33415b;
  border-radius: 12px;
  background: linear-gradient(145deg, #172038, #0f1420);
  color: #dbe5ff;
  font-weight: 800;
  letter-spacing: -.04em;
}
.brand-copy { display: flex; flex-direction: column; min-width: 0; }
.brand-copy strong { font-size: 14px; line-height: 1.2; }
.brand-copy small { margin-top: 3px; color: var(--muted); font-size: 12px; }

.search-wrap {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  gap: 10px;
  align-items: center;
  height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #11151c;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.search-wrap:focus-within { border-color: #52698f; box-shadow: 0 0 0 3px rgba(122,162,255,.08); }
.search-wrap svg { width: 19px; fill: none; stroke: #7f8897; stroke-width: 1.8; }
.search-wrap input { width: 100%; border: 0; background: transparent; color: var(--text); }
.search-wrap input::placeholder { color: #616a77; }
kbd {
  padding: 3px 7px;
  border: 1px solid #2c333f;
  border-bottom-color: #3a4352;
  border-radius: 7px;
  background: #171c24;
  color: #77808e;
  font-size: 11px;
}
.top-actions { justify-self: end; display: flex; gap: 10px; }

.button {
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-weight: 650;
  font-size: 13px;
  transition: .15s ease;
}
.button-primary { background: #dbe5ff; color: #0b101a; border-color: #dbe5ff; }
.button-primary:hover { background: #cddaff; transform: translateY(-1px); }
.button-secondary { background: #171c24; color: #d8dde5; border-color: #2a313d; }
.button-secondary:hover { border-color: #465263; background: #1b212b; }
.button:disabled { cursor: not-allowed; opacity: .45; transform: none; }
.text-button { border: 0; background: transparent; color: #8795aa; font-size: 12px; padding: 0; }
.text-button:hover { color: #d8e2f4; }

.layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); min-height: calc(100vh - 82px); }
.sidebar {
  position: sticky;
  top: 82px;
  align-self: start;
  height: calc(100vh - 82px);
  overflow: auto;
  padding: 30px 22px 40px 26px;
  border-right: 1px solid var(--line-soft);
  background: rgba(13, 15, 20, .72);
}
.sidebar-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 28px; }
.sidebar h2, .content h1, .modal h2 { margin: 2px 0 0; letter-spacing: -.03em; }
.sidebar h2 { font-size: 20px; }
.eyebrow { margin: 0; color: #66758d; text-transform: uppercase; letter-spacing: .12em; font-size: 10px; font-weight: 800; }
.filter-section { padding: 22px 0; border-top: 1px solid var(--line-soft); }
.filter-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.filter-title-row h3 { margin: 0; font-size: 12px; color: #d9dee7; }
.muted-count { color: #5e6876; font-size: 11px; }
.filter-list { display: grid; gap: 7px; }
.filter-option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  min-height: 30px;
  color: #9aa4b2;
  font-size: 12px;
  cursor: pointer;
}
.filter-option input { appearance: none; width: 15px; height: 15px; margin: 0; border: 1px solid #39414e; border-radius: 4px; background: #13171e; }
.filter-option input:checked { border-color: #88a8ec; background: #88a8ec; box-shadow: inset 0 0 0 3px #13171e; }
.filter-option span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-option small { color: #545d69; }
.filter-list-tags { max-height: 300px; overflow: auto; padding-right: 4px; }
.source-note { padding: 14px; border: 1px solid #222936; border-radius: 12px; background: #10141b; }
.source-note strong { font-size: 11px; }
.source-note p { margin: 7px 0 0; color: #687282; font-size: 11px; line-height: 1.55; }

.content { min-width: 0; padding: 34px 30px 60px; }
.content-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.content h1 { font-size: clamp(26px, 3vw, 38px); }
.result-summary { margin: 8px 0 0; color: var(--muted); font-size: 13px; }
.view-controls select {
  height: 40px;
  padding: 0 34px 0 12px;
  border: 1px solid #282f3a;
  border-radius: 10px;
  background: #13171e;
  color: #c9d0da;
  font-size: 12px;
}
.active-filters { display: flex; flex-wrap: wrap; gap: 8px; min-height: 0; margin-bottom: 18px; }
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border: 1px solid #2b3441;
  border-radius: 999px;
  background: #12171e;
  color: #aab4c1;
  font-size: 11px;
}
.filter-chip button { border: 0; background: transparent; color: #697383; padding: 0; line-height: 1; }
.filter-chip button:hover { color: #e0e5ed; }

.prop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
  gap: 14px;
}
.prop-card {
  min-width: 0;
  border: 1px solid #202630;
  border-radius: 15px;
  background: #0f1217;
  overflow: hidden;
  transition: transform .16s ease, border-color .16s ease, background .16s ease;
}
.prop-card:hover { transform: translateY(-2px); border-color: #323c4a; background: #11151b; }
.prop-image-button { display: block; width: 100%; padding: 0; border: 0; background: #171b22; }
.prop-image-wrap {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background:
    linear-gradient(45deg, #161a20 25%, transparent 25%),
    linear-gradient(-45deg, #161a20 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #161a20 75%),
    linear-gradient(-45deg, transparent 75%, #161a20 75%),
    #13171c;
  background-size: 22px 22px;
  background-position: 0 0, 0 11px, 11px -11px, -11px 0px;
}
.prop-image-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .25s ease; }
.prop-card:hover .prop-image-wrap img { transform: scale(1.02); }
.prop-image-overlay { position: absolute; inset: auto 10px 10px auto; padding: 5px 7px; border: 1px solid rgba(255,255,255,.12); border-radius: 7px; background: rgba(8,10,13,.72); color: #9fa9b8; font-size: 9px; backdrop-filter: blur(8px); }
.prop-card-body { display: grid; gap: 11px; padding: 13px 14px 14px; }
.prop-name-row { display: grid; grid-template-columns: minmax(0, 1fr) 32px; gap: 8px; align-items: center; }
.prop-name-button { min-width: 0; padding: 0; border: 0; background: transparent; color: #e7ebf1; text-align: left; }
.prop-name-button code { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; font-size: 11.5px; }
.icon-button {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid #2a303a;
  border-radius: 8px;
  background: #151920;
  color: #8993a1;
}
.icon-button:hover { border-color: #46505e; color: #dfe5ed; }
.icon-button svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.card-tags { display: flex; gap: 6px; min-height: 19px; overflow: hidden; }
.mini-chip { padding: 4px 7px; border-radius: 999px; background: #171c24; color: #6f7988; font-size: 9px; white-space: nowrap; }
.mini-chip.category { background: #151b27; color: #7e91b4; }

.empty-state { padding: 70px 20px; text-align: center; border: 1px dashed #252b34; border-radius: 16px; background: #0e1116; }
.empty-icon { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 14px; border-radius: 50%; background: #171b22; color: #5e6876; font-weight: 800; }
.empty-state h2 { margin: 0; font-size: 18px; }
.empty-state p { color: var(--muted); font-size: 13px; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(3, 5, 8, .78);
  backdrop-filter: blur(12px);
}
.modal {
  width: min(1180px, 100%);
  max-height: min(900px, calc(100vh - 44px));
  overflow: auto;
  border: 1px solid #2a313c;
  border-radius: 18px;
  background: #0f1217;
  box-shadow: var(--shadow);
}
.modal-small { width: min(470px, 100%); }
.modal-bar { position: sticky; top: 0; z-index: 3; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 19px 20px; border-bottom: 1px solid #202630; background: rgba(15,18,23,.96); backdrop-filter: blur(12px); }
.modal-bar h2 { font-size: 18px; }
.prop-modal-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(420px, 1.1fr); min-height: 600px; }
.prop-editor { padding: 22px; border-right: 1px solid #202630; }
.editor-block { padding: 18px 0; border-top: 1px solid #1f252e; }
.editor-block:first-child { padding-top: 0; border-top: 0; }
.field-label { display: block; margin-bottom: 8px; color: #aeb8c5; font-size: 11px; font-weight: 700; }
.editor-block p { margin: -2px 0 11px; color: #67717e; font-size: 11px; line-height: 1.5; }
.copy-field { display: grid; grid-template-columns: minmax(0,1fr) 32px; gap: 8px; align-items: center; }
.copy-field code { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 10px 11px; border: 1px solid #292f39; border-radius: 9px; background: #12161c; color: #e1e6ed; font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; }
.source-link { display: inline-block; margin-top: 10px; color: #8aa8e6; font-size: 11px; }
.source-link:hover { color: #bbcefa; }
.choice-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.choice-item { position: relative; }
.choice-item input { position: absolute; opacity: 0; pointer-events: none; }
.choice-item span { display: inline-flex; align-items: center; min-height: 31px; padding: 0 10px; border: 1px solid #2a313c; border-radius: 9px; background: #13171d; color: #7e8896; font-size: 11px; cursor: pointer; }
.choice-item input:checked + span { border-color: #617aa7; background: #172034; color: #c4d3f1; }
.choice-item input:disabled + span { cursor: default; opacity: .75; }
.choice-tags .choice-item span { border-radius: 999px; }
.create-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; margin-top: 12px; }
input, textarea, select {
  border: 1px solid #2a313b;
  border-radius: 9px;
  background: #12161c;
  color: #dce2ea;
}
input, textarea { width: 100%; padding: 10px 11px; }
input:focus, textarea:focus, select:focus { border-color: #536b95; box-shadow: 0 0 0 3px rgba(122,162,255,.07); }
textarea { resize: vertical; min-height: 120px; }
.modal-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 18px; }
.read-only-notice { margin: 0 !important; color: #727d8d !important; }
.prop-preview-pane { padding: 22px; background: #0b0e12; }
.large-preview { position: sticky; top: 92px; aspect-ratio: 16 / 11; overflow: hidden; border: 1px solid #252b34; border-radius: 14px; background: #14181d; }
.large-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview-source-badge { position: absolute; right: 12px; bottom: 12px; padding: 6px 8px; border: 1px solid rgba(255,255,255,.12); border-radius: 8px; background: rgba(6,8,10,.68); color: #77818e; font-size: 9px; }
.metadata-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 12px; }
.metadata-pill { padding: 6px 8px; border: 1px solid #242b34; border-radius: 8px; color: #707b89; font-size: 10px; }

.login-form { display: grid; gap: 15px; padding: 22px; }
.login-form label { display: grid; gap: 7px; color: #9ba5b3; font-size: 11px; }
.form-error { margin: 0; color: var(--danger); font-size: 11px; }
.hint { margin: -4px 0 0; color: #687281; font-size: 11px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 200; max-width: 360px; padding: 11px 13px; border: 1px solid #2d3642; border-radius: 10px; background: #141920; box-shadow: 0 16px 40px rgba(0,0,0,.36); color: #dce2ea; font-size: 12px; }

@media (max-width: 1000px) {
  .topbar { grid-template-columns: auto minmax(240px, 1fr) auto; gap: 14px; padding-inline: 18px; }
  .brand-copy { display: none; }
  .layout { grid-template-columns: 220px minmax(0,1fr); }
  .sidebar { padding-left: 18px; padding-right: 16px; }
  .content { padding-inline: 20px; }
  .prop-modal-grid { grid-template-columns: 1fr; }
  .prop-editor { border-right: 0; border-bottom: 1px solid #202630; }
  .large-preview { position: static; }
}

@media (max-width: 760px) {
  .topbar { position: sticky; grid-template-columns: auto 1fr auto; min-height: 70px; padding: 10px 12px; }
  .brand-mark { width: 38px; height: 38px; font-size: 12px; }
  .search-wrap { height: 44px; }
  .top-actions .button-secondary { display: none !important; }
  .top-actions .button { min-height: 36px; padding: 0 10px; }
  kbd { display: none; }
  .layout { display: block; }
  .sidebar { position: static; height: auto; padding: 15px 14px; border-right: 0; border-bottom: 1px solid var(--line-soft); }
  .sidebar-head, .source-note { display: none; }
  .filter-section { padding: 8px 0 10px; border-top: 0; }
  .filter-title-row { margin-bottom: 7px; }
  .filter-list { display: flex; overflow-x: auto; gap: 7px; padding-bottom: 4px; }
  .filter-option { flex: 0 0 auto; display: block; min-height: auto; }
  .filter-option input { display: none; }
  .filter-option span:nth-child(2) { display: block; padding: 7px 9px; border: 1px solid #252c36; border-radius: 999px; background: #11151b; }
  .filter-option input:checked + span { border-color: #607aa7; background: #172034; color: #c1d1ef; }
  .filter-option small { display: none; }
  .filter-list-tags { max-height: none; }
  .content { padding: 24px 14px 44px; }
  .content-head { align-items: center; }
  .content h1 { font-size: 27px; }
  .view-controls select { width: 122px; }
  .prop-grid { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
  .prop-card-body { padding: 10px; }
  .card-tags { display: none; }
  .prop-name-row { grid-template-columns: minmax(0,1fr) 30px; }
  .prop-name-button code { font-size: 10px; }
  .modal-backdrop { padding: 0; align-items: stretch; }
  .modal { width: 100%; max-height: 100vh; border: 0; border-radius: 0; }
  .prop-modal-grid { display: flex; flex-direction: column-reverse; }
  .prop-preview-pane { padding: 12px; }
  .large-preview { aspect-ratio: 16 / 10; }
  .prop-editor { padding: 16px; }
  .modal-bar { padding: 14px 15px; }
}

@media (max-width: 460px) {
  .search-wrap { grid-template-columns: 18px 1fr; padding-inline: 10px; }
  .search-wrap input { font-size: 12px; }
  .content-head { align-items: end; }
  .view-controls select { width: 108px; padding-left: 8px; font-size: 10px; }
  .prop-grid { grid-template-columns: 1fr; }
  .prop-image-wrap { aspect-ratio: 16 / 9; }
}
