@import url("https://fonts.googleapis.com/css2?family=Sora:wght@500;600;700;800&family=IBM+Plex+Mono:wght@400;500;600&display=swap");

:root {
  --bg: #f5f7fa;
  --bg-deep: #e8edf3;
  --panel: rgba(255, 255, 255, 0.88);
  --panel-strong: #ffffff;
  --panel-alt: rgba(22, 34, 47, 0.94);
  --ink: #10202b;
  --ink-soft: #5a6b79;
  --line: rgba(16, 32, 43, 0.1);
  --line-strong: rgba(16, 32, 43, 0.16);
  --accent: #28485f;
  --accent-strong: #1b3447;
  --accent-soft: #edf4f8;
  --accent-cool: #60798d;
  --accent-cool-soft: #f1f5f8;
  --danger: #a43229;
  --ok: #236046;
  --queued: #9a5b14;
  --shadow: 0 28px 80px rgba(15, 38, 45, 0.12);
  --shadow-soft: 0 18px 42px rgba(15, 38, 45, 0.09);
  --radius-xl: 16px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 8px;
  --mono: "IBM Plex Mono", "SF Mono", Menlo, Monaco, Consolas, monospace;
  --ui: "Sora", "Avenir Next", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  padding: 28px;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(96, 121, 141, 0.08), transparent 34%),
    radial-gradient(circle at top right, rgba(40, 72, 95, 0.05), transparent 24%),
    linear-gradient(180deg, #fafbfd 0%, #f3f6f9 46%, #ebf0f4 100%);
  font-family: var(--ui);
}

a {
  color: inherit;
}

.page {
  position: relative;
  max-width: 1240px;
  margin: 0 auto;
}

.page-grid {
  display: grid;
  gap: 12px;
}

.page-grid.columns-2 {
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  align-items: start;
}

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

.page-header {
  margin-bottom: 10px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 8px 12px;
  border: 1px solid rgba(96, 121, 141, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--accent-cool);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.04em;
}

h1 {
  max-width: 11ch;
  font-size: clamp(2.8rem, 6vw, 5.4rem);
  line-height: 0.92;
  font-weight: 800;
}

h2 {
  font-size: clamp(1.5rem, 2.6vw, 2.3rem);
  line-height: 1;
  font-weight: 700;
}

h3 {
  font-size: 1.05rem;
  font-weight: 700;
}

.page-subtitle,
.meta {
  margin: 8px 0 0;
  max-width: 720px;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.55;
}

.meta {
  font-family: var(--mono);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 30px;
  font-family: var(--mono);
  font-size: 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.75);
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}

.badge.offline {
  border-color: rgba(164, 50, 41, 0.2);
  color: var(--danger);
  background: #fff2ef;
}

.badge.confirmed,
.badge.success,
.badge.distributed,
.badge.exported {
  border-color: rgba(35, 96, 70, 0.18);
  color: var(--ok);
  background: #edf8f1;
}

.badge.retry_scheduled,
.badge.queued,
.badge.started,
.badge.pending,
.badge.partial {
  border-color: rgba(154, 91, 20, 0.2);
  color: var(--queued);
  background: #fff5e7;
}

.badge.retryable_failed,
.badge.non_retryable_failed,
.badge.failed_non_retryable,
.badge.expired_unconfirmed,
.badge.failed {
  border-color: rgba(164, 50, 41, 0.16);
  color: var(--danger);
  background: #fff1ef;
}

.nav {
  display: inline-flex;
  gap: 10px;
  margin-bottom: 18px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(14px);
  font-family: var(--mono);
  font-size: 12px;
}

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

.surface,
.card {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.surface::before,
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.42), transparent 55%);
  pointer-events: none;
}

.receipt-status-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(40, 72, 95, 0.12);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.62);
}

.receipt-status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.receipt-status-item {
  display: grid;
  gap: 6px;
}

.receipt-status-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.receipt-status-value {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.35;
}

.receipt-status-meta {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr;
  gap: 8px 10px;
  align-items: center;
}

@media (max-width: 720px) {
  .receipt-status-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 10px;
  }

  .receipt-status-meta {
    grid-template-columns: auto 1fr;
    gap: 4px 8px;
  }
}

.hero-card {
  padding: 22px 24px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.hero-card.warm {
  background:
    radial-gradient(circle at top right, rgba(120, 157, 184, 0.1), transparent 30%),
    radial-gradient(circle at bottom left, rgba(96, 121, 141, 0.06), transparent 28%),
    var(--panel);
}

.hero-card.dark {
  color: #f8f6f3;
  background:
    radial-gradient(circle at top right, rgba(108, 149, 180, 0.08), transparent 24%),
    radial-gradient(circle at bottom left, rgba(96, 121, 141, 0.1), transparent 25%),
    linear-gradient(145deg, #1d3141 0%, #16222f 100%);
  border-color: rgba(255, 255, 255, 0.08);
}

.hero-card.dark .page-subtitle,
.hero-card.dark .meta,
.hero-card.dark .panel-copy,
.hero-card.dark .stat-copy,
.hero-card.dark .card-copy,
.hero-card.dark .muted {
  color: rgba(248, 246, 243, 0.76);
}

.hero-actions,
.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.row.compact {
  gap: 6px;
}

.hero-card {
  display: grid;
  gap: 16px;
  padding: 24px 28px;
  border-radius: var(--radius-xl);
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  align-items: center;
}

.hero-card.compact {
  padding: 18px 20px;
}

.hero-card.compact h1 {
  max-width: 10ch;
  font-size: clamp(2.2rem, 4.2vw, 3.6rem);
}

.hero-card.compact .page-subtitle {
  max-width: 560px;
  font-size: 14px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 1px;
}

.checks-filters {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.checks-filters button.secondary {
  min-height: 40px;
  padding: 10px 14px;
}

.checks-filters button.is-active {
  border-color: rgba(40, 72, 95, 0.22);
  background: rgba(40, 72, 95, 0.12);
  color: var(--accent-strong);
  box-shadow: inset 0 0 0 1px rgba(40, 72, 95, 0.08);
}

.check-card .actions button,
.check-card .actions a.btn {
  border-radius: 10px;
  min-height: 30px;
  padding: 7px 10px;
  font-size: 9px;
  letter-spacing: 0.02em;
  box-shadow: none;
}

.app-header.compact {
  padding: 1px;
}

.app-header h1 {
  max-width: none;
  font-size: clamp(1.1rem, 2.4vw, 1.5rem);
  line-height: 1.08;
}

.app-header .page-subtitle {
  max-width: 560px;
  font-size: 12px;
  line-height: 1.35;
}

.page-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.page-header-copy {
  min-width: 0;
}

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

.quick-card {
  display: grid;
  gap: 8px;
  padding: 12px 14px;
}

.quick-card h2 {
  font-size: 1.18rem;
  line-height: 1.05;
}

.quick-card .card-copy {
  font-size: 13px;
  line-height: 1.45;
}

.quick-card-link {
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.quick-card-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(40, 72, 95, 0.16);
  border-color: rgba(96, 121, 141, 0.2);
}

.landing-header {
  align-items: center;
}

.landing-header .page-heading {
  align-items: center;
}

.landing-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  background: linear-gradient(145deg, #28485f 0%, #1b3447 100%);
  box-shadow: 0 16px 30px rgba(40, 72, 95, 0.22);
  flex: 0 0 auto;
}

.landing-icon-svg {
  width: 28px;
  height: 28px;
  stroke: #fff;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

button,
a.btn {
  appearance: none;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: #fff;
  border-radius: 12px;
  min-height: 46px;
  padding: 12px 18px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  box-shadow: 0 14px 32px rgba(40, 72, 95, 0.2);
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

button:hover,
a.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 36px rgba(40, 72, 95, 0.24);
}

button.secondary,
a.btn.secondary {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.64);
  color: var(--ink);
  box-shadow: none;
}

button.secondary:hover,
a.btn.secondary:hover {
  box-shadow: 0 10px 24px rgba(35, 49, 74, 0.08);
}

button.ghost,
a.btn.ghost {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  box-shadow: none;
}

.status {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
  background: rgba(255, 255, 255, 0.52);
}

.status.ok {
  border-color: rgba(35, 96, 70, 0.18);
  color: var(--ok);
  background: #effaf3;
}

.status.err {
  border-color: rgba(164, 50, 41, 0.16);
  color: var(--danger);
  background: #fff2ef;
}

.panel-title {
  margin-bottom: 8px;
}

.panel-copy,
.card-copy,
.muted {
  color: var(--ink-soft);
}

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

.stats-grid,
.feature-grid,
.mode-grid,
.info-grid {
  display: grid;
  gap: 16px;
}

.stats-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

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

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

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

.stat-card,
.feature-card,
.mode-card {
  min-height: 100%;
}

.stat-value {
  margin-top: 22px;
  font-size: clamp(2rem, 4vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.06em;
  line-height: 0.95;
}

.stat-copy {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.55;
}

.kicker {
  display: inline-flex;
  margin-bottom: 14px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.mode-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.mode-card .card-copy {
  flex: 1;
  font-size: 15px;
  line-height: 1.6;
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.56);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.input,
textarea,
pre,
video,
table,
.history {
  width: 100%;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
}

textarea,
pre {
  background: rgba(255, 255, 255, 0.72);
}

textarea {
  min-height: 132px;
  padding: 14px 16px;
  resize: vertical;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.6;
}

textarea::placeholder {
  color: #8c93a3;
}

pre,
.history {
  margin: 0;
  min-height: 140px;
  padding: 14px 16px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.65;
}

video {
  display: block;
  min-height: 260px;
  background:
    radial-gradient(circle at top, rgba(153, 246, 228, 0.2), transparent 30%),
    linear-gradient(180deg, #1a3341 0%, #10202b 100%);
  object-fit: cover;
  aspect-ratio: 16 / 10;
}

.hint {
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
}

.surface-stack {
  display: grid;
  gap: 12px;
  align-content: start;
}

.checks-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.7fr);
  gap: 12px;
}

.checks-page-header {
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
}

.checks-page-header .page-heading {
  align-items: center;
  flex: 0 1 auto;
}

.checks-page-header .page-subtitle {
  margin-top: 4px;
}

.checks-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.compact-list .section-heading {
  margin-bottom: 10px;
}

table {
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.35);
  font-family: var(--mono);
  font-size: 12px;
  overflow: hidden;
  table-layout: fixed;
}

.table-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  min-width: 164px;
}

.table-actions button {
  width: 100%;
  min-height: 28px;
  padding: 5px 8px;
  font-size: 9px;
  border-radius: 9px;
  letter-spacing: 0.03em;
}

th,
td {
  border-bottom: 1px solid rgba(35, 49, 74, 0.08);
  text-align: left;
  vertical-align: top;
  padding: 10px 8px;
}

th {
  color: var(--ink-soft);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
}

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

tr.focused td {
  background: rgba(96, 121, 141, 0.08);
}

code {
  word-break: break-all;
  font-family: var(--mono);
}

.checks-cards {
  display: block;
}

.checks-cards-desktop {
  display: grid;
  gap: 8px;
}

.checks-table,
.checks-aside {
  display: none;
}

.check-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 0;
  background: rgba(255, 255, 255, 0.52);
  margin-bottom: 6px;
  font-family: var(--mono);
  font-size: 11px;
  box-shadow: 0 12px 26px rgba(35, 49, 74, 0.05);
}

.check-card.focused {
  border-color: rgba(96, 121, 141, 0.18);
  box-shadow: 0 0 0 3px rgba(96, 121, 141, 0.08);
  background: #f2f7fb;
}

.check-summary {
  width: 100%;
  min-height: 0;
  padding: 10px 12px;
  border: 0;
  border-radius: inherit;
  background: transparent;
  box-shadow: none;
  color: inherit;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  text-transform: none;
  letter-spacing: 0;
}

.check-summary:hover {
  transform: none;
  box-shadow: none;
}

.check-mainline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: baseline;
  margin-bottom: 3px;
}

.check-mainline strong {
  font-size: 14px;
  color: var(--ink);
}

.check-mainline span,
.check-subline,
.check-attempts {
  color: var(--ink-soft);
  font-size: 10px;
}

.check-subline {
  line-height: 1.3;
}

.check-summary-side {
  display: grid;
  justify-items: end;
  gap: 5px;
  flex: 0 0 auto;
}

.check-attempts::before {
  content: "Попытки: ";
}

.mobile-inspector {
  display: block;
}

.mobile-inspector-title {
  margin: 10px 0 6px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.mobile-inspector .status,
.mobile-inspector .history {
  margin-top: 6px;
}

.mobile-inspector .history {
  min-height: 0;
  max-height: 240px;
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(239, 244, 248, 0.96));
  box-shadow: inset 0 0 0 1px rgba(96, 121, 141, 0.08);
  scrollbar-width: thin;
}

.history {
  display: grid;
  gap: 6px;
}

.attempt-item {
  padding: 8px 10px;
  border: 1px solid rgba(96, 121, 141, 0.08);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.6);
}

.attempt-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 6px;
}

.attempt-date {
  color: var(--ink);
  font-size: 10px;
}

.attempt-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 10px;
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-size: 9px;
}

.attempt-meta strong {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.attempt-error {
  padding-top: 6px;
  border-top: 1px solid rgba(35, 49, 74, 0.08);
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.35;
}

.attempts-empty {
  padding: 10px 12px;
  border: 1px dashed rgba(16, 32, 43, 0.14);
  border-radius: 10px;
  color: var(--ink-soft);
  font-size: 11px;
}

.check-details {
  display: none;
  padding: 0 12px 10px;
}

.check-card.expanded .check-details {
  display: block;
}

.compact-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 8px;
  margin: 6px 0 2px;
}

.compact-meta div {
  min-width: 0;
}

.compact-meta strong {
  display: block;
  margin-bottom: 1px;
  color: var(--ink);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.compact-meta span {
  display: block;
  line-height: 1.3;
}

.compact-error {
  margin-top: 4px;
  padding-top: 4px;
  border-top: 1px solid rgba(35, 49, 74, 0.08);
  font-size: 10px;
  line-height: 1.35;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 8px;
}

.actions button,
.actions a.btn {
  min-height: 32px;
  padding: 7px 10px;
  font-size: 10px;
}

.note {
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 14px;
  line-height: 1.55;
}

.note.cool {
  background: var(--accent-cool-soft);
  color: var(--accent-cool);
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.44);
  font-family: var(--mono);
  font-size: 12px;
}

.switch-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.scanner-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 18px;
}

.scanner-page {
  max-width: 920px;
}

.scanner-shell {
  display: grid;
  gap: 16px;
}

.scanner-step {
  min-height: 0;
}

[hidden] {
  display: none !important;
}

.receipt-summary-card {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(248, 250, 252, 0.82);
}

.receipt-facts {
  display: grid;
  gap: 8px;
}

.receipt-facts-empty {
  padding: 12px 14px;
  border: 1px dashed rgba(16, 32, 43, 0.14);
  border-radius: 12px;
  color: var(--ink-soft);
  font-size: 13px;
}

.receipt-raw {
  padding: 6px 8px;
  background: rgba(248, 250, 252, 0.82);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 11px;
}

.receipt-raw code {
  font-family: var(--mono);
  background: rgba(16, 32, 43, 0.06);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 10px;
  word-break: break-word;
}

.receipt-fields-table {
  display: grid;
  gap: 3px;
}

.field-row {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 8px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.78);
  border-radius: 6px;
  align-items: center;
}

.field-label {
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.field-value {
  font-size: 11px;
  line-height: 1.2;
  word-break: break-word;
}

/* Receipt Items Distribution Page */
.receipt-items-header {
  align-items: center;
  gap: 12px;
}

.receipt-items-header-copy {
  min-width: 0;
}

.receipt-items-header h1 {
  font-size: clamp(1.04rem, 2vw, 1.35rem);
  line-height: 1.08;
}

.receipt-items-header .page-subtitle {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.3;
}

.items-header {
  margin-bottom: 8px;
}

.items-controls {
  display: block;
}

.controls-row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.page-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  flex: 0 0 auto;
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1;
}

.page-back-btn span[aria-hidden="true"] {
  font-size: 16px;
  line-height: 1;
}

.items-container {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.item-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px 12px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: 12px;
  align-items: start;
  transition: all 0.2s ease;
}

.item-row:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: var(--accent-cool);
}

.item-col {
  display: flex;
  align-items: flex-start;
  min-width: 0;
}

.item-col:first-child {
  grid-row: 1 / span 4;
  justify-content: center;
  padding-top: 2px;
}

.item-name {
  grid-column: 2;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  word-break: break-word;
}

.item-price {
  grid-column: 2;
  font-family: inherit;
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 500;
}

.item-row > .item-col:nth-child(4) {
  grid-column: 2;
}

.per-item-unit {
  grid-column: 2;
  display: none;
}

.per-item-unit .autocomplete-container {
  width: 100%;
}

.per-item-unit.active {
  display: block;
}

.autocomplete-container {
  position: relative;
  width: 100%;
}

.category-autocomplete,
.unit-autocomplete {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  outline: none;
  transition: border-color 0.2s ease;
}

.category-autocomplete:focus,
.unit-autocomplete:focus {
  border-color: var(--accent-cool);
  box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.1);
}

.autocomplete-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.14);
  z-index: 1000;
  max-height: 200px;
  overflow-y: auto;
}

.autocomplete-option {
  padding: 10px 12px;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  transition: background-color 0.2s ease;
}

.autocomplete-option:last-child {
  border-bottom: none;
}

.autocomplete-option:hover {
  background-color: var(--accent-cool);
  color: white;
}

.item-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.receipt-summary {
  background: rgba(248, 250, 252, 0.82);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 12px;
  margin-bottom: 8px;
}

.summary-section {
  display: grid;
  gap: 6px;
}

.summary-row {
  display: grid;
  gap: 8px;
  margin-bottom: 0;
}

.summary-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

.summary-autocomplete {
  width: 100%;
}

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

@media (max-width: 768px) {
  .controls-row {
    gap: 8px;
    flex-wrap: nowrap;
  }

  .switch-row {
    flex: 1 1 0;
    justify-content: center;
    gap: 8px;
    padding: 10px 12px;
    font-size: 11px;
    white-space: nowrap;
  }

  .item-row {
    gap: 8px 10px;
    padding: 8px;
  }

  .item-name {
    font-size: 13px;
  }

  .item-price {
    font-size: 12px;
  }

  .category-autocomplete,
  .unit-autocomplete {
    min-height: 38px;
    padding: 8px 10px;
    font-size: 13px;
  }

  .autocomplete-option {
    padding: 8px 10px;
    font-size: 13px;
  }

  .surface-stack {
    padding: 10px;
    gap: 10px;
  }

  .receipt-summary {
    padding: 10px;
  }

  .receipt-items-header {
    align-items: stretch;
    gap: 10px;
  }

  .receipt-items-header h1 {
    font-size: 1.15rem;
  }

  .page-back-btn {
    min-width: auto;
  }
}

@media (max-width: 480px) {
  .page.page-grid {
    gap: 8px;
  }

  .receipt-items-header {
    gap: 8px;
  }

  .receipt-items-header h1 {
    font-size: 1.02rem;
  }

  .receipt-items-header .page-subtitle {
    font-size: 10px;
    line-height: 1.25;
  }

  .controls-row {
    gap: 6px;
  }

  .switch-row {
    gap: 6px;
    padding: 8px 10px;
    font-size: 10px;
  }

  .item-row {
    grid-template-columns: 24px minmax(0, 1fr);
    gap: 6px 8px;
    padding: 7px;
  }

  .item-name {
    font-size: 12px;
  }

  .item-price {
    font-size: 11px;
  }

  .category-autocomplete,
  .unit-autocomplete {
    min-height: 36px;
    padding: 7px 9px;
    font-size: 12px;
  }

  .autocomplete-option {
    padding: 7px 9px;
    font-size: 12px;
  }

  .surface-stack {
    padding: 8px;
    gap: 8px;
  }

  .receipt-summary {
    padding: 8px;
  }

  .summary-section {
    gap: 4px;
  }

  .summary-row {
    gap: 6px;
  }

  .page-back-btn {
    min-height: 38px;
    padding: 8px 10px;
    border-radius: 12px;
    font-size: 13px;
  }

  .actions {
    justify-content: stretch;
    margin-top: 2px;
  }

  .actions button,
  .actions a.btn {
    width: 100%;
  }
}

@media (max-width: 360px) {
  .receipt-items-header h1 {
    font-size: 0.96rem;
  }

  .receipt-items-header .page-subtitle {
    font-size: 9.5px;
  }

  .switch-row {
    padding: 7px 8px;
    font-size: 9px;
  }

  .item-row {
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 4px 6px;
    padding: 6px;
  }

  .item-name {
    font-size: 11px;
  }

  .item-price {
    font-size: 10px;
  }

  .category-autocomplete,
  .unit-autocomplete {
    min-height: 34px;
    padding: 6px 8px;
    font-size: 11px;
  }

  .autocomplete-option {
    padding: 6px 8px;
    font-size: 11px;
  }

  .switch-row {
    font-size: 11px;
  }
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-soft);
}

.loading {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-soft);
}

.list-loader {
  padding: 14px 16px;
  border: 1px dashed rgba(16, 32, 43, 0.14);
  border-radius: 12px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 12px;
  text-align: center;
}

.error-message {
  text-align: center;
  padding: 40px 20px;
}

.error-message h2 {
  color: var(--danger);
  margin-bottom: 12px;
}

.header-actions {
  display: flex;
  align-items: center;
}

.auth-header-actions {
  gap: 0.75rem;
  justify-content: flex-end;
}

.auth-header-actions form {
  margin: 0;
}

.auth-card {
  border-color: rgba(40, 72, 95, 0.18);
}

.profile-grid {
  display: grid;
  gap: 12px;
}

.claim-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.claim-list div {
  display: grid;
  gap: 4px;
}

.claim-list dt {
  color: var(--ink-soft);
  font-size: 12px;
}

.claim-list dd {
  margin: 0;
  font-weight: 600;
  display: grid;
  gap: 6px;
  min-width: 0;
}

.permissions-list {
  margin: 0;
  padding-left: 18px;
}

.icon-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid rgba(96, 121, 141, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--accent-strong);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.icon-btn:hover {
  transform: translateY(-1px);
  background: #eef5fa;
  box-shadow: 0 18px 36px rgba(40, 72, 95, 0.16);
}

.icon-refresh {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.receipt-fact {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid rgba(16, 32, 43, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
}

.receipt-fact span {
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.receipt-fact strong {
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}

.receipt-fact-raw strong {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
}

.receipt-preview-page {
  max-width: 960px;
}

.preview-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.receipt-preview-frame {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(248, 250, 252, 0.95);
  min-height: 320px;
}

.receipt-preview-frame img {
  display: block;
  width: min(100%, 640px);
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 16px 34px rgba(15, 38, 45, 0.16);
}

.preview-loader {
  width: min(100%, 380px);
  padding: 48px 24px;
  border: 1px dashed rgba(16, 32, 43, 0.14);
  border-radius: 14px;
  text-align: center;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.6;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.pagination-bar button {
  width: auto;
  min-width: 120px;
}

.pagination-label {
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 12px;
  white-space: nowrap;
}

.bottom-nav {
  display: none;
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.48);
  background: rgba(251, 253, 255, 0.9);
  backdrop-filter: blur(18px);
  border-radius: 14px;
  padding: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  z-index: 30;
  box-shadow: 0 22px 50px rgba(15, 38, 45, 0.16);
}

.bottom-nav a {
  text-decoration: none;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 12px 8px;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: transparent;
}

.bottom-nav a svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

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

.bottom-nav a.active {
  border-color: rgba(96, 121, 141, 0.14);
  background: #eef5fa;
  color: var(--accent-strong);
  font-weight: 600;
}

.pwa-update-banner {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(40, 72, 95, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 20px 44px rgba(15, 38, 45, 0.18);
  backdrop-filter: blur(18px);
}

.pwa-update-copy {
  display: grid;
  gap: 4px;
}

.pwa-update-copy strong {
  font-size: 13px;
  letter-spacing: -0.02em;
}

.pwa-update-copy span {
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.4;
}

.only-mobile {
  display: none;
}

@media (max-width: 1100px) {
  .checks-layout,
  .scanner-layout,
  .page-grid.columns-2,
  .dashboard-grid,
  .mode-grid,
  .feature-grid,
  .info-grid,
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  body {
    padding: 16px 16px 96px;
  }

  h1 {
    max-width: none;
    font-size: clamp(1.9rem, 9.2vw, 3rem);
    line-height: 0.96;
  }

  .nav {
    display: none;
  }

  .topline {
    align-items: flex-start;
  }

  .surface,
  .card,
  .hero-card {
    padding: 14px;
    border-radius: 12px;
  }

  .page-grid {
    gap: 10px;
  }

  .app-header {
    padding: 0;
  }

  .checks-header-row {
    width: 100%;
    justify-content: space-between;
  }

  .checks-page-header {
    align-items: center;
    gap: 10px;
  }

  .checks-toolbar {
    gap: 8px;
    align-items: stretch;
  }

  .checks-filters {
    min-width: 0;
    flex: 1 1 auto;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .checks-filters::-webkit-scrollbar {
    display: none;
  }

  .checks-filters button.secondary {
    width: auto;
    flex: 0 0 auto;
    min-height: 36px;
    padding: 8px 10px;
    border-radius: 11px;
    font-size: 10px;
    letter-spacing: 0.02em;
    white-space: nowrap;
  }

  .checks-toolbar .icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    flex: 0 0 auto;
    box-shadow: none;
  }

  .landing-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
  }

  .landing-icon-svg {
    width: 24px;
    height: 24px;
  }

  .app-header h1 {
    font-size: clamp(1.3rem, 7vw, 1.7rem);
  }

  .app-header .page-subtitle {
    display: none;
  }

  .page-header {
    margin-bottom: 6px;
  }

  .eyebrow {
    margin-bottom: 8px;
    padding: 7px 10px;
    font-size: 10px;
  }

  .page-subtitle,
  .meta {
    margin-top: 6px;
    font-size: 13px;
    line-height: 1.45;
  }

  .hero-card.compact {
    padding: 14px 16px;
    border-radius: 14px;
  }

  .hero-card.compact h1 {
    font-size: clamp(1.7rem, 7.5vw, 2.3rem);
    line-height: 0.98;
  }

  .hero-card.compact .page-subtitle {
    font-size: 12.5px;
    line-height: 1.4;
  }

  .hero-actions {
    gap: 8px;
  }

  .hero-actions a.btn,
  .hero-actions button {
    min-height: 42px;
    padding: 10px 14px;
  }

  .preview-toolbar {
    flex-direction: column;
  }

  .page-heading {
    width: 100%;
    align-items: center;
  }

  .landing-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 10px;
  }

  .landing-header .page-heading {
    width: auto;
    min-width: 0;
    align-items: center;
  }

  .page-back-btn {
    width: auto;
  }

  .header-actions {
    flex: 0 0 auto;
  }

  .auth-header-actions {
    width: auto;
    flex-wrap: nowrap;
    align-self: flex-start;
  }

  .landing-header .auth-header-actions .btn,
  .landing-header .auth-header-actions button {
    width: auto;
    flex: 0 0 auto;
    min-height: 40px;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 11px;
    letter-spacing: 0.03em;
    white-space: nowrap;
    box-shadow: none;
  }

  .pagination-bar {
    justify-content: stretch;
    flex-wrap: wrap;
  }

  .pagination-bar button {
    flex: 1 1 0;
    min-width: 0;
  }

  .pagination-label {
    width: 100%;
    text-align: center;
  }

  .checks-layout {
    grid-template-columns: 1fr;
  }

  .bottom-nav {
    display: grid;
  }

  .pwa-update-banner {
    left: 12px;
    right: 12px;
    bottom: calc(74px + env(safe-area-inset-bottom));
    align-items: stretch;
    flex-direction: column;
  }

  .pwa-update-banner .btn {
    width: 100%;
    justify-content: center;
  }

  .only-mobile {
    display: block;
  }

  button,
  a.btn {
    width: 100%;
  }

  .page-back-btn,
  a.btn.page-back-btn,
  button.page-back-btn {
    width: auto;
    flex: 0 0 auto;
  }

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

  .compact-meta {
    grid-template-columns: 1fr 1fr;
  }

  .check-summary {
    padding: 8px 10px;
  }

  .check-mainline strong {
    font-size: 12px;
  }

  .check-card .actions {
    gap: 6px;
    margin-top: 10px;
  }

}

@media (max-width: 560px) {
  .check-card .actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .check-card .actions button,
  .check-card .actions a.btn {
    min-height: 28px;
    padding: 6px 8px;
    font-size: 8px;
  }

  .checks-page-header .page-heading {
    gap: 10px;
    align-items: center;
  }

  .checks-page-header .page-back-btn {
    min-height: 38px;
    padding: 8px 10px;
    font-size: 11px;
  }

  .checks-toolbar .icon-btn {
    width: 38px;
    height: 38px;
  }

  .receipt-status-panel {
    padding: 10px 12px;
  }

  .receipt-status-item .badge {
    min-height: 26px;
    padding: 5px 8px;
    font-size: 9px;
  }

  .receipt-status-value {
    font-size: 11px;
  }
}

@media (min-width: 860px) {
  .profile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.directory-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(280px, 0.9fr);
  gap: 18px;
}

.directory-page-units {
  max-width: 1380px;
}

.directory-layout-units {
  grid-template-columns: minmax(0, 1fr);
}

.directory-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.directory-toolbar-main {
  flex: 1 1 auto;
  min-width: 0;
}

.directory-toolbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 0 0 auto;
}

.directory-search {
  display: block;
  width: 100%;
}

.directory-list {
  display: grid;
  gap: 12px;
}

.directory-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 160px;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(40, 72, 95, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.85);
}

.directory-meta {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #5f7586;
}

.directory-form {
  display: grid;
  gap: 10px;
}

.directory-input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid rgba(40, 72, 95, 0.18);
  border-radius: 12px;
  background: #fff;
  color: #10202b;
  font: inherit;
}

.directory-input:focus {
  outline: none;
  border-color: #28485f;
  box-shadow: 0 0 0 3px rgba(40, 72, 95, 0.12);
}

.directory-row-unit {
  grid-template-columns: minmax(220px, 280px) minmax(220px, 1fr) auto;
  gap: 16px;
  align-items: center;
}

.directory-unit-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.directory-unit-name {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  min-width: 0;
}

.directory-field {
  display: grid;
  gap: 6px;
}

.directory-field span {
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.directory-inline-meta {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.directory-inline-meta-actions {
  gap: 8px;
}

.directory-inline-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  line-height: 1.2;
}

.directory-meta-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
}

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

.directory-code-inline {
  max-width: 100%;
  font-size: 11px;
  line-height: 1.35;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.directory-editor {
  display: grid;
  gap: 12px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(40, 72, 95, 0.05);
  border: 1px solid rgba(40, 72, 95, 0.08);
  grid-column: 1 / -1;
}

.directory-editor-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.directory-editor-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.directory-inline-actions .secondary {
  width: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--accent);
  font: inherit;
}

.directory-inline-actions .secondary:hover {
  transform: none;
  box-shadow: none;
  text-decoration: underline;
}

.directory-link {
  color: var(--accent);
  text-decoration: none;
  font: inherit;
}

.directory-inline-actions .muted {
  color: var(--ink-soft);
  font: inherit;
}

.directory-link:hover {
  text-decoration: underline;
}

.directory-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
}

.directory-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 32, 43, 0.44);
  backdrop-filter: blur(6px);
}

.directory-modal-sheet {
  position: relative;
  z-index: 1;
  width: min(560px, calc(100vw - 32px));
  margin: 8vh auto 0;
}

.directory-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.directory-modal-close {
  width: auto;
  flex: 0 0 auto;
}

.directory-form-wide {
  gap: 12px;
}

body.modal-open {
  overflow: hidden;
}

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

@media (max-width: 680px) {
  .directory-row {
    grid-template-columns: 1fr;
  }

  .directory-toolbar {
    align-items: stretch;
    gap: 10px;
  }

  .directory-toolbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .directory-toolbar-actions .btn,
  .directory-toolbar-actions .secondary {
    width: auto;
    flex: 0 0 auto;
  }

  .directory-unit-head {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .directory-row-unit {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .directory-inline-actions {
    display: grid;
    justify-items: start;
    gap: 6px;
  }

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

  .directory-editor-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .directory-editor-actions .btn,
  .directory-editor-actions .secondary {
    width: 100%;
  }

  .directory-modal-sheet {
    width: calc(100vw - 20px);
    margin-top: auto;
    margin-bottom: 0;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
  }

  .directory-modal {
    display: flex;
    align-items: flex-end;
    justify-content: center;
  }

  .directory-modal-header {
    gap: 10px;
  }
}
