:root {
  color-scheme: light;
  --accent: #14b8a6;
  --accent-dark: #0f766e;
  --accent-soft: #ccfbf1;
  --ink: #0f172a;
  --ink-soft: #475569;
  --muted: #64748b;
  --border: #e2e8f0;
  --surface: #ffffff;
  --page: #f8fafc;
  --field: #ffffff;
  --danger-bg: #fee2e2;
  --danger: #b91c1c;
  --warm-bg: #fef3c7;
  --warm: #92400e;
  --positive: #166534;
  --focus: rgba(20, 184, 166, 0.18);
}

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

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 16px 24px;
  box-sizing: border-box;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

.notice {
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
}

.notice.success {
  border-color: #99f6e4;
  background: #f0fdfa;
}

.notice.error {
  border-color: #fecdd3;
  background: #fff1f2;
}

.app-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  flex: 1;
  min-height: 0;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 10;
  min-width: 0;
  padding: 12px 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.header-left,
.brand {
  display: flex;
  align-items: center;
  min-width: 0;
}

.header-left {
  gap: 16px;
}

.brand {
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark {
  display: block;
  width: 118px;
  height: 118px;
  flex: 0 0 118px;
  margin-block: -31px;
  object-fit: contain;
}

.brand strong,
.brand small,
.nav-tab span,
.list-item span,
.muted-text,
.hint,
.subcopy,
.event-list time {
  overflow-wrap: anywhere;
}

.brand strong {
  display: block;
  font-size: 22px;
  line-height: 1.05;
  letter-spacing: 0;
}

.brand small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.main-nav {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--surface);
}

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

.nav-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border-bottom: 3px solid transparent;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
}

.nav-tab:hover,
.nav-tab:focus-visible {
  color: var(--ink);
  background: #f8fafc;
  outline: none;
}

.nav-tab.active {
  color: var(--accent-dark);
  border-bottom-color: var(--accent);
  background: #f0fdfa;
}

.nav-tab .icon {
  display: none;
}

.account-tools {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 8px;
  min-width: 0;
}

.account-name {
  max-width: 120px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-tools form {
  margin: 0;
}

.account-tools .btn {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}

.logout-button {
  min-width: 34px;
}

.logout-button svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.logout-label {
  display: none;
}

.logout-button.confirming {
  min-width: 0;
  border-color: #fecdd3;
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 800;
}

.logout-button.confirming .logout-label {
  display: inline;
}

.account-tools.logout-confirming > a {
  display: none;
}

.landing-page main {
  max-width: none;
  padding: 0;
}

.landing-hero {
  position: relative;
  isolation: isolate;
  display: grid;
  min-height: clamp(520px, 78dvh, 760px);
  overflow: hidden;
  background: #0f172a;
  color: #ffffff;
}

.landing-hero::after {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(6, 20, 15, 0.88) 0%, rgba(6, 20, 15, 0.62) 32%, rgba(6, 20, 15, 0.08) 68%),
    linear-gradient(0deg, rgba(6, 20, 15, 0.34) 0%, rgba(6, 20, 15, 0) 38%);
  content: "";
}

.landing-hero-image {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.landing-hero-content {
  display: grid;
  align-content: end;
  width: min(100%, 1180px);
  min-height: inherit;
  margin: 0 auto;
  padding: clamp(18px, 4vw, 48px);
}

.landing-brand {
  width: max-content;
  max-width: 100%;
  color: #ffffff;
}

.landing-brand .brand-mark {
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.26));
}

.landing-brand small {
  color: rgba(255, 255, 255, 0.72);
}

.landing-copy {
  width: min(100%, 620px);
  min-width: 0;
  max-width: 100%;
  padding-bottom: clamp(40px, 9dvh, 86px);
}

.landing-title {
  display: flex;
  align-items: center;
  gap: clamp(12px, 2vw, 20px);
  max-width: 100%;
}

.landing-title-logo {
  display: block;
  width: clamp(82px, 9vw, 132px);
  height: clamp(82px, 9vw, 132px);
  flex: 0 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 12px 24px rgba(0, 0, 0, 0.28));
}

.landing-title span {
  min-width: 0;
}

.landing-title h1 {
  margin: 0;
  color: #ffffff;
  font-size: clamp(48px, 8vw, 94px);
  line-height: 0.94;
  letter-spacing: 0;
}

.landing-title small {
  display: block;
  margin-top: 6px;
  color: rgba(255, 255, 255, 0.76);
  font-size: clamp(13px, 1.2vw, 16px);
  font-weight: 800;
  line-height: 1.1;
}

.landing-copy p {
  max-width: min(560px, 100%);
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.84);
  font-size: clamp(18px, 2.1vw, 24px);
  font-weight: 650;
  line-height: 1.32;
  hyphens: manual;
  overflow-wrap: normal;
  word-break: normal;
}

.landing-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: min(100%, 276px);
  margin-top: 26px;
}

.landing-actions .btn {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding-inline: 12px;
  border-color: rgba(255, 255, 255, 0.28);
  font-weight: 850;
  white-space: nowrap;
}

.landing-actions .btn-primary {
  background: #14b8a6;
}

.landing-actions .btn-secondary {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  backdrop-filter: blur(8px);
}

.landing-actions .btn-secondary:hover,
.landing-actions .btn-secondary:focus-visible {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.landing-strip {
  align-self: center;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  width: min(100%, 1180px);
  min-width: 0;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 48px) 42px;
  transform: translateY(-24px);
}

.landing-strip div {
  min-width: 0;
  padding: 18px 20px;
  border: 1px solid rgba(203, 213, 225, 0.78);
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
}

.landing-strip strong {
  display: block;
  color: var(--accent-dark);
  font-size: 15px;
}

.landing-strip span {
  display: block;
  max-width: 100%;
  margin-top: 5px;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  hyphens: manual;
  overflow-wrap: normal;
  white-space: normal;
  word-break: normal;
}

.auth-shell {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
  width: 100%;
  min-height: calc(100dvh - 24px);
  padding: 32px 0;
}

.auth-brand {
  justify-content: center;
}

.auth-card {
  width: min(100%, 460px);
  padding: 24px;
}

.auth-card h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: 0;
}

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

.auth-alt {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.auth-alt a {
  color: var(--accent-dark);
  font-weight: 800;
}

.tab-content {
  min-width: 0;
  padding: 24px 0 0;
}

.page-heading {
  margin-bottom: 20px;
}

.page-heading h2,
.form-card h2,
.match-toolbar h2 {
  margin: 0;
  color: var(--ink);
  font-size: 21px;
  line-height: 1.2;
  letter-spacing: 0;
}

.page-heading p,
.subcopy {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
}

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

.stat-card,
.card {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

.stat-card {
  padding: 18px 20px;
}

.stat-card strong {
  display: block;
  color: var(--ink);
  font-size: 32px;
  line-height: 1;
  font-weight: 800;
}

.stat-card.muted strong {
  color: var(--muted);
}

.stat-card span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr) minmax(0, 1fr);
  gap: 20px;
  min-width: 0;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.82fr);
  gap: 20px;
  min-width: 0;
}

.card {
  padding: 20px;
}

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

.card h3,
.card h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
  letter-spacing: 0;
}

.tag,
.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.tag-warm {
  background: var(--warm-bg);
  color: var(--warm);
}

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

.detail-list div {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 10px;
}

dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

dd {
  margin: 0;
  color: #334155;
  font-size: 14px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.action-bar,
.match-toolbar,
.match-actions,
.grid-actions {
  display: flex;
  gap: 10px;
}

.action-bar {
  margin-top: 18px;
}

.btn,
button.btn,
a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  box-sizing: border-box;
  padding: 9px 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.btn-primary,
button.btn-primary,
a.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--accent-dark);
  color: #ffffff;
}

.btn-secondary,
button.btn-secondary,
a.btn-secondary {
  border-color: var(--border);
  background: #f1f5f9;
  color: #334155;
}

.btn-secondary:hover,
.btn-secondary:focus-visible {
  background: #e2e8f0;
  color: #0f172a;
}

.btn-approve,
button.btn-approve {
  background: var(--accent);
  color: #ffffff;
}

.btn-reject,
button.btn-reject {
  background: var(--danger-bg);
  color: var(--danger);
}

button:focus-visible,
a:focus-visible,
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--focus);
}

.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.mini-table th,
.mini-table td {
  padding: 9px 0;
  border-bottom: 1px solid #eef2f7;
  text-align: left;
}

.mini-table th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.num {
  text-align: right !important;
}

.positive {
  color: var(--positive);
  font-weight: 800;
}

.warning {
  color: #854d0e;
  font-weight: 800;
}

.hint,
.muted-text {
  color: var(--muted);
  font-size: 12px;
}

.hint {
  margin: 14px 0 0;
  font-style: italic;
}

.field-hint {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.panel-scroll {
  max-width: 100%;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.event-list {
  display: grid;
  align-content: start;
  gap: 0;
  padding: 0;
  margin: 0;
  list-style: none;
}

.event-list li {
  padding: 10px 0;
  border-bottom: 1px solid #eef2f7;
  color: #334155;
  font-size: 13.5px;
  line-height: 1.4;
}

.event-list li:last-child {
  border-bottom: 0;
}

.event-list time {
  display: block;
  margin-top: 3px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  margin-top: 18px;
}

.form-group,
.note-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.form-group.full,
.btn.full,
.errorlist,
.note-form {
  grid-column: 1 / -1;
}

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

input,
select,
textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  background: var(--field) !important;
  color: var(--ink) !important;
  font: inherit;
  font-size: 14px;
}

textarea {
  min-height: 72px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted) !important;
  opacity: 1;
}

.errorlist {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #fecdd3;
  border-radius: 8px;
  background: #fff1f2;
  color: var(--danger);
  font-size: 13px;
  list-style-position: inside;
}

.list-stack {
  display: grid;
  align-content: start;
  gap: 10px;
}

.list-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fafafa;
}

.list-item strong,
.list-item span {
  display: block;
}

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

.list-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.item-meta {
  flex: 0 0 auto;
  text-align: right;
}

.status-planned,
.status-available,
.status-open,
.status-new,
.status-approved,
.status-sent,
.status-accepted,
.status-delivered {
  color: var(--positive);
  background: #dcfce7;
}

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

.match-toolbar {
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.match-toolbar form,
.match-actions form,
.action-bar form {
  margin: 0;
}

.match-list {
  display: grid;
  align-content: start;
  gap: 0;
}

.match-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid #eef2f7;
}

.match-row:first-child {
  padding-top: 0;
}

.match-row:last-child {
  border-bottom: 0;
}

.match-copy {
  min-width: 0;
}

.match-copy strong,
.match-copy span {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.match-copy strong {
  color: var(--ink);
  font-size: 15px;
}

.match-copy span {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 13px;
}

.match-facts {
  display: flex;
  gap: 16px;
  margin: 10px 0 0;
}

.match-facts div {
  min-width: 0;
}

.match-facts dt {
  font-size: 11px;
  text-transform: uppercase;
}

.match-facts dd {
  margin-top: 2px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.confidence-line {
  display: grid;
  grid-template-columns: auto minmax(80px, 120px) auto;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.confidence-line strong {
  color: var(--positive);
  font-size: 12px;
}

.confidence-bar {
  display: block;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.confidence-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.match-actions {
  flex-direction: column;
  min-width: 110px;
}

.match-actions .btn {
  width: 100%;
  min-height: 34px;
  padding: 7px 12px;
  font-size: 13px;
}

.grid-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 210px;
}

.match-notes {
  grid-column: 1 / -1;
  color: var(--ink-soft);
  font-size: 13px;
}

.match-notes summary {
  cursor: pointer;
  font-weight: 700;
}

.match-notes p {
  margin: 10px 16px;
}

.note-form {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding: 12px;
  border-radius: 8px;
  background: #f8fafc;
}

.empty-state {
  display: grid;
  gap: 5px;
  margin: 0;
  padding: 24px 12px;
  color: var(--muted);
  text-align: center;
}

.empty-state.tall {
  min-height: 140px;
  align-content: center;
}

.empty-state strong {
  color: var(--ink-soft);
}

.compact-field input {
  max-width: 120px;
}

#feedback .compact-field {
  grid-column: 1 / -1;
}

#feedback .textarea-field {
  min-height: 0;
}

#feedback .textarea-field textarea {
  flex: 1;
  min-height: 72px;
}

.operator-feedback-grid {
  margin-top: 20px;
}

@media (orientation: landscape), (min-aspect-ratio: 1/1) {
  body {
    min-height: 100dvh;
    overflow: auto;
  }

  main {
    min-height: 100dvh;
    overflow: visible;
    flex: 1;
  }

  .app-shell,
  .tab-content,
  .content-grid,
  .two-col {
    min-height: 0;
    flex: 1;
  }

  .app-shell,
  .tab-content {
    height: 100%;
    overflow: visible;
  }

  .content-grid,
  .two-col {
    min-height: 0;
    height: 100%;
  }

  #supply.tab-content,
  #demand.tab-content,
  #feedback.tab-content {
    padding-top: 24px;
  }

  #supply .two-col,
  #demand .two-col,
  #feedback .two-col {
    min-height: calc(100vh - 122px);
    height: auto;
  }

  .card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .panel-scroll,
  .form-card .form-grid {
    flex: 1;
    min-height: 0;
    overflow: auto;
  }

  .list-card .panel-scroll,
  .event-card .panel-scroll {
    flex: 0 0 auto;
    overflow: visible;
  }

  #feedback .form-card .form-grid {
    grid-template-rows: auto auto minmax(56px, 1fr) minmax(56px, 1fr) auto;
    align-content: stretch;
    gap: 8px 18px;
    overflow: hidden;
  }

  #feedback .event-card .event-list {
    flex: 0 0 auto;
  }

  .app-header {
    position: sticky;
    display: flex;
    grid-template-columns: none;
    align-items: center;
    gap: 14px;
    padding: 6px 0;
  }

  .header-left {
    flex: 0 0 auto;
    flex-wrap: nowrap;
  }

  .brand {
    gap: 8px;
  }

  .brand-mark {
    width: 72px;
    height: 72px;
    flex-basis: 72px;
    margin-block: -18px;
  }

  .brand strong {
    font-size: 20px;
  }

  .brand small {
    font-size: 11px;
    white-space: nowrap;
  }

  .main-nav {
    align-self: stretch;
    margin: 0;
    padding: 0;
    border-bottom: 0;
  }

  .nav-tab {
    min-height: 42px;
    padding: 0 13px;
    font-size: 14px;
  }

  .tab-content {
    padding-top: 14px;
  }
}

@media (orientation: portrait), (max-aspect-ratio: 1/1) {
  .content-grid,
  .two-col {
    grid-template-columns: 1fr;
  }

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

  .app-header {
    position: sticky;
    top: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px 10px;
  }

  .header-left {
    grid-column: 1;
    grid-row: 1;
    flex-wrap: wrap;
  }

  main {
    padding-left: 12px;
    padding-right: 12px;
  }

  .main-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    margin-left: -12px;
    margin-right: -12px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .account-tools {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    gap: 6px;
    width: auto;
    max-width: min(58vw, 250px);
    overflow: visible;
    padding-bottom: 0;
  }

  .account-name {
    max-width: 15vw;
    font-size: 12px;
  }

  .account-tools .btn {
    min-height: 34px;
    padding: 7px 9px;
  }

  .logout-button {
    width: 34px;
    padding-inline: 8px;
  }

  .logout-button.confirming {
    width: auto;
    white-space: nowrap;
  }

  .nav-tab {
    flex: 0 0 auto;
    min-height: 46px;
    padding: 0 14px;
  }

  .tab-content {
    padding-top: 18px;
  }

  .stats-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .auth-shell {
    align-content: start;
    min-height: calc(100dvh - 24px);
    padding-top: 18px;
  }

  .landing-page main {
    position: relative;
    display: block;
    height: 100svh;
    min-height: 0;
    overflow: hidden;
    background: #0f172a;
    --landing-strip-space: 226px;
  }

  .landing-hero {
    height: 100%;
    min-height: 0;
  }

  .landing-hero::after {
    background:
      linear-gradient(90deg, rgba(6, 20, 15, 0.9) 0%, rgba(6, 20, 15, 0.54) 54%, rgba(6, 20, 15, 0.12) 100%),
      linear-gradient(0deg, rgba(6, 20, 15, 0.78) 0%, rgba(6, 20, 15, 0.36) 34%, rgba(6, 20, 15, 0) 62%);
  }

  .landing-hero-image {
    object-position: 58% center;
  }

  .landing-hero-content {
    height: 100%;
    min-height: 0;
    padding: 18px 16px calc(var(--landing-strip-space) + max(10px, env(safe-area-inset-bottom)));
  }

  .landing-copy {
    padding-bottom: 0;
  }

  .landing-title {
    gap: 9px;
  }

  .landing-title-logo {
    width: 58px;
    height: 58px;
  }

  .landing-title h1 {
    font-size: 46px;
  }

  .landing-title small {
    margin-top: 3px;
    font-size: 11px;
  }

  .landing-copy p {
    max-width: 342px;
    margin-top: 10px;
    font-size: 15px;
    line-height: 1.22;
  }

  .landing-actions {
    width: min(100%, 340px);
    margin-top: 12px;
  }

  .landing-actions .btn {
    min-height: 42px;
    padding-inline: 10px;
  }

  .landing-strip {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    max-width: none;
    margin: 0;
    padding-inline: 16px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
    transform: none;
  }

  .landing-strip div {
    width: 100%;
    padding: 8px 14px;
    border-color: rgba(255, 255, 255, 0.28);
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 14px 28px rgba(6, 20, 15, 0.28);
    backdrop-filter: blur(10px);
  }

  .landing-strip strong {
    font-size: 13px;
    line-height: 1.12;
  }

  .landing-strip span {
    width: calc(100vw - 60px);
    max-width: 100%;
    margin-top: 3px;
    font-size: 11px;
    line-height: 1.18;
    overflow-wrap: anywhere;
  }

  @media (max-height: 700px) {
    .landing-page main {
      --landing-strip-space: 196px;
    }

    .landing-hero {
      min-height: 0;
    }

    .landing-hero-content {
      padding-top: 14px;
      padding-bottom: calc(var(--landing-strip-space) + max(10px, env(safe-area-inset-bottom)));
    }

    .landing-copy {
      padding-bottom: 0;
    }

    .landing-title-logo {
      width: 52px;
      height: 52px;
    }

    .landing-title h1 {
      font-size: 42px;
    }

    .landing-copy p {
      max-width: 330px;
      margin-top: 8px;
      font-size: 14px;
      line-height: 1.18;
    }

    .landing-actions {
      margin-top: 10px;
    }

    .landing-actions .btn {
      min-height: 40px;
    }

    .landing-strip {
      gap: 5px;
      transform: none;
    }

    .landing-strip div {
      padding-block: 6px;
    }

    .landing-strip strong {
      font-size: 12px;
    }

    .landing-strip span {
      font-size: 10.5px;
      line-height: 1.14;
    }
  }

  .detail-list div,
  .match-row,
  .match-facts,
  .confidence-line {
    grid-template-columns: 1fr;
  }

  .match-facts,
  .action-bar,
  .match-toolbar,
  .list-item {
    flex-direction: column;
  }

  .match-toolbar {
    align-items: stretch;
  }

  .action-bar .btn,
  .match-toolbar .btn {
    width: 100%;
  }

  .item-meta {
    text-align: left;
  }

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

  input,
  select,
  textarea {
    font-size: 16px;
  }

  .stats-grid {
    gap: 10px;
  }

  .stat-card,
  .card {
    padding: 14px;
  }

  .stat-card strong {
    font-size: 26px;
  }

  .brand strong {
    font-size: 20px;
  }

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

@media (orientation: portrait), (max-aspect-ratio: 1/1) {
  .app-header {
    padding: 4px 0;
  }

  .brand-mark {
    width: 64px;
    height: 64px;
    flex-basis: 64px;
    margin-block: -16px;
  }

  .brand strong {
    font-size: 19px;
  }

  .brand small {
    font-size: 10px;
  }

  .account-name {
    display: none;
  }

  .nav-tab {
    min-height: 38px;
    padding: 0 12px;
  }

  .tab-content {
    padding-top: 10px;
  }
}
