:root {
  --bg: #f4f1ec;
  --surface: #fffcf8;
  --border: #ddd5c8;
  --text: #1c1917;
  --muted: #6b6560;
  --accent: #0d6e4f;
  --accent-hover: #0a5840;
  --error-bg: rgba(220, 38, 38, 0.18);
  --error-underline: #dc2626;
  --style-bg: rgba(37, 99, 235, 0.15);
  --style-underline: #2563eb;
  --warn-bg: #fef3c7;
  --warn-text: #92400e;
  --shadow: 0 8px 30px rgba(28, 25, 23, 0.08);
  --font-sans: "IBM Plex Sans", system-ui, sans-serif;
  --font-serif: "IBM Plex Serif", Georgia, serif;
}

[data-theme="dark"] {
  --bg: #141210;
  --surface: #1f1c19;
  --border: #3d3834;
  --text: #f5f2ed;
  --muted: #a8a29e;
  --accent: #34d399;
  --accent-hover: #6ee7b7;
  --error-bg: rgba(248, 113, 113, 0.22);
  --warn-bg: #422006;
  --warn-text: #fcd34d;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

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

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

a.btn {
  text-decoration: none;
}

a.btn-primary {
  color: #fff;
}

a.btn-primary:hover {
  color: #fff;
  text-decoration: none;
}

[data-theme="dark"] a.btn-primary,
[data-theme="dark"] a.btn-primary:hover {
  color: #052e1f;
}

.header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.header-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas:
    "brand tools"
    "quota quota";
  gap: 0.65rem 0.75rem;
  align-items: center;
  width: 100%;
  max-width: 100%;
}

html[data-open-access="1"] .header-inner {
  grid-template-areas: "brand tools";
}

html[data-open-access="1"] .guest-nav,
html[data-open-access="1"] .header-quota,
html[data-open-access="1"] #accountMenu,
html[data-open-access="1"] #quotaHint,
html[data-open-access="1"] .auth-links {
  display: none !important;
}

.brand {
  grid-area: brand;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.brand-text {
  min-width: 0;
}

.brand-home {
  display: flex;
  flex-shrink: 0;
  text-decoration: none;
  color: inherit;
}

.brand-home:hover .brand-mark {
  opacity: 1;
}

.brand-mark {
  flex-shrink: 0;
  font-size: 1.75rem;
  line-height: 1;
  opacity: 0.85;
}

h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.2;
}

.tagline {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.3;
}

.header-tools {
  grid-area: tools;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-shrink: 0;
}

.header-quota {
  grid-area: quota;
  width: 100%;
  min-width: 0;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  cursor: pointer;
  user-select: none;
}

.picky-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.picky-help-btn {
  width: 1.15rem;
  height: 1.15rem;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.picky-help-btn:hover,
.picky-help-btn[aria-expanded="true"] {
  color: var(--accent);
  border-color: var(--accent);
}

.picky-help-tip {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  z-index: 40;
  width: min(20rem, calc(100vw - 2rem));
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.8rem;
  line-height: 1.4;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] .picky-help-tip {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.status-bar {
  padding: 0.5rem 1.5rem;
  font-size: 0.8rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.status-dot::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.5rem;
  background: #9ca3af;
  vertical-align: middle;
}

.status-dot.ok::before {
  background: #22c55e;
}

.status-dot.warn::before {
  background: #f59e0b;
}

.status-dot.err::before {
  background: #ef4444;
}

.warning-bar {
  padding: 0.65rem 1.5rem;
  background: var(--warn-bg);
  color: var(--warn-text);
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
}

.warning-bar.limit-error {
  background: #fef2f2;
  color: #991b1b;
  border-bottom: 2px solid #dc2626;
  font-size: 0.9rem;
  line-height: 1.5;
}

[data-theme="dark"] .warning-bar.limit-error {
  background: #450a0a;
  color: #fecaca;
  border-bottom-color: #f87171;
}

.warning-bar.limit-error strong {
  color: #dc2626;
}

[data-theme="dark"] .warning-bar.limit-error strong {
  color: #f87171;
}

.warning-bar.limit-error a {
  color: #b91c1c;
  font-weight: 600;
}

[data-theme="dark"] .warning-bar.limit-error a {
  color: #fca5a5;
}

.warning-bar.hidden {
  display: none;
}

.layout {
  display: grid;
  grid-template-columns: 1fr min(360px, 38vw);
  gap: 0;
  flex: 1;
  min-height: 0;
  align-items: stretch;
}

@media (max-width: 900px) {
  .layout {
    grid-template-columns: 1fr;
    flex: 1 1 auto;
  }
}

.editor-panel {
  padding: 1rem 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.char-count {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--muted);
}

.btn {
  font: inherit;
  border-radius: 8px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  font-weight: 500;
}

[data-theme="dark"] .btn-primary {
  color: #052e1f;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:disabled,
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  background: var(--border);
}

.editor-wrap {
  position: relative;
  flex: 1;
  min-height: 320px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.highlight-layer,
.editor {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 1.25rem 1.5rem;
  font-family: var(--font-serif);
  font-size: 1.05rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow: auto;
  border: none;
  resize: none;
  width: 100%;
  height: 100%;
}

.highlight-layer {
  pointer-events: none;
  color: transparent;
  z-index: 1;
}

.editor {
  z-index: 2;
  background: transparent;
  color: var(--text);
  caret-color: var(--text);
}

.editor:focus {
  outline: none;
}

.highlight-layer mark {
  border-radius: 2px;
}

mark.err {
  background: var(--error-bg);
  box-shadow: inset 0 -2px 0 var(--error-underline);
}

mark.style {
  background: var(--style-bg);
  box-shadow: inset 0 -2px 0 var(--style-underline);
}

.issues-panel {
  border-left: 1px solid var(--border);
  background: var(--surface);
  padding: 1rem 1rem 2rem;
  overflow-y: auto;
  min-height: 0;
  height: 100%;
  align-self: stretch;
}

@media (max-width: 900px) {
  .issues-panel {
    border-left: none;
    border-top: 1px solid var(--border);
  }
}

.issues-panel h2 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--border);
  font-size: 0.75rem;
  font-weight: 600;
}

.issues-hint {
  margin: 0 0 1rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.issues-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.issue-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.issue-card:hover,
.issue-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.issue-card .fragment {
  font-family: var(--font-serif);
  font-size: 0.9rem;
  margin: 0.35rem 0;
  padding: 0.35rem 0.5rem;
  background: var(--bg);
  border-radius: 6px;
}

.issue-card .fragment em {
  font-style: normal;
  background: var(--error-bg);
  box-shadow: inset 0 -2px 0 var(--error-underline);
}

.issue-card .message {
  margin: 0;
  font-size: 0.875rem;
}

.issue-card .category {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.replacements {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}

.replacements button {
  font: inherit;
  font-size: 0.8rem;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
}

.replacements button:hover {
  background: var(--accent);
  color: #fff;
}

[data-theme="dark"] .replacements button:hover {
  color: #052e1f;
}

.issues-list .empty {
  color: var(--muted);
  font-size: 0.9rem;
  padding: 1rem 0;
}

.footer {
  padding: 1rem 1.5rem 1.5rem;
  font-size: 0.75rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

.footer a {
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.875rem;
}

.nav-links a:hover {
  text-decoration: underline;
}

.guest-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.guest-nav a {
  font-size: 0.875rem;
  font-weight: 500;
}

.account-menu {
  position: relative;
  display: flex;
  align-items: center;
}

/* Одинаковая высота: тема и «Мой аккаунт» */
.header-tools .header-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  box-sizing: border-box;
  height: 2.125rem;
  min-height: 2.125rem;
  max-height: 2.125rem;
  padding: 0 0.75rem;
  line-height: 1;
  font-size: 0.875rem;
  vertical-align: middle;
}

#themeBtn {
  width: 2.125rem;
  min-width: 2.125rem;
  padding: 0;
  font-size: 1.1rem;
}

.account-trigger[aria-expanded="true"] {
  border-color: var(--accent);
  background: var(--border);
}

.account-icon {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  color: var(--accent);
}

.account-icon svg {
  display: block;
  width: 1rem;
  height: 1rem;
}

.account-label {
  white-space: nowrap;
}

.account-chevron {
  font-size: 0.65rem;
  color: var(--muted);
  transition: transform 0.15s;
}

.account-trigger[aria-expanded="true"] .account-chevron {
  transform: rotate(180deg);
}

.account-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 240px;
  max-width: min(300px, calc(100vw - 1.5rem));
  padding: 0.35rem 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  z-index: 100;
}

.account-dropdown a,
.account-logout {
  display: block;
  width: 100%;
  padding: 0.55rem 1rem;
  font: inherit;
  font-size: 0.875rem;
  text-align: left;
  text-decoration: none;
  color: var(--text);
  background: none;
  border: none;
  cursor: pointer;
}

.account-dropdown a:hover,
.account-logout:hover {
  background: var(--bg);
  text-decoration: none;
}

.account-header {
  padding: 0.55rem 1rem 0.6rem;
  border-bottom: 1px solid var(--border);
}

.account-name {
  margin: 0 0 0.2rem;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
}

.account-name.hidden {
  display: none;
}

.account-email {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--muted);
  overflow-wrap: anywhere;
  word-break: normal;
}

.account-tariff {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-top: 0.45rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  line-height: 1.35;
}

.account-tariff.hidden {
  display: none;
}

.account-tariff-name {
  font-weight: 600;
  color: var(--accent);
}

.account-tariff-days {
  color: var(--muted);
  font-weight: 500;
}

.account-tariff-days.hidden {
  display: none;
}

.account-logout {
  color: #dc2626;
  border-top: 1px solid var(--border);
  margin-top: 0.25rem;
  padding-top: 0.65rem;
}

[data-theme="dark"] .account-logout {
  color: #f87171;
}

.quota-bar {
  display: block;
  width: 100%;
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.35;
}

/* Широкий экран: одна строка — лого | лимит | кнопки */
@media (min-width: 900px) {
  .header {
    padding: 1.25rem 1.5rem;
  }

  .header-inner {
    grid-template-columns: 1fr auto auto;
    grid-template-areas: "brand quota tools";
    gap: 0.75rem 1.25rem;
  }

  .header-quota {
    width: auto;
    justify-self: end;
  }

  .quota-bar {
    width: auto;
    white-space: nowrap;
    text-align: right;
  }
}

/* Узкий экран: подзаголовок скрыт, компактные кнопки */
@media (max-width: 899px) {
  .tagline {
    display: none;
  }

  h1 {
    font-size: 1.05rem;
  }

  .brand-mark {
    font-size: 1.45rem;
  }

  .header {
    padding: 0.85rem 1rem;
  }

  .editor-toolbar {
    gap: 0.35rem;
    margin-bottom: 0.5rem;
  }

  .editor-toolbar .btn {
    padding: 0.32rem 0.6rem;
    font-size: 0.8125rem;
    border-radius: 6px;
  }

  .editor-toolbar .toggle {
    font-size: 0.8125rem;
    gap: 0.3rem;
  }

  .char-count {
    font-size: 0.75rem;
  }
}

@media (max-width: 420px) {
  h1 {
    font-size: 0.95rem;
  }

  .account-label {
    display: none;
  }

  .account-trigger {
    padding: 0 0.5rem !important;
    min-width: 2.125rem;
  }

  .guest-nav {
    gap: 0.5rem;
    font-size: 0.8rem;
  }

  .header-nav-link {
    font-size: 0.75rem;
    padding: 0.25rem 0.35rem;
  }

  .editor-toolbar .btn {
    padding: 0.28rem 0.5rem;
    font-size: 0.75rem;
  }

  .editor-toolbar .toggle span {
    font-size: 0.75rem;
  }
}

.quota-hint {
  padding: 0.5rem 1.5rem;
  background: #fef2f2;
  color: #991b1b;
  font-size: 0.875rem;
  border-bottom: 1px solid #fecaca;
}

[data-theme="dark"] .quota-hint {
  background: #450a0a;
  color: #fecaca;
}

.quota-hint.hidden {
  display: none;
}

.quota-hint a {
  color: inherit;
  font-weight: 600;
}

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.auth-card h1 {
  margin-top: 0;
}

.auth-card label {
  display: block;
  margin-bottom: 1rem;
  font-size: 0.875rem;
}

.auth-card input {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.5rem 0.65rem;
  font: inherit;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}

.auth-hint {
  font-size: 0.85rem;
  color: var(--muted);
}

.auth-links {
  margin-top: 1.25rem;
  font-size: 0.875rem;
  text-align: center;
  color: var(--muted);
}

.auth-links a {
  font-weight: 500;
}

.form-error {
  color: #dc2626;
  font-size: 0.875rem;
}

.form-error.hidden {
  display: none;
}

.page-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem;
}

.content-page .lead {
  font-size: 1.05rem;
  line-height: 1.55;
  margin: 0 0 1.25rem;
  max-width: 42rem;
}

.content-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 0 0 2rem;
}

.content-section {
  margin-bottom: 2rem;
  max-width: 42rem;
}

.content-section h2 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
}

.steps-list,
.feature-list {
  margin: 0 0 0.85rem;
  padding-left: 1.25rem;
}

.steps-list li,
.feature-list li {
  margin-bottom: 0.55rem;
  line-height: 1.45;
}

.content-section code {
  font-size: 0.88em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: rgba(13, 110, 79, 0.08);
}

[data-theme="dark"] .content-section code {
  background: rgba(52, 211, 153, 0.12);
}

.header-nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
}

.header-nav-link:hover {
  color: var(--accent);
  text-decoration: none;
  background: rgba(13, 110, 79, 0.08);
}

.header-nav-link[aria-current="page"] {
  color: var(--accent);
}

.tariff-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.tariff-card {
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.tariff-price {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--accent);
}

.tariff-order-note {
  margin: 0.6rem 0 0;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: lowercase;
  white-space: nowrap;
}

.badge-ok {
  background: rgba(13, 110, 79, 0.12);
  color: var(--accent);
}

.badge-warn {
  background: rgba(217, 119, 6, 0.15);
  color: #b45309;
}

[data-theme="dark"] .badge-warn {
  color: #fbbf24;
}

.muted-text {
  color: var(--muted);
  font-size: 0.85rem;
}

.extend-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  min-width: 12rem;
}

.extend-date {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  align-items: center;
}

.extend-date input[type="date"] {
  max-width: 9.5rem;
  padding: 0.25rem 0.35rem;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
}

.admin-table-users {
  min-width: 960px;
}

.admin-extend-cell {
  min-width: 14rem;
}

.admin-main {
  max-width: 1200px;
}

.admin-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.admin-tabs button {
  font: inherit;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}

.admin-tabs button.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

[data-theme="dark"] .admin-tabs button.active {
  color: #052e1f;
}

.admin-tab.hidden {
  display: none;
}

.admin-tab {
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.admin-table th,
.admin-table td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.5rem;
  text-align: left;
  vertical-align: top;
}

.log-text {
  max-width: 400px;
  word-break: break-word;
  white-space: pre-wrap;
}

.log-group-row {
  cursor: pointer;
}

.log-group-row:hover {
  background: rgba(13, 110, 79, 0.06);
}

[data-theme="dark"] .log-group-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.log-group-row[aria-expanded="true"] {
  background: rgba(13, 110, 79, 0.1);
}

.log-group-toggle {
  width: 1.5rem;
  color: var(--muted);
  user-select: none;
}

.log-detail-panel {
  padding: 0.5rem 0;
}

.log-items-table {
  margin: 0;
  width: 100%;
}

.btn-sm {
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.inline-form input {
  padding: 0.4rem;
  font: inherit;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.tariff-edit-panel {
  margin: 1.25rem 0;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}

.tariff-edit-panel h3 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
}

.tariff-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.65rem 1rem;
}

.tariff-form-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.8rem;
}

.tariff-form-field span {
  color: var(--muted);
}

.tariff-form-field input {
  padding: 0.4rem 0.5rem;
  font: inherit;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}

.tariff-form-slug {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.75rem;
}

.tariff-form-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.admin-actions-cell {
  white-space: nowrap;
}

.admin-actions-cell .btn {
  margin: 0.1rem 0;
}

.admin-table tr.row-inactive td {
  opacity: 0.72;
}

.hidden {
  display: none !important;
}

.feedback-hint {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.link-btn {
  font: inherit;
  color: var(--accent);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.link-btn:hover {
  color: var(--accent-hover);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.hidden {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(28, 25, 23, 0.45);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(28rem, 100%);
  max-height: min(90vh, 40rem);
  overflow: auto;
  padding: 1.35rem 1.35rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.modal-close {
  position: absolute;
  top: 0.55rem;
  right: 0.65rem;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  background: var(--border);
  color: var(--text);
}

.modal-card h2 {
  margin: 0 1.5rem 0.35rem 0;
  font-size: 1.15rem;
}

.feedback-modal-hint {
  margin: 0 0 1rem;
  font-size: 0.85rem;
}

.feedback-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.feedback-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.feedback-form input,
.feedback-form textarea {
  font: inherit;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  resize: vertical;
}

.feedback-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.feedback-success {
  margin: 0;
  color: var(--accent);
  font-size: 0.9rem;
}

.feedback-success.hidden {
  display: none !important;
}

.admin-table tr.row-unread td {
  font-weight: 500;
}

.feedback-message-cell {
  max-width: 28rem;
  white-space: pre-wrap;
  word-break: break-word;
}
