:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --ink: #111827;
  --muted: #64748b;
  --line: #dbe3ef;
  --line-strong: #cbd5e1;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --blue: #2563eb;
  --amber: #b45309;
  --green: #15803d;
  --red: #b91c1c;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.07), transparent 290px),
    var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.28);
  outline-offset: 2px;
}

.app-loading {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.loader-card,
.auth-card,
.config-card,
.card,
.table-card,
.detail-panel,
.modal-card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.loader-card {
  width: min(460px, 100%);
  padding: 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  animation: rise 0.45s ease both;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: #0f766e;
  color: white;
  display: grid;
  place-items: center;
  font-weight: 900;
  letter-spacing: -0.05em;
  flex: 0 0 auto;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

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

.auth-layout {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 480px;
}

.auth-visual {
  padding: 42px;
  color: white;
  background:
    linear-gradient(rgba(10, 27, 43, 0.74), rgba(10, 27, 43, 0.82)),
    url("https://images.unsplash.com/photo-1559757148-5c350d0d3c56?auto=format&fit=crop&w=1600&q=80") center/cover;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.auth-visual h1 {
  font-size: 64px;
  line-height: 0.95;
  letter-spacing: 0;
  max-width: 760px;
  margin-bottom: 18px;
}

.auth-visual p {
  max-width: 580px;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.7;
  font-weight: 500;
}

.auth-card,
.config-card {
  margin: auto;
  width: min(420px, calc(100% - 32px));
  padding: 28px;
  animation: rise 0.45s ease both;
}

.config-card {
  width: min(760px, calc(100% - 32px));
}

.stack {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span,
.label {
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 11px 12px;
  outline: none;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.textarea {
  min-height: 94px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.input[readonly] {
  color: #64748b;
  background: #eef2f7;
  cursor: not-allowed;
}

.btn {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ink);
  background: white;
  font-weight: 800;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

.btn:disabled:hover {
  transform: none;
  box-shadow: none;
}

.btn-primary {
  color: white;
  background: var(--primary);
  border-color: var(--primary);
}

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

.btn-quiet {
  border-color: var(--line);
  background: var(--panel-soft);
}

.btn-danger {
  color: white;
  background: var(--red);
}

.btn-icon {
  width: 42px;
  padding: 0;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  background: #08111f;
  color: #cbd5e1;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 6px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.brand h1 {
  margin: 0;
  color: white;
  font-size: 19px;
  letter-spacing: -0.04em;
}

.brand p {
  margin: 2px 0 0;
  color: #5eead4;
  font-size: 11px;
  font-weight: 800;
}

.nav {
  display: grid;
  gap: 6px;
  overflow-y: auto;
  padding-bottom: 8px;
}

.nav-button {
  width: 100%;
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px 11px;
  background: transparent;
  color: #cbd5e1;
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 13px;
  font-weight: 800;
  text-align: left;
}

.nav-button:hover,
.nav-button.active {
  color: white;
  background: rgba(15, 118, 110, 0.22);
  border-color: rgba(94, 234, 212, 0.22);
}

.nav-button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.sidebar-footer {
  margin-top: auto;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 8px;
  padding: 12px;
  background: rgba(15, 23, 42, 0.75);
}

.sidebar-footer strong,
.sidebar-footer span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-footer span {
  color: #94a3b8;
  font-size: 12px;
  margin-top: 3px;
}

.workspace {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 12;
  min-height: 76px;
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.topbar h2 {
  margin: 0 0 4px;
  font-size: 22px;
  letter-spacing: 0;
}

.topbar-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.chip {
  min-height: 32px;
  border-radius: 8px;
  padding: 7px 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 900;
  background: #ecfeff;
  color: #0e7490;
  border: 1px solid #a5f3fc;
}

.chip.warn {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.chip.danger {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.content {
  width: min(1480px, 100%);
  padding: 22px 24px 48px;
  margin: 0 auto;
}

.view {
  animation: rise 0.28s ease both;
}

.grid {
  display: grid;
  gap: 16px;
}

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

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

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

.card {
  padding: 18px;
}

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

.card h3,
.detail-panel h3,
.modal-card h3 {
  margin: 0;
  letter-spacing: 0;
}

.stat {
  position: relative;
  overflow: hidden;
}

.stat::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 86px;
  height: 5px;
  background: var(--primary);
}

.stat strong {
  display: block;
  margin-top: 10px;
  font-size: 30px;
  letter-spacing: 0;
}

.stat span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.hero-panel {
  border-radius: var(--radius);
  padding: 22px;
  background: #0f172a;
  color: white;
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.8fr);
  gap: 18px;
  align-items: center;
  overflow: hidden;
}

.hero-panel h2 {
  margin: 0 0 10px;
  font-size: 42px;
  line-height: 1.02;
  letter-spacing: 0;
}

.hero-panel p {
  margin: 0;
  color: #cbd5e1;
  line-height: 1.55;
  max-width: 760px;
}

.focus-list {
  display: grid;
  gap: 10px;
}

.focus-item,
.row-item,
.mini-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
}

.focus-item {
  color: #0f172a;
  background: #f8fafc;
}

.home-actions {
  margin-top: 16px;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.quick-action {
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--ink);
  display: grid;
  place-items: center;
  gap: 7px;
  padding: 12px 8px;
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.quick-action:hover {
  transform: translateY(-1px);
  border-color: var(--primary);
  background: #ecfdf5;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
}

.quick-action svg {
  width: 22px;
  height: 22px;
  color: var(--primary);
}

.alert-line {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #f8fafc;
}

.alert-line svg {
  width: 19px;
  height: 19px;
  color: var(--primary);
  flex: 0 0 auto;
}

.alert-line strong,
.alert-line span {
  display: block;
}

.alert-line span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.alert-line.warn {
  background: #fffbeb;
  border-color: #fde68a;
}

.alert-line.warn svg {
  color: var(--amber);
}

.alert-line.danger {
  background: #fef2f2;
  border-color: #fecaca;
}

.alert-line.danger svg {
  color: var(--red);
}

.focus-item strong,
.row-item strong,
.mini-row strong {
  display: block;
  margin-bottom: 3px;
}

.row-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.row-item:hover {
  transform: translateY(-1px);
  border-color: var(--primary);
}

.row-item.active {
  border-color: var(--primary);
  background: #f0fdfa;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.compact-actions {
  align-items: center;
  justify-content: flex-start;
}

.compact-actions .btn-icon {
  min-height: 34px;
  width: 34px;
}

.compact-actions .btn,
.compact-actions .select {
  flex: 0 0 auto;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.toolbar .input,
.toolbar .select {
  width: auto;
  min-width: 210px;
}

.table-card {
  overflow: hidden;
}

.data-health {
  margin-bottom: 16px;
}

.health-card {
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  padding: 14px;
  display: grid;
  gap: 10px;
  align-content: start;
}

.health-card div {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.health-card svg {
  width: 17px;
  height: 17px;
  color: var(--primary);
}

.health-card strong {
  font-size: 28px;
  line-height: 1;
  letter-spacing: 0;
}

.health-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 740px;
}

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

th {
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

td {
  font-size: 13px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 26px;
  padding: 5px 8px;
  border-radius: 8px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 11px;
  font-weight: 900;
}

.badge.green {
  background: #dcfce7;
  color: #166534;
}

.badge.amber {
  background: #fef3c7;
  color: #92400e;
}

.badge.red {
  background: #fee2e2;
  color: #991b1b;
}

.badge.gray {
  background: #f1f5f9;
  color: #475569;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 16px;
  align-items: start;
}

.detail-panel {
  padding: 18px;
  position: sticky;
  top: 96px;
}

.contact-strip,
.metric-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.contact-strip .btn {
  flex: 1 1 auto;
}

.mini-metric {
  min-width: 84px;
  flex: 1 1 84px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 10px;
  display: grid;
  gap: 3px;
}

.mini-metric svg {
  width: 17px;
  height: 17px;
  color: var(--primary);
}

.mini-metric strong {
  font-size: 19px;
  line-height: 1;
}

.mini-metric span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.detail-list {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.detail-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.detail-list strong {
  color: var(--ink);
  text-align: right;
}

.timeline-row {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  padding: 10px 0;
}

.timeline-row + .timeline-row {
  border-top: 1px solid var(--line);
}

.timeline-icon {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #ecfdf5;
  color: var(--primary);
}

.timeline-icon svg {
  width: 17px;
  height: 17px;
}

.rx-grid {
  display: grid;
  grid-template-columns: 70px repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
}

.rx-label {
  min-height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #0f172a;
  color: white;
  font-weight: 900;
}

.cart-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
}

.progress {
  height: 10px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--primary);
}

.empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.7);
}

.modal-root {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.56);
  backdrop-filter: blur(10px);
}

.modal-root.open {
  display: flex;
}

.modal-card {
  width: min(720px, 100%);
  max-height: min(860px, calc(100vh - 36px));
  overflow: auto;
  padding: 20px;
  animation: pop 0.24s ease both;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 16px;
}

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

.check-row {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  color: #334155;
  font-size: 12px;
  font-weight: 900;
}

.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.full {
  grid-column: 1 / -1;
}

.toast-host {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 120;
  display: grid;
  gap: 10px;
  width: min(380px, calc(100% - 36px));
}

.toast {
  border-radius: 8px;
  background: #0f172a;
  color: white;
  padding: 13px 14px;
  box-shadow: var(--shadow);
  font-size: 13px;
  font-weight: 700;
  animation: toastIn 0.25s ease both;
}

.toast.success {
  background: #065f46;
}

.toast.error {
  background: #991b1b;
}

.created-by {
  margin-top: 18px;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 800;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1120px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .split,
  .hero-panel {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }
}

@media (max-width: 860px) {
  body {
    background: var(--bg);
  }

  .auth-layout {
    display: block;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 16px 0 28px;
  }

  .auth-visual {
    min-height: 260px;
    padding: 24px;
    justify-content: flex-end;
  }

  .auth-visual h1 {
    font-size: 38px;
    line-height: 1.04;
  }

  .auth-card,
  .config-card {
    margin-top: -22px;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    height: auto;
    max-height: none;
    min-height: calc(84px + env(safe-area-inset-bottom));
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    border-top: 1px solid rgba(148, 163, 184, 0.2);
    border-right: 0;
  }

  .brand,
  .sidebar-footer {
    display: none;
  }

  .nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0 2px 2px;
    scrollbar-width: thin;
  }

  .nav-button {
    min-width: 78px;
    max-width: 104px;
    flex: 0 0 auto;
    min-height: 60px;
    padding: 8px 7px;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    text-align: center;
    font-size: 10px;
    line-height: 1.15;
    white-space: normal;
  }

  .nav-button svg {
    width: 18px;
    height: 18px;
  }

  .workspace {
    padding-bottom: calc(104px + env(safe-area-inset-bottom));
  }

  .topbar {
    min-height: auto;
    align-items: flex-start;
    padding: 12px;
    gap: 10px;
    flex-direction: column;
  }

  .topbar h2 {
    font-size: 20px;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    justify-content: stretch;
  }

  .topbar-actions .btn,
  .topbar-actions .select,
  .topbar-actions .chip {
    min-width: 0;
    width: 100%;
  }

  .content {
    padding: 12px 12px calc(22px + env(safe-area-inset-bottom));
  }

  .grid-2,
  .grid-3,
  .grid-4,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    align-items: stretch;
  }

  .toolbar .row-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .toolbar .input,
  .toolbar .select,
  .toolbar .btn {
    width: 100%;
    min-width: 0;
  }

  .toolbar .btn-icon {
    width: 46px;
    flex: 0 0 46px;
  }

  .row-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .row-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    justify-content: stretch;
  }

  .row-actions .btn,
  .row-actions .select {
    min-width: 0;
    width: 100%;
    flex: 1 1 auto;
  }

  .row-actions .btn-icon {
    width: 100%;
    flex: 1 1 auto;
  }

  .row-actions.compact-actions,
  .compact-actions {
    display: flex;
    width: auto;
    justify-content: flex-start;
  }

  .row-actions.compact-actions .btn-icon,
  .compact-actions .btn-icon {
    width: 38px;
    flex: 0 0 38px;
  }

  .card-head {
    align-items: stretch;
    flex-direction: column;
  }

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

  .stat strong {
    font-size: 26px;
    overflow-wrap: anywhere;
  }

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

  .quick-action {
    min-height: 76px;
  }

  .alert-line {
    padding: 11px;
  }

  .cart-line {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .cart-line > span {
    justify-self: end;
    font-weight: 900;
  }

  .rx-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
  }

  .rx-grid > div:first-child,
  .rx-grid > label.field {
    display: none;
  }

  .rx-label {
    grid-column: 1 / -1;
    min-height: 38px;
  }

  .rx-grid .input {
    padding: 10px 8px;
    text-align: center;
  }

  .hero-panel {
    padding: 18px;
  }

  .hero-panel h2 {
    font-size: 30px;
    line-height: 1.08;
  }

  .contact-strip,
  .metric-strip {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-list div {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .detail-list strong {
    text-align: left;
    overflow-wrap: anywhere;
  }

  .table-card {
    overflow: visible;
  }

  .table-wrap {
    overflow: visible;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  table {
    border-collapse: separate;
    border-spacing: 0;
  }

  thead {
    display: none;
  }

  tr {
    display: grid;
    gap: 10px;
    padding: 14px;
    border-bottom: 1px solid var(--line);
  }

  td {
    display: grid;
    gap: 4px;
    padding: 0;
    border-bottom: 0;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
  }

  td.row-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  td.row-actions::before {
    grid-column: 1 / -1;
  }

  .modal-root {
    align-items: flex-end;
    padding: 8px;
  }

  .modal-card {
    width: 100%;
    max-height: calc(100dvh - 16px);
    border-radius: 8px 8px 0 0;
    padding: 16px;
  }

  .modal-head {
    position: sticky;
    top: -16px;
    z-index: 2;
    margin: -16px -16px 14px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.97);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
  }

  .toast-host {
    right: 12px;
    bottom: 98px;
    width: calc(100% - 24px);
  }
}

@media (max-width: 420px) {
  .auth-visual h1 {
    font-size: 34px;
  }

  .card,
  .modal-card,
  .auth-card,
  .config-card {
    padding: 16px;
  }

  .btn {
    width: 100%;
  }

  .btn.btn-icon {
    width: 42px;
    flex: 0 0 42px;
  }

  .row-actions .btn.btn-icon {
    width: 100%;
    flex: 1 1 auto;
  }

  .row-actions.compact-actions .btn.btn-icon,
  .compact-actions .btn.btn-icon {
    width: 38px;
    flex: 0 0 38px;
  }

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

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

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

  .quick-action {
    min-height: 70px;
    font-size: 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
