/* EDZ Library — clean catalogue UI */
:root {
  --bg: #ffffff;
  --text: #18181b;
  --text-soft: #3f3f46;
  --muted: #71717a;
  --faint: #a1a1aa;
  --border: #e4e4e7;
  --border-soft: #f1f1f3;
  --soft: #fafafa;
  --soft-2: #f4f4f5;
  --soft-3: #efeff1;
  --accent: #18181b;
  --accent-hover: #27272a;
  --blue: #2563eb;
  --blue-soft: #eff6ff;
  --violet: #7c3aed;
  --violet-soft: #f5f3ff;
  --green: #047857;
  --green-soft: #ecfdf5;
  --amber: #b45309;
  --amber-soft: #fffbeb;
  --red: #b91c1c;
  --red-soft: #fef2f2;
  --radius: 10px;
  --radius-lg: 14px;
  --max: 1180px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Code", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
::selection { background: #dbeafe; }

/* ------------------------------------------------------------------ header */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid transparent;
}
.topbar-inner {
  max-width: 1440px;
  margin: 0 auto;
  height: 60px;
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.brand-mark {
  width: 26px;
  height: 26px;
  color: var(--text);
  flex-shrink: 0;
}
.brand-sub {
  color: var(--faint);
  font-weight: 400;
  font-size: 12px;
  letter-spacing: 0;
  margin-left: 2px;
}
.topnav {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-left: auto;
}
.topnav a {
  color: var(--muted);
  font-size: 13px;
  transition: color 0.15s;
  white-space: nowrap;
}
.topnav a:hover, .topnav a.active { color: var(--text); }
.nav-cart { position: relative; display: inline-flex; align-items: center; gap: 6px; }
.cart-badge[hidden] { display: none; }
.cart-badge {
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: 6px;
}
.quota-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  background: #fff;
}
.quota-chip b { color: var(--text); font-weight: 600; }
.quota-chip .dot { width: 5px; height: 5px; border-radius: 50%; background: #22c55e; }
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
  max-width: 230px;
}
.user-chip:hover { background: var(--soft-2); border-color: var(--border-soft); }
.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--soft-2);
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-soft);
  flex-shrink: 0;
}
.user-chip-name {
  font-size: 12px;
  color: var(--text-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.logout-form { display: inline; }
.link-button {
  background: none;
  border: 0;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
}
.link-button:hover { color: var(--text); }

/* ------------------------------------------------------------------ layout */
.page {
  max-width: var(--max);
  margin: 0 auto;
  padding: 34px 28px 64px;
}
.page-wide { max-width: 1320px; }
.maintenance-banner {
  background: var(--amber-soft);
  border-bottom: 1px solid #fde68a;
  color: #92400e;
  font-size: 13px;
  text-align: center;
  padding: 8px 16px;
}

/* ------------------------------------------------------------------ search */
.search-area { max-width: 760px; margin: 8px auto 30px; }
.search-form {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--soft-2);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 5px 6px 5px 16px;
  height: 48px;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.search-form:focus-within {
  background: #fff;
  border-color: var(--border);
  box-shadow: none;
}
.search-icon { color: var(--faint); flex-shrink: 0; }
.search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14px;
  padding: 0 4px;
  height: 38px;
}
.search-input::placeholder { color: var(--faint); }
.search-sort {
  appearance: none;
  border: 0;
  background: transparent;
  font-size: 12px;
  color: var(--text-soft);
  padding: 8px 26px 8px 10px;
  border-radius: 999px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%2371717a' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.search-sort:hover { background-color: rgba(0, 0, 0, 0.04); }
.search-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--faint);
  font-size: 11px;
  padding: 8px 16px 0;
}
.search-meta b { color: var(--muted); font-weight: 500; }

/* ------------------------------------------------------------------ catalog grid */
.catalog-layout {
  display: grid;
  grid-template-columns: 220px minmax(320px, 350px) minmax(320px, 1fr);
  gap: 26px;
  align-items: start;
}
.sidebar { grid-column: 1; }
.results { min-width: 0; grid-column: 2; }
.result-list { display: flex; flex-direction: column; gap: 10px; }
.result-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  scroll-margin-top: 80px;
  min-height: 116px;
}
.result-card:hover, .result-card:focus-within {
  border-color: #d4d4d8;
  box-shadow: none;
  background: #fff;
}
.result-card:focus { outline: 2px solid rgba(37, 99, 235, 0.28); outline-offset: 2px; }
.result-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
}
.result-titles { min-width: 0; flex: 1; }
.result-title {
  display: block;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.35;
  color: var(--text);
  word-break: break-word;
}
.result-title:hover { text-decoration: underline; text-underline-offset: 3px; }
.result-mfr { font-weight: 750; }
.result-article {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-soft);
}
.result-type {
  font-size: 10.5px;
  color: var(--muted);
  font-family: var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
}
.result-badges {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 108px;
}
.result-badges .badge { font-size: 9px; padding: 1px 5px; max-width: 102px; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border-radius: 5px;
  padding: 2px 7px;
  font-size: 10.5px;
  line-height: 1.5;
  font-weight: 500;
  white-space: nowrap;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.badge-blue { background: var(--blue-soft); color: #1d4ed8; }
.badge-violet { background: var(--violet-soft); color: #6d28d9; }
.badge-green { background: var(--green-soft); color: #047857; }
.badge-gray { background: var(--soft-2); color: var(--muted); }
.badge-amber { background: var(--amber-soft); color: #92400e; }
.badge-red { background: var(--red-soft); color: var(--red); }
.result-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  width: 100%;
}
.result-actions .btn-detail { flex: 1; }
.btn-detail {
  background: #fff;
  border-color: var(--border);
  color: var(--text-soft);
  box-shadow: none;
}
.btn-detail:hover {
  background: var(--soft-2);
  border-color: #d4d4d8;
  color: var(--text);
}
.icon-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: all 0.15s;
  flex-shrink: 0;
}
.icon-btn:hover { color: var(--text); border-color: #d4d4d8; background: var(--soft); }
.icon-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.icon-btn.primary:hover { background: var(--accent-hover); }
.icon-btn.in-basket { background: var(--blue-soft); border-color: #bfdbfe; color: var(--blue); }
.icon-btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.download-light { background: var(--soft-2); border-color: var(--border); color: #111; }
.download-light:hover { background: #e4e4e7; border-color: #d4d4d8; color: #000; }
.btn-ghost {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 6px;
}
.btn-ghost:hover { color: var(--text); background: var(--soft-2); }

/* ------------------------------------------------------------------ detail panel */
.detail-panel {
  grid-column: 3;
  box-sizing: border-box;
  position: sticky;
  top: 86px;
  align-self: start;
  min-width: 0;
  max-height: calc(100vh - 100px);
  overflow: auto;
  scrollbar-width: thin;
}
.detail-placeholder {
  border: 1px dashed var(--border);
  border-radius: 14px;
  background: var(--soft);
  padding: 44px 26px;
  text-align: center;
  color: var(--muted);
}
.detail-placeholder-icon {
  width: 42px;
  height: 42px;
  margin: 0 auto 12px;
  border-radius: 11px;
  background: #fff;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--faint);
}
.detail-placeholder h3 { margin: 0 0 6px; color: var(--text); font-size: 14px; letter-spacing: -0.01em; }
.detail-placeholder p { margin: 0 auto; max-width: 320px; font-size: 11.5px; line-height: 1.65; }
.detail-content {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
  min-width: 0;
  width: 100%;
}
.detail-header {
  padding: 16px 18px 13px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.detail-header h2 { margin: 0; font-size: 19px; letter-spacing: -0.025em; line-height: 1.3; word-break: break-word; }
.detail-header .sub { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.detail-close {
  margin-left: auto;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 7px;
  background: var(--soft-2);
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
  flex-shrink: 0;
}
.detail-close:hover { background: var(--soft-3); color: var(--text); }
.detail-body { padding: 16px 18px; }
.detail-image {
  background: var(--soft);
  border: 1px solid var(--border-soft);
  border-radius: 11px;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  margin-bottom: 14px;
}
.detail-image img { max-height: 300px; object-fit: contain; }
.detail-image .noimg { color: var(--faint); font-size: 11.5px; text-align: center; line-height: 1.6; padding: 20px; }
.detail-desc { margin: 0 0 4px; font-size: 13.5px; color: var(--text-soft); line-height: 1.6; }
.detail-desc2 { color: var(--muted); font-size: 12px; margin: 0 0 12px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; border-top: 1px solid var(--border-soft); padding-top: 4px; margin: 10px 0 0; }
.detail-row { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--border-soft); font-size: 11.5px; }
.detail-row dt { color: var(--faint); margin: 0; white-space: nowrap; }
.detail-row dd { margin: 0; color: var(--text-soft); text-align: right; word-break: break-word; overflow-wrap: anywhere; min-width: 0; }
.detail-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; }
.detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 13px 18px;
  border-top: 1px solid var(--border-soft);
  background: var(--soft);
}
.detail-actions .spacer { flex: 1; }
.detail-source { color: var(--faint); font-size: 10px; line-height: 1.5; width: 100%; }
.detail-loading { padding: 44px 20px; text-align: center; color: var(--faint); font-size: 12px; }
.detail-backdrop { display: none; }

/* ------------------------------------------------------------------ sidebar */
.sidebar {
  position: sticky;
  top: 86px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding-top: 2px;
}
.sidebar-heading {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
}
.sidebar-heading span { color: var(--faint); font-weight: 400; }
.sidebar-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  padding: 9px 11px;
  font-size: 12px;
  color: var(--text-soft);
  margin-bottom: 8px;
}
.sidebar-input:focus { outline: 2px solid rgba(24, 24, 27, 0.06); border-color: #d4d4d8; }
.filter-pills { max-height: 300px; overflow-y: auto; padding-right: 2px; }
.segmented {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
  background: #fff;
}
.segmented a, .segmented button {
  flex: 1;
  border: 0;
  background: transparent;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11.5px;
  color: var(--muted);
  text-align: center;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.segmented a:hover, .segmented button:hover { color: var(--text); }
.segmented .active { background: var(--soft-2); color: var(--text); font-weight: 600; }
.filter-pills { display: flex; flex-wrap: wrap; gap: 7px; }
.filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 7px 9px;
  font-size: 11.5px;
  color: var(--text-soft);
  background: #fff;
  transition: all 0.15s;
  max-width: 100%;
}
.filter-pill:hover { border-color: #d4d4d8; background: var(--soft); }
.filter-pill.active { border-color: var(--text); box-shadow: none; }
.filter-pill .count {
  font-size: 10px;
  color: var(--faint);
  background: var(--soft-2);
  border-radius: 999px;
  padding: 1px 5px;
}
.filter-pill .mfr-dot {
  width: 6px; height: 6px; border-radius: 2px; background: var(--violet); flex-shrink: 0;
}
.filter-pill.all .mfr-dot { background: var(--text-soft); }
.sidebar-select {
  width: 100%;
  appearance: none;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%2371717a' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 11px center;
  padding: 9px 30px 9px 11px;
  font-size: 12px;
  color: var(--text-soft);
}
.sidebar-select:focus { outline: 2px solid rgba(24,24,27,0.08); border-color: #d4d4d8; }
.sidebar-note { color: var(--faint); font-size: 10.5px; line-height: 1.5; margin-top: 6px; }
.quota-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  background: var(--soft);
}
.quota-card .quota-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.quota-card .quota-role { font-size: 11px; color: var(--muted); }
.quota-card .quota-value { font-size: 22px; font-weight: 700; letter-spacing: -0.03em; }
.quota-card .quota-value small { font-size: 12px; color: var(--faint); font-weight: 500; }
.quota-card p { color: var(--muted); font-size: 11px; margin: 6px 0 0; line-height: 1.5; }
.quota-card .btn { margin-top: 10px; width: 100%; }
.quota-bar { height: 4px; border-radius: 999px; background: var(--soft-3); overflow: hidden; margin-top: 10px; }
.quota-bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 550;
  padding: 8px 13px;
  transition: all 0.15s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:hover { background: var(--soft); border-color: #d4d4d8; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-blue { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn-blue:hover { background: #1d4ed8; border-color: #1d4ed8; }
.btn-danger { color: var(--red); border-color: #fecaca; background: #fff; }
.btn-danger:hover { background: var(--red-soft); border-color: #fca5a5; }
.btn-sm { padding: 5px 9px; font-size: 11.5px; border-radius: 7px; }
.btn-lg { padding: 10px 16px; font-size: 13px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-icon { width: 32px; height: 32px; padding: 0; }

/* ------------------------------------------------------------------ pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 26px 0 10px;
  flex-wrap: wrap;
}
.page-btn {
  min-width: 30px;
  height: 30px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  text-decoration: none;
}
.page-btn:hover { background: var(--soft-2); color: var(--text); }
.page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.page-btn.disabled { opacity: 0.35; pointer-events: none; }
.page-gap { color: var(--faint); padding: 0 2px; }
.page-info { color: var(--faint); font-size: 11px; margin-left: 8px; }

/* ------------------------------------------------------------------ empty states */
.empty-state {
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 24px;
  text-align: center;
  color: var(--muted);
  background: var(--soft);
}
.empty-state h3 { margin: 0 0 6px; color: var(--text); font-size: 15px; letter-spacing: -0.01em; }
.empty-state p { margin: 0 auto 16px; font-size: 12.5px; max-width: 420px; line-height: 1.6; }
.empty-icon { font-size: 26px; margin-bottom: 12px; color: var(--faint); }
.loading { padding: 32px; text-align: center; color: var(--faint); font-size: 12px; }
.skeleton {
  background: linear-gradient(90deg, var(--soft-2) 25%, #fafafa 37%, var(--soft-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 6px;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ------------------------------------------------------------------ spinner */
.spinner {
  width: 22px; height: 22px; border: 2px solid var(--border); border-top-color: var(--text);
  border-radius: 50%; animation: spin 0.7s linear infinite; margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ auth */
.auth-wrap { max-width: 420px; margin: 34px auto 40px; }
.auth-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  background: #fff;
}
.auth-head { text-align: center; margin-bottom: 22px; }
.auth-head h1 { font-size: 22px; letter-spacing: -0.03em; margin: 0 0 6px; }
.auth-head p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 550; color: var(--text-soft); margin-bottom: 6px; }
.form-input, .form-select, .form-textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  padding: 9px 11px;
  font-size: 13px;
  outline: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: #a1a1aa;
  box-shadow: none;
}
.form-hint { color: var(--faint); font-size: 10.5px; margin-top: 5px; line-height: 1.5; }
.form-error { color: var(--red); font-size: 11px; margin-top: 5px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.code-input {
  font-family: var(--mono);
  font-size: 26px;
  letter-spacing: 8px;
  text-align: center;
  padding: 12px;
}
.auth-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 14px; font-size: 12px; color: var(--muted); }
.auth-links a { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.auth-divider { display: flex; align-items: center; gap: 10px; color: var(--faint); font-size: 10.5px; margin: 18px 0; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border-soft); }
.auth-foot { text-align: center; color: var(--faint); font-size: 11px; margin-top: 18px; line-height: 1.6; }
.auth-note { background: var(--soft); border: 1px solid var(--border-soft); border-radius: 10px; padding: 10px 12px; font-size: 11px; color: var(--muted); line-height: 1.6; margin-top: 16px; }

/* ------------------------------------------------------------------ alerts / flash */
.alert {
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.55;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert-error { background: var(--red-soft); color: #991b1b; border-color: #fecaca; }
.alert-ok { background: var(--green-soft); color: #065f46; border-color: #a7f3d0; }
.alert-info { background: var(--blue-soft); color: #1e40af; border-color: #bfdbfe; }
.alert-warn { background: var(--amber-soft); color: #92400e; border-color: #fde68a; }
.flash {
  max-width: var(--max);
  margin: 14px auto -12px;
  padding: 0 28px;
}
.flash .alert { margin: 0; }

/* ------------------------------------------------------------------ cards / sections */
.section-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 0 0 14px; }
.section-title h2 { margin: 0; font-size: 16px; letter-spacing: -0.02em; }
.section-title p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
}
.panel-pad { padding: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border-soft); }
.panel-head h2, .panel-head h3 { margin: 0; font-size: 13.5px; letter-spacing: -0.01em; }
.panel-body { padding: 16px 18px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 11.5px; }
.mono { font-family: var(--mono); }
.nowrap { white-space: nowrap; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }

/* ------------------------------------------------------------------ account */
.account-head { display: flex; align-items: center; gap: 16px; margin-bottom: 26px; }
.account-head .avatar { width: 46px; height: 46px; font-size: 16px; }
.account-head h1 { margin: 0; font-size: 22px; letter-spacing: -0.03em; }
.account-head p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.account-grid { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 24px; align-items: start; }
.account-side { position: sticky; top: 86px; }
.account-nav { display: flex; flex-direction: column; gap: 2px; }
.account-nav a { padding: 8px 10px; border-radius: 7px; color: var(--muted); font-size: 12.5px; }
.account-nav a:hover { background: var(--soft-2); color: var(--text); }
.account-nav a.active { background: var(--soft-2); color: var(--text); font-weight: 600; }
.quota-big { font-size: 30px; font-weight: 700; letter-spacing: -0.04em; }
.quota-big small { font-size: 13px; color: var(--faint); font-weight: 500; }
.stat-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border-soft); font-size: 12px; }
.stat-row:last-child { border-bottom: 0; }
.stat-row span { color: var(--muted); }
.stat-row b { font-weight: 600; }
.session-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-soft); align-items: flex-start; }
.session-item:last-child { border-bottom: 0; }
.session-icon { width: 30px; height: 30px; border-radius: 8px; background: var(--soft-2); display: flex; align-items: center; justify-content: center; color: var(--muted); flex-shrink: 0; }
.session-main { flex: 1; min-width: 0; }
.session-main b { font-size: 12px; }
.session-main p { margin: 2px 0 0; color: var(--faint); font-size: 10.5px; }
.session-current { font-size: 9px; background: var(--green-soft); color: var(--green); border-radius: 4px; padding: 1px 5px; margin-left: 5px; }
.ua { font-size: 10px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 380px; }

/* ------------------------------------------------------------------ basket */
.basket-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 40px; align-items: start; }
.basket-list { border-top: 1px solid var(--border-soft); }
.basket-row { display: flex; align-items: center; gap: 14px; padding: 14px 2px; border-bottom: 1px solid var(--border-soft); }
.basket-row .basket-main { flex: 1; min-width: 0; }
.basket-row h3 { margin: 0; font-size: 14px; letter-spacing: -0.01em; }
.basket-row p { margin: 3px 0 0; color: var(--faint); font-size: 11px; }
.basket-summary { position: sticky; top: 86px; }
.summary-line { display: flex; justify-content: space-between; padding: 7px 0; font-size: 12px; color: var(--muted); }
.summary-line b { color: var(--text); }
.summary-total { border-top: 1px solid var(--border-soft); margin-top: 6px; padding-top: 12px; }

/* ------------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 12px; }
.table th {
  text-align: left;
  font-weight: 550;
  color: var(--faint);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  background: var(--soft);
}
.table td { padding: 9px 10px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #fcfcfc; }
.table .actions { display: flex; gap: 5px; justify-content: flex-end; }
.table code { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.table .email { font-weight: 550; color: var(--text-soft); }
.table .num { font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------------ admin */
.admin-layout { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 36px; align-items: start; }
.admin-side { position: sticky; top: 86px; }
.admin-side-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); margin: 0 0 10px; padding: 0 10px; }
.admin-nav { display: flex; flex-direction: column; gap: 2px; }
.admin-nav a { padding: 7px 10px; border-radius: 7px; color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 8px; }
.admin-nav a:hover { background: var(--soft-2); color: var(--text); }
.admin-nav a.active { background: var(--soft-2); color: var(--text); font-weight: 600; }
.admin-nav svg { opacity: 0.7; }
.admin-main { min-width: 0; }
.admin-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.admin-head h1 { margin: 0; font-size: 21px; letter-spacing: -0.03em; }
.admin-head p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.stat-card { border: 1px solid var(--border); border-radius: 12px; padding: 14px 15px; background: #fff; }
.stat-card .stat-label { color: var(--faint); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-card .stat-value { font-size: 23px; font-weight: 700; letter-spacing: -0.035em; margin-top: 3px; font-variant-numeric: tabular-nums; }
.stat-card .stat-sub { color: var(--faint); font-size: 10.5px; margin-top: 3px; }
.stat-card.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.stat-card.accent .stat-label, .stat-card.accent .stat-sub { color: rgba(255,255,255,0.55); }
.chart { display: flex; align-items: flex-end; gap: 6px; height: 120px; padding: 8px 2px 0; }
.chart-bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; height: 100%; }
.chart-bar .bar { width: 100%; max-width: 26px; background: var(--soft-3); border-radius: 3px 3px 0 0; min-height: 2px; transition: background 0.15s; }
.chart-bar:hover .bar { background: var(--text); }
.chart-bar .bar-label { font-size: 8.5px; color: var(--faint); white-space: nowrap; transform: rotate(-35deg); transform-origin: top center; height: 14px; }
.chart-bar .bar-count { font-size: 9px; color: var(--muted); }
.admin-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.admin-tabs a { padding: 8px 12px; color: var(--muted); font-size: 12.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.admin-tabs a.active { color: var(--text); border-bottom-color: var(--text); font-weight: 600; }
.progress { height: 6px; background: var(--soft-3); border-radius: 999px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width 0.4s; }
.index-log:empty::before { content: "Журнал пуст — запустите индексацию."; color: #71717a; }
.index-log {
  background: #18181b;
  color: #d4d4d8;
  border-radius: 9px;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.7;
  max-height: 240px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.checkbox-row { display: flex; align-items: flex-start; gap: 9px; padding: 9px 0; }
.checkbox-row input { margin-top: 2px; accent-color: var(--accent); }
.checkbox-row label { font-size: 12px; color: var(--text-soft); }
.checkbox-row p { margin: 2px 0 0; color: var(--faint); font-size: 10.5px; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; }
.input-compact { padding: 5px 8px; font-size: 11.5px; border-radius: 7px; }
.mfr-table-wrap { max-height: 540px; overflow: auto; border: 1px solid var(--border-soft); border-radius: 9px; }
.mfr-table { font-size: 11.5px; }
.mfr-table thead th { position: sticky; top: 0; z-index: 2; background: var(--soft); }
.mfr-table td { padding: 5px 7px; }
.mfr-table .actions { white-space: nowrap; }
.mfr-table .mfr-code { font-family: var(--mono); font-size: 11px; background: var(--soft); }
.mfr-table tr.mfr-used .mfr-code { background: var(--blue-soft); border-color: #bfdbfe; }
.mfr-count { color: var(--faint); font-size: 9.5px; margin-top: 2px; }

/* ------------------------------------------------------------------ footer */
.footer {
  border-top: 1px solid var(--border-soft);
  margin-top: 30px;
  padding: 22px 28px 34px;
  color: var(--faint);
  font-size: 10.5px;
}
.footer-inner { max-width: var(--max); margin: 0 auto; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer a { color: var(--muted); }
.footer a:hover { color: var(--text); }

/* ------------------------------------------------------------------ toast */
#toast-host {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 9px 16px;
  font-size: 12px;
  box-shadow: none;
  animation: toastIn 0.2s ease;
  max-width: min(520px, 90vw);
  text-align: center;
}
.toast.error { background: #991b1b; }
.toast.ok { background: #065f46; }
@keyframes toastIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1180px) {
  .catalog-layout { grid-template-columns: 200px 325px minmax(0, 1fr); gap: 20px; }
  .topnav { gap: 14px; }
  .brand-sub { display: none; }
}
@media (max-width: 900px) {
  .page { padding: 24px 18px 48px; }
  .catalog-layout { grid-template-columns: 1fr; gap: 26px; }
  .sidebar { position: static; order: 0; }
  .results { order: 1; }
  .sidebar .quota-card, .sidebar > div:last-child { display: none; }
  .filter-pill.mobile-extra { display: none; }
  .detail-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(440px, 100vw);
    height: 100dvh;
    max-height: 100dvh;
    z-index: 120;
    background: #fff;
    padding: 10px;
    overflow: auto;
    transform: translateX(105%);
    transition: transform 0.22s ease;
    box-shadow: none;
  }
  .detail-panel.open { transform: none; }
  body.detail-open { overflow: hidden; }
  .detail-placeholder { display: none; }
  .detail-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 119;
    background: rgba(24, 24, 27, 0.28);
    backdrop-filter: blur(2px);
  }
  .detail-backdrop.open { display: block; }
  .admin-layout { grid-template-columns: 1fr; gap: 18px; }
  .admin-side { position: static; }
  .admin-nav { flex-direction: row; flex-wrap: wrap; }
  .admin-side-title { display: none; }
  .account-grid, .basket-layout { grid-template-columns: 1fr; }
  .account-side, .basket-summary { position: static; }
  .modal-body { display: block; }
  .modal-image { min-height: 180px; margin-bottom: 16px; }
  .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .topbar-inner { padding: 0 16px; gap: 12px; height: 56px; }
  .topnav { gap: 12px; }
  .topnav a:not(.nav-cart) { display: none; }
  .header-right .quota-chip { display: none; }
  .user-chip-name { display: none; }
  .search-area { margin-top: 0; }
  .search-form { height: 46px; }
  .search-sort { display: none; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .modal { max-height: 92vh; }
  .modal-body { padding: 16px; gap: 16px; }
  .detail-grid { grid-template-columns: 1fr; }
  .footer-inner { flex-direction: column; }
}

/* ------------------------------------------------------------------ i18n */
html { zoom: 1.25; }
.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;
}
.lang-select select {
  height: 30px;
  max-width: 112px;
  padding: 0 22px 0 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}
.lang-select select:hover { border-color: var(--faint); color: var(--text); }
.auth-link { font-size: 12px; color: var(--muted); }
.auth-link:hover { color: var(--text); }

/* ------------------------------------------------------------------ portal */
.portal-body {
  background:
    radial-gradient(900px 420px at 50% -120px, #f4f4f5 0%, rgba(244, 244, 245, 0) 70%),
    var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.portal-page {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 70px 28px 90px;
  flex: 1;
}
.portal-hero { text-align: center; max-width: 760px; margin: 0 auto; }
.portal-hero-mark {
  width: 62px;
  height: 62px;
  margin: 0 auto 22px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 18px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: none;
}
.portal-hero-mark svg { width: 38px; height: 38px; }
.portal-eyebrow {
  margin: 0 0 14px;
  color: var(--faint);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.portal-hero h1 {
  margin: 0 0 18px;
  font-size: clamp(28px, 4.2vw, 46px);
  line-height: 1.12;
  letter-spacing: -0.045em;
}
.portal-notice {
  margin: 0 auto;
  max-width: 680px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}
.portal-actions { max-width: 720px; margin: 42px auto 0; }
.portal-primary {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px 24px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  background: var(--accent);
  color: #fff;
  box-shadow: none;
  transition: transform 0.15s ease, background 0.15s ease;
}
.portal-primary:hover { transform: translateY(-2px); background: var(--accent-hover); }
.portal-primary-icon {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}
.portal-primary-icon svg { width: 28px; height: 28px; }
.portal-primary-text { display: flex; flex-direction: column; gap: 4px; text-align: left; }
.portal-primary-text b { font-size: 17px; letter-spacing: -0.02em; }
.portal-primary-text small { color: rgba(255, 255, 255, 0.66); font-size: 12px; line-height: 1.45; }
.portal-arrow { margin-left: auto; font-size: 24px; color: rgba(255, 255, 255, 0.8); }
.portal-secondary { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.portal-stub {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  padding: 16px 18px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  background: rgba(250, 250, 250, 0.7);
  color: var(--muted);
  cursor: not-allowed;
}
.portal-stub b { color: var(--text-soft); font-size: 13px; }
.portal-stub .badge { margin-left: auto; white-space: nowrap; }
.portal-stub-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--soft-2);
  color: var(--faint);
  font-size: 18px;
  flex-shrink: 0;
}
.portal-body .footer { margin-top: auto; }

@media (max-width: 680px) {
  .portal-page { padding: 42px 16px 60px; }
  .portal-secondary { grid-template-columns: 1fr; }
  .portal-primary { padding: 18px; gap: 13px; }
  .portal-primary-text small { display: none; }
  .lang-select select { max-width: 88px; }
}

/* ------------------------------------------------------------------ header v2 */
.topbar-edz {
  max-width: 1560px;
  height: 64px;
  padding: 0 22px;
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(280px, 460px) minmax(300px, 1fr);
  align-items: center;
  gap: 18px;
}
.brand-path {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.brand-portal {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}
.portal-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  display: block;
}
.brand-sep {
  color: var(--border);
  font-size: 20px;
  font-weight: 300;
  line-height: 1;
}
.brand-service {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
  white-space: nowrap;
  min-width: 0;
}
.brand-service .brand-mark { width: 23px; height: 23px; }
.topbar-search {
  width: 100%;
  max-width: 460px;
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--soft-2);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.topbar-search:focus-within {
  background: #fff;
  border-color: var(--border);
  box-shadow: none;
}
.topbar-search .search-icon { color: var(--faint); }
.topbar-search-input {
  flex: 1;
  min-width: 0;
  height: 34px;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13px;
}
.topbar-search-input::placeholder { color: var(--faint); }
.topbar-edz .header-right {
  justify-self: end;
  margin-left: 0;
  gap: 8px;
}
.topbar-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.topbar-link:hover { color: var(--text); background: var(--soft-2); }
.topbar-icon-img { width: 17px; height: 17px; object-fit: contain; display: block; }
.topbar-link .cart-badge { margin-left: -2px; }
.results-meta {
  margin: 0 0 10px 2px;
  color: var(--faint);
  font-size: 11px;
}
.mfr-flag { font-size: 13px; line-height: 1; }

/* user menu */
.user-menu { position: relative; }
.user-chip-button {
  background: none;
  border: 1px solid transparent;
  cursor: pointer;
  font: inherit;
}
.user-chip-button[aria-expanded="true"] {
  background: var(--soft-2);
  border-color: var(--border-soft);
}
.user-chevron { color: var(--faint); flex-shrink: 0; }
.user-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 120;
  min-width: 195px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: none;
}
.user-dropdown[hidden] { display: none; }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}
.dropdown-item:hover { background: var(--soft-2); color: var(--text); }
.dropdown-button { font: inherit; }
.dropdown-icon { width: 15px; height: 15px; object-fit: contain; display: block; opacity: 0.8; }
.user-dropdown form { margin: 0; }

/* language menu */
.lang-menu { position: relative; }
.lang-button {
  list-style: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
  user-select: none;
}
.lang-button::-webkit-details-marker { display: none; }
.lang-button::marker { content: ""; }
.lang-flag { font-size: 15px; line-height: 1; }
.lang-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 120;
  min-width: 165px;
  padding: 6px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: none;
}
.lang-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text-soft);
  font-size: 12px;
  white-space: nowrap;
}
.lang-item:hover, .lang-item.active { background: var(--soft-2); color: var(--text); }
.portal-body .topbar-inner { height: 64px; }
.portal-body .topnav { gap: 16px; }
.portal-body .topnav a { display: inline-flex; align-items: center; gap: 5px; }
.portal-hero-mark img { width: 44px; height: 44px; object-fit: contain; }

@media (max-width: 1150px) {
  .topbar-edz {
    grid-template-columns: minmax(170px, 1fr) minmax(240px, 400px) minmax(280px, 1fr);
    gap: 12px;
  }
  .topbar-link-label { display: none; }
  .topbar-link { padding: 5px; }
}
@media (max-width: 900px) {
  .topbar-edz {
    height: auto;
    min-height: 60px;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    padding: 10px 16px;
    gap: 8px 12px;
  }
  .topbar-edz .brand-path { grid-column: 1; grid-row: 1; }
  .topbar-edz .header-right { grid-column: 2; grid-row: 1; }
  .topbar-edz .topbar-search { grid-column: 1 / -1; grid-row: 2; max-width: none; }
  .portal-body .topbar-inner { height: auto; min-height: 60px; padding: 10px 16px; flex-wrap: wrap; }
  .portal-body .topnav { order: 3; width: 100%; margin-left: 0; padding-top: 2px; }
}

@media (max-width: 1350px) {
  .topbar-link-label,
  .user-chip-name { display: none; }
  .topbar-link { padding: 5px; }
  .topbar-edz { grid-template-columns: minmax(170px, 1fr) minmax(240px, 460px) minmax(250px, 1fr); }
}
@media (max-width: 1200px) {
  .topbar-edz { grid-template-columns: minmax(160px, 1fr) minmax(220px, 400px) minmax(230px, 1fr); }
}

.auth-link,
.header-right > .btn,
.header-right { flex-shrink: 0; }
.auth-link,
.header-right > .btn { white-space: nowrap; }
.topbar-edz .header-right { flex-wrap: nowrap; }
@media (max-width: 1500px) {
  .topbar-link-label,
  .user-chip-name { display: none; }
  .topbar-link { padding: 5px; }
  .topbar-edz { grid-template-columns: minmax(170px, 1fr) minmax(240px, 460px) minmax(250px, 1fr); }
}
@media (max-width: 1100px) {
  .topbar-edz { grid-template-columns: minmax(150px, 1fr) minmax(220px, 400px) auto; }
}

/* icon-only header actions and truly centred search */
.topbar-edz {
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
}
.topbar-search {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(460px, 38vw);
  max-width: none;
  margin: 0;
  z-index: 1;
}
.topbar-edz .header-right {
  margin-left: auto;
  position: relative;
  z-index: 2;
}
.topbar-link-label { display: none !important; }
.topbar-link { padding: 5px; }
@media (max-width: 900px) {
  .topbar-edz { flex-wrap: wrap; height: auto; min-height: 60px; padding: 10px 16px; }
  .topbar-search {
    position: static;
    transform: none;
    order: 3;
    flex: 1 0 100%;
    width: 100%;
  }
}
@media (min-width: 1301px) {
  .user-chip-name { display: inline; }
}
@media (max-width: 1100px) and (min-width: 901px) {
  .topbar-search { width: min(360px, 34vw); }
}

.user-chip-name { display: inline; }
.topbar-search { width: min(420px, 34vw); }
@media (max-width: 1300px) {
  .topbar-search { width: min(320px, 30vw); }
}
@media (max-width: 680px) {
  .user-chip-name { display: none; }
}

.login-button { height: 32px; padding: 0 14px; }
.auth-register-hint {
  margin: 16px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
.auth-register-hint a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ------------------------------------------------------------------ compact header refinements */
.portal-logo { width: 23px; height: 23px; }
.portal-body .topbar-inner {
  max-width: 1560px;
  height: 64px;
  padding: 0 22px;
  gap: 18px;
}
.portal-body .brand { gap: 9px; }
.portal-body .topnav { gap: 14px; }
.portal-body .topnav a { font-size: 12px; }
.quota-chip {
  height: 28px;
  padding: 0 9px;
  font-size: 11px;
  line-height: 1;
  box-sizing: border-box;
}
.lang-button {
  width: 34px;
  height: 28px;
  box-sizing: border-box;
}
.lang-flag { font-size: 13px; }
.lang-dropdown {
  min-width: 148px;
  padding: 5px;
  border-radius: 10px;
  box-shadow: none;
}
.lang-item {
  font-size: 11px;
  padding: 7px 9px;
  gap: 8px;
  border-radius: 7px;
}
.user-chip {
  gap: 7px;
  padding: 3px 8px 3px 3px;
  max-width: 200px;
}
.avatar { width: 24px; height: 24px; font-size: 10px; }
.user-chip-name { font-size: 11px; }
.user-chevron { width: 9px; height: 9px; }
.user-dropdown {
  min-width: 168px;
  padding: 5px;
  border-radius: 10px;
  box-shadow: none;
}
.dropdown-item {
  font-size: 11px;
  padding: 7px 9px;
  gap: 8px;
  border-radius: 7px;
}
.dropdown-button {
  font-family: inherit;
  font-size: 11px;
  line-height: 1.5;
}
.dropdown-icon { width: 14px; height: 14px; }
.portal-page { padding-top: 54px; }
.portal-hero h1 { font-size: clamp(26px, 3.6vw, 40px); }
.portal-notice { font-size: 14px; }
.portal-primary { padding: 19px 22px; }
.portal-primary-text b { font-size: 16px; }

/* ------------------------------------------------------------------ compact layout (10–15% denser) */
.page { padding-top: 26px; padding-bottom: 52px; }
.catalog-layout { gap: 20px; }
.result-list { gap: 8px; }
.result-card { padding: 9px; gap: 5px; min-height: 102px; border-radius: 10px; }
.sidebar { gap: 20px; }
.sidebar-heading { margin-bottom: 7px; }
.filter-pills { gap: 5px; }
.filter-pill { padding: 5px 8px; font-size: 11px; }
.quota-card { padding: 12px; }
.panel-head { padding: 12px 16px; }
.panel-body { padding: 14px 16px; }
.panel-pad { padding: 16px; }
.stack { gap: 12px; }
.basket-layout { gap: 28px; }
.account-grid { gap: 18px; }
.account-head { margin-bottom: 18px; }

/* ------------------------------------------------------------------ responsive header */
@media (max-width: 1500px) {
  .user-chip-name { display: none; }
}
@media (max-width: 1250px) {
  .topbar-edz { display: flex; gap: 12px; }
  .topbar-search {
    position: static;
    transform: none;
    flex: 1 1 220px;
    width: auto;
    min-width: 150px;
    max-width: 360px;
    margin: 0 auto;
  }
  .quota-detail { display: none; }
  .quota-chip { padding: 0 9px; }
}

@media (max-width: 900px) {
  .topbar-edz {
    flex-wrap: wrap;
    height: auto;
    min-height: 60px;
    padding: 10px 16px;
    gap: 8px 12px;
  }
  .topbar-search {
    order: 3;
    flex: 1 0 100%;
    width: 100%;
    max-width: none;
    min-width: 0;
    margin: 0;
  }
}

/* ------------------------------------------------------------------ tighter catalogue/detail layout */
.page { padding-top: 18px; padding-bottom: 40px; }
.catalog-layout { gap: 14px; }
.result-list { gap: 6px; }
.result-card { padding: 8px; gap: 4px; min-height: 92px; }
.sidebar { gap: 16px; top: 76px; }
.sidebar-heading { margin-bottom: 6px; }
.sidebar-input { padding: 7px 9px; margin-bottom: 6px; font-size: 11.5px; }
.filter-pills { max-height: 210px; gap: 5px; }
.filter-pill { padding: 4px 7px; font-size: 10.5px; gap: 5px; border-radius: 8px; }
.filter-pill .count { font-size: 9.5px; padding: 0 4px; }
.sidebar-select { padding: 7px 28px 7px 10px; font-size: 11.5px; }
.quota-card { padding: 10px; }
.quota-card .quota-value { font-size: 20px; }
.quota-card p { font-size: 10.5px; line-height: 1.45; margin-top: 4px; }
.quota-card .btn { margin-top: 7px; }
.quota-bar { margin-top: 7px; }
.detail-panel { top: 76px; max-height: calc(100vh - 88px); }
.detail-header { padding: 12px 14px 10px; }
.detail-header h2 { font-size: 17px; }
.detail-header .sub { font-size: 10.5px; margin-top: 2px; }
.detail-body { padding: 10px 14px; }
.detail-image { min-height: 150px; padding: 8px; margin-bottom: 10px; border-radius: 9px; }
.detail-image img { max-height: 180px; }
.detail-image .noimg { font-size: 10.5px; padding: 12px; }
.detail-desc { font-size: 12.5px; line-height: 1.5; }
.detail-desc2 { font-size: 11px; margin-bottom: 8px; }
.detail-grid { padding-top: 2px; margin-top: 7px; gap: 0 14px; }
.detail-row { padding: 4px 0; font-size: 10.5px; }
.detail-tags { margin-top: 8px; gap: 4px; }
.detail-actions { padding: 9px 14px; gap: 6px; }
.detail-actions .btn { height: 34px; }
.detail-close { width: 25px; height: 25px; font-size: 15px; }
@media (min-width: 901px) {
  .detail-content {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 88px);
  }
  .detail-header, .detail-actions { flex: 0 0 auto; }
  .detail-body { overflow-y: auto; min-height: 0; }
}

/* keep the whole filter/quota block visible on common laptop heights */
.sidebar { gap: 12px; }
.filter-pills { max-height: 160px; }
.quota-card { padding: 9px; }
.quota-card p {
  font-size: 10px;
  line-height: 1.35;
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.quota-card .btn { margin-top: 6px; }

/* ------------------------------------------------------------------ portal spacing */
.portal-secondary { margin-top: 30px; }

/* ------------------------------------------------------------------ mobile item card */
@media (max-width: 900px) {
  .detail-panel {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    top: 0;
    right: 0;
    bottom: 0;
    padding: 0;
    overflow: hidden;
    border-radius: 0;
  }
  .detail-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    border: 0;
    border-radius: 0;
  }
  .detail-header {
    flex: 0 0 auto;
    padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  }
  .detail-header h2 { font-size: 16px; }
  .detail-close { width: 28px; height: 28px; }
  .detail-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 10px 14px;
  }
  .detail-image {
    min-height: 120px;
    max-height: 170px;
    padding: 6px;
    margin-bottom: 8px;
  }
  .detail-image img {
    max-height: 150px;
    max-width: 100%;
    width: auto;
  }
  .detail-actions {
    position: sticky;
    bottom: 0;
    flex: 0 0 auto;
    padding: 8px 14px calc(8px + env(safe-area-inset-bottom));
    background: #fff;
    box-shadow: none;
  }
  .detail-actions .btn { flex: 1; }
  .detail-grid { grid-template-columns: 1fr; gap: 0; }
}
.portal-body .header-right { margin-left: auto; }

@media (max-width: 900px) {
  .detail-panel {
    left: 0;
    right: 0;
    width: auto;
    max-width: none;
  }
  .detail-content,
  .detail-body,
  .detail-actions {
    width: 100%;
    box-sizing: border-box;
  }
  .detail-header > div { min-width: 0; flex: 1; }
  .detail-header h2 { overflow-wrap: anywhere; }
  .detail-image { width: 100%; box-sizing: border-box; }
}

@media (max-width: 900px) {
  .detail-panel {
    height: auto;
    max-height: none;
  }
}

@media (max-width: 900px) {
  .detail-panel {
    top: 0;
    bottom: auto;
    height: 100vh;
    max-height: 100vh;
  }
}

@media (max-width: 900px) {
  .detail-actions {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 130;
    padding: 8px 14px calc(8px + env(safe-area-inset-bottom));
    background: #fff;
    box-shadow: none;
  }
  .detail-panel:not(.open) .detail-actions { display: none; }
  .detail-body { padding-bottom: 92px; }
}

@media (max-width: 900px) {
  .detail-panel { transition: none; }
}

/* ------------------------------------------------------------------ help / FAQ */
.help-page { max-width: 820px; margin: 0 auto; }
.help-header { margin-bottom: 22px; }
.help-header h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -0.035em; }
.help-header p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.help-faq h2 { margin: 0 0 10px; font-size: 15px; letter-spacing: -0.02em; }
.faq-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  margin-bottom: 7px;
  overflow: hidden;
}
.faq-item summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::marker { content: ""; }
.faq-toggle {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--soft-2);
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
  line-height: 16px;
  text-align: center;
  transition: transform 0.15s;
}
.faq-item[open] .faq-toggle { transform: rotate(180deg); }
.faq-answer {
  padding: 0 14px 14px;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.65;
}
.faq-answer p { margin: 0 0 8px; }
.faq-answer p:last-child { margin-bottom: 0; }
.faq-answer .help-note { color: var(--muted); }
.help-steps { margin: 6px 0 10px; padding-left: 20px; }
.help-steps li { margin-bottom: 4px; }
.help-source {
  display: inline-block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.help-source:hover { color: var(--text); }
.help-request { margin-top: 14px; }
.help-request-head { padding: 14px 16px 0; }
.help-request-head h2 { margin: 0 0 4px; font-size: 15px; letter-spacing: -0.02em; }
.help-request-head p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.help-request-form { padding: 10px 16px 14px; }
.help-request-form label { display: block; margin-bottom: 5px; font-size: 11.5px; font-weight: 600; }
.help-form-row { display: flex; gap: 8px; }
.help-form-row input {
  flex: 1;
  min-width: 0;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 11px;
  font-size: 12px;
  background: #fff;
}
.help-form-row input:focus { outline: 2px solid rgba(24, 24, 27, 0.07); border-color: #d4d4d8; }
.help-form-row .btn { height: 38px; white-space: nowrap; }
.help-form-note { margin: 6px 0 0; color: var(--faint); font-size: 10.5px; line-height: 1.45; }
.help-login-prompt { margin: 0; padding: 12px 16px 16px; color: var(--muted); font-size: 12px; }
.help-login-prompt a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }
@media (max-width: 680px) {
  .help-page { max-width: none; }
  .help-form-row { flex-direction: column; }
  .help-form-row .btn { width: 100%; }
}

/* ------------------------------------------------------------------ partner ads */
.portal-partners { margin-top: 34px; }
.portal-partners h2 { margin: 0 0 12px; font-size: 18px; letter-spacing: -0.025em; }
.partner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.partner-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.partner-card:hover {
  border-color: #d4d4d8;
  box-shadow: none;
  transform: translateY(-1px);
}
.partner-stretched-link {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: inherit;
}
.partner-stretched-link:focus-visible { outline: 2px solid rgba(37, 99, 235, 0.4); outline-offset: -2px; }
.partner-cover { position: relative; z-index: 0; aspect-ratio: 16 / 9; background: var(--soft-2); overflow: hidden; }
.partner-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.partner-copy { position: relative; z-index: 2; display: flex; flex-direction: column; gap: 5px; padding: 12px 14px 14px; }
.partner-card--linked .partner-copy { pointer-events: none; }
.partner-card--linked .partner-copy a { pointer-events: auto; position: relative; z-index: 3; }
.partner-copy h3 { margin: 0; font-size: 13.5px; line-height: 1.35; letter-spacing: -0.015em; }
.partner-body { margin: 0; color: var(--muted); font-size: 11.5px; line-height: 1.55; white-space: pre-line; overflow-wrap: anywhere; }
.partner-body a { color: var(--text-soft); text-decoration: underline; text-underline-offset: 2px; }
.partner-body a:hover { color: var(--text); }
.partner-more { margin-top: 4px; color: var(--text-soft); font-size: 11px; font-weight: 600; }
.partner-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.partner-form .form-group { margin-bottom: 10px; }
.partner-form textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 12px;
  resize: vertical;
}
.partner-image-preview img {
  max-width: 220px;
  max-height: 120px;
  object-fit: cover;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: block;
  margin-bottom: 6px;
}
.partner-image-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 88px;
  max-width: 220px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--faint);
  font-size: 11px;
}
.checkline { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--text-soft); }
.partner-form-actions { margin-top: 12px; }
.partner-admin-list { display: flex; flex-direction: column; }
.partner-admin-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-soft);
}
.partner-admin-thumb {
  width: 92px;
  height: 56px;
  border-radius: 7px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--soft-2);
}
.partner-admin-thumb.empty { border: 1px dashed var(--border); }
.partner-admin-info { flex: 1; min-width: 0; }
.partner-admin-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.partner-admin-title b { font-size: 12.5px; }
.partner-admin-info p { margin: 3px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.partner-state {
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 9.5px;
  font-weight: 600;
}
.partner-state-live { background: var(--green-soft); color: #047857; }
.partner-state-scheduled { background: var(--blue-soft); color: #1d4ed8; }
.partner-state-expired { background: var(--soft-2); color: var(--muted); }
.partner-state-off { background: var(--amber-soft); color: #92400e; }
.partner-admin-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.partner-admin-actions form { margin: 0; }
.btn-danger { color: var(--red); border-color: #fecaca; background: #fff; }
.btn-danger:hover { background: var(--red-soft); }
@media (max-width: 680px) {
  .partner-form-grid { grid-template-columns: 1fr; gap: 0; }
  .partner-admin-row { align-items: flex-start; flex-wrap: wrap; }
  .partner-admin-thumb { width: 72px; height: 46px; }
  .partner-admin-info { flex-basis: calc(100% - 84px); }
  .partner-admin-actions { width: 100%; padding-left: 84px; }
}

.partner-copy h3 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.partner-body {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ------------------------------------------------------------------ portal news */
.portal-news { max-width: 860px; margin-top: 32px; }
.portal-news h2 { margin: 0 0 12px; font-size: 18px; letter-spacing: -0.025em; }
.news-feed { display: flex; flex-direction: column; gap: 12px; }
.news-message { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.news-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: #fff;
}
.news-message-main { flex: 1; min-width: 0; }
.news-message-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 4px 3px;
}
.news-message-meta b { color: var(--text); font-size: 11.5px; font-weight: 650; }
.news-message-meta time { color: var(--faint); font-size: 10px; }
.news-bubble {
  position: relative;
  min-width: 0;
  padding: 10px 14px 12px;
  border: 1px solid #e4e4e7;
  border-radius: 14px;
  background: #f7f7f8;
  box-shadow: none;
}
.news-bubble h3 {
  margin: 0 0 5px;
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.35;
  letter-spacing: -0.015em;
}
.news-body {
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.news-body p { margin: 0 0 6px; }
.news-body p:last-child { margin-bottom: 0; }
.news-body a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }
.news-body a:hover { color: var(--accent); }
@media (max-width: 680px) {
  .portal-news { margin-top: 26px; }
  .news-message { gap: 8px; }
  .news-avatar { width: 32px; height: 32px; }
  .news-bubble { padding: 9px 12px 10px; }
}


/* ------------------------------------------------------------------ portal three-column layout */
.portal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 0.82fr);
  gap: 24px;
  align-items: start;
  margin-top: 34px;
}
.portal-column { min-width: 0; }
.portal-column > h2 {
  margin: 0 0 10px;
  font-size: 17px;
  letter-spacing: -0.025em;
}
.portal-column-empty {
  margin: 0;
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--faint);
  font-size: 11.5px;
}
.portal-column-partners .partner-grid { grid-template-columns: 1fr; }
.portal-column-news .news-feed { gap: 10px; }
.portal-column-news .news-avatar { width: 34px; height: 34px; }
.portal-column-news .news-bubble { padding: 9px 12px 10px; }
.portal-column-news .news-bubble h3 { font-size: 13px; }
.portal-column-news .news-body { font-size: 11.5px; }
.news-message--pinned .news-bubble {
  border-color: #fde68a;
  background: #fffdf5;
}
.news-pinned {
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  padding: 1px 6px;
  font-size: 9px;
  font-weight: 600;
  white-space: nowrap;
}
.service-list { display: flex; flex-direction: column; gap: 8px; }
.service-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
a.service-item:hover {
  border-color: #d4d4d8;
  box-shadow: none;
}
.service-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--soft-2);
  color: var(--text);
  font-size: 19px;
  font-weight: 500;
}
.service-icon svg { width: 23px; height: 23px; }
.service-item { min-height: 66px; box-sizing: border-box; }
.service-copy { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.service-copy b { font-size: 12px; line-height: 1.3; }
.service-copy small {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.service-status {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 9px;
  font-weight: 600;
  background: var(--green-soft);
  color: #047857;
}
.service-item-muted { opacity: 0.68; }
@media (max-width: 1100px) {
  .portal-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
  .portal-column-services { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .portal-grid { grid-template-columns: 1fr; gap: 20px; margin-top: 26px; }
  .portal-column-services { grid-column: auto; }
  .service-list { display: flex; }
}

/* ------------------------------------------------------------------ wide portal dashboard */
.portal-page {
  max-width: 1560px;
  padding-left: 24px;
  padding-right: 24px;
}
.portal-grid {
  grid-template-columns: 260px minmax(0, 1fr) 200px;
  gap: 20px;
  margin-top: 30px;
}
.portal-column-partners .partner-cover { aspect-ratio: 4 / 3; }
.portal-column-partners .partner-copy { padding: 9px 10px 10px; gap: 3px; }
.portal-column-partners .partner-copy h3 { font-size: 12px; }
.portal-column-partners .partner-body { font-size: 10.5px; line-height: 1.45; }
.portal-column-partners .partner-more { font-size: 10px; }
.portal-column-partners .partner-grid { gap: 8px; }
.portal-column-news .news-feed { gap: 9px; }
.portal-column-news .news-bubble { max-width: 100%; }
.portal-column-services .service-item { min-height: 62px; }
@media (max-width: 1100px) {
  .portal-grid { grid-template-columns: minmax(0, 1fr) 220px; }
  .portal-column-services { grid-column: 1 / -1; order: -1; }
  .portal-column-news { grid-column: 1; order: 0; }
  .portal-column-partners { grid-column: 2; order: 0; }
}
@media (max-width: 760px) {
  .portal-grid { grid-template-columns: 1fr; }
  .portal-column-services,
  .portal-column-news,
  .portal-column-partners { grid-column: auto; }
}

@media (min-width: 1101px) {
  .portal-grid { grid-template-columns: 260px minmax(0, 1fr) 200px; }
}

/* ------------------------------------------------------------------ partner text must never be clipped */
.partner-copy h3,
.partner-body {
  display: block;
  overflow: visible;
  -webkit-line-clamp: unset;
}

/* Services are the primary feature: on narrow layouts they go above the rest. */
@media (max-width: 1100px) {
  .portal-column-services {
    order: -1;
    grid-column: 1 / -1;
  }
  .portal-column-partners,
  .portal-column-news { order: 0; }
}
@media (max-width: 760px) {
  .portal-column-services { grid-column: auto; }
}

/* ------------------------------------------------------------------ portal wordmark */
@font-face {
  font-family: "ISOCPEUR";
  src: url("/static/fonts/isocpeur.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}
.portal-wordmark {
  font-family: "ISOCPEUR", "Isocpeur", Arial, sans-serif;
  font-weight: normal;
  font-size: 17px;
  letter-spacing: 0;
  color: var(--text);
  text-transform: lowercase;
}
.portal-wordmark .brand-sub {
  display: inline;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  margin-left: 0;
}

/* ------------------------------------------------------------------ portal chat */
.portal-column-chat { min-width: 0; }
.chat-shell {
  display: grid;
  grid-template-columns: 154px minmax(0, 1fr);
  height: 560px;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  box-shadow: none;
}
.chat-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  overflow-y: auto;
  padding: 10px 8px;
  border-right: 1px solid var(--border-soft);
  background: #fafafa;
}
.chat-side-heading { padding: 2px 4px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--faint); }
.chat-room-group h3 { margin: 0 0 5px 4px; color: var(--faint); font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.chat-room-list { display: flex; flex-direction: column; gap: 2px; }
.chat-room {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  min-width: 0;
  padding: 7px 7px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft);
  text-align: left;
  cursor: pointer;
}
.chat-room:hover { background: #f0f0f1; }
.chat-room.active { background: #eef2ff; color: var(--text); }
.chat-room-title { display: flex; align-items: center; gap: 3px; width: 100%; font-size: 10.5px; font-weight: 650; line-height: 1.25; }
.chat-room-pin { font-size: 8px; }
.chat-room-last { width: 100%; overflow: hidden; color: var(--faint); font-size: 9.5px; line-height: 1.35; text-overflow: ellipsis; white-space: nowrap; }
.chat-sidebar-note { margin-top: auto; padding: 8px 4px; color: var(--faint); font-size: 9.5px; line-height: 1.45; }
.chat-sidebar-note a { color: var(--text); text-decoration: underline; }
.chat-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-soft);
  background: #fff;
}
.chat-header b { display: block; font-size: 12px; line-height: 1.3; }
.chat-header span { display: block; margin-top: 1px; color: var(--faint); font-size: 9.5px; }
.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 12px 8px;
  background: #fff;
  scroll-behavior: smooth;
}
.chat-loading, .chat-empty { padding: 30px 12px; color: var(--faint); font-size: 11px; text-align: center; }
.chat-msg { display: flex; align-items: flex-end; gap: 7px; margin: 0 0 11px; max-width: 92%; }
.chat-msg-own { margin-left: auto; flex-direction: row-reverse; }
.chat-msg-avatar {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 50%;
  background: var(--soft-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}
.chat-msg-avatar img { width: 100%; height: 100%; object-fit: cover; }
.chat-msg-content { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.chat-msg-own .chat-msg-content { align-items: flex-end; }
.chat-msg-meta { display: flex; align-items: baseline; gap: 5px; margin: 0 3px 3px; color: var(--faint); font-size: 9px; }
.chat-msg-meta b { color: var(--text-soft); font-size: 10px; font-weight: 650; }
.chat-edited { font-size: 8.5px; font-style: italic; }
.chat-bubble {
  max-width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border-soft);
  border-radius: 4px 13px 13px 13px;
  background: var(--soft);
  color: var(--text);
}
.chat-msg-own .chat-bubble {
  border-color: #dbe4ff;
  border-radius: 13px 4px 13px 13px;
  background: #edf2ff;
}
.chat-text { font-size: 11.5px; line-height: 1.5; white-space: pre-line; overflow-wrap: anywhere; }
.chat-quote {
  display: block;
  width: 100%;
  margin: 0 0 5px;
  padding: 3px 7px;
  overflow: hidden;
  border: 0;
  border-left: 2px solid #a5b4fc;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.65);
  color: var(--muted);
  font: inherit;
  font-size: 9.5px;
  line-height: 1.35;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.chat-image { display: block; max-width: 100%; max-height: 260px; margin-top: 6px; border-radius: 8px; object-fit: contain; cursor: zoom-in; }
.chat-link { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; padding: 4px 8px; border: 1px solid var(--border); border-radius: 7px; background: #fff; color: var(--text-soft); font-size: 10px; text-decoration: none; }
.chat-link:hover { border-color: #c7d2fe; color: var(--text); }
.chat-reactions { display: flex; flex-wrap: wrap; gap: 3px; margin: 3px 0 0 2px; }
.chat-reaction { border: 1px solid var(--border-soft); border-radius: 999px; background: #fff; padding: 1px 6px; color: var(--muted); font-size: 10px; line-height: 1.5; cursor: pointer; }
.chat-reaction:hover, .chat-reaction.active { border-color: #c7d2fe; background: #eef2ff; color: var(--text); }
.chat-msg-highlight .chat-bubble { animation: chatHighlight 1s ease; }
@keyframes chatHighlight { 0%, 100% { box-shadow: none; } 35% { box-shadow: none; } }
.chat-composer { padding: 8px 10px 10px; border-top: 1px solid var(--border-soft); background: #fff; }
.chat-reply-preview, .chat-attachment {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  padding: 5px 8px;
  border-left: 2px solid #818cf8;
  border-radius: 4px;
  background: #f5f6ff;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.35;
}
.chat-reply-preview span, .chat-attachment span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-reply-preview button, .chat-attachment button { border: 0; background: transparent; color: var(--faint); font-size: 15px; line-height: 1; cursor: pointer; }
.chat-input {
  display: block;
  width: 100%;
  min-height: 42px;
  max-height: 110px;
  box-sizing: border-box;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 9px;
  color: var(--text);
  font: inherit;
  font-size: 11.5px;
  line-height: 1.45;
}
.chat-input:focus { outline: 2px solid rgba(99, 102, 241, 0.12); border-color: #c7d2fe; }
.chat-toolbar { display: flex; align-items: center; gap: 4px; margin-top: 5px; flex-wrap: wrap; }
.chat-tool { border: 0; border-radius: 6px; background: transparent; padding: 4px 5px; color: var(--faint); font: inherit; font-size: 9.5px; cursor: pointer; }
.chat-tool:hover { background: var(--soft-2); color: var(--text-soft); }
.chat-tool span { font-size: 11px; }
.chat-send { margin-left: auto; border: 0; border-radius: 7px; background: var(--accent); padding: 6px 12px; color: #fff; font: inherit; font-size: 10.5px; font-weight: 600; cursor: pointer; }
.chat-send:hover { background: var(--accent-hover); }
.chat-send:disabled { opacity: 0.5; }
.chat-guest-bar { padding: 12px 14px; border-top: 1px solid var(--border-soft); color: var(--muted); font-size: 10.5px; text-align: center; }
.chat-guest-bar a { color: var(--text); text-decoration: underline; }
.chat-context-menu {
  position: fixed;
  z-index: 250;
  width: 178px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  box-shadow: none;
}
.chat-context-reactions { display: flex; justify-content: space-between; padding: 3px 2px 5px; border-bottom: 1px solid var(--border-soft); margin-bottom: 3px; }
.chat-context-reactions button { border: 0; border-radius: 6px; background: transparent; padding: 3px 4px; font-size: 15px; cursor: pointer; }
.chat-context-reactions button:hover { background: var(--soft-2); }
.chat-context-action { display: block; width: 100%; border: 0; border-radius: 6px; background: transparent; padding: 7px 8px; color: var(--text-soft); font: inherit; font-size: 10.5px; text-align: left; cursor: pointer; }
.chat-context-action:hover { background: var(--soft-2); color: var(--text); }
@media (max-width: 1200px) {
  .chat-shell { grid-template-columns: 140px minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .chat-shell { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); height: 650px; }
  .chat-sidebar { display: flex; flex-direction: row; gap: 10px; overflow-x: auto; overflow-y: hidden; padding: 8px; border-right: 0; border-bottom: 1px solid var(--border-soft); }
  .chat-side-heading { display: none; }
  .chat-room-group { min-width: 155px; }
  .chat-room-group h3 { margin-bottom: 3px; }
  .chat-room-list { flex-direction: row; }
  .chat-room { min-width: 145px; padding: 5px 6px; }
  .chat-sidebar-note { display: none; }
}

.chat-input:disabled { background: #fafafa; color: var(--faint); cursor: not-allowed; }
.chat-tool:disabled { opacity: 0.45; cursor: not-allowed; }

/* The author display rules must not override the hidden attribute. */
.chat-reply-preview[hidden],
.chat-attachment[hidden] { display: none !important; }

.chat-composer[hidden] { display: none !important; }

/* Chat sidebar islands: borderless panel with two soft groups. */
.chat-sidebar {
  gap: 9px;
  padding: 8px;
  border-right: 0;
  background: transparent;
}
.chat-room-group {
  padding: 5px;
  border-radius: 16px;
  background: #f3f3f5;
}
.chat-room-group h3 {
  margin: 1px 7px 5px;
  font-size: 9px;
  letter-spacing: 0.04em;
}
.chat-room-list { gap: 1px; }
.chat-room {
  padding: 7px 8px;
  border-radius: 12px;
}
.chat-room:hover { background: rgba(255, 255, 255, 0.62); }
.chat-room.active { background: #fff; }
@media (max-width: 760px) {
  .chat-room-group { padding: 4px; border-radius: 14px; }
  .chat-sidebar { gap: 7px; padding: 7px; background: #fff; }
}

/* Chat conversation is the only bordered surface; sidebar islands are flat. */
.chat-shell {
  gap: 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: visible;
}
.chat-sidebar {
  border: 0;
  background: transparent;
}
.chat-main {
  height: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}
.chat-room-group { border: 0; }
.chat-context-menu { width: 196px; }
.chat-context-reactions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
}
.chat-context-reactions button { justify-self: center; }
@media (min-width: 1201px) {
  .chat-shell { grid-template-columns: 231px minmax(0, 1fr); }
}
@media (max-width: 1200px) and (min-width: 761px) {
  .chat-shell { grid-template-columns: 210px minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .chat-shell { gap: 8px; }
  .chat-main { border-radius: 12px; }
}

/* ------------------------------------------------------------------ avatars */
.avatar img,
.avatar-photo img,
.avatar-setting-preview img,
.chat-msg-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar { overflow: hidden; }
.avatar-setting {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-soft);
}
.avatar-setting-preview { flex: 0 0 auto; }
.avatar-setting-preview .avatar,
.avatar-setting-preview img { width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.avatar-setting-body { flex: 1; min-width: 0; }
.avatar-setting-body b { font-size: 12.5px; }
.avatar-setting-body p { margin: 2px 0 7px; }
.avatar-form { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.avatar-form .form-input { flex: 1; min-width: 150px; font-size: 11px; }
.chat-room-title { display: flex; align-items: center; gap: 3px; width: 100%; }
.chat-room-avatar { width: 18px; height: 18px; margin-left: auto; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
@media (max-width: 680px) {
  .avatar-setting { gap: 10px; }
  .avatar-setting-preview .avatar,
  .avatar-setting-preview img { width: 44px; height: 44px; }
}

/* Fixed, two-line chat rows with a full-height avatar and fading text. */
.chat-sidebar {
  padding: 0;
  gap: 8px;
}
.chat-room {
  height: 56px;
  min-height: 56px;
  box-sizing: border-box;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 6px;
  overflow: hidden;
}
.chat-room-avatar {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  margin-left: 0;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--soft-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.chat-room-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.chat-room-copy {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, #000 0%, #000 82%, transparent 100%);
  mask-image: linear-gradient(90deg, #000 0%, #000 82%, transparent 100%);
}
.chat-room-title {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  font-size: 10.5px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-room-pin { margin-left: 3px; font-size: 8px; }
.chat-room-last {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  font-size: 9.5px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 760px) {
  .chat-sidebar { padding: 7px; }
  .chat-room { height: 52px; min-height: 52px; }
  .chat-room-avatar { width: 40px; height: 40px; flex-basis: 40px; font-size: 11px; }
}

/* Compact room avatars. */
.chat-room {
  height: 52px;
  min-height: 52px;
}
.chat-room-avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  font-size: 10px;
}
@media (max-width: 760px) {
  .chat-room { height: 50px; min-height: 50px; }
  .chat-room-avatar { width: 28px; height: 28px; flex-basis: 28px; }
}

/* Full-size image viewer for chat attachments. */
.chat-lightbox {
  position: fixed;
  inset: 0;
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: rgba(18, 18, 22, 0.82);
}
.chat-lightbox img {
  max-width: 92vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 8px;
}
.chat-lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #111;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}

/* ------------------------------------------------------------------ terms and chat moderation */
.terms-page { max-width: 820px; margin: 0 auto; }
.terms-page h1 { margin: 0 0 8px; font-size: 26px; letter-spacing: -0.035em; }
.terms-page > p { margin: 0 0 18px; }
.terms-page .panel { margin-bottom: 10px; }
.terms-page h2 { margin: 0 0 8px; font-size: 15px; }
.terms-page p { margin: 0; color: var(--text-soft); font-size: 12.5px; line-height: 1.65; }
.chat-report-list { display: flex; flex-direction: column; }
.chat-report { padding: 14px 16px; border-top: 1px solid var(--border-soft); }
.chat-report-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.chat-report-head b { display: block; font-size: 12.5px; }
.chat-report-head .small { display: block; margin-top: 2px; }
.chat-report-body { margin-top: 8px; }
.chat-report-text { margin-bottom: 5px; padding: 8px 10px; border: 1px solid var(--border-soft); border-radius: 7px; background: var(--soft); color: var(--text-soft); font-size: 12px; white-space: pre-line; }
.chat-report-reasons { margin-top: 7px; }
.chat-report-reasons summary { color: var(--muted); font-size: 11px; cursor: pointer; }
.chat-report-reasons ul { margin: 6px 0 0 18px; padding: 0; font-size: 11px; line-height: 1.55; }

/* ------------------------------------------------------------------ fixed-width site and chat-first portal */
:root { --site-width: 1080px; }
.page,
.page-wide,
.topbar-inner,
.topbar-edz,
.footer-inner { max-width: var(--site-width); }
.portal-body .topbar-inner {
  position: relative;
  max-width: var(--site-width);
  height: 64px;
  padding: 0 20px;
}
.portal-page {
  max-width: var(--site-width);
  padding: 12px 20px 30px;
}
.portal-chat { min-width: 0; }
.portal-chat .chat-shell {
  height: calc(100vh - 108px);
  height: calc(100dvh - 108px);
  min-height: 560px;
  max-height: none;
  grid-template-columns: 231px minmax(0, 1fr);
}
.portal-chat .chat-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  padding: 0;
  gap: 8px;
}
.chat-rooms-scroll {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  scrollbar-width: none;
}
.chat-rooms-scroll::-webkit-scrollbar { display: none; }
.chat-room-list {
  max-height: 158px;
  overflow-y: auto;
  scrollbar-width: none;
}
.chat-room-list::-webkit-scrollbar { display: none; }
.portal-chat .chat-main { height: 100%; }

/* Services menu in the centre of the portal top bar. */
.services-menu {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 140;
}
.services-button {
  list-style: none;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--soft-2);
  cursor: pointer;
  user-select: none;
}
.services-button::-webkit-details-marker { display: none; }
.services-button::marker { content: ""; }
.services-button img { width: 22px; height: 22px; display: block; }
.services-button:hover { background: #e8e8ea; }
.services-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 370px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  z-index: 150;
}
.services-entry {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 7px;
  border-radius: 8px;
  color: var(--text);
}
a.services-entry:hover { background: var(--soft-2); }
.services-entry .service-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  font-size: 16px;
  border-radius: 8px;
}
.services-entry .service-icon svg { width: 19px; height: 19px; }
.services-entry .service-copy b { font-size: 11.5px; }
.services-entry .service-copy small { font-size: 9.5px; }
.services-entry .service-status { margin-left: auto; }
.services-entry-muted { opacity: 0.65; }

/* Announcement carousel at the bottom of the chat column. */
.chat-promo {
  flex: 0 0 auto;
  min-height: 200px;
  margin-top: auto;
  padding-top: 8px;
}
.chat-ad {
  display: none;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
}
.chat-ad.active { display: block; }
.chat-ad-image {
  display: block;
  width: 100%;
  height: 42px;
  object-fit: cover;
}
.chat-ad-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px 12px 14px;
}
.chat-ad-body b {
  overflow: hidden;
  font-size: 12.5px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-ad-body small {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}
@media (max-width: 760px) {
  .portal-page { padding: 10px 14px 24px; }
  .portal-chat .chat-shell { height: calc(100vh - 84px); height: calc(100dvh - 84px); min-height: 540px; }
  .services-dropdown { width: min(370px, calc(100vw - 32px)); }
}
.chat-ad { position: relative; }
.chat-ad-link { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.chat-ad-image { position: relative; z-index: 0; }
.chat-ad-body { position: relative; z-index: 2; pointer-events: none; }
.chat-ad-body a { pointer-events: auto; position: relative; z-index: 3; color: inherit; text-decoration: underline; text-underline-offset: 2px; }

@media (min-width: 761px) {
  .portal-chat .chat-sidebar {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    align-content: stretch;
  }
}

.chat-ad { height: 100%; }


/* Keep the centred fixed-width shell from shifting when a page scrollbar appears. */
html { scrollbar-gutter: stable; }
.topbar-edz { padding-left: 20px; padding-right: 20px; }
@media (max-width: 760px) {
  .topbar-edz,
  .portal-body .topbar-inner { padding-left: 16px; padding-right: 16px; }
}

/* Keep the ad row strictly inside the chat column, flush with its bottom edge. */
@media (min-width: 761px) {
  .portal-chat .chat-sidebar.has-ads {
    display: block;
    position: relative;
    overflow: hidden;
  }
  .portal-chat .chat-sidebar.has-ads .chat-rooms-scroll {
    height: calc(100% - 208px);
    flex: none;
    overflow-y: auto;
  }
  .portal-chat .chat-sidebar.has-ads .chat-promo {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 200px;
    min-height: 0;
    padding-top: 0;
  }
}

/* Hard-bound the portal chat column to the viewport so the ad cannot slip below it. */
@media (min-width: 761px) {
  .portal-chat .chat-shell {
    height: calc(100dvh - 108px) !important;
    max-height: calc(100dvh - 108px) !important;
    overflow: hidden;
  }
  .portal-chat .chat-sidebar {
    height: calc(100dvh - 108px) !important;
    max-height: calc(100dvh - 108px) !important;
  }
  .portal-chat .chat-sidebar.has-ads {
    height: calc(100dvh - 108px) !important;
    max-height: calc(100dvh - 108px) !important;
    overflow: hidden;
  }
  .portal-chat .chat-sidebar.has-ads .chat-rooms-scroll {
    height: calc(100dvh - 316px) !important;
  }
  .portal-chat .chat-sidebar.has-ads .chat-promo {
    bottom: 0 !important;
    height: 200px !important;
  }
}

/* The portal uses html { zoom: 1.25 }, so 100dvh is rendered 25% taller.
   80dvh keeps the actual rendered chat column inside the visible window. */
@media (min-width: 761px) {
  .portal-chat .chat-shell,
  .portal-chat .chat-sidebar,
  .portal-chat .chat-sidebar.has-ads {
    height: calc(80dvh - 108px) !important;
    max-height: calc(80dvh - 108px) !important;
  }
  .portal-chat .chat-sidebar.has-ads .chat-rooms-scroll {
    height: calc(80dvh - 316px) !important;
  }
}

/* ASCII wordmark in the portal logo. */
.portal-ascii {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 3.2px;
  line-height: 1;
  letter-spacing: 0;
  white-space: pre;
  user-select: none;
  overflow: hidden;
}
@media (max-width: 760px) {
  .portal-ascii { font-size: 2.4px; }
}

/* Portal-to-service transition: the ASCII wordmark slides out, the service mark slides in. */
.portal-ascii {
  transition: transform 0.48s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.34s ease;
  transform-origin: left center;
}
.portal-body .brand.leaving-service .portal-ascii {
  transform: translateX(-130%);
  opacity: 0;
}
.portal-body .brand.leaving-service .brand-sep {
  opacity: 1;
}
.brand-service.service-entering {
  animation: service-mark-in 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes service-mark-in {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}
@media (prefers-reduced-motion: reduce) {
  .portal-ascii { transition: none; }
  .brand-service.service-entering { animation: none; }
}

/* Four ASCII wordmark variants; each is sized to fit the same header slot. */
.portal-ascii.ascii-2 { font-size: 2px; }
.portal-ascii.ascii-3 { font-size: 2.2px; }
.portal-ascii.ascii-4 { font-size: 2.4px; }
@media (max-width: 760px) {
  .portal-ascii.ascii-2 { font-size: 1.5px; }
  .portal-ascii.ascii-3 { font-size: 1.65px; }
  .portal-ascii.ascii-4 { font-size: 1.8px; }
}
.portal-body .brand { gap: 10px; }
.portal-ascii { position: relative; z-index: 1; }
.portal-body .brand-sep { position: relative; z-index: 2; }

/* Keep all four ASCII variants legible at the same approximate width. */
.portal-ascii.ascii-1 { font-size: 3.4px; }
.portal-ascii.ascii-2 { font-size: 2.7px; }
.portal-ascii.ascii-3 { font-size: 2.8px; }
.portal-ascii.ascii-4 { font-size: 3px; }
@media (max-width: 760px) {
  .portal-ascii.ascii-1 { font-size: 2.6px; }
  .portal-ascii.ascii-2 { font-size: 2px; }
  .portal-ascii.ascii-3 { font-size: 2.1px; }
  .portal-ascii.ascii-4 { font-size: 2.2px; }
}

/* Mobile portal: one usable column, compact header, horizontal room rows. */
@media (max-width: 760px) {
  .portal-body .topbar-inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-rows: auto auto;
    height: auto;
    min-height: 0;
    padding: 8px 14px;
    gap: 4px 8px;
    flex-wrap: nowrap;
  }
  .portal-body .brand {
    grid-column: 1 / -1;
    grid-row: 1;
    justify-self: start;
    min-width: 0;
  }
  .portal-body .services-menu {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    grid-column: 2;
    grid-row: 2;
    justify-self: center;
  }
  .portal-body .header-right {
    grid-column: 3;
    grid-row: 2;
    justify-self: end;
  }
  .services-dropdown {
    left: 50%;
    transform: translateX(-50%);
  }

  .portal-chat .chat-shell {
    display: flex;
    flex-direction: column;
    grid-template-columns: none;
    grid-template-rows: none;
    height: auto;
    min-height: 0;
    max-height: none;
    gap: 8px;
    overflow: visible;
  }
  .portal-chat .chat-sidebar {
    display: contents;
  }
  .portal-chat .chat-rooms-scroll {
    order: 1;
    height: auto !important;
    max-height: none;
    overflow: visible;
    gap: 6px;
  }
  .portal-chat .chat-room-group {
    min-width: 0;
  }
  .portal-chat .chat-room-list {
    flex-direction: row;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 3px;
    padding-bottom: 1px;
  }
  .portal-chat .chat-room {
    flex: 0 0 185px;
    width: 185px;
  }
  .portal-chat .chat-main {
    order: 2;
    height: calc(80dvh - 260px);
    min-height: 360px;
    max-height: 620px;
  }
  .portal-chat .chat-promo {
    order: 3;
    position: static !important;
    min-height: 0;
    height: auto !important;
    margin-top: 2px;
    padding-top: 0;
  }
  .portal-chat .chat-ad-image {
    height: 42px;
  }
  .chat-sidebar-note {
    display: none;
  }
}

.chat-tool-icon {
  width: 14px;
  height: 14px;
  margin-right: 3px;
  object-fit: contain;
  vertical-align: -2px;
  opacity: 0.8;
}
.chat-tool:hover .chat-tool-icon { opacity: 1; }

/* Keep the composer tools on one clean row. */
.chat-toolbar {
  flex-wrap: nowrap;
  gap: 2px;
  align-items: center;
}
.chat-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 0 1 auto;
  min-width: 0;
  padding: 4px;
  white-space: nowrap;
}
.chat-tool-icon {
  flex: 0 0 14px;
  margin-right: 0;
}
.chat-send {
  flex: 0 0 auto;
  margin-left: auto;
  padding: 6px 9px;
  white-space: nowrap;
}
@media (max-width: 520px) {
  .chat-tool {
    width: 28px;
    height: 26px;
    padding: 3px;
    gap: 0;
    font-size: 0;
  }
  .chat-tool-icon {
    width: 16px;
    height: 16px;
    flex-basis: 16px;
  }
  .chat-send {
    padding: 6px 8px;
    font-size: 9.5px;
  }
}

/* Multiple cloud-drive links in the composer and in sent messages. */
.chat-links-preview {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 0 0 4px;
}
.chat-links-preview[hidden] { display: none !important; }
.chat-link-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 3px 4px 3px 7px;
  border: 1px solid var(--border-soft);
  border-radius: 6px;
  background: var(--soft);
  color: var(--text-soft);
  font-size: 9.5px;
}
.chat-link-chip b {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}
.chat-link-chip-remove {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--faint);
  font-size: 15px;
  line-height: 1;
  padding: 0 3px;
  cursor: pointer;
}
.chat-link-chip-remove:hover { color: var(--text); }
.chat-link-block {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-top: 5px;
  padding: 7px 8px;
  border: 1px solid var(--border-soft);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  text-decoration: none;
}
.chat-link-block:hover { border-color: var(--border); background: var(--soft); }
.chat-link-block-icon { width: 20px; height: 20px; flex: 0 0 20px; object-fit: contain; }
.chat-link-block-copy { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.chat-link-block-copy b {
  overflow: hidden;
  font-size: 10.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-link-block-copy small { color: var(--muted); font-size: 9px; }
.chat-link-block-arrow { color: var(--muted); font-size: 13px; }

/* Sizes for the additional ASCII logo variants (5–14). */
.portal-ascii.ascii-5 { font-size: 3.1px; }
.portal-ascii.ascii-6 { font-size: 2.75px; }
.portal-ascii.ascii-7 { font-size: 3.2px; }
.portal-ascii.ascii-8 { font-size: 5.3px; }
.portal-ascii.ascii-9 { font-size: 4.5px; }
.portal-ascii.ascii-10 { font-size: 4.4px; }
.portal-ascii.ascii-11 { font-size: 3.3px; }
.portal-ascii.ascii-12 { font-size: 3.8px; }
.portal-ascii.ascii-13 { font-size: 1.8px; }
.portal-ascii.ascii-14 { font-size: 1.7px; }
@media (max-width: 760px) {
  .portal-ascii.ascii-5 { font-size: 2.3px; }
  .portal-ascii.ascii-6 { font-size: 2.05px; }
  .portal-ascii.ascii-7 { font-size: 2.4px; }
  .portal-ascii.ascii-8 { font-size: 3.9px; }
  .portal-ascii.ascii-9 { font-size: 3.3px; }
  .portal-ascii.ascii-10 { font-size: 3.25px; }
  .portal-ascii.ascii-11 { font-size: 2.45px; }
  .portal-ascii.ascii-12 { font-size: 2.8px; }
  .portal-ascii.ascii-13 { font-size: 1.35px; }
  .portal-ascii.ascii-14 { font-size: 1.3px; }
}

/* Compact per-user action popup in the admin users table. */
.user-actions-toggle { white-space: nowrap; }
.admin-user-menu {
  position: fixed;
  z-index: 400;
  width: 230px;
  padding: 5px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
}
.admin-user-menu-item {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  padding: 7px 9px;
  color: var(--text);
  font: inherit;
  font-size: 11.5px;
  text-align: left;
  cursor: pointer;
}
.admin-user-menu-item:hover { background: var(--soft-2); }
.admin-user-menu-item.danger { color: var(--danger, #b42318); }

/* Chat expert/admin badges, expert plaque and pinned message. */
.chat-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 4px;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 8px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.01em;
  vertical-align: 1px;
}
.chat-badge-expert { background: #eef0ff; color: #5a4bea; }
.chat-badge-admin { background: #fff0df; color: #c26000; }
.chat-top-notices { flex: 0 0 auto; }
.chat-expert-plaque {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-bottom: 1px solid var(--border-soft);
  background: #f8f7ff;
  color: var(--text-soft);
  font-size: 10px;
}
.chat-expert-plaque b { color: var(--text); font-weight: 600; }
.chat-pin {
  padding: 5px 12px 6px;
  border-bottom: 1px solid var(--border-soft);
  background: #fffdf4;
  color: var(--text-soft);
  font-size: 10px;
}
.chat-pin-head { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 9px; }
.chat-pin-label { color: #9a6a00; font-weight: 600; }
.chat-pin-body {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 2px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}
.chat-pin:hover .chat-pin-body { -webkit-line-clamp: 6; }

/* Slim custom scrollbars for chat islands and the conversation. */
.chat-room-list,
.chat-rooms-scroll,
.chat-messages {
  scrollbar-width: thin;
  scrollbar-color: rgba(90, 90, 105, 0.24) transparent;
}
.chat-room-list:hover,
.chat-rooms-scroll:hover,
.chat-messages:hover {
  scrollbar-width: auto;
  scrollbar-color: rgba(90, 90, 105, 0.46) transparent;
}
.chat-room-list::-webkit-scrollbar,
.chat-rooms-scroll::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
  display: block;
  width: 4px;
  height: 4px;
}
.chat-room-list:hover::-webkit-scrollbar,
.chat-rooms-scroll:hover::-webkit-scrollbar,
.chat-messages:hover::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}
.chat-room-list::-webkit-scrollbar-track,
.chat-rooms-scroll::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track {
  background: transparent;
}
.chat-room-list::-webkit-scrollbar-thumb,
.chat-rooms-scroll::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(90, 90, 105, 0.22);
}
.chat-room-list:hover::-webkit-scrollbar-thumb,
.chat-rooms-scroll:hover::-webkit-scrollbar-thumb,
.chat-messages:hover::-webkit-scrollbar-thumb {
  background: rgba(90, 90, 105, 0.44);
}
.chat-room-list::-webkit-scrollbar-button,
.chat-rooms-scroll::-webkit-scrollbar-button,
.chat-messages::-webkit-scrollbar-button {
  display: none;
}

/* Fixed-size slim scrollbars and a wider chat rail. */
.chat-room-list,
.chat-rooms-scroll,
.chat-messages {
  scrollbar-width: thin;
}
.chat-room-list::-webkit-scrollbar,
.chat-rooms-scroll::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar,
.chat-room-list:hover::-webkit-scrollbar,
.chat-rooms-scroll:hover::-webkit-scrollbar,
.chat-messages:hover::-webkit-scrollbar {
  width: 4px !important;
  height: 4px !important;
}
.chat-room-list {
  padding-right: 8px;
}
.portal-chat .chat-shell {
  grid-template-columns: 277px minmax(0, 1fr);
}
@media (max-width: 1200px) and (min-width: 761px) {
  .portal-chat .chat-shell {
    grid-template-columns: 252px minmax(0, 1fr);
  }
}
.chat-room-list:hover,
.chat-rooms-scroll:hover,
.chat-messages:hover {
  scrollbar-width: thin;
}

/* Expert plaque is absent when no expert is assigned; pin has an unpin control. */
.chat-expert-plaque[hidden] { display: none !important; }
.chat-pin-remove {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
  padding: 0 3px;
  cursor: pointer;
}
.chat-pin-remove:hover { color: var(--text); }
.chat-pin-remove[hidden] { display: none !important; }

/* Translation editor keeps line breaks, unlike a browser prompt. */
.chat-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 420;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(18, 18, 22, 0.55);
}
.chat-modal {
  width: min(560px, 100%);
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}
.chat-modal h3 { margin: 0 0 10px; font-size: 15px; }
.chat-modal-textarea {
  display: block;
  width: 100%;
  min-height: 180px;
  resize: vertical;
  box-sizing: border-box;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}
.chat-modal-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 10px; }
.chat-pin-body { white-space: pre-line; }

/* Request form under the quota card in the library sidebar. */
.sidebar-request {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}
.sidebar-request h2 { margin-bottom: 5px; }
.sidebar-request p { margin: 0 0 7px; color: var(--muted); font-size: 9.5px; line-height: 1.4; }
.sidebar-request-form { display: flex; flex-direction: column; gap: 6px; }
.sidebar-request-form .sidebar-input { width: 100%; box-sizing: border-box; }
.sidebar-request-form .btn { width: 100%; }
