:root {
  color-scheme: light;
  --bg: #f5f7f4;
  --surface: #ffffff;
  --surface-muted: #eef3ed;
  --line: #d9e1d8;
  --text: #17211b;
  --muted: #617067;
  --brand: #0f8f61;
  --brand-dark: #0a5f45;
  --warn: #9a6400;
  --warn-bg: #fff3d4;
  --danger: #b42318;
  --danger-bg: #fee4df;
  --good-bg: #daf7e8;
  --shadow: 0 18px 42px rgba(29, 45, 36, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

body.admin-auth-locked {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 12% 16%, rgba(191, 246, 216, 0.42), transparent 34%),
    linear-gradient(110deg, #f7faf4 0%, #ffffff 48%, #f3f5ed 100%);
}

.login-card {
  width: min(446px, calc(100vw - 32px));
  margin: 0;
  padding: 28px 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.login-card .brand-lockup {
  margin-bottom: 20px;
}

.login-card .brand-lockup strong {
  font-size: 22px;
}

.admin-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 100vh;
}

.admin-shell > * {
  min-width: 0;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 22px 18px;
  border-right: 1px solid var(--line);
  background: #fbfcfa;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  flex: 0 0 auto;
}

.brand-mark img {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.brand-lockup strong {
  display: block;
  font-size: 17px;
}

.brand-lockup span {
  color: var(--muted);
  font-size: 13px;
}

.sidebar-nav {
  display: grid;
  align-content: start;
  flex: 0 0 auto;
  gap: 6px;
  min-height: 0;
  margin-bottom: auto;
  overflow-y: auto;
  padding-right: 2px;
}

.sidebar-nav button {
  width: 100%;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 8px 10px;
}

.sidebar-nav button:hover,
.sidebar-nav button:focus-visible,
.sidebar-nav button.is-active {
  border-color: var(--line);
  background: var(--surface-muted);
  color: var(--text);
  outline: none;
}

.admin-account-panel {
  display: grid;
  flex: 0 0 auto;
  gap: 7px;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.admin-account-panel span,
.admin-account-panel small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.admin-account-panel strong {
  overflow-wrap: anywhere;
  font-size: 16px;
}

.admin-account-panel button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--text);
  font-weight: 800;
}

.admin-account-panel button:hover,
.admin-account-panel button:focus-visible {
  border-color: var(--brand);
  background: #ffffff;
  outline: none;
}

.admin-login {
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.admin-login label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.admin-login input {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  color: var(--text);
}

.admin-login button {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: #ffffff;
  font-weight: 800;
}

.admin-login small {
  color: var(--muted);
}

.main {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
  text-wrap: pretty;
}

h1 {
  margin-bottom: 8px;
  max-width: 780px;
  font-size: 34px;
  line-height: 1.18;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 14px;
  font-size: 21px;
}

h3 {
  margin-bottom: 0;
  font-size: 18px;
}

.lead {
  max-width: 880px;
  color: var(--muted);
}

.environment-chip {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  padding: 7px 13px;
  color: var(--brand-dark);
  font-weight: 700;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.summary-tile,
.section-block,
.module-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.summary-tile {
  padding: 16px;
}

.summary-tile span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.summary-tile strong {
  display: block;
  margin-top: 6px;
  font-size: 26px;
  line-height: 1.1;
}

.section-block {
  margin-bottom: 24px;
  padding: 20px;
}

.page-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 14px;
}

.page-layout > *,
.operation-panel > * {
  min-width: 0;
}

.module-directory {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.module-link-card {
  display: grid;
  align-items: center;
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 15px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 160ms ease, background 160ms ease;
}

.module-link-card:hover,
.module-link-card:focus-visible {
  border-color: var(--brand);
  background: #f7fbf8;
  outline: none;
}

.module-link-card strong {
  font-size: 17px;
}

.operation-panel {
  display: grid;
  grid-template-columns: minmax(240px, 0.7fr) minmax(0, 1.3fr);
  gap: 18px;
  align-items: start;
  margin-bottom: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 20px;
}

.operation-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
}

.operation-form--compact {
  grid-template-columns: minmax(160px, 240px) auto;
}

.operation-form label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.operation-form input,
.operation-form select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 8px 10px;
  color: var(--text);
}

.operation-form button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: #ffffff;
  padding: 8px 13px;
  font-weight: 800;
  white-space: nowrap;
}

.operation-status {
  grid-column: 1 / -1;
  min-height: 20px;
  color: var(--muted);
}

.operation-status[data-tone="good"] {
  color: var(--brand-dark);
}

.operation-status[data-tone="danger"] {
  color: var(--danger);
}

.orders-summary {
  margin-bottom: 20px;
}

.billing-policy-panel {
  display: grid;
  gap: 16px;
}

.billing-policy-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.billing-policy-head h2 {
  margin-bottom: 0;
}

.billing-policy-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.billing-policy-meta div {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
  padding: 12px;
}

.billing-policy-meta dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.billing-policy-meta dd {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.billing-policy-form {
  display: grid;
  grid-template-columns: minmax(180px, 0.75fr) minmax(220px, 1fr) minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.billing-policy-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.billing-policy-form input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 8px 10px;
  color: var(--text);
}

.billing-policy-form button {
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: #ffffff;
  padding: 8px 13px;
  font-weight: 800;
  white-space: nowrap;
}

.billing-policy-switch {
  position: relative;
  grid-template-columns: auto 1fr;
  gap: 10px !important;
  align-items: center;
  color: var(--text) !important;
  cursor: pointer;
}

.billing-policy-switch input {
  position: absolute;
  width: 1px;
  min-height: 1px;
  opacity: 0;
}

.billing-policy-toggle {
  position: relative;
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  width: 86px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #edf2ec;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
  color: var(--muted);
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.billing-policy-toggle-track-text {
  position: relative;
  z-index: 1;
  text-align: center;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.05em;
}

.billing-policy-toggle-track-text--off {
  color: var(--brand-dark);
}

.billing-policy-toggle-track-text--on {
  color: rgba(255, 255, 255, 0.75);
}

.billing-policy-toggle-knob {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 5px 14px rgba(14, 43, 31, 0.18);
  transition: transform 160ms ease;
}

.billing-policy-switch input:checked + .billing-policy-toggle {
  border-color: var(--brand);
  background: var(--brand);
}

.billing-policy-switch input:checked + .billing-policy-toggle .billing-policy-toggle-knob {
  transform: translateX(48px);
}

.billing-policy-switch input:checked + .billing-policy-toggle .billing-policy-toggle-track-text--off {
  color: rgba(255, 255, 255, 0.7);
}

.billing-policy-switch input:checked + .billing-policy-toggle .billing-policy-toggle-track-text--on {
  color: #ffffff;
}

.billing-policy-switch input:focus-visible + .billing-policy-toggle {
  outline: 3px solid rgba(21, 146, 106, 0.18);
  outline-offset: 3px;
}

.billing-policy-switch-copy {
  display: grid;
  gap: 2px;
}

.billing-policy-switch-copy strong {
  color: var(--text);
  font-size: 13px;
}

.billing-policy-switch-copy small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.billing-confirmation {
  grid-column: 1 / -1;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--warn-bg);
  padding: 12px 14px;
  color: var(--warn);
}

.billing-confirmation strong {
  display: block;
  margin-bottom: 6px;
}

.billing-confirmation ul {
  display: grid;
  gap: 4px;
  margin: 0;
  padding-left: 18px;
}

.orders-workspace {
  display: grid;
  gap: 20px;
}

.management-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.management-grid > .section-block,
.management-grid > .stacked-section {
  min-width: 0;
}

.stacked-section {
  display: grid;
  gap: 18px;
}

.stacked-section .operation-panel {
  margin-bottom: 0;
}

.orders-actions-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 14px;
}

.orders-actions-grid .operation-panel {
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 0;
}

.orders-actions-grid .operation-panel h2 {
  margin-bottom: 0;
}

.orders-actions-grid .operation-form {
  grid-template-columns: repeat(2, minmax(0, 1fr)) auto;
}

.orders-actions-grid .operation-form--compact {
  grid-template-columns: minmax(160px, 240px) auto;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

.section-head h2 {
  margin-bottom: 0;
}

.section-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.imports-workspace {
  display: grid;
  gap: 20px;
}

.record-pagination {
  display: inline-flex;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.record-pagination div {
  display: inline-flex;
  gap: 6px;
}

.record-pagination button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--brand-dark);
  padding: 6px 10px;
  font-weight: 800;
}

.record-pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

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

.users-management-panel {
  padding: 0;
  overflow: hidden;
}

.users-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.users-panel-head h2 {
  margin-bottom: 0;
}

.users-panel-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.users-management-table {
  border: 0;
  border-radius: 0;
}

.users-management-table table {
  min-width: 980px;
}

.users-management-table th,
.users-management-table td {
  padding: 12px;
  vertical-align: middle;
}

.credit-balance {
  display: block;
  font-weight: 800;
}

.session-toggle {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  white-space: nowrap;
}

.user-actions {
  display: grid;
  gap: 6px;
  min-width: 116px;
}

.user-actions button {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: #ffffff;
  padding: 7px 10px;
  font-weight: 800;
  white-space: nowrap;
}

.user-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.user-actions small {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
}

.user-actions small[data-tone="good"] {
  color: var(--brand-dark);
}

.user-actions small[data-tone="danger"] {
  color: var(--danger);
}

.user-edit-modal[hidden] {
  display: none !important;
}

.user-edit-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 25, 19, 0.42);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(15, 25, 19, 0.22);
  font-size: 16px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
}

.modal-head h2 {
  margin-bottom: 0;
  font-size: 24px;
}

.modal-close {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--text);
  font-size: 26px;
  line-height: 1;
}

.modal-user-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin: 0;
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfa;
}

.modal-user-summary div {
  min-width: 0;
}

.modal-user-summary dt {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.modal-user-summary dd {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  font-size: 17px;
  font-weight: 800;
}

.modal-form {
  display: grid;
  gap: 16px;
  padding: 22px 24px 24px;
}

.modal-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.modal-form input,
.modal-form select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 10px 12px;
  color: var(--text);
  font-size: 16px;
}

.modal-check {
  grid-template-columns: auto 1fr;
  align-items: center;
  color: var(--text) !important;
}

.modal-check input {
  width: 20px;
  min-height: 20px;
}

.modal-status {
  min-height: 22px;
  color: var(--muted);
  font-size: 14px;
}

.modal-status[data-tone="good"] {
  color: var(--brand-dark);
}

.modal-status[data-tone="danger"] {
  color: var(--danger);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
}

.primary-button,
.secondary-button {
  min-height: 46px;
  border-radius: 6px;
  padding: 10px 18px;
  font-size: 16px;
  font-weight: 800;
}

.primary-button {
  border: 0;
  background: var(--brand);
  color: #ffffff;
}

.secondary-button {
  border: 1px solid var(--line);
  background: var(--surface-muted);
  color: var(--text);
}

.primary-button:disabled,
.secondary-button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.event-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: end;
  margin-bottom: 14px;
}

.contact-imports-panel {
  overflow: hidden;
}

.event-toolbar p {
  margin-bottom: 0;
  color: var(--muted);
}

.event-toolbar label {
  display: grid;
  gap: 5px;
  min-width: 260px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.event-filters {
  display: grid;
  grid-template-columns: minmax(110px, 0.7fr) minmax(110px, 0.7fr) minmax(220px, 1.4fr);
  gap: 10px;
  align-items: end;
}

.event-toolbar input,
.event-toolbar select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 8px 10px;
  color: var(--text);
}

.event-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
}

.event-pagination {
  display: inline-flex;
  gap: 6px;
}

.event-pagination button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--brand-dark);
  padding: 5px 10px;
  font-weight: 800;
}

.event-pagination button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.copy-button {
  min-height: 28px;
  margin-right: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--brand-dark);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
}

.copy-button:hover,
.copy-button:focus-visible {
  border-color: var(--brand);
  background: #ffffff;
  outline: none;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 5px 10px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
}

.status-pill--good {
  background: var(--good-bg);
  color: var(--brand-dark);
}

.status-pill--warn {
  background: var(--warn-bg);
  color: var(--warn);
}

.status-pill--neutral {
  background: var(--surface-muted);
  color: var(--muted);
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 780px;
  background: var(--surface);
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 14px;
  text-align: left;
  vertical-align: top;
}

thead th {
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

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

td span {
  display: block;
  margin-bottom: 5px;
}

code {
  border-radius: 6px;
  background: var(--surface-muted);
  padding: 2px 6px;
  color: var(--brand-dark);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
}

.operations-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 14px;
}

.queue-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.queue-item {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  background: var(--surface);
}

.queue-item span {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.queue-item small {
  color: var(--muted);
}

.queue-item--warn span {
  color: var(--warn);
}

.queue-item--danger span {
  color: var(--danger);
}

.queue-item--info span {
  color: var(--brand-dark);
}

@media (max-width: 1100px) {
  .summary-grid,
  .page-layout,
  .management-grid,
  .orders-actions-grid,
  .operation-panel,
  .operation-form,
  .operation-form--compact,
  .orders-actions-grid .operation-form,
  .orders-actions-grid .operation-form--compact {
    grid-template-columns: 1fr;
  }

  .billing-policy-meta,
  .billing-policy-form {
    grid-template-columns: 1fr;
  }

  .event-toolbar {
    display: grid;
  }

  .event-toolbar label,
  .event-filters {
    min-width: 0;
  }

  .event-filters {
    grid-template-columns: 1fr;
  }

  .event-summary {
    align-items: stretch;
    display: grid;
  }

  .users-panel-head,
  .section-head,
  .record-pagination {
    align-items: stretch;
    display: grid;
  }

  .module-directory {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .admin-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 18px;
  }

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

  .main {
    padding: 18px;
  }

  .topbar {
    display: grid;
  }

  h1 {
    font-size: 28px;
  }
}

@media (max-width: 540px) {
  .sidebar-nav {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  body {
    font-size: 15px;
  }

  button,
  input,
  select,
  .admin-login input,
  .admin-login button,
  .admin-account-panel button,
  .operation-form input,
  .operation-form select,
  .operation-form button,
  .event-toolbar input,
  .event-toolbar select,
  .event-pagination button,
  .record-pagination button,
  .user-actions button,
  .primary-button,
  .secondary-button {
    min-height: 44px;
  }

  .login-screen {
    align-items: start;
    padding: 16px;
  }

  .login-card {
    width: 100%;
    margin-top: 8vh;
    padding: 22px 18px;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    gap: 12px;
    padding: 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 10px 24px rgba(29, 45, 36, 0.08);
  }

  .sidebar .brand-lockup {
    margin-bottom: 0;
  }

  .sidebar-nav {
    display: flex;
    gap: 8px;
    margin: 0 -2px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding: 0 2px 4px;
    scrollbar-width: none;
  }

  .sidebar-nav::-webkit-scrollbar {
    display: none;
  }

  .sidebar-nav button {
    flex: 0 0 auto;
    width: auto;
    min-width: 92px;
    min-height: 44px;
    text-align: center;
    white-space: nowrap;
  }

  .admin-account-panel {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px 12px;
    margin-top: 0;
    padding: 10px;
  }

  .admin-account-panel span,
  .admin-account-panel small {
    grid-column: 1;
  }

  .admin-account-panel button {
    grid-column: 2;
    grid-row: 1 / span 3;
    padding: 8px 12px;
    white-space: nowrap;
  }

  .main {
    padding: 14px 12px 24px;
  }

  .topbar {
    gap: 12px;
    margin-bottom: 16px;
  }

  h1 {
    font-size: 24px;
  }

  h2 {
    font-size: 18px;
  }

  .environment-chip {
    justify-content: center;
    width: 100%;
    white-space: normal;
  }

  .summary-grid,
  .users-summary {
    gap: 10px;
    margin-bottom: 16px;
  }

  .summary-tile,
  .section-block,
  .operation-panel {
    box-shadow: none;
  }

  .summary-tile,
  .section-block,
  .operation-panel {
    padding: 14px;
  }

  .summary-tile strong {
    font-size: 22px;
  }

  .operation-panel {
    gap: 12px;
  }

  .operation-form,
  .orders-actions-grid .operation-form,
  .operation-form--compact,
  .orders-actions-grid .operation-form--compact {
    gap: 12px;
  }

  .operation-form button,
  .orders-actions-grid .operation-form button,
  .event-pagination button,
  .record-pagination button,
  .copy-button,
  .user-actions button {
    width: 100%;
    white-space: normal;
  }

  .event-toolbar,
  .event-summary,
  .section-head,
  .users-panel-head,
  .billing-policy-head,
  .record-pagination {
    gap: 10px;
  }

  .event-pagination,
  .record-pagination div,
  .modal-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .users-management-panel {
    overflow: visible;
  }

  .users-management-table table,
  table {
    min-width: 0;
  }

  .table-wrap {
    overflow-x: visible;
    border: 0;
    border-radius: 0;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
    width: 100%;
  }

  thead {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  tbody {
    display: grid;
    gap: 10px;
  }

  tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    overflow: hidden;
  }

  td {
    display: grid;
    grid-template-columns: minmax(88px, 0.36fr) minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    border-bottom: 1px solid var(--line);
    padding: 10px 12px;
    overflow-wrap: anywhere;
  }

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

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }

  td[colspan] {
    grid-template-columns: 1fr;
  }

  td[colspan]::before {
    content: none;
  }

  td span {
    margin-bottom: 3px;
  }

  code {
    display: inline-block;
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .user-actions {
    min-width: 0;
  }

  .user-edit-modal {
    align-items: end;
    padding: 12px;
  }

  .modal-card {
    width: 100%;
    max-height: calc(100dvh - 24px);
  }

  .modal-head,
  .modal-user-summary,
  .modal-form {
    padding-left: 16px;
    padding-right: 16px;
  }

  .modal-user-summary {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .modal-actions {
    justify-content: stretch;
  }
}
