:root {
  color-scheme: dark;
  --bg: #0b1020;
  --panel: rgba(17, 24, 39, 0.84);
  --panel-solid: #111827;
  --line: rgba(148, 163, 184, 0.18);
  --text: #e5eefc;
  --muted: #92a2bd;
  --accent: #5aa2ff;
  --accent-soft: rgba(90, 162, 255, 0.14);
  --success: #7ae2a1;
  --shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
  --radius: 20px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(90, 162, 255, 0.2), transparent 34%),
    radial-gradient(circle at right, rgba(122, 226, 161, 0.12), transparent 30%),
    linear-gradient(180deg, #08101f 0%, #09111b 100%);
}
button, input, select { font: inherit; }
button, input, select { border-radius: 14px; border: 1px solid var(--line); }
button {
  cursor: pointer;
  color: var(--text);
  background: linear-gradient(180deg, #3488ff, #1767e6);
  border: 0;
  padding: 0.82rem 1rem;
  box-shadow: 0 12px 24px rgba(23, 103, 230, 0.28);
}
button:hover { filter: brightness(1.05); }
.ghost-btn { background: rgba(255,255,255,0.04); border: 1px solid var(--line); box-shadow: none; }
input, select {
  width: 100%;
  color: var(--text);
  padding: 0.8rem 0.95rem;
  background: rgba(255,255,255,0.035);
}
input::placeholder { color: #73839f; }
select {
  appearance: auto;
  color: var(--text);
}
select option,
select optgroup {
  color: #101828;
  background: #f8fafc;
}
.app-shell {
  display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 22px; min-height: 100vh; padding: 22px;
}
.sidebar, .main-panel, .preview-dialog { backdrop-filter: blur(18px); }
.sidebar { display: flex; flex-direction: column; gap: 18px; }
.brand, .panel, .content-card, .topbar, .preview-dialog {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow);
}
.brand { display: flex; gap: 16px; align-items: center; padding: 1.1rem 1.15rem; }
.brand h1, .content-header h2, .preview-header h3, .panel-head h2 { margin: 0; }
.brand p, .content-header p, .preview-header p, .field span, .eyebrow, .breadcrumbs, #statusText, .path-box, th, .empty-state p, .field-note { color: var(--muted); }
.brand-mark {
  display: grid; place-items: center; width: 54px; height: 54px; border-radius: 18px; font-weight: 800; letter-spacing: 0.06em;
  background: linear-gradient(135deg, #5aa2ff, #7ae2a1); color: #06101f;
}
.panel, .content-card { padding: 1rem; }
.panel-head { margin-bottom: 0.85rem; }
.path-box {
  min-height: 48px; display: flex; align-items: center; padding: 0.85rem 0.95rem; border-radius: 16px;
  border: 1px solid var(--line); background: rgba(255,255,255,0.03); word-break: break-all;
}
.sidebar-actions, .stats-panel, .search-form { display: grid; gap: 10px; }
.search-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-note { margin: 0; font-size: 0.83rem; line-height: 1.45; }
.stats-panel { grid-template-columns: 1fr 1fr; }
.stat-card { padding: 1rem; border-radius: 18px; background: rgba(255,255,255,0.035); border: 1px solid var(--line); }
.stat-card span { display: block; font-size: 0.85rem; color: var(--muted); }
.stat-card strong { display: block; font-size: 1.8rem; margin-top: 0.25rem; }
.field { display: grid; gap: 0.4rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.main-panel { min-width: 0; }
.topbar {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; padding: 1rem 1.1rem; margin-bottom: 18px;
}
.eyebrow { text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.72rem; }
.breadcrumbs { margin-top: 0.4rem; display: flex; flex-wrap: wrap; gap: 8px; min-height: 24px; }
.breadcrumbs button {
  background: var(--accent-soft); color: #dbeafe; border: 1px solid rgba(90,162,255,0.24); padding: 0.45rem 0.7rem; box-shadow: none;
}
.prefix-form { display: grid; grid-template-columns: minmax(0,440px) auto; gap: 10px; width: min(100%, 640px); }
.content-card { min-height: calc(100vh - 84px - 44px); }
.content-header {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 14px;
}
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 18px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.95rem 1rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:hover { background: rgba(255,255,255,0.03); }
th { font-size: 0.85rem; font-weight: 600; }
.name-cell { display: flex; align-items: center; gap: 12px; min-width: 260px; }
.name-text { min-width: 0; }
.name-title {
  display: inline-block; color: var(--text); text-decoration: none; background: transparent; border: 0; padding: 0;
  box-shadow: none; text-align: left; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.name-title:hover { text-decoration: underline; filter: none; }
.name-sub { display: block; color: var(--muted); font-size: 0.82rem; margin-top: 0.18rem; }
.icon-pill {
  width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; flex: 0 0 auto;
  background: rgba(255,255,255,0.06); border: 1px solid var(--line); font-size: 1.1rem;
}
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions button, .actions a {
  padding: 0.5rem 0.75rem; border-radius: 12px; text-decoration: none; color: var(--text);
  background: rgba(255,255,255,0.04); border: 1px solid var(--line); box-shadow: none;
}
.tag {
  display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.35rem 0.6rem; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(255,255,255,0.04); color: var(--muted); font-size: 0.82rem;
}
.empty-state { display: grid; place-items: center; text-align: center; padding: 3rem 1rem 2rem; }
.empty-emoji { font-size: 2.3rem; margin-bottom: 0.7rem; }
.preview-dialog { width: min(980px, calc(100vw - 28px)); margin: auto; padding: 0; color: var(--text); }
.preview-dialog::backdrop { background: rgba(5,9,18,0.72); backdrop-filter: blur(6px); }
.preview-header {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 1rem 1rem 0.8rem; border-bottom: 1px solid var(--line);
}
.preview-body { max-height: calc(100vh - 180px); overflow: auto; padding: 1rem; }
.preview-body img, .preview-body video, .preview-body audio, .preview-body iframe {
  width: 100%; max-width: 100%; border-radius: 16px; border: 1px solid var(--line); background: #050913;
}
.preview-body pre {
  margin: 0; white-space: pre-wrap; word-break: break-word; padding: 1rem; border-radius: 18px;
  border: 1px solid var(--line); background: rgba(5,9,18,0.82); color: #d9e7ff;
}
.toast {
  position: fixed; right: 20px; bottom: 20px; max-width: min(420px, calc(100vw - 30px));
  padding: 0.9rem 1rem; border-radius: 14px; background: rgba(7,12,24,0.92);
  border: 1px solid rgba(122,226,161,0.24); box-shadow: var(--shadow);
}
@media (max-width: 1120px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { order: 2; }
  .main-panel { order: 1; }
}
@media (max-width: 840px) {
  .topbar, .content-header { flex-direction: column; align-items: stretch; }
  .prefix-form, .two-col, .search-actions { grid-template-columns: 1fr; }
  table, thead, tbody, th, td, tr { display: block; }
  thead { display: none; }
  tbody tr { padding: 0.4rem 0; }
  td { border-bottom: none; padding-top: 0.45rem; padding-bottom: 0.45rem; }
  td::before { content: attr(data-label); display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 0.3rem; }
  .table-wrap { border: none; }
  tbody tr + tr { border-top: 1px solid var(--line); }
}
