:root {
  --bg: #f3efe6;
  --bg2: #e7e0d2;
  --ink: #1c2420;
  --muted: #5c675f;
  --accent: #1f6f5b;
  --accent2: #c45c26;
  --line: #cfc5b4;
  --card: #fffdf8;
  --ok: #1f6f5b;
  --err: #a33b2b;
  --font: "Segoe UI", "PT Sans", "Source Sans 3", sans-serif;
  --display: "Segoe UI Semibold", "PT Sans", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #dfe9e2 0%, transparent 55%),
    radial-gradient(900px 400px at 100% 0%, #f0dcc8 0%, transparent 50%),
    var(--bg);
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.topbar nav { display: flex; gap: 0.75rem; flex-wrap: wrap; flex: 1; }
.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-left: auto;
  flex-shrink: 0;
}
.topbar nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
}
.topbar nav a:hover, .topbar nav a.active {
  color: var(--accent);
  background: #e5efe9;
}

.container { max-width: 1400px; margin: 0 auto; padding: 1.25rem 1.5rem 3rem; }

.hero-admin {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
.hero-admin h1 {
  margin: 0 0 0.25rem;
  font-family: var(--display);
  font-size: 1.75rem;
  letter-spacing: -0.03em;
}
.muted { color: var(--muted); }
.stats { display: flex; gap: 0.75rem; }
.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  min-width: 7rem;
  text-align: center;
}
.stat-num { display: block; font-size: 1.4rem; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 0.8rem; color: var(--muted); }

.card-section {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.15rem 1.25rem;
  margin-bottom: 1.25rem;
}
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.section-head h2, .card-section h2 { margin: 0 0 0.75rem; font-size: 1.15rem; }
.section-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.btn {
  appearance: none;
  border: none;
  background: var(--accent);
  color: #fff;
  padding: 0.5rem 0.9rem;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
  display: inline-block;
}
.btn:hover { filter: brightness(1.05); }
.btn-secondary { background: #3d4a43; }
.btn-danger { background: var(--err); }
.btn-small { padding: 0.3rem 0.55rem; font-size: 0.85rem; }

.upload-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
table.data th, table.data td {
  border-bottom: 1px solid var(--line);
  padding: 0.45rem 0.5rem;
  text-align: left;
  vertical-align: top;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
table.data td.col-filename {
  max-width: 420px;
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
}
table.data td.col-filename .file-name {
  cursor: help;
}
table.data th {
  background: var(--bg2);
  position: sticky;
  top: 0;
  z-index: 1;
}
.table-wrap {
  overflow: auto;
  max-height: 70vh;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: #e8e2d6;
}
.status-processed { background: #d7ebe3; color: var(--ok); }
.status-in_db { background: #d7ebe3; color: var(--ok); }
.status-uploaded, .status-mapped { background: #f3e2d4; color: var(--accent2); }
.status-processing { background: #dde6f5; color: #2a4a7a; }
.status-error { background: #f3d6d1; color: var(--err); }

.file-msg { font-size: 0.78rem; margin-top: 0.25rem; max-width: 18rem; line-height: 1.3; }
.file-msg.err { color: var(--err); }
.file-msg.warn { color: #7a4e12; }
.row-off-disk { opacity: 0.88; }
.row-collision td.col-filename { background: #f8edd8; }
.flash {
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  margin-bottom: 1rem;
}
.flash.warn { background: #f8edd8; color: #7a4e12; }
.flash.err {
  background: #f3d6d1;
  border: 1px solid #e0b4ac;
  color: var(--err);
}

.progress-wrap {
  display: inline-block;
  vertical-align: middle;
  width: 7.5rem;
  height: 0.55rem;
  background: #e8e4dc;
  border-radius: 999px;
  overflow: hidden;
  margin-right: 0.4rem;
}
.progress-bar {
  height: 100%;
  background: #3d6b9a;
  border-radius: 999px;
  width: 0;
  transition: width 0.35s ease;
}
.progress-pct {
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.flash.ok {
  background: #d7ebe3;
  border: 1px solid #9fcbb8;
  color: var(--ok);
}

.mapping-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}
.map-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.7rem;
}
.map-label { font-size: 0.82rem; color: var(--muted); }
.map-label .req { color: #a33; font-weight: 700; }
.dirty-columns-section { margin: 1rem 0; }
.dirty-columns-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.75rem;
}
.dirty-col-row {
  display: grid;
  grid-template-columns: auto 1fr minmax(12rem, 16rem);
  gap: 0.65rem;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
}
.dirty-col-check {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  white-space: nowrap;
  cursor: pointer;
}
.dirty-col-name { font-weight: 600; font-size: 0.92rem; word-break: break-word; }
.dirty-col-fields { font-size: 0.75rem; margin-top: 0.15rem; }
@media (max-width: 720px) {
  .dirty-col-row {
    grid-template-columns: 1fr;
  }
}
select, input[type="text"], input[type="number"], input[type="password"], input:not([type]) {
  font: inherit;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.form-actions, .inline-form {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  flex-wrap: wrap;
  margin: 0.75rem 0;
}
.actions { white-space: nowrap; }

.tabs { display: flex; gap: 0.4rem; }
.tab {
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  text-decoration: none;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--line);
}
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.filters-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  margin-bottom: 1rem;
}
.filters-panel summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

/* Главная «База»: таблица слева ~80%, фильтры справа ~20% */
.container:has(.browse-layout) {
  max-width: min(2112px, 100%); /* 1760 × 1.2 */
  padding-left: 1rem;
  padding-right: 1rem;
}
.browse-hero {
  margin-bottom: 0.85rem;
}
.browse-hero .muted {
  margin: 0;
}
.browse-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 20%);
  gap: 1rem;
  align-items: start;
}
.browse-main {
  min-width: 0;
}
.browse-sidebar {
  min-width: 0;
  position: sticky;
  top: 4.25rem;
  max-height: calc(100vh - 5rem);
  overflow: auto;
}
.browse-filters {
  margin-bottom: 0;
  padding: 0.75rem 0.85rem;
}
.browse-filters details + details {
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--line);
}
.browse-filters .filters-grid {
  grid-template-columns: 1fr;
  gap: 0.55rem;
}
.browse-filters .chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.browse-filters .chip {
  font-size: 0.75rem;
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.browse-sidebar-actions {
  flex-direction: column;
  align-items: stretch;
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line);
}
.browse-sidebar-actions .btn,
.browse-sidebar-actions .btn-secondary {
  text-align: center;
  justify-content: center;
}
.browse-row-count {
  font-size: 0.85rem;
  text-align: center;
}
.browse-table-wrap {
  max-height: calc(100vh - 14rem);
}
.browse-main .holding-toolbar {
  margin-top: 0;
}
.browse-quick-search {
  margin: 0 0 0.75rem;
}
.browse-quick-search-input {
  width: 100%;
  max-width: 36rem;
  font: inherit;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}
.browse-quick-search-input:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 1px;
  border-color: var(--accent);
}
table.browse-data {
  table-layout: fixed;
  width: max-content;
  min-width: 100%;
}
table.browse-data th,
table.browse-data td {
  /* max-width: 0 — иначе браузер не даёт сузить столбец уже содержимого */
  max-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
table.browse-data .col-check-width {
  width: 2.5rem;
}
table.browse-data th.th-check,
table.browse-data td.td-check {
  max-width: none;
  width: 2.5rem;
  overflow: visible;
}
table.browse-data th {
  position: sticky;
  top: 0;
  z-index: 2;
  user-select: none;
}
table.browse-data th .th-label {
  display: block;
  padding-right: 0.55rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 7px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  touch-action: none;
}
.col-resizer::after {
  content: "";
  position: absolute;
  top: 20%;
  bottom: 20%;
  left: 2px;
  width: 2px;
  border-radius: 1px;
  background: transparent;
}
table.browse-data th:hover .col-resizer::after,
body.is-col-resizing .col-resizer::after {
  background: var(--line);
}
body.is-col-resizing {
  cursor: col-resize !important;
  user-select: none !important;
}
body.is-col-resizing iframe {
  pointer-events: none;
}
.col-group { margin-bottom: 0.75rem; }
.col-group-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.chip-contact { background: #e5efe9; }
.th-contact { background: #d7ebe3 !important; }

.chip {
  display: inline-flex;
  gap: 0.35rem;
  align-items: center;
  background: var(--bg2);
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  font-size: 0.82rem;
}
.filters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: 0.65rem 0.75rem;
}
.filters-grid .filter-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.82rem;
  min-width: 0;
  max-width: 100%;
}
.filters-grid .filter-item > span {
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.filters-grid input,
.filters-grid select {
  font: inherit;
  padding: 0.35rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.filter-multi-dd {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}
.filter-multi-dd > summary {
  cursor: pointer;
  font-weight: 400;
  padding: 0.35rem 0.45rem;
  margin: 0;
  list-style: none;
}
.filter-multi-dd > summary::-webkit-details-marker {
  display: none;
}
.filter-multi-list {
  max-height: 12rem;
  overflow-y: auto;
  border-top: 1px solid var(--line);
  padding: 0.25rem 0.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.filter-multi-opt {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  font-size: 0.82rem;
  padding: 0.15rem 0.05rem;
  cursor: pointer;
  line-height: 1.3;
}
.filters-grid .filter-multi-opt input {
  width: auto;
  max-width: none;
  min-width: 0;
  margin: 0.15rem 0 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  flex-shrink: 0;
}
.filter-inn-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.82rem;
  margin-bottom: 0.75rem;
}
.filter-inn-list > span {
  line-height: 1.25;
}
.filter-inn-list textarea {
  font: inherit;
  padding: 0.4rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 6.5rem;
  resize: vertical;
  box-sizing: border-box;
  line-height: 1.35;
}
.filter-inn-list-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
}
.filter-inn-file-btn {
  cursor: pointer;
  margin: 0;
}
.filter-inn-list-status {
  margin: 0;
}
.filter-range {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.35rem;
  min-width: 0;
  width: 100%;
}
.filter-range input[type="number"],
.filter-range input[type="date"] {
  min-width: 0;
  width: 100%;
}
.pager {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: center;
  margin-top: 1rem;
  flex-wrap: wrap;
}
.pager-goto {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--muted, #667);
}
.pager-goto input {
  width: 5.5rem;
  min-width: 5.5rem;
  padding: 0.25rem 0.35rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  text-align: center;
}

.th-check, .td-check {
  width: 2rem;
  max-width: 2.5rem;
  text-align: center;
  white-space: nowrap;
}
.holding-toolbar {
  margin: 0 0 0.75rem;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
}
.browse-view-toggle {
  display: inline-flex;
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--card);
}
.browse-view-option {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  padding: 0.35rem 0.7rem;
  font-size: 0.85rem;
  cursor: pointer;
  user-select: none;
  border-right: 1px solid var(--line);
}
.browse-view-option:last-child {
  border-right: none;
}
.browse-view-option:has(input:checked) {
  background: var(--accent);
  color: #fff;
}
.browse-view-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.col-group.is-disabled,
.filter-item.is-disabled {
  opacity: 0.55;
}
.col-group.is-disabled .chip,
.filter-item.is-disabled {
  cursor: not-allowed;
}
.holding-dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.15rem 1.25rem;
  background: var(--card);
  color: var(--ink);
  max-width: min(520px, 94vw);
}
.holding-dialog::backdrop {
  background: rgba(28, 36, 32, 0.45);
}
.holding-dialog h2 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
}
.holding-dialog .filter-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 0.75rem 0;
}
.holding-dialog select,
.holding-dialog input[type="text"],
.holding-dialog input[type="password"] {
  font: inherit;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  width: 100%;
  box-sizing: border-box;
}
.browse-empty-cell {
  padding: 1.25rem 0.75rem;
  text-align: center;
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

tr.row-company {
  cursor: pointer;
}
tr.row-company:hover td {
  background: #f3ebe0;
}
tr.row-company:hover td.td-check {
  background: transparent;
}

/* —— Drawer (slide-over справа) —— */
body.drawer-open {
  overflow: hidden;
}
.drawer-root {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
}
.drawer-root:not([hidden]) {
  pointer-events: auto;
}
.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 36, 32, 0.35);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  width: min(1248px, 96vw);
  background: var(--card);
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 28px rgba(28, 36, 32, 0.12);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.22s ease;
}
.drawer-root.is-open .drawer-backdrop {
  opacity: 1;
}
.drawer-root.is-open .drawer-panel {
  transform: translateX(0);
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.95);
  flex-shrink: 0;
}
.drawer-title {
  margin: 0;
  font-size: 1rem;
  font-family: var(--display);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drawer-body {
  flex: 1;
  overflow: auto;
  padding: 1rem 1.1rem 2rem;
  -webkit-overflow-scrolling: touch;
}
.profile-page-drawer {
  max-width: none;
}
.profile-page-drawer .profile-hero h1 {
  font-size: 1.45rem;
}
.profile-page-drawer .profile-grid {
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.profile-page {
  max-width: 1248px;
}
.profile-back { margin: 0 0 1rem; }
.profile-hero {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}
.profile-hero h1 {
  margin: 0 0 0.35rem;
  font-family: var(--display);
  font-size: 1.85rem;
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.profile-subname {
  margin: 0 0 0.65rem;
  color: var(--muted);
  font-size: 1.05rem;
}
.profile-ids {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.25rem;
  font-variant-numeric: tabular-nums;
  margin-bottom: 0.65rem;
}
.profile-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}
.badge-muted { background: #ebe6dc; color: var(--muted); }
.profile-holding { margin: 0.5rem 0 0; }
.profile-holding a { color: var(--accent); }

.profile-enrich {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  margin: -0.5rem 0 1.25rem;
}
.profile-enrich-status {
  font-size: 0.85rem;
  max-width: 36rem;
}

.profile-edit-form {
  margin: 0 0 1.5rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
}
.profile-edit-form h2 {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-family: var(--display);
}
.profile-edit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem 1rem;
}
.profile-edit-wide {
  grid-column: 1 / -1;
}
.profile-edit-form .filter-item input {
  width: 100%;
  box-sizing: border-box;
}
.profile-sibling-list {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
}
.profile-sibling-list li {
  margin: 0.35rem 0;
}
.profile-sibling-list label {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.65rem;
  align-items: center;
}

.profile-section {
  margin-bottom: 1.75rem;
}
.profile-section h2 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
  font-family: var(--display);
}
.profile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.85rem 1.25rem;
  margin: 0;
}
.profile-grid div {
  min-width: 0;
}
.profile-grid dt {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.2rem;
}
.profile-grid dd {
  margin: 0;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.profile-desc {
  margin: 1rem 0 0;
  line-height: 1.5;
  white-space: pre-wrap;
}
.profile-alias-list,
.profile-child-list {
  margin: 0;
  padding-left: 1.15rem;
  line-height: 1.55;
}
.profile-child-list a { color: var(--accent); }
.profile-table {
  max-height: none;
}

@media (max-width: 720px) {
  .hero-admin { flex-direction: column; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .profile-hero h1 { font-size: 1.45rem; }
  .drawer-panel { width: 100vw; }
}

.login-wrap {
  max-width: 32rem;
  margin: 3.5rem auto 0;
}
.login-card h1 {
  margin: 0 0 0.75rem;
  font-family: var(--display);
  font-size: 1.6rem;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 1rem;
}
.login-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.login-form .btn { align-self: flex-start; }
.login-cmd {
  background: #f3efe6;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.65rem 0.8rem;
  overflow-x: auto;
  font-size: 0.82rem;
  white-space: pre-wrap;
}

@media (max-width: 1100px) {
  .browse-layout {
    grid-template-columns: 1fr;
  }
  .browse-sidebar {
    position: static;
    max-height: none;
    order: -1;
  }
  .browse-table-wrap {
    max-height: 65vh;
  }
}
