@font-face {
  font-family: "Onest";
  src: url("/assets/fonts/onest/onest-cyrillic-ext.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0460-052F, U+1C80-1C8A, U+20B4, U+2DE0-2DFF, U+A640-A69F, U+FE2E-FE2F;
}

@font-face {
  font-family: "Onest";
  src: url("/assets/fonts/onest/onest-cyrillic.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}

@font-face {
  font-family: "Onest";
  src: url("/assets/fonts/onest/onest-latin-ext.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Onest";
  src: url("/assets/fonts/onest/onest-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Settings */
:root {
  color-scheme: light;
  --font-sans: "Onest", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --color-page: #f3f4f6;
  --color-surface: #ffffff;
  --color-surface-muted: #f8fafc;
  --color-surface-soft: #f1f5f9;
  --color-surface-soft-hover: #e2e8f0;
  --color-surface-strong: #cbd5e1;
  --color-table-head: #edf1f5;
  --color-border: #d1d5db;
  --color-border-soft: #e5e7eb;
  --color-border-muted: #e5e7eb;
  --color-text: #1f2937;
  --color-heading: #374151;
  --color-control-text: #334155;
  --color-navigation: #475569;
  --color-muted: #6b7280;
  --color-muted-strong: #4b5563;
  --color-muted-soft: #9ca3af;
  --color-accent: #0b63ce;
  --color-accent-hover: #084f9f;
  --color-primary-action: #475569;
  --color-primary-action-hover: #334155;
  --color-success-bg: #d9f4e4;
  --color-success-text: #146c43;
  --color-warning-bg: #fff3cd;
  --color-warning-text: #795600;
  --color-info-bg: #dbeafe;
  --color-info-text: #1e5a9e;
  --color-danger-bg: #fde2e1;
  --color-danger-soft: #fff0ef;
  --color-danger-text: #9f2a25;
  --color-error-text: #8a2a22;

  --space-2xs: 2px;
  --space-xs: 3px;
  --space-sm: 6px;
  --space-md: 8px;
  --space-table-y: 9px;
  --space-lg: 10px;
  --space-xl: 12px;
  --space-2xl: 14px;
  --space-gap-wide: 16px;
  --space-3xl: 18px;
  --space-4xl: 24px;
  --space-5xl: 28px;

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-pill: 999px;
  --protocol-card-radius: 14px;

  --font-size-xs: 0.6875rem;
  --font-size-sm: 0.75rem;
  --font-size-md: 0.8125rem;
  --font-size-lg: 0.875rem;
  --font-size-xl: 0.9375rem;
  --font-size-2xl: 1rem;
  --font-size-3xl: 1.0625rem;
  --font-size-4xl: 1.125rem;
  --font-size-title: 1.25rem;
  --font-size-title-mobile: 1.125rem;

  --content-list: 1280px;
  --content-protocol: 1040px;
  --content-cabinet: 1024px;
  --control-height: 34px;
  --control-height-sm: 30px;
  --bin-col-width: 120px;
  --reason-cell-min-width: 240px;
  --mobile-label-col-width: 92px;
  --mobile-action-min-width: 120px;
  --mobile-score-col-min: 108px;
  --mobile-price-col-min: 90px;
  --mobile-grid-gap: 9px;
  --primary-cell-padding-y: 7px;
  --details-arrow-y: 5px;
  --details-arrow-x: 7px;
  --badge-height: 24px;
  --badge-height-mobile: 22px;
  --page-top-space: 48px;
  --page-bottom-space: 72px;
  --section-summary-height-mobile: 32px;
  --error-max-width: 300px;

  font-family: var(--font-sans);
  background: var(--color-page);
  color: var(--color-text);
}

/* Base */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

body.dialog-open {
  position: fixed;
  right: 0;
  left: 0;
  width: 100%;
  overflow: hidden;
}

.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;
}

/* Layout */
.list-page {
  padding-top: calc(var(--page-top-space) + var(--tg-content-safe-area-inset-top, 0px));
  padding-right: calc(var(--space-4xl) + var(--tg-content-safe-area-inset-right, 0px));
  padding-bottom: calc(var(--page-bottom-space) + var(--tg-content-safe-area-inset-bottom, 0px));
  padding-left: calc(var(--space-4xl) + var(--tg-content-safe-area-inset-left, 0px));
}

.page-is-loading {
  cursor: progress;
}

.auth-page {
  min-height: 100vh;
  padding-top: calc(var(--page-top-space) + var(--tg-content-safe-area-inset-top, 0px));
  padding-right: calc(var(--space-4xl) + var(--tg-content-safe-area-inset-right, 0px));
  padding-bottom: calc(var(--space-4xl) + var(--tg-content-safe-area-inset-bottom, 0px));
  padding-left: calc(var(--space-4xl) + var(--tg-content-safe-area-inset-left, 0px));
  display: flex;
  align-items: center;
  justify-content: center;
}

.protocol-page {
  padding-top: calc(var(--page-top-space) + var(--tg-content-safe-area-inset-top, 0px));
  padding-right: calc(var(--space-4xl) + var(--tg-content-safe-area-inset-right, 0px));
  padding-bottom: calc(var(--page-bottom-space) + var(--tg-content-safe-area-inset-bottom, 0px));
  padding-left: calc(var(--space-4xl) + var(--tg-content-safe-area-inset-left, 0px));
}

#protocol-detail-view:not([hidden]) {
  position: fixed;
  z-index: 900;
  inset: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--color-page);
}

.protocol-memory-view {
  min-height: 100%;
  background: var(--color-page);
}

main {
  margin: 0 auto;
}

.list-page main {
  max-width: var(--content-protocol);
}

.list-page.admin-page main {
  max-width: var(--content-list);
}

.protocol-page main {
  max-width: min(100%, var(--content-cabinet));
}

.auth-page main {
  width: min(100%, 520px);
}

header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-gap-wide);
  margin-bottom: var(--space-3xl);
}

.page-back-nav {
  margin-bottom: var(--space-3xl);
}

.page-back-nav + header {
  margin-bottom: var(--space-xl);
}

.page-back-nav + header .protocol-list-title {
  margin-top: 0;
}

.protocol-page .page-back-nav + header {
  margin-bottom: var(--space-3xl);
}

.page-back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--color-navigation);
  font-size: var(--font-size-lg);
  font-weight: 400;
  text-decoration: none;
}

.page-back-link::before {
  content: "←";
  color: var(--color-navigation);
  font-weight: 600;
}

.page-back-link:hover,
.page-back-link:focus-visible {
  color: var(--color-heading);
  text-decoration: none;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-xl);
  margin-bottom: var(--space-2xl);
}

.actions {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  justify-content: flex-end;
}

.page-shell {
  position: relative;
}

.page-loading {
  position: fixed;
  top: var(--tg-content-safe-area-inset-top, 0px);
  right: 0;
  left: 0;
  z-index: 1000;
  height: 3px;
  overflow: hidden;
  background: transparent;
  opacity: 0;
  transition: opacity 120ms ease;
  pointer-events: none;
}

.page-is-loading .page-loading,
.htmx-request.page-loading,
.htmx-request .page-loading {
  opacity: 1;
}

.page-loading-bar {
  width: 28%;
  height: 100%;
  border-radius: 0 var(--radius-pill) var(--radius-pill) 0;
  background: linear-gradient(90deg, #0b63ce 0%, #4ca0ff 100%);
  transform: translateX(-120%);
}

.page-is-loading .page-loading-bar,
.htmx-request .page-loading-bar {
  animation: list-loading-slide 900ms ease-in-out infinite;
}

/* Typography */
h1 {
  margin: 0;
  color: var(--color-text);
  font-size: var(--font-size-title);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: 0;
}

.list-page h1 {
  margin-bottom: var(--space-lg);
}

.protocol-page h1 {
  margin-bottom: var(--space-lg);
  padding-left: var(--space-2xl);
}

.protocol-page .page-shell > header h1 {
  margin-bottom: 0;
  padding-left: 0;
}

.protocol-page h2 {
  font-size: var(--font-size-2xl);
  font-weight: 600;
  line-height: 1.3;
}

.protocol-page h3 {
  font-size: var(--font-size-xl);
  font-weight: 600;
  line-height: 1.35;
}

h2 {
  margin: 0 0 var(--space-lg);
  font-size: var(--font-size-3xl);
  letter-spacing: 0;
}

h3 {
  margin: var(--space-2xl) 0 var(--space-md);
  font-size: var(--font-size-xl);
  letter-spacing: 0;
}

.meta,
.muted {
  color: var(--color-muted);
}

.meta {
  font-size: var(--font-size-lg);
}

.protocol-admin-nav {
  color: var(--color-muted);
  font-size: var(--font-size-2xl);
  font-weight: 400;
}

.protocol-admin-nav a {
  font-weight: 400;
}

.protocol-admin-nav--desktop {
  margin: var(--space-lg) 0 var(--space-xl);
}

.protocol-admin-nav--mobile {
  display: none;
}

.page-hint {
  color: var(--color-muted);
  font-size: var(--font-size-lg);
  margin: 0 0 var(--space-xl);
}

.members-page .page-hint {
  margin: var(--space-4xl) 0 var(--space-3xl);
}

.muted {
  font-size: var(--font-size-md);
}

a {
  color: var(--color-accent);
  font-weight: 700;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

@keyframes list-loading-slide {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(320%);
  }
}

/* Components */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 var(--space-2xl);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-heading);
  cursor: pointer;
  font-family: inherit;
  font-size: var(--font-size-lg);
  font-weight: 600;
  text-decoration: none;
}

.button:hover {
  background: var(--color-surface-soft-hover);
  text-decoration: none;
}

.button:focus-visible {
  outline: 2px solid rgb(11 99 206 / 34%);
  outline-offset: 2px;
}

.button:disabled {
  background: var(--color-surface-soft-hover);
  color: var(--color-muted-strong);
  cursor: progress;
}

.button.secondary {
  background: var(--color-surface-soft);
  color: var(--color-heading);
}

.button.secondary:hover {
  background: var(--color-surface-soft-hover);
  color: var(--color-heading);
}

.button.cancel-action {
  background: var(--color-danger-soft);
  color: var(--color-danger-text);
}

.button.cancel-action:hover {
  background: var(--color-danger-bg);
  color: var(--color-danger-text);
}

.button.primary-action {
  background: var(--color-primary-action);
  color: var(--color-surface);
}

.button.primary-action:hover,
.button.primary-action:focus-visible {
  background: var(--color-primary-action-hover);
  color: var(--color-surface);
}

.button-sm {
  min-height: var(--control-height-sm);
  padding: 0 var(--space-lg);
  font-size: var(--font-size-md);
}

.button-nav {
  min-height: 34px;
  padding: 8px 10px;
  background: var(--color-surface-soft-hover);
  color: var(--color-control-text);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
}

.button-nav:hover,
.button-nav:focus-visible {
  background: var(--color-surface-strong);
  color: var(--color-control-text);
}

.button-full {
  width: 100%;
  min-width: 0;
}

.button-gap {
  gap: var(--space-sm);
}

.auth-card {
  padding: clamp(24px, 5vw, 36px);
  border: 1px solid var(--color-border);
  border-radius: 18px;
  background: linear-gradient(180deg, #fff 0%, #f5f9ff 100%);
  box-shadow: 0 20px 50px rgb(36 50 65 / 10%);
}

.invite-card {
  display: grid;
  gap: var(--space-xl);
  background: var(--color-surface);
}

.invite-label {
  color: var(--color-muted-strong);
  font-size: var(--font-size-lg);
  font-weight: 600;
  text-transform: none;
}

.invite-card h1 {
  margin-bottom: 0;
}

.invite-copy {
  margin: 0;
  color: var(--color-muted);
  font-size: var(--font-size-xl);
  line-height: 1.5;
}

.invite-warning {
  padding: var(--space-xl) var(--space-2xl);
  border: 1px solid #d7c9a5;
  border-radius: 12px;
  background: #fff8e6;
  color: #5f4b1b;
  font-size: var(--font-size-md);
  font-weight: 600;
  line-height: 1.45;
}

.invite-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
  margin: 0;
}

.auth-eyebrow {
  margin-bottom: var(--space-lg);
  color: var(--color-accent);
  font-size: var(--font-size-sm);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-copy {
  margin: var(--space-lg) 0 var(--space-3xl);
  color: var(--color-muted);
  font-size: var(--font-size-xl);
  line-height: 1.5;
}

.auth-meta {
  margin-top: var(--space-xl);
  color: var(--color-muted-strong);
  font-size: var(--font-size-lg);
}

.auth-status {
  padding: var(--space-xl) var(--space-2xl);
  border: 1px solid var(--color-border);
  border-radius: 14px;
  background: var(--color-surface);
  color: var(--color-heading);
  font-size: var(--font-size-lg);
  font-weight: 700;
}

.login-card .auth-status {
  margin: var(--space-2xl) 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--color-muted);
  font-size: var(--font-size-lg);
  font-weight: 500;
  line-height: 1.45;
}

.login-card {
  width: min(100%, 380px);
  margin: 0 auto;
}

.auth-status.error {
  border-color: rgb(159 42 37 / 18%);
  background: var(--color-danger-bg);
  color: var(--color-danger-text);
}

.login-card .auth-status.error {
  padding: var(--space-xl) var(--space-2xl);
  border: 1px solid rgb(159 42 37 / 18%);
  background: var(--color-danger-bg);
  color: var(--color-danger-text);
}

.auth-actions {
  margin-top: var(--space-2xl);
}

.auth-actions + .auth-actions {
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--color-border);
}

#browser-login-actions {
  text-align: center;
}

.browser-login-button {
  min-height: 48px;
  gap: var(--space-md);
  padding: 0 var(--space-4xl);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: 0 8px 20px rgb(36 50 65 / 8%);
  font-size: var(--font-size-lg);
}

.browser-login-button:hover,
.browser-login-button:focus-visible {
  border-color: var(--color-border-soft);
  background: var(--color-surface-muted);
  color: var(--color-text);
}

.browser-login-button:focus-visible {
  outline: 2px solid rgb(45 58 69 / 22%);
  outline-offset: 2px;
}

.telegram-icon {
  flex: none;
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.auth-field {
  display: grid;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  color: var(--color-muted-strong);
  font-size: var(--font-size-sm);
  font-weight: 700;
}

.auth-field input {
  width: 100%;
  min-height: 44px;
  padding: 0 var(--space-lg);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-heading);
  font: inherit;
}

.auth-field input:focus {
  border-color: var(--color-accent);
  outline: 3px solid rgb(36 128 200 / 14%);
}

.admin-page main {
  max-width: min(100%, 1360px);
}

.admin-actions {
  display: flex;
  gap: var(--space-md);
  align-items: center;
  flex-wrap: wrap;
}

.page-actions {
  display: flex;
  gap: var(--space-md);
  align-items: center;
  flex-wrap: wrap;
}

.protocol-list-toolbar {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--space-md);
  margin-bottom: var(--space-4xl);
}

.protocol-filter-button {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: 34px;
}

.protocol-filter-button svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

.protocol-filter-count {
  display: inline-grid;
  flex: none;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 var(--space-xs);
  border-radius: var(--radius-pill);
  background: #ef4444; /* Tailwind red-500 */
  color: #ffffff;
  font-size: var(--font-size-sm);
  font-weight: 700;
}

.protocol-filter-dialog {
  width: min(480px, calc(100vw - var(--space-4xl)));
}

.protocol-filter-dialog .dialog-header {
  align-items: center;
}

.protocol-filter-dialog .dialog-header h2 {
  margin: 0;
  font-size: var(--font-size-2xl);
  font-weight: 600;
}

.protocol-filter-form {
  display: block;
}

.protocol-company-options {
  display: grid;
  gap: var(--space-sm);
  margin: 0;
  padding: 0;
  border: 0;
}

.protocol-company-options legend {
  margin-bottom: var(--space-md);
  color: var(--color-heading);
  font-size: var(--font-size-lg);
  font-weight: 600;
}

.protocol-company-option {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  min-height: 46px;
  padding: var(--space-md) var(--space-lg);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--font-size-md);
  cursor: pointer;
}

.protocol-company-option:hover {
  background: var(--color-surface-soft);
}

.protocol-company-option:has(input:checked) {
  border-color: var(--color-surface-strong);
  background: var(--color-surface-soft);
}

.protocol-company-option input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--color-primary-action);
}

.protocol-company-option span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.protocol-filter-actions {
  gap: var(--space-md);
}

.segmented-tabs {
  position: relative;
  z-index: 1;
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.protocol-mode-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: var(--space-xs) var(--space-xl);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-navigation);
  font-size: var(--font-size-lg);
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
}

.protocol-mode-link:focus-visible {
  outline: 2px solid rgb(11 99 206 / 34%);
  outline-offset: 2px;
}

.protocol-mode-link:hover,
.protocol-mode-link:focus-visible {
  color: var(--color-heading);
  background: var(--color-surface-soft);
  text-decoration: none;
}

.protocol-mode-link[aria-current="page"] {
  color: var(--color-heading);
  background: var(--color-surface-soft-hover);
}

.protocol-search {
  margin-left: auto;
  grid-template-columns: auto minmax(220px, 320px) auto auto;
  margin-bottom: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.protocol-search-disclosure {
  grid-column: 2;
  grid-row: 1;
}

.protocol-list-toolbar-search-only .protocol-search-disclosure {
  grid-column: 1;
  justify-self: start;
}

.protocol-search-disclosure summary {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  width: max-content;
  min-height: var(--control-height);
  padding: 0 var(--space-xl);
  border-radius: var(--radius-sm);
  color: var(--color-navigation);
  font-size: var(--font-size-lg);
  font-weight: 500;
  list-style: none;
  cursor: pointer;
}

.protocol-search-disclosure summary::-webkit-details-marker {
  display: none;
}

.protocol-search-disclosure summary:hover,
.protocol-search-disclosure summary:focus-visible,
.protocol-search-disclosure[open] summary {
  color: var(--color-heading);
  background: var(--color-surface-soft);
  outline: none;
}

.protocol-search-disclosure summary svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

.protocol-search-active {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-pill);
  background: var(--color-accent);
}

.protocol-search-submit {
  position: relative;
  min-width: 72px;
}

.protocol-search.htmx-request .protocol-search-submit span {
  visibility: hidden;
}

.protocol-search.htmx-request .protocol-search-submit::after {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  content: "Поиск…";
}

.protocol-search-submit:disabled {
  cursor: progress;
  opacity: 0.75;
}

.protocol-search-disclosure .protocol-search {
  position: absolute;
  z-index: 20;
  top: calc(var(--control-height) + var(--space-sm));
  right: 0;
  left: 0;
  width: 100%;
  margin: 0;
  padding: var(--space-xl);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  background: var(--color-surface);
  box-shadow: 0 18px 44px rgb(15 23 42 / 18%), 0 4px 12px rgb(15 23 42 / 10%);
}

.protocol-search label {
  font-size: 14px;
  font-weight: 600;
}

.admin-protocol-search {
  grid-column: 1 / -1;
  grid-template-columns: auto minmax(220px, 360px) auto auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.list-page .protocol-list-title {
  margin-top: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.admin-panel,
.admin-table-section {
  margin-bottom: var(--space-3xl);
}

.admin-menu {
  margin-bottom: var(--space-3xl);
}

.admin-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--space-2xl);
}

.admin-card {
  display: grid;
  gap: var(--space-lg);
  align-content: start;
  min-height: 100%;
  padding: var(--space-2xl);
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: inherit;
  text-decoration: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.admin-card:hover,
.admin-card:focus-visible {
  border-color: var(--color-accent);
  box-shadow: 0 10px 28px rgb(36 50 65 / 10%);
  text-decoration: none;
  transform: translateY(-1px);
}

.admin-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-card-icon {
  flex: none;
  width: 24px;
  height: 24px;
  color: var(--color-muted);
  stroke: currentColor;
}

.admin-card h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
}

.admin-card p {
  margin: 0;
  color: var(--color-muted-strong);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.45;
}

.admin-card:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

.admin-page .button:focus-visible,
.admin-page .admin-card:focus-visible {
  outline: none;
}

.admin-page .admin-card:hover,
.admin-page .admin-card:focus-visible {
  border-color: var(--color-border);
  background: var(--color-surface-muted);
  box-shadow: none;
}

.admin-page .search-bar input:focus,
.admin-page .search-bar select:focus,
.admin-page .admin-company-form input:focus {
  border-color: var(--color-muted-soft);
  outline: none;
}

.admin-table-wrap {
  overflow-x: auto;
}

.table-cell-wrap {
  display: block;
  max-width: min(52vw, 680px);
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.inline-form {
  margin: 0;
}

.admin-company-form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-sm);
  width: 100%;
}

.admin-company-name-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  gap: var(--space-md);
  width: 100%;
}

.admin-company-form input {
  width: 100%;
  min-width: 0;
  height: var(--control-height);
  padding: 0 var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
}

.admin-company-form input:focus {
  border-color: var(--color-accent);
  outline: 2px solid rgb(11 99 206 / 18%);
  outline-offset: 1px;
}

.invite-link-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex-wrap: wrap;
  max-width: min(100%, 760px);
}

.invite-link-row a {
  min-width: 180px;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.member-invite-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas:
    "intro actions"
    "url url";
  align-items: center;
  gap: var(--space-xl);
  margin-bottom: var(--space-3xl);
  padding: var(--space-xl) var(--space-2xl);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
}

.member-invite-heading {
  grid-area: intro;
}

.member-invite-strip h2 {
  margin: 0 0 var(--space-xs);
  color: var(--color-heading);
  font-size: var(--font-size-2xl);
}

.member-invite-url {
  grid-area: url;
  min-width: 0;
  overflow-wrap: anywhere;
}

.member-invite-actions {
  grid-area: actions;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.member-invite-note {
  margin: calc(-1 * var(--space-md)) 0 var(--space-3xl);
}

.search-bar {
  display: grid;
  grid-template-columns: auto minmax(220px, 360px) auto minmax(150px, 190px) auto auto;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-3xl);
  padding: var(--space-xl) var(--space-2xl);
  border: 1px solid var(--color-border-soft);
  border-radius: 10px;
  background: var(--color-surface-muted);
}

.search-bar label {
  color: var(--color-heading);
  font-size: var(--font-size-lg);
  font-weight: 700;
}

.search-bar input,
.search-bar select {
  min-width: 0;
  height: var(--control-height);
  padding: 0 var(--space-xl);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: var(--font-size-lg);
}

.search-bar input:focus,
.search-bar select:focus {
  border-color: var(--color-accent);
  outline: 2px solid rgb(11 99 206 / 18%);
  outline-offset: 1px;
}

.admin-user-search {
  grid-template-columns: auto minmax(220px, 360px) auto auto;
}

.admin-user-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: var(--space-xl);
  margin-bottom: var(--space-3xl);
  padding: var(--space-xl) var(--space-2xl);
  border: 1px solid var(--color-border-soft);
  border-radius: 10px;
  background: var(--color-surface);
}

.admin-user-filter-field {
  display: grid;
  gap: var(--space-sm);
}

.admin-user-filter-field label,
.admin-user-paid-filter {
  color: var(--color-heading);
  font-size: var(--font-size-lg);
  font-weight: 700;
}

.admin-user-filter-field select {
  height: var(--control-height);
  padding: 0 var(--space-xl);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
}

.admin-user-paid-filter {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-height: var(--control-height);
}

.admin-billing-filters {
  grid-template-columns: minmax(260px, 1fr) minmax(140px, 180px) minmax(180px, 220px) auto;
  align-items: end;
  gap: var(--space-xl);
}

.admin-billing-filter-field {
  display: grid;
  gap: var(--space-sm);
  min-width: 0;
}

.admin-billing-filter-field input,
.admin-billing-filter-field select {
  width: 100%;
}

.admin-billing-filter-actions {
  display: flex;
  gap: var(--space-md);
  align-items: center;
}

.search-summary {
  margin: var(--space-3xl) 0;
  color: var(--color-muted-strong);
  font-size: var(--font-size-lg);
  font-weight: 400;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  margin-top: var(--space-xl);
  padding: var(--space-xl);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}

.pagination-top {
  margin: 0 0 var(--space-xl);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.pagination-summary {
  color: var(--color-muted-strong);
  font-size: var(--font-size-lg);
  font-weight: 700;
}

.pagination-actions {
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.button.disabled {
  background: var(--color-surface-soft);
  color: var(--color-muted-soft);
  cursor: default;
  pointer-events: none;
}

table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.list-page table {
  background: var(--color-surface);
  border-color: var(--color-border);
}

th,
td {
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--color-border-muted);
  text-align: left;
  vertical-align: top;
  font-size: var(--font-size-md);
}

.list-page th,
.list-page td {
  padding: var(--space-lg) var(--space-xl);
  font-size: var(--font-size-lg);
  white-space: nowrap;
}

th {
  background: var(--color-table-head);
  color: var(--color-heading);
  font-weight: 700;
}

.list-page th {
  font-weight: 600;
}

tr:last-child td {
  border-bottom: 0;
}

.status {
  display: inline-block;
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-pill);
  text-align: center;
  font-size: var(--font-size-sm);
  font-weight: 700;
  text-transform: none;
}

.status.succeeded,
.badge--success {
  background: var(--color-success-bg);
  color: var(--color-success-text);
}

.status.failed,
.badge--danger {
  background: var(--color-danger-bg);
  color: var(--color-danger-text);
}

.badge.badge--warning {
  background: var(--color-warning-bg);
  color: var(--color-warning-text);
}

.badge.badge--info {
  background: var(--color-info-bg);
  color: var(--color-info-text);
}

.table-error-cell {
  max-width: var(--error-max-width);
  white-space: normal;
  color: var(--color-error-text);
}

.empty {
  color: var(--color-muted);
  font-size: var(--font-size-lg);
}

.list-page .empty {
  padding: var(--space-5xl);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
}

.empty-title {
  margin-bottom: var(--space-md);
  color: var(--color-heading);
  font-size: var(--font-size-2xl);
  font-weight: 400;
}

.protocol-list-empty-state {
  margin: var(--space-5xl) auto 0;
  color: var(--color-muted-strong);
  font-size: var(--font-size-2xl);
  font-weight: 400;
  text-align: center;
}

.empty-copy {
  max-width: 52rem;
  margin-bottom: var(--space-xl);
}

.protocol-card-list {
  display: grid;
  gap: var(--space-xl);
}

.protocol-load-more {
  display: flex;
  grid-column: 1 / -1;
  justify-content: center;
  padding: var(--space-lg) var(--space-xl) 0;
}

.protocol-card {
  display: grid;
  content-visibility: auto;
  contain-intrinsic-size: auto 220px;
  gap: var(--space-gap-wide);
  align-items: center;
  margin-bottom: 0;
  padding: var(--space-3xl);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--protocol-card-radius);
  background: var(--color-surface);
  box-shadow: none;
}

.protocol-card-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.42fr);
  grid-template-areas:
    "title key"
    "organizer key"
    "sample-org key"
    "facts key"
    "kicker key";
  column-gap: var(--space-4xl);
  align-items: start;
  min-width: 0;
}

.protocol-card-kicker {
  grid-area: kicker;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-md);
  margin-top: var(--space-xl);
  color: var(--color-muted);
  font-size: var(--font-size-sm);
  font-weight: 400;
}

.protocol-card-title {
  grid-area: title;
  margin: 0 0 var(--space-2xl);
  color: var(--color-heading);
  font-size: var(--font-size-4xl);
  font-weight: 600;
  line-height: 1.25;
}

.protocol-card-sample-organization {
  grid-area: sample-org;
  display: -webkit-box;
  margin: calc(-1 * var(--space-sm)) 0 var(--space-xl);
  color: var(--color-muted-strong);
  font-size: var(--font-size-lg);
  font-weight: 400;
  line-height: 1.35;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.protocol-card-title-link {
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 18px;
  font-weight: 500;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  text-decoration: none;
}

.protocol-card-title-link:hover {
  color: var(--color-accent-hover);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.protocol-card-title-link:focus-visible {
  border-radius: var(--radius-xs);
  outline: none;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.protocol-card-key-facts {
  display: grid;
  grid-area: key;
  grid-template-columns: 1fr;
  gap: var(--space-lg) var(--space-3xl);
  margin: calc(-1 * var(--space-3xl)) 0;
  padding: var(--space-3xl) 0 var(--space-3xl) var(--space-3xl);
  align-self: stretch;
  border-left: 1px solid var(--color-border-muted);
}

.protocol-card-key-facts div {
  min-width: 0;
  padding: 0;
}

.protocol-card-key-facts dt {
  margin: 0 0 var(--space-xs);
  color: var(--color-muted);
  font-size: var(--font-size-lg);
  font-weight: 500;
  text-transform: none;
}

.protocol-card-key-facts dd {
  margin: 0;
  color: var(--color-text);
  font-size: var(--font-size-2xl);
  font-weight: 400;
  overflow-wrap: anywhere;
}

.protocol-method-help {
  position: relative;
  width: fit-content;
}

.protocol-method-abbr {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 2rem;
  padding: 0 var(--space-sm);
  border: 1px solid var(--color-border-muted);
  border-radius: var(--radius-xs);
  background: var(--color-surface-muted);
  color: var(--color-heading);
  font-weight: 600;
  line-height: 1.1;
  cursor: pointer;
  list-style: none;
}

.protocol-method-abbr::marker {
  content: "";
}

.protocol-method-abbr::-webkit-details-marker {
  display: none;
}

.protocol-method-tooltip {
  display: none;
  position: fixed;
  z-index: 2;
  top: var(--protocol-method-tooltip-top, 0px);
  left: var(--protocol-method-tooltip-left, 0px);
  width: max-content;
  max-width: min(22rem, calc(100vw - 2 * var(--space-xl)));
  max-height: calc(100vh - 2 * var(--space-xl));
  box-sizing: border-box;
  overflow-wrap: anywhere;
  overflow-y: auto;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border-muted);
  border-radius: var(--radius-xs);
  background: var(--color-surface);
  box-shadow: 0 12px 24px rgb(36 50 65 / 12%);
  color: var(--color-text);
  font-size: var(--font-size-md);
  font-weight: 400;
  line-height: 1.25;
}

.protocol-method-help[open] .protocol-method-tooltip {
  display: block;
}

.protocol-card-mobile-keyline {
  display: none;
  color: var(--color-muted-strong);
  font-size: var(--font-size-lg);
  font-weight: 400;
  line-height: 1.35;
}

.protocol-card-facts {
  display: grid;
  grid-area: facts;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: var(--space-lg) var(--space-3xl);
  margin: 0;
}

.protocol-card-facts div {
  padding: 0;
}

.protocol-card-facts dt {
  margin: 0 0 var(--space-xs);
  color: var(--color-muted);
  font-size: var(--font-size-lg);
  font-weight: 500;
  text-transform: none;
}

.protocol-card-facts dd {
  margin: 0;
  color: var(--color-text);
  font-size: var(--font-size-2xl);
  font-weight: 400;
  overflow-wrap: anywhere;
}

.protocol-card-organizer {
  grid-area: organizer;
  margin-top: 0;
  color: var(--color-muted);
  font-size: var(--font-size-md);
  font-weight: 400;
  line-height: 1.35;
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.panel {
  margin-bottom: var(--space-xl);
  padding: var(--space-2xl);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}

.cabinet-page main {
  max-width: min(100%, var(--content-cabinet));
}

.cabinet-header {
  align-items: center;
  margin-bottom: var(--space-3xl);
}

.notice-stack {
  display: grid;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.cabinet-summary-grid,
.cabinet-nav-grid,
.plan-card-grid {
  display: grid;
  gap: var(--space-xl);
}

.cabinet-summary-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.summary-tile,
.plan-card,
.checkout-panel {
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
}

.summary-tile {
  display: grid;
  gap: var(--space-sm);
  align-content: start;
  padding: 16px;
  color: var(--color-text);
  text-decoration: none;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.summary-tile:hover,
.summary-tile:focus-visible {
  border-color: var(--color-border);
  background: var(--color-border-soft);
  text-decoration: none;
}

.summary-tile:focus-visible {
  outline: 2px solid var(--color-surface-strong);
  outline-offset: 2px;
}

.summary-tile span,
.plan-card span {
  color: var(--color-muted);
  font-size: 14px;
  font-weight: 600;
}

.cabinet-card-title {
  display: grid;
  gap: 10px;
  justify-items: center;
}

.cabinet-icon {
  flex: none;
  width: 30px;
  height: 30px;
  stroke: currentColor;
}

.summary-tile strong {
  color: var(--color-heading);
  font-size: var(--font-size-2xl);
  font-weight: 600;
}

.summary-tile small,
.plan-card small {
  color: var(--color-muted-strong);
  font-size: var(--font-size-md);
  font-weight: 400;
  line-height: 1.35;
}

.summary-tile .summary-badge {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  min-height: var(--badge-height-mobile);
  padding: 0 var(--space-sm);
  border: 1px solid rgb(11 99 206 / 18%);
  border-radius: var(--radius-pill);
  background: var(--color-surface-soft);
  color: var(--color-accent);
  font-size: var(--font-size-sm);
  font-weight: 800;
}

.summary-action {
  justify-self: start;
  margin-top: var(--space-md);
}

.cabinet-nav-section {
  display: grid;
  gap: var(--space-lg);
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--color-border);
}

.cabinet-support-section {
  margin-top: var(--space-4xl);
  padding-top: var(--space-4xl);
  border-top: 1px solid var(--color-border);
}

.cabinet-support-item {
  width: 100%;
  background: var(--color-page);
}

.summary-tile .cabinet-support-action {
  display: inline-flex;
  align-items: center;
  gap: var(--space-md);
  font-weight: 400;
}

.cabinet-support-action .cabinet-icon {
  width: 20px;
  height: 20px;
}

.cabinet-nav-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-xl);
}

.cabinet-nav-item {
  display: grid;
  place-items: center;
  min-height: 104px;
  padding: 16px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
  color: var(--color-text);
  text-decoration: none;
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

.cabinet-nav-item:hover,
.cabinet-nav-item:focus-visible {
  border-color: var(--color-border);
  background: var(--color-surface-soft);
  text-decoration: none;
}

.cabinet-nav-item:focus-visible {
  outline: 2px solid var(--color-surface-strong);
  outline-offset: 2px;
}

.cabinet-nav-item strong {
  color: var(--color-heading);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.25;
  text-align: center;
}

.cabinet-nav-item span {
  color: var(--color-navigation);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.35;
}

.notification-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 24px;
	height: 24px;
	padding: 0 7px;
	border-radius: 999px;
	background: var(--color-accent);
	color: #fff;
	font-size: 13px;
	font-weight: 700;
}

.notification-list {
	display: grid;
	gap: var(--space-md);
	margin-top: var(--space-xl);
}

.notification-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-lg);
	padding: 16px;
	border: 1px solid var(--color-border);
	border-radius: 8px;
	background: var(--color-surface);
}

.notification-item.unread {
	border-left: 4px solid var(--color-accent);
}

.notification-item-content h2,
.notification-item-content p {
	margin: 0 0 var(--space-sm);
}

.notification-item-content time {
	color: var(--color-muted);
	font-size: var(--font-size-sm);
}

.notification-channel-setting {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-lg);
}

.billing-screen {
  display: grid;
  gap: var(--space-xl);
}

.billing-payment-page .billing-screen {
  width: clamp(420px, 50%, 520px);
  max-width: 520px;
}

.billing-choice-form {
  display: grid;
  gap: var(--space-xl);
}

.plan-card-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.plan-card {
  position: relative;
  display: grid;
  gap: var(--space-md);
  min-height: 164px;
  padding: var(--space-2xl);
  cursor: pointer;
}

.plan-card strong {
  color: var(--color-heading);
  font-size: var(--font-size-title-mobile);
}

.plan-select-button {
  align-self: end;
  margin-top: var(--space-md);
}

.plan-card.selected {
  border-color: rgb(11 99 206 / 54%);
  background: var(--color-surface-muted);
}

.plan-card.selected .plan-select-button {
  background: var(--color-accent);
  color: var(--color-surface);
}

.checkout-panel {
  display: grid;
  gap: var(--space-xl);
  padding: var(--space-2xl);
}

.checkout-plan-title,
.payment-method-card {
  display: grid;
  gap: var(--space-sm);
}

.checkout-plan-title span,
.payment-method-card span {
  color: var(--color-muted);
  font-size: var(--font-size-md);
  font-weight: 600;
  text-transform: none;
}

.checkout-plan-title strong,
.payment-method-card strong {
  color: var(--color-heading);
  font-size: var(--font-size-title-mobile);
}

.term-control {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

.term-control label {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: var(--space-lg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface-muted);
  font-weight: 700;
}

.term-control input {
  margin: 0;
}

.term-option-copy {
  display: grid;
  gap: var(--space-xs);
  min-width: 0;
  padding-right: 72px;
}

.term-option-title {
  color: var(--color-heading);
  font-size: var(--font-size-lg);
  line-height: 1.2;
}

.term-option-price {
  color: var(--color-muted-strong);
  font-size: var(--font-size-2xl);
  font-weight: 600;
  line-height: 1.2;
}

.term-option-price-row {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.term-option-price-old {
  color: var(--color-muted);
  font-size: var(--font-size-md);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: line-through;
}

.term-option-discount {
  position: absolute;
  top: var(--space-md);
  right: var(--space-lg);
  width: max-content;
  max-width: 100%;
  padding: 2px var(--space-sm);
  border-radius: var(--radius-pill);
  background: var(--color-success-bg);
  color: var(--color-success-text);
  font-size: var(--font-size-xs);
  font-weight: 700;
  line-height: 1.2;
}

.checkout-summary {
  display: grid;
  gap: var(--space-sm);
  color: var(--color-muted-strong);
  font-size: var(--font-size-lg);
}

.billing-payment-page .checkout-panel {
  gap: var(--space-3xl);
}

.billing-phone-field {
  max-width: 360px;
}

.billing-phone-field input {
  width: 100%;
}

.company-form.billing-phone-field input:focus {
  border-color: var(--color-accent);
  outline: 2px solid rgb(11 99 206 / 18%);
  outline-offset: 1px;
  box-shadow: none;
}

.billing-phone-field input[aria-invalid="true"] {
  border-color: var(--color-danger-text);
  box-shadow: none;
}

.checkout-actions {
  display: grid;
  gap: var(--space-md);
}

.profile-card {
  display: grid;
  gap: var(--space-2xl);
  padding: var(--space-2xl);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
}

.profile-head {
  display: flex;
  justify-content: space-between;
  gap: var(--space-xl);
  align-items: flex-start;
}

.profile-head h2,
.profile-head p {
  margin: 0;
}

.profile-head h2 {
  font-size: var(--font-size-title);
}

.profile-head p {
  margin-top: var(--space-md);
  color: var(--color-muted-strong);
}

.profile-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-lg);
}

.profile-grid div {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(0, 1fr);
  align-items: baseline;
  gap: var(--space-sm);
  padding: 0;
  background: transparent;
}

.profile-grid span {
  color: var(--color-muted);
  font-size: var(--font-size-sm);
  font-weight: 600;
  text-transform: none;
}

.profile-grid strong {
  color: var(--color-heading);
  font-size: var(--font-size-lg);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-xl);
}

.dashboard-card {
  padding: var(--space-xl);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
}

.dashboard-card h2 {
  margin: 0 0 var(--space-lg);
  font-size: var(--font-size-title-mobile);
}

.dashboard-status {
  display: inline-flex;
  align-items: center;
  min-height: var(--badge-height);
  padding: 0 var(--space-md);
  border-radius: var(--radius-pill);
  font-size: var(--font-size-sm);
  font-weight: 800;
}

.dashboard-status.success {
  background: var(--color-success-bg);
  color: var(--color-success-text);
}

.dashboard-status.error {
  background: var(--color-danger-bg);
  color: var(--color-danger-text);
}

.dashboard-copy {
  margin: var(--space-lg) 0;
  color: var(--color-muted-strong);
}

.dashboard-meta {
  margin-top: var(--space-md);
  color: var(--color-muted-strong);
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: var(--space-xl);
  align-items: flex-start;
  margin-bottom: var(--space-xl);
}

.section-head h2 {
  margin: 0;
  font-size: var(--font-size-title-mobile);
}

.company-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-xl);
}

.company-grid.company-screen-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.company-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
  min-width: 0;
  padding: var(--space-2xl);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
}

.company-card-locked {
  background: var(--color-surface-muted);
}

.company-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-xl);
}

.company-card-head h2 {
  margin: 0;
  font-size: var(--font-size-2xl);
}

.company-name {
  padding: var(--space-sm) 0 var(--space-xs);
  color: var(--color-heading);
  font-size: var(--font-size-lg);
  font-weight: 600;
  overflow-wrap: anywhere;
}

.company-empty {
  padding: var(--space-sm) 0 var(--space-xs);
  color: var(--color-muted-strong);
  font-size: var(--font-size-lg);
  font-weight: 500;
}

.company-not-found {
  padding: var(--space-sm) 0 var(--space-xs);
  color: var(--color-danger-text);
  font-size: var(--font-size-lg);
  font-weight: 600;
}

.company-form {
  display: grid;
  gap: var(--space-md);
}

.company-form label {
  color: var(--color-muted-strong);
  font-size: var(--font-size-md);
  font-weight: 400;
}

.company-form input,
.company-form select,
.company-form textarea {
  height: 42px;
  padding: 0 var(--space-xl);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
}

.company-form textarea {
  min-height: 96px;
  height: auto;
  padding-top: var(--space-sm);
  padding-bottom: var(--space-sm);
  resize: vertical;
}

.company-form input:focus,
.company-form select:focus,
.company-form textarea:focus {
  border-color: var(--color-accent);
  outline: 2px solid rgb(11 99 206 / 18%);
  outline-offset: 1px;
}

.company-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
}

.company-actions--split {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.company-delete-form {
  display: flex;
  margin: 0;
}

.company-submit-indicator {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: button-spinner-rotate 700ms linear infinite;
}

.billing-submit-indicator {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: button-spinner-rotate 700ms linear infinite;
}

.company-submit-indicator.htmx-request {
  display: inline-block;
}

.billing-submit-indicator.htmx-request {
  display: inline-block;
}

@keyframes button-spinner-rotate {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .company-submit-indicator,
  .billing-submit-indicator {
    animation-duration: 1200ms;
  }
}

.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-xl);
}

.member-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
  min-width: 0;
  padding: var(--space-2xl);
  border: 1px solid var(--color-border);
  border-radius: 8px;
  background: var(--color-surface);
}

.member-card-empty {
  background: var(--color-surface-muted);
}

.members-page .member-card-empty h3 {
  color: var(--color-muted);
}

.member-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-xl);
}

.member-card h3 {
  margin: 0 0 var(--space-sm);
  color: var(--color-heading);
  font-size: var(--font-size-2xl);
  overflow-wrap: anywhere;
}

.member-identity {
  color: var(--color-muted-strong);
  font-size: var(--font-size-lg);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.member-meta {
  color: var(--color-muted);
  font-size: var(--font-size-md);
  overflow-wrap: anywhere;
}

.form-error {
  padding: var(--space-md) var(--space-lg);
  border-radius: 12px;
  background: var(--color-danger-bg);
  color: var(--color-danger-text);
  font-size: var(--font-size-md);
  font-weight: 700;
}

.billing-notice-message {
  line-height: 1.35;
}

.billing-screen .form-error,
.billing-screen .form-success {
  font-size: var(--font-size-lg);
  font-weight: 500;
}

.field-error {
  color: var(--color-danger-text);
  font-size: var(--font-size-md);
  font-weight: 600;
}

.form-success {
  padding: var(--space-md) var(--space-lg);
  border-radius: 12px;
  background: var(--color-success-bg);
  color: var(--color-success-text);
  font-size: var(--font-size-md);
  font-weight: 700;
}

.protocol-facts-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-lg);
}

.protocol-summary-grid {
  grid-template-columns: 1fr;
}

.protocol-field {
  min-width: 0;
}

.lot-result {
  display: grid;
  grid-column: 1 / -1;
  gap: var(--space-xl);
  margin-top: var(--space-md);
  margin-bottom: var(--space-md);
  padding: var(--space-xl) var(--space-2xl);
  border-left: 3px solid var(--color-surface-strong);
  border-radius: var(--radius-sm);
  background: var(--color-surface-soft);
}

.headline-field {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
}

.headline-field .protocol-value {
  font-size: var(--font-size-xl);
}

.protocol-label {
  margin-bottom: var(--space-2xs);
  color: var(--color-muted);
  font-size: var(--font-size-xs);
  font-weight: 800;
  text-transform: none;
}

.protocol-value {
  overflow-wrap: anywhere;
  font-size: var(--font-size-lg);
  line-height: 1.35;
}

.protocol-failure-reason {
  display: flex;
  grid-column: 1 / -1;
  flex-wrap: wrap;
  gap: 0 var(--space-sm);
  margin: var(--space-md) 0 0;
  padding: var(--space-md) var(--space-xl);
  border-radius: var(--radius-sm);
  background: var(--color-surface-muted);
  font-size: var(--font-size-lg);
  line-height: 1.35;
}

.protocol-failure-label {
  font-weight: 600;
}

/* Protocol page */
.protocol-page .protocol-label {
  font-size: var(--font-size-md);
  font-weight: 500;
}

.lot-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-xl);
  margin-top: var(--space-md);
  margin-bottom: calc(var(--space-2xl) + 4px);
}

.lot-title strong {
  display: block;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.3;
}

.lot-title .muted {
  color: var(--color-muted-strong);
  font-size: var(--font-size-lg);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: var(--badge-height);
  padding: 0 var(--space-md);
  border-radius: var(--radius-pill);
  background: var(--color-surface-soft);
  color: var(--color-heading);
  font-size: var(--font-size-sm);
  font-weight: 800;
  white-space: nowrap;
}

.protocol-page .bin-col {
  width: var(--bin-col-width);
  white-space: nowrap;
}

.protocol-page td.bin-col {
  color: var(--color-muted);
}

.protocol-page .unit-price-cell,
.protocol-page .article13-cell,
.protocol-page .amount-cell {
  white-space: nowrap;
}

.protocol-page .offer-values {
  display: none;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

.section-summary {
  margin: var(--space-2xl) 0 var(--space-md);
  color: var(--color-control-text);
  font-size: var(--font-size-xl);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: 0;
  cursor: pointer;
}

.section-summary::marker {
  color: var(--color-muted-soft);
}

.section-summary::-webkit-details-marker {
  color: var(--color-muted-soft);
}

.protocol-page th {
  font-weight: 600;
}

.protocol-page .badge {
  font-weight: 700;
}

.lot-details + .lot-details .section-summary {
  margin-top: var(--space-md);
}

.lot-rejected-suppliers + .lot-details .section-summary {
  margin-top: var(--space-xs);
}

.compact-list {
  margin: var(--space-sm) 0 0;
  padding-left: var(--space-3xl);
}

.compact-list li + li {
  margin-top: 5px;
}

.reason-cell {
  min-width: var(--reason-cell-min-width);
}

.reason-summary {
  display: block;
}

.reason-details-button {
  margin-top: var(--space-sm);
}

.reason-dialog {
  margin: auto;
  width: min(640px, calc(100vw - var(--space-4xl)));
  max-height: min(680px, calc(100vh - var(--space-4xl)));
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  overscroll-behavior: contain;
  overflow: auto;
}

.reason-dialog::backdrop {
  background: rgb(36 50 65 / 45%);
}

.reason-dialog[data-lightweight-modal][open] {
  position: fixed;
  inset: 0;
  z-index: 1000;
  box-shadow: 0 0 0 100vmax rgb(36 50 65 / 45%);
}

.reason-dialog[open] {
  display: flex;
  flex-direction: column;
}

.dialog-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: var(--space-xl);
  padding: var(--space-xl);
  border-bottom: 1px solid var(--color-border-muted);
  background: var(--color-surface-muted);
}

.reason-details-dialog .dialog-header {
  align-items: center;
}

.dialog-close {
  white-space: nowrap;
}

.dialog-close-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--color-heading);
  cursor: pointer;
  font: inherit;
  font-size: 28px;
  line-height: 1;
}

.dialog-close-icon-form {
  margin-left: auto;
}

.dialog-close-icon:hover {
  background: var(--color-surface-soft-hover);
}

.dialog-close-icon:focus-visible {
  outline: 2px solid rgb(11 99 206 / 34%);
  outline-offset: 2px;
}

.dialog-body {
  padding: var(--space-xl);
}

.admin-user-manage-dialog {
  width: min(720px, calc(100vw - var(--space-4xl)));
}

.admin-billing-manage-dialog {
  width: min(720px, calc(100vw - var(--space-4xl)));
}

.admin-company-manage-dialog {
  width: min(720px, calc(100vw - var(--space-4xl)));
}

.admin-user-dialog-section {
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--color-border-muted);
}

.admin-user-dialog-section + .admin-user-dialog-section {
  margin-top: var(--space-xl);
}

.admin-user-dialog-section:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.admin-user-dialog-section h3 {
  margin: 0 0 var(--space-md);
  color: var(--color-heading);
  font-size: var(--font-size-lg);
}

.admin-user-dialog-summary {
  display: grid;
  gap: var(--space-xs);
  margin-bottom: var(--space-xl);
  font-size: var(--font-size-lg);
}

.admin-billing-dialog-summary {
  width: 100%;
  margin-bottom: var(--space-xl);
  table-layout: fixed;
  border-collapse: collapse;
  font-size: var(--font-size-lg);
}

.admin-billing-dialog-summary th {
  width: 34%;
  padding: var(--space-sm) var(--space-md);
  background: transparent;
  font-weight: 600;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
}

.admin-billing-dialog-summary td {
  padding: var(--space-sm) var(--space-md);
  white-space: normal;
  overflow-wrap: anywhere;
}

.admin-billing-dialog-summary tr:last-child th,
.admin-billing-dialog-summary tr:last-child td {
  border-bottom: 0;
}

.admin-user-status-form,
.admin-member-remove-form {
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.admin-billing-action-form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-sm);
  justify-content: flex-start;
  width: 100%;
}

.admin-billing-issue-row {
  display: grid;
  grid-template-columns: minmax(0, 50%) max-content;
  align-items: center;
  gap: var(--space-md);
  width: 100%;
}

.admin-billing-issue-row input[type="text"] {
  width: 100%;
  min-width: 0;
  height: var(--control-height);
  padding: 0 var(--space-lg);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-control-text);
  font: inherit;
  font-size: var(--font-size-md);
  line-height: normal;
}

.admin-billing-issue-row input[type="text"]:focus {
  border-color: var(--color-muted-soft);
  outline: none;
  box-shadow: none;
}

.admin-billing-cancel-local-form {
  margin-top: var(--space-md);
}

.admin-billing-dialog-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  align-items: flex-start;
}

.admin-access-trial-form {
  width: min(100%, 340px);
}

.admin-access-trial-form .dialog-footer {
  margin-top: var(--space-sm);
  padding-top: 0;
  border-top: 0;
  justify-content: flex-start;
}

.admin-trial-notice {
  display: grid;
  gap: var(--space-2xs);
  width: min(100%, 420px);
  padding: var(--space-md) var(--space-lg);
  border: 1px solid var(--color-border-muted);
  border-radius: var(--radius-sm);
  background: var(--color-surface-muted);
  color: var(--color-muted-strong);
  font-size: var(--font-size-md);
}

.reason-dialog-supplier {
  min-width: 0;
  font-size: var(--font-size-lg);
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.reason-dialog-summary {
  margin: 0 0 var(--space-md);
  font-size: var(--font-size-lg);
  font-weight: 600;
}

.reason-details-dialog .compact-list {
  font-size: var(--font-size-lg);
}

.dialog-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: var(--space-xl);
  padding-top: var(--space-xl);
  border-top: 1px solid var(--color-border-muted);
}

@media (max-width: 760px) and (orientation: portrait) {
  .reason-dialog {
    inset: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }

  .reason-dialog .dialog-header {
    position: sticky;
    top: 0;
    z-index: 1;
    justify-content: space-between;
    padding-top: calc(var(--page-top-space) + var(--tg-content-safe-area-inset-top, 0px));
  }

  .reason-dialog .dialog-footer {
    display: none;
  }

  .reason-dialog .dialog-body {
    flex: 1 1 auto;
    min-height: 0;
  }

  .reason-dialog.protocol-filter-dialog .dialog-footer {
    position: sticky;
    bottom: 0;
    display: flex;
    padding-bottom: calc(var(--space-xl) + var(--tg-content-safe-area-inset-bottom, 0px));
    background: var(--color-surface);
  }
}

@media (hover: none) and (pointer: coarse) {
  :root.telegram-webapp {
    --page-top-space: var(--space-4xl);
  }
}

/* Mobile protocol layout */
@media (max-width: 760px), (orientation: landscape) and (max-height: 520px) {
  .protocol-page {
    padding-top: calc(var(--page-top-space) + var(--tg-content-safe-area-inset-top, 0px));
    padding-right: var(--tg-content-safe-area-inset-right, 0px);
    padding-bottom: calc(var(--page-bottom-space) + var(--tg-content-safe-area-inset-bottom, 0px));
    padding-left: var(--tg-content-safe-area-inset-left, 0px);
  }

  .protocol-page main {
    max-width: none;
  }

  .protocol-page .page-shell > header {
    display: block;
    padding: 0 var(--space-xl);
  }

  .protocol-page .page-back-nav {
    margin-bottom: var(--space-3xl);
    padding: 0 var(--space-xl);
  }

  .actions {
    justify-content: flex-start;
    margin-top: var(--space-lg);
  }

  .protocol-page .button {
    flex: 1 1 var(--mobile-action-min-width);
  }

  h1 {
    font-size: var(--font-size-title-mobile);
  }

  .panel {
    margin-bottom: var(--space-md);
    padding: var(--space-xl);
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }

  .protocol-facts-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--mobile-grid-gap);
  }

  .protocol-summary-grid.protocol-facts-grid {
    grid-template-columns: 1fr;
  }

  .protocol-facts-grid .protocol-field-full {
    grid-column: 1 / -1;
  }

  .lot-title {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
  }

  .headline-field {
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
  }

  .lot-title strong {
    font-size: 16px;
  }

.lot-title .muted {
  margin: var(--space-2xs) 0;
  line-height: 1.2;
}

  .badge {
    margin-top: 0;
    min-height: var(--badge-height-mobile);
    font-size: var(--font-size-xs);
  }

  .section-summary {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    min-height: var(--section-summary-height-mobile);
    margin: var(--space-xl) 0 0;
    padding: 0 var(--space-2xs);
    font-size: var(--font-size-lg);
  }

  .lot-details + .lot-details .section-summary {
    margin-top: var(--space-sm);
  }

  .lot-rejected-suppliers + .lot-details .section-summary {
    margin-top: var(--space-xs);
  }

  .section-summary::-webkit-details-marker {
    display: none;
  }

  .section-summary::before {
    width: 0;
    height: 0;
    border-top: var(--details-arrow-y) solid transparent;
    border-bottom: var(--details-arrow-y) solid transparent;
    border-left: var(--details-arrow-x) solid var(--color-muted-soft);
    content: "";
    transition: transform 0.15s ease;
  }

  .lot-details[open] .section-summary::before {
    transform: rotate(90deg);
  }

  .lot-details[open] .section-summary {
    margin-bottom: var(--space-md);
  }

  .protocol-page table,
  .protocol-page thead,
  .protocol-page tbody,
  .protocol-page tr,
  .protocol-page th,
  .protocol-page td {
    display: block;
  }

  .protocol-page table {
    border: 0;
  }

  .protocol-page thead {
    display: none;
  }

  .protocol-page tr {
    margin-bottom: var(--space-md);
    border: 1px solid var(--color-border-soft);
    border-radius: var(--radius-sm);
    overflow: hidden;
  }

  .lot-details tr:last-child {
    margin-bottom: 0;
  }

  .protocol-page td {
    display: grid;
    grid-template-columns: var(--mobile-label-col-width) minmax(0, 1fr);
    gap: var(--space-md);
    padding: var(--space-table-y) var(--space-xl);
  }

  .protocol-page td::before {
    content: attr(data-label);
    color: var(--color-muted);
    font-size: var(--font-size-sm);
    font-weight: 500;
    text-transform: none;
  }

  .protocol-page td.primary-cell {
    display: block;
    padding: var(--primary-cell-padding-y) var(--space-xl);
    background: var(--color-surface-muted);
    color: var(--color-heading);
    font-size: var(--font-size-lg);
    font-weight: 400;
    line-height: 1.35;
  }

  .protocol-page td.primary-cell::before,
  .protocol-page td.reason-cell::before,
  .protocol-page td.offer-values::before {
    content: none;
  }

  .protocol-page td.reason-cell {
    display: block;
  }

  .protocol-page td.reason-cell .compact-list {
    list-style: none;
    padding-left: 0;
  }

  .protocol-page tr.price-calculation-row,
  .protocol-page tr.pitanie-score-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(var(--mobile-score-col-min), 1fr));
  }

  .protocol-page tr.price-calculation-row .primary-cell,
  .protocol-page tr.pitanie-score-row .primary-cell {
    grid-column: 1 / -1;
  }

  .protocol-page td.price-calculation-cell,
  .protocol-page td.pitanie-score-cell {
    display: block;
    color: var(--color-text);
    font-size: var(--font-size-lg);
    font-weight: 400;
    line-height: 1.35;
  }

  .protocol-page td.price-calculation-cell::before,
  .protocol-page td.pitanie-score-cell::before {
    display: block;
    margin-bottom: var(--space-2xs);
  }

  .protocol-page .bin-col,
  .protocol-page .unit-price-cell,
  .protocol-page .article13-cell,
  .protocol-page .amount-cell {
    display: none;
  }

  .protocol-page td.offer-values {
    display: block;
    color: var(--color-text);
    font-size: var(--font-size-lg);
    font-weight: 400;
    line-height: 1.35;
  }

  .price-line {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(var(--mobile-price-col-min), 1fr));
    gap: var(--space-md);
  }

  .mini-label {
    display: block;
    margin-bottom: var(--space-2xs);
    color: var(--color-muted);
    font-size: var(--font-size-sm);
    font-weight: 500;
    text-transform: none;
  }
}

/* Mobile landscape */
@media (orientation: landscape) and (max-height: 520px) {
  .protocol-page {
    padding-top: calc(var(--page-top-space) + var(--tg-content-safe-area-inset-top, 0px));
    padding-right: var(--tg-content-safe-area-inset-right, 0px);
    padding-bottom: calc(var(--page-bottom-space) + var(--tg-content-safe-area-inset-bottom, 0px));
    padding-left: var(--tg-content-safe-area-inset-left, 0px);
  }

  .protocol-page main {
    max-width: none;
  }

  .panel {
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }
}

@media (max-width: 760px), (orientation: landscape) and (max-height: 520px) {
  .protocol-page .submission-time-cell {
    display: none;
  }
}

/* Mobile list layout */
@media (max-width: 720px) {
  :root {
    --color-page: #f3f4f6;
    --page-top-space: 48px;
    --page-bottom-space: 56px;
  }

  .list-page {
    padding-top: calc(var(--page-top-space) + var(--tg-content-safe-area-inset-top, 0px));
    padding-right: calc(var(--space-xl) + var(--tg-content-safe-area-inset-right, 0px));
    padding-bottom: calc(var(--page-bottom-space) + var(--tg-content-safe-area-inset-bottom, 0px));
    padding-left: calc(var(--space-xl) + var(--tg-content-safe-area-inset-left, 0px));
  }

  .auth-page {
    padding-top: calc(var(--page-top-space) + var(--tg-content-safe-area-inset-top, 0px));
    padding-right: calc(var(--space-xl) + var(--tg-content-safe-area-inset-right, 0px));
    padding-bottom: calc(var(--page-bottom-space) + var(--tg-content-safe-area-inset-bottom, 0px));
    padding-left: calc(var(--space-xl) + var(--tg-content-safe-area-inset-left, 0px));
  }

  header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-xl);
    margin-bottom: var(--space-3xl);
  }

  .list-page .protocol-list-title {
    margin-top: 0;
    margin-bottom: 0;
  }

  .page-actions,
  .admin-actions {
    margin-top: 0;
    margin-left: auto;
    flex: none;
  }

  .button-nav {
    min-height: var(--control-height-sm);
    padding: 0 var(--space-lg);
    font-size: var(--font-size-md);
  }

  .admin-actions .button-nav {
    order: 1;
  }

  .admin-actions .protocol-admin-nav {
    order: 2;
    width: 100%;
    margin: var(--space-md) 0 var(--space-lg);
  }

  .protocol-admin-nav--desktop {
    display: none;
  }

  .protocol-admin-nav--mobile {
    display: block;
  }

  .cabinet-nav-section {
    margin-right: calc(-1 * var(--space-xl) - var(--tg-content-safe-area-inset-right, 0px));
    margin-left: calc(-1 * var(--space-xl) - var(--tg-content-safe-area-inset-left, 0px));
    padding-right: calc(var(--space-xl) + var(--tg-content-safe-area-inset-right, 0px));
    padding-left: calc(var(--space-xl) + var(--tg-content-safe-area-inset-left, 0px));
  }

  .cabinet-support-section {
    margin-right: calc(-1 * var(--space-xl) - var(--tg-content-safe-area-inset-right, 0px));
    margin-left: calc(-1 * var(--space-xl) - var(--tg-content-safe-area-inset-left, 0px));
    padding-right: calc(var(--space-xl) + var(--tg-content-safe-area-inset-right, 0px));
    padding-left: calc(var(--space-xl) + var(--tg-content-safe-area-inset-left, 0px));
  }

  .cabinet-nav-grid {
    grid-template-columns: repeat(3, minmax(72px, 1fr));
    gap: 12px 8px;
  }

  .cabinet-nav-item {
    min-height: 82px;
    padding: 12px 4px;
    border: 0;
    background: transparent;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 160ms ease, color 160ms ease;
  }

  .cabinet-nav-item:hover,
  .cabinet-nav-item:active {
    background: transparent;
  }

  .plan-card-grid {
    grid-template-columns: 1fr;
  }

  .company-grid.company-screen-grid {
    grid-template-columns: 1fr;
  }

  .billing-payment-page .billing-screen {
    width: auto;
    max-width: none;
  }

  .billing-phone-field {
    max-width: none;
  }

  .checkout-button {
    width: 100%;
  }

  .cabinet-nav-item,
  .plan-card {
    min-height: 0;
  }

  .cabinet-nav-item strong {
    font-size: 14px;
    letter-spacing: -0.02em;
  }

  .profile-head,
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .profile-head {
    display: grid;
  }

  .profile-grid div {
    grid-template-columns: 1fr;
  }

  .list-page table {
    background: transparent;
    border: 0;
  }

  .list-page .admin-billing-dialog-summary {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    overflow: hidden;
  }

  .list-page table,
  .list-page thead,
  .list-page tbody,
  .list-page tr,
  .list-page th,
  .list-page td {
    display: block;
  }

  .list-page thead {
    display: none;
  }

  .list-page tr {
    margin-bottom: var(--space-lg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    overflow: hidden;
  }

  .list-page .admin-billing-dialog-summary tr {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    align-items: start;
    gap: var(--space-md);
    margin-bottom: 0;
    border: 0;
    border-bottom: 1px solid var(--color-border-muted);
    border-radius: 0;
    background: transparent;
    overflow: visible;
  }

  .list-page td {
    display: grid;
    grid-template-columns: var(--mobile-label-col-width) minmax(0, 1fr);
    gap: var(--space-lg);
    padding: var(--space-md) var(--space-lg);
    white-space: normal;
  }

  .list-page td::before {
    font-size: var(--font-size-sm);
    font-weight: 700;
  }

  .list-page .admin-billing-dialog-summary th,
  .list-page .admin-billing-dialog-summary td {
    display: block;
    grid-template-columns: none;
    gap: 0;
    padding: var(--space-sm) var(--space-lg);
    border-bottom: 0;
    white-space: normal;
  }

  .list-page .admin-billing-dialog-summary th {
    width: auto;
    color: var(--color-muted);
    font-size: var(--font-size-sm);
    font-weight: 700;
    overflow-wrap: anywhere;
  }

  .admin-page .admin-data-table td {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    align-items: start;
    gap: var(--space-md);
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .admin-page .admin-data-table td::before {
    content: attr(data-label);
    color: var(--color-muted);
    font-size: var(--font-size-sm);
    font-weight: 700;
  }

  .admin-page .admin-data-table td > * {
    grid-column: 2;
    min-width: 0;
  }

  .admin-page .admin-data-table td > .badge {
    justify-self: start;
  }

  .admin-page .admin-data-table td > .status {
    justify-self: start;
  }

  .admin-page .admin-data-table .admin-company-form {
    width: 100%;
  }

  .admin-page .admin-data-table td[data-label="Действия"] {
    grid-template-columns: 104px minmax(0, 1fr);
    align-items: center;
  }

  .button-mobile-full {
    width: 100%;
  }

  .protocol-list-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: var(--space-md);
    margin-bottom: var(--space-3xl);
  }

  .protocol-search {
    order: 1;
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }

  .segmented-tabs {
    order: 0;
    justify-content: flex-start;
    width: auto;
  }

  .protocol-card {
    grid-template-columns: 1fr;
    border: 1px solid var(--color-border-soft);
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    padding: 16px var(--space-xl) 12px;
  }

  .protocol-card-list {
    margin-right: calc(-1 * var(--space-xl));
    margin-left: calc(-1 * var(--space-xl));
    gap: var(--space-lg);
  }

  .protocol-card-main {
    display: block;
  }

  .protocol-card-title {
    margin-bottom: var(--space-2xl);
    font-size: var(--font-size-2xl);
  }

  .protocol-card-title-link {
    font-size: 16px;
  }

  .protocol-card-kicker {
    margin-top: var(--space-2xl);
  }

  .protocol-card-organizer {
    display: none;
  }

  .protocol-card-sample-organization {
    display: none;
  }

  .protocol-card-mobile-keyline {
    display: flex;
    flex-wrap: wrap;
    align-items: start;
    gap: var(--space-sm);
    margin: calc(-1 * var(--space-xs)) 0 var(--space-lg);
  }

  .protocol-card-mobile-keyline > * {
    flex: 1 1 calc(33.333% - var(--space-sm));
    min-width: max-content;
  }

  .protocol-card-mobile-keyline-item {
    display: grid;
    gap: var(--space-2xs);
  }

  .protocol-card-mobile-keyline-label {
    color: var(--color-muted);
    font-size: var(--font-size-sm);
    font-weight: 500;
    white-space: nowrap;
  }

  .protocol-card-mobile-keyline-item > :not(.protocol-method-help),
  .protocol-card-mobile-keyline .protocol-method-abbr {
    white-space: nowrap;
  }

  .protocol-card-mobile-keyline .protocol-method-tooltip {
    white-space: normal;
  }

  .protocol-card-mobile-keyline .protocol-method-abbr {
    min-height: auto;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
  }

  .protocol-card-key-facts dt,
  .protocol-card-key-facts dd,
  .protocol-card-facts dt,
  .protocol-card-facts dd {
    font-size: var(--font-size-lg);
  }

  .protocol-card-key-facts {
    display: none;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    margin-bottom: var(--space-lg);
    padding-left: 0;
    border-left: 0;
  }

  .protocol-card-key-facts div:nth-child(3) {
    grid-column: 1 / -1;
  }

  .protocol-card-facts {
    display: none;
  }

  .invite-link-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .member-invite-strip {
    grid-template-columns: 1fr;
    grid-template-areas:
      "intro"
      "url"
      "actions";
    align-items: stretch;
  }

  .member-invite-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: stretch;
  }

  .member-invite-actions .button {
    width: 100%;
    min-width: 0;
  }

  .member-invite-actions .inline-form {
    grid-column: 1 / -1;
  }

  .invite-actions {
    grid-template-columns: 1fr;
  }

  .search-bar {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .admin-billing-filter-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-billing-filter-actions .button {
    width: 100%;
  }

  .pagination {
    display: grid;
    justify-content: stretch;
  }

  .pagination-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 420px) {
  .protocol-facts-grid {
    grid-template-columns: 1fr 1fr;
  }

  .protocol-summary-grid.protocol-facts-grid {
    grid-template-columns: 1fr;
  }
}
