:root {
  --bg: #f7f5ef;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: rgba(255, 255, 255, 0.95);
  --surface-dark: #35632a;
  --surface-dark-alt: #171c15;
  --line: rgba(53, 99, 42, 0.14);
  --text: #141512;
  --muted: #5b6357;
  --accent: #c71635;
  --accent-soft: rgba(199, 22, 53, 0.1);
  --danger: #af1632;
  --success: #4f8d1a;
  --brand-green: #3f7d2d;
  --brand-green-soft: #93c112;
  --brand-red: #c71635;
  --brand-ink: #111111;
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow-lg: 0 24px 70px rgba(24, 38, 19, 0.16);
  --shadow-md: 0 10px 30px rgba(24, 38, 19, 0.11);
  --font-sans: "Aptos", "Segoe UI Variable", "Trebuchet MS", sans-serif;
  --font-display: "Georgia", "Iowan Old Style", serif;
}

body[data-theme="theme-atlas"] {
  --bg: #f5f7fa;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: rgba(255, 255, 255, 0.98);
  --surface-dark: #1f2937;
  --surface-dark-alt: #111827;
  --line: rgba(148, 163, 184, 0.2);
  --text: #111827;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.1);
  --danger: #dc2626;
  --success: #16a34a;
  --brand-green: #2563eb;
  --brand-green-soft: #93c5fd;
  --brand-red: #2563eb;
  --brand-ink: #111827;
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 12px 30px rgba(15, 23, 42, 0.06);
  --font-sans: "Aptos", "Segoe UI Variable", "Trebuchet MS", sans-serif;
  --font-display: "Aptos", "Segoe UI Variable", "Trebuchet MS", sans-serif;
}

body[data-theme="theme-marina"] {
  --bg: #eef4f3;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-strong: rgba(255, 255, 255, 0.96);
  --surface-dark: #0f5d67;
  --surface-dark-alt: #0a2731;
  --line: rgba(15, 93, 103, 0.14);
  --text: #112228;
  --muted: #50717a;
  --accent: #d0704d;
  --accent-soft: rgba(208, 112, 77, 0.12);
  --danger: #ba4a43;
  --success: #2f8c77;
  --brand-green: #177e89;
  --brand-green-soft: #78c6a3;
  --brand-red: #d0704d;
  --brand-ink: #10262e;
  --shadow-lg: 0 24px 70px rgba(16, 54, 64, 0.16);
  --shadow-md: 0 10px 30px rgba(16, 54, 64, 0.11);
  --font-sans: "Verdana", "Trebuchet MS", sans-serif;
  --font-display: "Palatino Linotype", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-sans);
  background:
    radial-gradient(circle at 12% 10%, rgba(147, 193, 18, 0.24), transparent 22%),
    radial-gradient(circle at 86% 12%, rgba(199, 22, 53, 0.16), transparent 26%),
    radial-gradient(circle at 44% 82%, rgba(63, 125, 45, 0.12), transparent 24%),
    linear-gradient(145deg, #faf8f2 0%, #f4f1e7 48%, #ede9dc 100%);
  color: var(--text);
  overflow-x: hidden;
}

body[data-theme="theme-atlas"] {
  background:
    radial-gradient(circle at 12% 10%, rgba(147, 197, 253, 0.16), transparent 22%),
    radial-gradient(circle at 88% 14%, rgba(226, 232, 240, 0.5), transparent 26%),
    linear-gradient(180deg, #fbfcfe 0%, #f4f7fb 52%, #eef2f7 100%);
}

body[data-theme="theme-marina"] {
  background:
    radial-gradient(circle at 10% 12%, rgba(120, 198, 163, 0.2), transparent 23%),
    radial-gradient(circle at 88% 12%, rgba(208, 112, 77, 0.16), transparent 24%),
    radial-gradient(circle at 50% 86%, rgba(23, 126, 137, 0.12), transparent 26%),
    linear-gradient(145deg, #f5fbfb 0%, #e9f3f3 46%, #dde8e8 100%);
}

body.app-booting #loginView,
body.app-booting #workspace {
  visibility: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

.hidden {
  display: none !important;
}

.ambient {
  position: fixed;
  inset: auto;
  border-radius: 999px;
  filter: blur(24px);
  opacity: 0.34;
  pointer-events: none;
}

.ambient-a {
  width: 280px;
  height: 280px;
  top: 6%;
  left: 8%;
  background: rgba(147, 193, 18, 0.28);
}

.ambient-b {
  width: 340px;
  height: 340px;
  right: 6%;
  top: 18%;
  background: rgba(199, 22, 53, 0.18);
}

.ambient-c {
  width: 260px;
  height: 260px;
  left: 40%;
  bottom: 8%;
  background: rgba(63, 125, 45, 0.16);
}

body[data-theme="theme-atlas"] .ambient-a { background: rgba(147, 197, 253, 0.16); }
body[data-theme="theme-atlas"] .ambient-b { background: rgba(226, 232, 240, 0.26); }
body[data-theme="theme-atlas"] .ambient-c { background: rgba(148, 163, 184, 0.12); }
body[data-theme="theme-marina"] .ambient-a { background: rgba(120, 198, 163, 0.22); }
body[data-theme="theme-marina"] .ambient-b { background: rgba(208, 112, 77, 0.18); }
body[data-theme="theme-marina"] .ambient-c { background: rgba(23, 126, 137, 0.16); }

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

body[data-theme="theme-atlas"] .app-shell,
body[data-theme="theme-marina"] .app-shell {
  padding: 18px;
}

.login-view {
  margin: auto;
  min-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  width: min(100%, 560px);
}

body[data-theme="theme-atlas"] .login-view {
  width: min(100%, 1180px);
  padding: 28px;
  border-radius: 40px;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 252, 0.96));
  border: 1px solid rgba(226, 232, 240, 0.9);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.08);
}

body[data-theme="theme-marina"] .login-view {
  width: min(100%, 1280px);
  padding: 24px;
  border-radius: 34px;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(9, 52, 64, 0.96) 0%, rgba(15, 93, 103, 0.9) 44%, rgba(120, 198, 163, 0.48) 100%);
  box-shadow: 0 30px 80px rgba(14, 47, 55, 0.22);
}

.login-copy,
.login-panel,
.sidebar,
.hero-card,
.panel-card,
.metric-card,
.drawer,
.modal-card {
  backdrop-filter: blur(18px);
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.68);
  box-shadow: var(--shadow-lg);
}

.login-copy,
.login-panel {
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
}

body[data-theme="theme-atlas"] .login-panel,
body[data-theme="theme-marina"] .login-panel {
  width: min(100%, 430px);
  margin-inline: auto;
}

body[data-theme="theme-atlas"] .login-panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(248, 250, 252, 0.96));
  border-color: rgba(226, 232, 240, 0.96);
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.06);
}

body[data-theme="theme-marina"] .login-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(244, 250, 248, 0.9) 100%);
  border-color: rgba(255, 255, 255, 0.52);
}

.login-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100%;
}

.eyebrow,
.brand-overline,
.nav-group-label {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.login-copy h1,
.topbar h1,
.hero-card h2,
.drawer h2,
.modal-card h2 {
  font-family: var(--font-display);
  font-weight: 600;
  margin: 10px 0 14px;
  color: var(--surface-dark);
}

.login-copy h1 {
  font-size: clamp(2.3rem, 4vw, 4.2rem);
  line-height: 1.03;
}

.login-copy-text,
.hero-copy,
.sidebar-caption {
  color: var(--muted);
  line-height: 1.65;
}

.login-highlights,
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.highlight-card,
.metric-card,
.info-card {
  display: grid;
  border-radius: var(--radius-lg);
  padding: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(244, 247, 238, 0.92));
  border: 1px solid rgba(53, 99, 42, 0.1);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42);
}

.highlight-card span,
.metric-card span,
.info-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.metric-title {
  font-weight: 600;
}

.metric-figure,
.metric-amount {
  display: grid;
  gap: 4px;
}

.metric-card {
  gap: 14px;
}

.metric-caption {
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.highlight-card strong,
.metric-card strong,
.info-card strong {
  font-size: 1.15rem;
  color: var(--surface-dark);
}

.metric-card strong {
  color: var(--brand-green);
}

.metric-card em {
  font-style: normal;
  font-size: 1.05rem;
  color: var(--surface-dark);
}

.metric-card-dashboard {
  align-content: start;
  gap: 16px;
}

.metric-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.metric-card-expanded {
  grid-column: span 2;
}

.metric-chart-toggle {
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.72));
  color: var(--surface-dark);
  border-radius: 999px;
  padding: 9px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.metric-chart-toggle:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--brand-green) 28%, var(--line));
  box-shadow: 0 10px 18px rgba(17, 19, 16, 0.08);
}

.dashboard-metric-panel {
  display: grid;
  gap: 16px;
  padding: 16px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(247, 249, 245, 0.9)),
    radial-gradient(circle at top right, color-mix(in srgb, var(--brand-green-soft) 34%, transparent), transparent 44%);
  border: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
}

.dashboard-metric-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

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

.dashboard-metric-field span {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.dashboard-metric-field select {
  min-width: 120px;
  border-radius: 14px;
  border: 1px solid color-mix(in srgb, var(--line) 84%, transparent);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  padding: 10px 12px;
}

.dashboard-metric-segmented {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
}

.dashboard-metric-segmented button {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 9px 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.dashboard-metric-segmented button:hover {
  color: var(--surface-dark);
  transform: translateY(-1px);
}

.dashboard-metric-segmented .is-active {
  background: linear-gradient(135deg, var(--brand-green), color-mix(in srgb, var(--brand-green) 52%, white));
  color: white;
  box-shadow: 0 10px 18px color-mix(in srgb, var(--brand-green) 24%, transparent);
}

.dashboard-metric-chart-shell {
  display: grid;
  gap: 14px;
}

.dashboard-metric-chart-summary {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.dashboard-metric-chart-summary span,
.dashboard-metric-chart-summary small {
  margin: 0;
  color: var(--muted);
}

.dashboard-metric-chart-summary strong {
  font-size: clamp(1.35rem, 2vw, 1.8rem);
  color: var(--surface-dark);
}

.dashboard-metric-chart-frame {
  border-radius: 20px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.56));
  border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  overflow: hidden;
}

.dashboard-metric-chart {
  width: 100%;
  height: auto;
  display: block;
}

.dashboard-chart-grid line {
  stroke: color-mix(in srgb, var(--line) 76%, transparent);
  stroke-width: 1;
  stroke-dasharray: 5 8;
}

.dashboard-chart-line polyline {
  fill: none;
  stroke: color-mix(in srgb, var(--brand-red) 88%, white);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.88;
}

.dashboard-chart-bar rect {
  fill: color-mix(in srgb, var(--brand-green) 78%, white);
  opacity: 0.84;
  transition: transform 0.18s ease, opacity 0.18s ease, fill 0.18s ease;
  transform-origin: center bottom;
}

.dashboard-chart-bar circle {
  fill: white;
  stroke: color-mix(in srgb, var(--brand-red) 88%, white);
  stroke-width: 2.5;
}

.dashboard-chart-bar text {
  font-size: 12px;
  fill: var(--muted);
  letter-spacing: 0.02em;
}

.dashboard-chart-bar:hover rect {
  opacity: 1;
  fill: color-mix(in srgb, var(--brand-red) 42%, var(--brand-green));
  transform: translateY(-4px);
}

body[data-theme="theme-atlas"] .dashboard-metric-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.94)),
    radial-gradient(circle at top right, rgba(147, 197, 253, 0.16), transparent 44%);
}

body[data-theme="theme-marina"] .dashboard-metric-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(243, 250, 248, 0.88)),
    radial-gradient(circle at top right, rgba(120, 198, 163, 0.2), transparent 44%);
}

.brand-block,
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.login-panel .brand-block {
  justify-content: center;
  text-align: left;
}

.brand-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(242, 246, 236, 0.92));
  border: 1px solid rgba(53, 99, 42, 0.12);
  box-shadow: 0 10px 22px rgba(53, 99, 42, 0.12);
  overflow: hidden;
  padding: 5px;
}

.brand-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.panel-form,
.modal-form {
  display: grid;
  gap: 18px;
  margin-top: 26px;
}

.field,
.toggle-field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.toggle-field {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.field span,
.toggle-field span {
  font-size: 0.92rem;
  color: var(--muted);
}

.field input,
.field textarea,
.field select,
.lookup-input,
.line-table input,
.line-table select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--text);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.field textarea {
  resize: vertical;
}

.field input:focus,
.field textarea:focus,
.field select:focus,
.lookup-input:focus,
.line-table input:focus,
.line-table select:focus {
  outline: none;
  border-color: rgba(63, 125, 45, 0.4);
  box-shadow: 0 0 0 4px rgba(147, 193, 18, 0.14);
}

.line-table select {
  width: 100%;
  min-width: 0;
}

.modal-form input[readonly],
.modal-form textarea[readonly],
.modal-form input:disabled,
.modal-form textarea:disabled {
  background: rgba(245, 244, 240, 0.96);
  color: var(--muted);
  cursor: default;
  box-shadow: none;
}

.button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
  font-weight: 600;
}

.button:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: linear-gradient(125deg, var(--brand-green) 0%, var(--brand-green-soft) 46%, var(--brand-red) 100%);
  color: white;
  box-shadow: 0 14px 24px rgba(53, 99, 42, 0.18);
}

body[data-theme="theme-atlas"] .button-primary {
  background: linear-gradient(125deg, #2563eb 0%, #60a5fa 54%, #93c5fd 100%);
  box-shadow: 0 14px 24px rgba(37, 99, 235, 0.22);
}

body[data-theme="theme-atlas"] .button-secondary {
  background: rgba(37, 99, 235, 0.08);
  color: #1e3a8a;
  box-shadow: inset 0 0 0 1px rgba(147, 197, 253, 0.9);
}

body[data-theme="theme-marina"] .button-primary {
  background: linear-gradient(125deg, #177e89 0%, #78c6a3 50%, #d0704d 100%);
}

.button-secondary {
  background: rgba(63, 125, 45, 0.1);
  color: var(--text);
  box-shadow: inset 0 0 0 1px rgba(53, 99, 42, 0.08);
}

.button-ghost {
  background: transparent;
  color: var(--text);
}

.button-secondary:hover {
  background: rgba(63, 125, 45, 0.16);
}

.button-ghost:hover {
  background: rgba(199, 22, 53, 0.08);
}

.button-danger {
  background: rgba(199, 22, 53, 0.12);
  color: var(--danger);
}

.button-block {
  width: min(220px, 100%);
  margin: auto;
}

.login-note,
.inline-badge,
.fixed-field,
.user-badge,
.sidebar-role {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(147, 193, 18, 0.16), rgba(199, 22, 53, 0.1));
  border: 1px solid rgba(53, 99, 42, 0.1);
  color: var(--text);
}

.workspace {
  display: grid;
  grid-template-columns: 56px 290px minmax(0, 1fr);
  gap: 24px;
  min-height: calc(100vh - 48px);
  position: relative;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.checkbox-inline span {
  white-space: nowrap;
}

.checkbox-field {
  align-content: start;
}

.checkbox-field-control {
  min-height: 50px;
  width: 100%;
  justify-content: flex-start;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
}

.checkbox-field-control input {
  width: auto;
  margin: 0;
  flex: 0 0 auto;
}

.delivery-line-table .action-cell,
.delivery-line-table .action-cell .button,
.delivery-line-table .table-button {
  white-space: nowrap;
  word-break: normal;
  overflow-wrap: normal;
}

.delivery-line-table td,
.delivery-line-table th {
  word-break: normal;
  overflow-wrap: normal;
}

.delivery-select-shell {
  position: relative;
  width: 100%;
  min-width: 0;
}

.delivery-select-arrow {
  position: absolute;
  top: 50%;
  right: 14px;
  width: 10px;
  height: 10px;
  border-right: 2px solid #111827;
  border-bottom: 2px solid #111827;
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

.delivery-select-shell select:disabled + .delivery-select-arrow {
  border-color: #64748b;
}

.delivery-package-select,
.delivery-line-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  display: block;
  width: 100%;
  min-width: 0;
  padding-right: 42px;
  background-color: rgba(255, 255, 255, 0.98);
  background-image: none;
  border-color: rgba(148, 163, 184, 0.45);
  box-shadow: none;
  font-weight: 500;
  color: #111827;
  cursor: pointer;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}

.delivery-line-select:disabled {
  cursor: not-allowed;
  color: rgba(100, 116, 139, 0.9);
  background-color: rgba(248, 250, 252, 0.98);
}

.delivery-line-table td .delivery-select-shell,
.delivery-line-table td select.delivery-line-select,
.delivery-line-table td select.delivery-package-select {
  width: 100%;
  min-width: 0;
}

.delivery-order-select {
  min-width: 140px;
}

.delivery-order-column {
  min-width: 160px;
}

.deliveries-header-grid {
  margin-bottom: 20px;
  align-items: start;
}

.deliveries-bottom-actions {
  margin-top: 18px;
  justify-content: flex-start;
}

.delivery-entry-table input.delivery-cell-invalid,
.delivery-entry-table select.delivery-cell-invalid,
.deliveries-header-grid input.delivery-cell-invalid,
.deliveries-header-grid select.delivery-cell-invalid {
  background: rgba(175, 22, 50, 0.14) !important;
  border-color: rgba(175, 22, 50, 0.9) !important;
  box-shadow: inset 0 0 0 1px rgba(175, 22, 50, 0.36) !important;
}

.delivery-entry-table .delivery-select-shell select.delivery-cell-invalid,
.deliveries-header-grid .delivery-select-shell select.delivery-cell-invalid {
  background: rgba(175, 22, 50, 0.14) !important;
  border-color: rgba(175, 22, 50, 0.9) !important;
  box-shadow: inset 0 0 0 1px rgba(175, 22, 50, 0.36) !important;
}

.delivery-entry-table input.delivery-cell-warning,
.delivery-entry-table select.delivery-cell-warning,
.delivery-entry-table .delivery-select-shell select.delivery-cell-warning {
  border-color: rgba(217, 119, 6, 0.88) !important;
  background: rgba(250, 204, 21, 0.08) !important;
  box-shadow: inset 0 0 0 1px rgba(217, 119, 6, 0.28) !important;
}

.delivery-line-meta {
  margin-top: 6px;
  font-size: 0.78rem;
  color: rgba(71, 85, 105, 0.95);
}

.delivery-line-meta.delivery-cell-warning {
  color: rgb(180, 83, 9);
  font-weight: 600;
}

.delivery-order-lines-panel {
  margin-top: 20px;
}

.delivery-order-lines-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.delivery-line-select:hover,
.delivery-package-select:hover {
  border-color: rgba(100, 116, 139, 0.65);
  box-shadow: none;
}

.workspace.sidebar-collapsed {
  grid-template-columns: 56px minmax(0, 1fr);
}

body[data-theme="theme-atlas"] .workspace {
  grid-template-columns: 74px 300px minmax(0, 1fr);
  grid-template-areas: "rail sidebar main";
  gap: 22px;
  align-items: start;
}

body[data-theme="theme-atlas"] .workspace.sidebar-collapsed {
  grid-template-columns: 74px minmax(0, 1fr);
  grid-template-areas: "rail main";
}

body[data-theme="theme-marina"] .workspace,
body[data-theme="theme-marina"] .workspace.sidebar-collapsed {
  display: block;
  min-height: calc(100vh - 36px);
}

.sidebar-toggle-rail {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 8px;
}

body[data-theme="theme-atlas"] .sidebar-toggle-rail {
  grid-area: rail;
  justify-content: flex-start;
  align-items: stretch;
  padding-top: 18px;
}

body[data-theme="theme-marina"] .sidebar-toggle-rail {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

.sidebar {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(circle at 85% 18%, rgba(199, 22, 53, 0.22), transparent 22%),
    linear-gradient(180deg, rgba(63, 125, 45, 0.98) 0%, rgba(53, 99, 42, 0.98) 42%, rgba(23, 28, 21, 0.98) 100%);
  color: #eff7f3;
  border-radius: var(--radius-xl);
  padding: 24px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 28px 60px rgba(17, 19, 16, 0.24);
}

body[data-theme="theme-atlas"] .sidebar {
  grid-area: sidebar;
  padding: 26px 18px 20px;
  border-radius: 28px;
  position: sticky;
  top: 18px;
  align-self: start;
  height: calc(100dvh - 36px);
  max-height: calc(100dvh - 36px);
}

body[data-theme="theme-atlas"] .sidebar {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.98) 100%);
  color: #334155;
  border: 1px solid rgba(226, 232, 240, 0.96);
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.06);
}

body[data-theme="theme-marina"] .sidebar {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  min-height: 0;
  margin-bottom: 18px;
  padding: 18px 22px;
  border-radius: 30px;
  overflow: visible;
  background:
    radial-gradient(circle at 84% 16%, rgba(208, 112, 77, 0.18), transparent 22%),
    linear-gradient(90deg, rgba(10, 39, 49, 0.98) 0%, rgba(15, 93, 103, 0.98) 54%, rgba(23, 126, 137, 0.92) 100%);
}

body[data-theme="theme-marina"] .workspace.sidebar-collapsed .sidebar {
  display: grid;
}

.workspace.sidebar-collapsed .sidebar {
  display: none;
}

.sidebar::before {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  top: -30px;
  right: -40px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(147, 193, 18, 0.18) 0%, rgba(147, 193, 18, 0) 68%);
  filter: blur(8px);
  z-index: -1;
}

body[data-theme="theme-atlas"] .sidebar::before {
  display: none;
}

.sidebar > * {
  position: relative;
  z-index: 1;
}

.sidebar .brand-overline,
.sidebar .nav-group-label,
.sidebar-caption,
.sidebar-role {
  color: #64748b;
}

.sidebar .sidebar-role {
  background: #f8fafc;
  border-color: rgba(226, 232, 240, 0.96);
}

.sidebar-nav {
  display: grid;
  gap: 18px;
  margin-top: 32px;
  min-height: 0;
}

body[data-theme="theme-atlas"] .sidebar-nav {
  flex: 1 1 auto;
  gap: 18px;
  margin-top: 22px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  scrollbar-gutter: stable;
}

body[data-theme="theme-marina"] .sidebar-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 0;
  overflow: visible;
  padding-bottom: 0;
  align-items: flex-start;
}

.nav-group {
  display: grid;
  gap: 10px;
}

.nav-group-toggle {
  display: none;
}

.nav-group-menu {
  display: grid;
  gap: 10px;
}

body[data-theme="theme-atlas"] .nav-group {
  gap: 12px;
}

body[data-theme="theme-atlas"] .nav-group-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 12px 14px 12px 16px;
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 16px;
  background: #f8fafc;
  color: #475569;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

body[data-theme="theme-atlas"] .nav-group-toggle:hover {
  background: #ffffff;
  border-color: rgba(148, 163, 184, 0.35);
}

body[data-theme="theme-atlas"] .nav-group-toggle-label {
  font-weight: 700;
  letter-spacing: 0.01em;
}

body[data-theme="theme-atlas"] .nav-group-caret {
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.18s ease;
}

body[data-theme="theme-atlas"] .nav-group-open .nav-group-caret {
  transform: rotate(225deg) translateY(-1px);
}

body[data-theme="theme-atlas"] .nav-group-label {
  display: none;
}

body[data-theme="theme-atlas"] .nav-group-menu {
  padding: 0 4px 0 0;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: max-height 0.22s ease, opacity 0.18s ease;
}

body[data-theme="theme-atlas"] .nav-group-open .nav-group-menu {
  max-height: 320px;
  opacity: 1;
  pointer-events: auto;
}

body[data-theme="theme-marina"] .nav-group {
  position: relative;
  display: grid;
  gap: 8px;
  min-width: max-content;
  z-index: 1;
}

body[data-theme="theme-marina"] .nav-group-open {
  z-index: 6;
}

body[data-theme="theme-marina"] .nav-group-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 148px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: #eff7f3;
  cursor: pointer;
}

body[data-theme="theme-marina"] .nav-group-toggle:hover {
  background: rgba(255, 255, 255, 0.11);
  border-color: rgba(255, 255, 255, 0.18);
}

body[data-theme="theme-marina"] .nav-group-toggle-label {
  white-space: nowrap;
  font-weight: 600;
}

body[data-theme="theme-marina"] .nav-group-caret {
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.18s ease;
}

body[data-theme="theme-marina"] .nav-group-open .nav-group-caret {
  transform: rotate(225deg) translateY(-1px);
}

body[data-theme="theme-marina"] .nav-group-label {
  display: none;
}

body[data-theme="theme-marina"] .nav-group-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  min-width: 220px;
  padding: 10px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(9, 36, 44, 0.96);
  box-shadow: 0 18px 40px rgba(8, 29, 36, 0.28);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 4;
}

body[data-theme="theme-marina"] .nav-group-open .nav-group-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

body[data-theme="theme-marina"] .sidebar-brand,
body[data-theme="theme-marina"] .sidebar-footer {
  align-items: center;
}

.nav-link {
  padding: 13px 16px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: inherit;
  text-align: left;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

body[data-theme="theme-atlas"] .nav-link {
  position: relative;
  padding: 13px 16px 13px 18px;
  border-radius: 16px;
  background: transparent;
  border-color: transparent;
  overflow: hidden;
  color: #334155;
}

body[data-theme="theme-atlas"] .nav-link::before {
  content: "";
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 6px;
  width: 3px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.36);
  transition: background 0.18s ease, transform 0.18s ease;
  transform: scaleY(0.45);
  transform-origin: center;
}

body[data-theme="theme-atlas"] .nav-link:hover::before,
body[data-theme="theme-atlas"] .nav-link.active::before {
  background: linear-gradient(180deg, #60a5fa 0%, #2563eb 100%);
  transform: scaleY(1);
}

body[data-theme="theme-atlas"] .nav-link.active {
  background: #eff6ff;
  border-color: rgba(191, 219, 254, 0.92);
  color: #1d4ed8;
}

body[data-theme="theme-atlas"] .nav-link:hover {
  background: #f8fafc;
  border-color: rgba(226, 232, 240, 0.96);
}

body[data-theme="theme-atlas"] .sidebar-footer {
  padding-top: 18px;
  border-top: 1px solid rgba(226, 232, 240, 0.96);
}

body[data-theme="theme-marina"] .nav-link {
  width: 100%;
  padding: 10px 14px;
  border-radius: 16px;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.07);
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(147, 193, 18, 0.18);
}

.nav-link.active {
  background: linear-gradient(135deg, rgba(147, 193, 18, 0.26), rgba(199, 22, 53, 0.16));
  border-color: rgba(255, 255, 255, 0.24);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 12px;
  flex-shrink: 0;
}

body[data-theme="theme-marina"] .sidebar-footer {
  margin-top: 0;
}

.workspace-main {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

body[data-theme="theme-atlas"] .workspace-main {
  grid-area: main;
  gap: 22px;
}

body[data-theme="theme-marina"] .workspace-main {
  gap: 20px;
}

.menu-toggle {
  width: 48px;
  height: 48px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid rgba(53, 99, 42, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

body[data-theme="theme-atlas"] .menu-toggle {
  width: 58px;
  height: 120px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96));
  border-color: rgba(226, 232, 240, 0.96);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.06);
}

body[data-theme="theme-atlas"] .menu-toggle:hover {
  background: rgba(255, 255, 255, 1);
  border-color: rgba(191, 219, 254, 0.96);
}

.menu-toggle:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(63, 125, 45, 0.22);
}

.menu-toggle span {
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: var(--surface-dark);
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.workspace:not(.sidebar-collapsed) .menu-toggle span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.workspace:not(.sidebar-collapsed) .menu-toggle span:nth-child(2) {
  opacity: 0;
}

.workspace:not(.sidebar-collapsed) .menu-toggle span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.topbar,
.drawer-header,
.modal-header,
.panel-header,
.tight-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.drawer-header,
.modal-header {
  flex: 0 0 auto;
}

body[data-theme="theme-atlas"] .topbar {
  padding: 24px 28px;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.96));
  border: 1px solid rgba(226, 232, 240, 0.96);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.05);
}

body[data-theme="theme-marina"] .topbar {
  padding: 28px 30px;
  border-radius: 34px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94) 0%, rgba(239, 248, 247, 0.92) 42%, rgba(219, 236, 232, 0.92) 100%);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 20px 44px rgba(16, 54, 64, 0.14);
}

.topbar-title,
.topbar-actions,
.content,
.view-shell,
.hero-card,
.panel-card,
.metric-card,
.toolbar-fields,
.form-grid,
.info-grid,
.table-shell {
  min-width: 0;
}

.topbar-actions,
.drawer-actions,
.toolbar-actions,
.pagination-actions,
.modal-actions,
.action-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar-actions,
.action-cell {
  flex-wrap: wrap;
}

.user-badge {
  flex-direction: column;
  align-items: flex-start;
  max-width: 100%;
}

.user-badge strong,
.user-badge span {
  overflow-wrap: anywhere;
}

.user-badge span {
  color: var(--muted);
  font-size: 0.92rem;
}

.content,
.view-shell {
  display: grid;
  gap: 20px;
}

.hero-card,
.panel-card,
.metric-card {
  border-radius: var(--radius-xl);
  padding: 24px;
}

body[data-theme="theme-atlas"] .hero-card,
body[data-theme="theme-atlas"] .panel-card,
body[data-theme="theme-atlas"] .metric-card {
  border-radius: 24px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.96) 100%);
  border: 1px solid rgba(226, 232, 240, 0.96);
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.05);
}

body[data-theme="theme-atlas"] .hero-card::before,
body[data-theme="theme-atlas"] .panel-card::before,
body[data-theme="theme-atlas"] .metric-card::before,
body[data-theme="theme-atlas"] .modal-card::before,
body[data-theme="theme-atlas"] .drawer::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, #93c5fd 0%, #60a5fa 40%, #2563eb 100%);
}

body[data-theme="theme-atlas"] .hero-card {
  padding: 30px 34px;
  min-height: 180px;
  background:
    radial-gradient(circle at 92% 20%, rgba(191, 219, 254, 0.42), transparent 24%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.99) 0%, rgba(248, 250, 252, 0.97) 100%);
}

body[data-theme="theme-atlas"] .panel-card {
  padding: 28px 30px;
}

body[data-theme="theme-atlas"] .metric-card {
  gap: 18px;
}

body[data-theme="theme-atlas"] .metric-card strong {
  font-size: 2rem;
  line-height: 1;
  color: #1d4ed8;
}

body[data-theme="theme-atlas"] .metric-card em {
  color: #334155;
  font-weight: 600;
}

body[data-theme="theme-atlas"] .toolbar {
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  padding: 20px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.92), rgba(255, 255, 255, 0.98));
  border: 1px solid rgba(226, 232, 240, 0.96);
}

body[data-theme="theme-atlas"] .toolbar-fields {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

body[data-theme="theme-atlas"] .toolbar-actions {
  justify-content: flex-start;
}

body[data-theme="theme-atlas"] .form-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

body[data-theme="theme-atlas"] .field span,
body[data-theme="theme-atlas"] .toggle-field span {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #64748b;
}

body[data-theme="theme-atlas"] .field input,
body[data-theme="theme-atlas"] .field textarea,
body[data-theme="theme-atlas"] .field select,
body[data-theme="theme-atlas"] .lookup-input,
body[data-theme="theme-atlas"] .line-table input,
body[data-theme="theme-atlas"] .line-table select {
  border-radius: 16px;
  border-color: rgba(203, 213, 225, 0.96);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

body[data-theme="theme-atlas"] .field input:focus,
body[data-theme="theme-atlas"] .field textarea:focus,
body[data-theme="theme-atlas"] .field select:focus,
body[data-theme="theme-atlas"] .lookup-input:focus,
body[data-theme="theme-atlas"] .line-table input:focus,
body[data-theme="theme-atlas"] .line-table select:focus {
  border-color: rgba(96, 165, 250, 0.9);
  box-shadow: 0 0 0 4px rgba(191, 219, 254, 0.6);
}

body[data-theme="theme-atlas"] .inline-badge,
body[data-theme="theme-atlas"] .fixed-field,
body[data-theme="theme-atlas"] .user-badge,
body[data-theme="theme-atlas"] .sidebar-role {
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(239, 246, 255, 0.98), rgba(248, 250, 252, 0.96));
  border-color: rgba(226, 232, 240, 0.96);
}

body[data-theme="theme-atlas"] .table-shell {
  border-radius: 20px;
  border-color: rgba(226, 232, 240, 0.96);
  background: rgba(255, 255, 255, 0.96);
}

body[data-theme="theme-atlas"] .data-table {
  min-width: 700px;
}

body[data-theme="theme-atlas"] .data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.99), rgba(241, 245, 249, 0.98));
  color: #475569;
}

body[data-theme="theme-atlas"] .data-table td {
  background: rgba(255, 255, 255, 0.98);
}

body[data-theme="theme-atlas"] .data-table tbody tr:hover td {
  background: rgba(248, 250, 252, 1);
}

body[data-theme="theme-atlas"] .lookup-option {
  border-radius: 16px;
  border-color: rgba(226, 232, 240, 0.96);
  background: rgba(255, 255, 255, 0.98);
}

body[data-theme="theme-atlas"] .lookup-option:hover {
  background: rgba(248, 250, 252, 0.98);
}

body[data-theme="theme-atlas"] .pagination {
  padding-top: 8px;
  border-top: 1px solid rgba(226, 232, 240, 0.96);
}

body[data-theme="theme-atlas"] .inline-detail-row td {
  padding: 0;
  background: rgba(248, 250, 252, 0.92);
}

body[data-theme="theme-atlas"] .inline-detail-sheet {
  display: grid;
  gap: 16px;
  padding: 18px;
}

body[data-theme="theme-atlas"] .empty-state,
body[data-theme="theme-atlas"] .loading-card {
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(255, 255, 255, 0.98));
  border: 1px dashed rgba(203, 213, 225, 0.96);
}

body[data-theme="theme-atlas"] .modal-backdrop {
  background: rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(8px);
}

body[data-theme="theme-atlas"] .modal-card,
body[data-theme="theme-atlas"] .drawer {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(248, 250, 252, 0.97));
  border: 1px solid rgba(226, 232, 240, 0.96);
  box-shadow: 0 22px 48px rgba(15, 23, 42, 0.08);
}

body[data-theme="theme-atlas"] .modal-card {
  width: min(1180px, calc(100vw - 48px));
  padding: 28px 30px;
}

body[data-theme="theme-atlas"] .drawer {
  width: min(1140px, calc(100vw - 48px));
  padding: 28px 30px;
}

body[data-theme="theme-marina"] .hero-card,
body[data-theme="theme-marina"] .panel-card,
body[data-theme="theme-marina"] .metric-card {
  border-radius: 26px;
}

body[data-theme="theme-marina"] .view-shell {
  gap: 24px;
}

body[data-theme="theme-marina"] .content {
  gap: 24px;
}

body[data-theme="theme-marina"] .hero-card,
body[data-theme="theme-marina"] .panel-card,
body[data-theme="theme-marina"] .metric-card,
body[data-theme="theme-marina"] .modal-card,
body[data-theme="theme-marina"] .drawer {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(245, 251, 250, 0.94) 100%);
  border: 1px solid rgba(17, 93, 103, 0.14);
  box-shadow: 0 22px 46px rgba(16, 54, 64, 0.12);
}

body[data-theme="theme-marina"] .hero-card::before,
body[data-theme="theme-marina"] .panel-card::before,
body[data-theme="theme-marina"] .metric-card::before,
body[data-theme="theme-marina"] .modal-card::before,
body[data-theme="theme-marina"] .drawer::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  background: linear-gradient(90deg, #0f5d67 0%, #177e89 55%, #78c6a3 100%);
}

body[data-theme="theme-marina"] .hero-card {
  padding: 30px 30px 28px;
  min-height: 168px;
  align-content: start;
  background:
    radial-gradient(circle at 88% 24%, rgba(120, 198, 163, 0.18), transparent 24%),
    linear-gradient(180deg, rgba(245, 251, 250, 0.96) 0%, rgba(236, 246, 244, 0.94) 100%);
}

body[data-theme="theme-marina"] .panel-card {
  padding: 28px;
}

body[data-theme="theme-marina"] .metric-card {
  gap: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(240, 249, 247, 0.94) 100%);
}

body[data-theme="theme-marina"] .metric-card strong {
  font-size: 2rem;
  line-height: 1;
  color: #0f5d67;
}

body[data-theme="theme-marina"] .metric-card em {
  color: #144550;
  font-weight: 600;
}

body[data-theme="theme-marina"] .toolbar {
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(233, 245, 243, 0.9), rgba(247, 251, 250, 0.95));
  border: 1px solid rgba(17, 93, 103, 0.1);
}

body[data-theme="theme-marina"] .toolbar-fields {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

body[data-theme="theme-marina"] .toolbar-actions {
  justify-content: flex-start;
}

body[data-theme="theme-marina"] .form-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

body[data-theme="theme-marina"] .field,
body[data-theme="theme-marina"] .toggle-field {
  gap: 10px;
}

body[data-theme="theme-marina"] .field span,
body[data-theme="theme-marina"] .toggle-field span {
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #557780;
}

body[data-theme="theme-marina"] .field input,
body[data-theme="theme-marina"] .field textarea,
body[data-theme="theme-marina"] .field select,
body[data-theme="theme-marina"] .lookup-input,
body[data-theme="theme-marina"] .line-table input,
body[data-theme="theme-marina"] .line-table select {
  border-radius: 16px;
  border-color: rgba(17, 93, 103, 0.14);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

body[data-theme="theme-marina"] .field input:focus,
body[data-theme="theme-marina"] .field textarea:focus,
body[data-theme="theme-marina"] .field select:focus,
body[data-theme="theme-marina"] .lookup-input:focus,
body[data-theme="theme-marina"] .line-table input:focus,
body[data-theme="theme-marina"] .line-table select:focus {
  border-color: rgba(23, 126, 137, 0.44);
  box-shadow: 0 0 0 4px rgba(120, 198, 163, 0.18);
}

body[data-theme="theme-marina"] .inline-badge,
body[data-theme="theme-marina"] .fixed-field,
body[data-theme="theme-marina"] .user-badge {
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(120, 198, 163, 0.18), rgba(208, 112, 77, 0.08));
  border-color: rgba(17, 93, 103, 0.12);
}

body[data-theme="theme-marina"] .table-shell {
  border-radius: 22px;
  border-color: rgba(17, 93, 103, 0.12);
  background: rgba(255, 255, 255, 0.82);
}

body[data-theme="theme-marina"] .data-table {
  min-width: 680px;
}

body[data-theme="theme-marina"] .data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(226, 242, 239, 0.96), rgba(213, 233, 229, 0.96));
  color: #426871;
}

body[data-theme="theme-marina"] .data-table td {
  background: rgba(255, 255, 255, 0.78);
}

body[data-theme="theme-marina"] .data-table tbody tr:hover td {
  background: rgba(235, 247, 244, 0.92);
}

body[data-theme="theme-marina"] .info-card {
  border-radius: 20px;
  padding: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(240, 249, 247, 0.94));
  border: 1px solid rgba(17, 93, 103, 0.1);
}

body[data-theme="theme-marina"] .info-card strong {
  font-size: 1.05rem;
  color: #113842;
}

body[data-theme="theme-marina"] .lookup-option {
  border-radius: 16px;
  border-color: rgba(17, 93, 103, 0.12);
  background: rgba(255, 255, 255, 0.98);
}

body[data-theme="theme-marina"] .lookup-option:hover {
  background: rgba(236, 247, 245, 0.98);
}

body[data-theme="theme-marina"] .pagination {
  padding-top: 6px;
  border-top: 1px solid rgba(17, 93, 103, 0.08);
}

body[data-theme="theme-marina"] .inline-detail-row td {
  padding: 0;
  background: rgba(232, 245, 242, 0.54);
}

body[data-theme="theme-marina"] .inline-detail-sheet {
  display: grid;
  gap: 16px;
  padding: 18px;
  cursor: pointer;
}

body[data-theme="theme-marina"] .inline-detail-panel {
  margin: 0;
}

body[data-theme="theme-marina"] .empty-state,
body[data-theme="theme-marina"] .loading-card {
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(241, 249, 247, 0.96), rgba(231, 244, 241, 0.92));
  border: 1px dashed rgba(17, 93, 103, 0.16);
}

body[data-theme="theme-marina"] .modal-backdrop {
  background: rgba(8, 33, 40, 0.46);
  backdrop-filter: blur(8px);
}

body[data-theme="theme-marina"] .modal-card {
  width: min(1180px, calc(100vw - 48px));
  padding: 28px;
}

body[data-theme="theme-marina"] .drawer {
  width: min(1120px, calc(100vw - 48px));
  padding: 28px;
}

.toolbar,
.toolbar-fields,
.form-grid,
.info-grid {
  display: grid;
  gap: 16px;
}

.toolbar {
  grid-template-columns: 1fr auto;
  margin-bottom: 16px;
}

.toolbar-fields,
.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-span-2 {
  grid-column: span 2;
}

.compact-field input {
  padding-block: 12px;
}

.dashboard-route-field {
  align-self: end;
}

.dashboard-route-select-shell {
  position: relative;
}

.dashboard-route-select-shell::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 16px;
  width: 10px;
  height: 10px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-70%) rotate(45deg);
  opacity: 0.55;
  pointer-events: none;
}

.dashboard-route-select-shell select {
  width: 100%;
  appearance: none;
  padding-right: 44px;
  background:
    linear-gradient(135deg, rgba(147, 193, 18, 0.16), rgba(199, 22, 53, 0.08)),
    rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(53, 99, 42, 0.14);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

body[data-theme="theme-atlas"] .dashboard-route-select-shell select {
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(147, 197, 253, 0.14)),
    rgba(255, 255, 255, 0.98);
  border-color: rgba(147, 197, 253, 0.9);
}

body[data-theme="theme-marina"] .dashboard-route-select-shell select {
  background:
    linear-gradient(135deg, rgba(23, 126, 137, 0.14), rgba(208, 112, 77, 0.12)),
    rgba(255, 255, 255, 0.96);
  border-color: rgba(23, 126, 137, 0.22);
}

.table-shell {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.32);
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  overflow-wrap: anywhere;
}

.data-table th {
  white-space: nowrap;
}

.data-table .cell-nowrap {
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

.data-table th {
  font-size: 0.84rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  background: rgba(63, 125, 45, 0.08);
}

.table-button {
  padding: 8px 12px;
}

.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 40px;
  padding: 9px 13px;
  white-space: nowrap;
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(10px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 10px 22px rgba(24, 38, 19, 0.08);
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease,
    background 0.18s ease,
    color 0.18s ease;
}

.action-button::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.2), transparent 55%);
  opacity: 0.9;
  pointer-events: none;
}

.action-button-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
  position: relative;
  z-index: 1;
}

.action-button-icon svg {
  width: 14px;
  height: 14px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.action-button-label {
  line-height: 1;
  position: relative;
  z-index: 1;
  letter-spacing: 0.01em;
}

.action-button:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.62),
    0 14px 28px rgba(24, 38, 19, 0.12);
}

.action-button.button-ghost {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(247, 244, 239, 0.72));
  border-color: rgba(53, 99, 42, 0.1);
}

.action-button.button-ghost .action-button-icon {
  color: var(--surface-dark);
}

.action-button.button-secondary {
  background: linear-gradient(180deg, rgba(63, 125, 45, 0.12), rgba(147, 193, 18, 0.08));
  border-color: rgba(63, 125, 45, 0.12);
}

.action-button.button-secondary .action-button-icon {
  background: rgba(255, 255, 255, 0.82);
  color: var(--brand-green);
}

.action-button.button-danger {
  background: linear-gradient(180deg, rgba(199, 22, 53, 0.14), rgba(199, 22, 53, 0.08));
  border-color: rgba(175, 22, 50, 0.12);
}

.action-button.button-danger .action-button-icon {
  background: rgba(255, 255, 255, 0.84);
  color: var(--danger);
}

body[data-theme="theme-atlas"] .action-button {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 10px 24px rgba(15, 23, 42, 0.08);
}

body[data-theme="theme-atlas"] .action-button.button-ghost {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 248, 255, 0.92));
  border-color: rgba(191, 219, 254, 0.9);
  color: #1f3b73;
}

body[data-theme="theme-atlas"] .action-button.button-secondary {
  background: linear-gradient(180deg, rgba(37, 99, 235, 0.12), rgba(96, 165, 250, 0.08));
  border-color: rgba(147, 197, 253, 0.9);
  color: #1e40af;
}

body[data-theme="theme-atlas"] .action-button.button-danger {
  background: linear-gradient(180deg, rgba(220, 38, 38, 0.12), rgba(248, 113, 113, 0.08));
  border-color: rgba(252, 165, 165, 0.85);
}

body[data-theme="theme-marina"] .action-button {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.56),
    0 10px 24px rgba(16, 54, 64, 0.11);
}

body[data-theme="theme-marina"] .action-button.button-ghost {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(239, 248, 247, 0.86));
  border-color: rgba(23, 126, 137, 0.14);
  color: #145560;
}

body[data-theme="theme-marina"] .action-button.button-secondary {
  background: linear-gradient(180deg, rgba(23, 126, 137, 0.12), rgba(120, 198, 163, 0.1));
  border-color: rgba(120, 198, 163, 0.4);
  color: #145560;
}

body[data-theme="theme-marina"] .action-button.button-danger {
  background: linear-gradient(180deg, rgba(208, 112, 77, 0.14), rgba(186, 74, 67, 0.1));
  border-color: rgba(208, 112, 77, 0.24);
}

.drawer {
  position: fixed;
  top: 24px;
  right: 24px;
  bottom: 24px;
  width: min(1240px, calc(100vw - 48px));
  border-radius: var(--radius-xl);
  padding: 24px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: calc(100dvh - 48px);
  overflow: hidden;
}

.drawer-body,
.modal-body,
.line-builder {
  display: grid;
  gap: 18px;
}

.drawer-body,
.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding-right: 6px;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.info-grid,
.metrics-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: grid;
  align-items: start;
  justify-items: center;
  padding: 24px;
  overflow-y: auto;
  overflow-x: hidden;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 19, 16, 0.4);
}

.modal-card {
  position: relative;
  width: min(1120px, calc(100vw - 48px));
  max-height: calc(100dvh - 48px);
  margin: 0;
  border-radius: var(--radius-xl);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: hidden;
}

.modal.modal-confirm-variant {
  align-items: center;
}

.modal.modal-confirm-variant .modal-card {
  width: min(640px, calc(100vw - 32px));
  max-height: none;
  padding: 22px;
}

.confirm-dialog {
  display: grid;
  gap: 18px;
}

.confirm-dialog-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  padding: 20px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(199, 22, 53, 0.12), transparent 34%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(246, 248, 242, 0.96));
  border: 1px solid rgba(53, 99, 42, 0.08);
}

.confirm-dialog-icon {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(199, 22, 53, 0.16), rgba(147, 193, 18, 0.14));
  color: var(--brand-red);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.confirm-dialog-icon svg {
  width: 34px;
  height: 34px;
  stroke: currentColor;
  stroke-width: 1.7;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.confirm-dialog-copy {
  min-width: 0;
}

.confirm-dialog-copy h3 {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: 1.45rem;
  line-height: 1.15;
  color: var(--surface-dark);
}

.confirm-dialog-copy p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.confirm-dialog-details {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.confirm-detail-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(53, 99, 42, 0.1);
  color: var(--text);
  text-align: center;
  box-shadow: 0 10px 22px rgba(17, 19, 16, 0.04);
}

.confirm-dialog-actions {
  justify-content: flex-end;
}

.confirm-dialog-warning .confirm-dialog-icon {
  color: var(--brand-red);
}

body[data-theme="theme-atlas"] .confirm-dialog-hero {
  background:
    radial-gradient(circle at top right, rgba(37, 99, 235, 0.12), transparent 34%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.98), rgba(244, 248, 255, 0.96));
  border-color: rgba(147, 197, 253, 0.5);
}

body[data-theme="theme-atlas"] .confirm-dialog-icon {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.14), rgba(96, 165, 250, 0.12));
  color: #2563eb;
}

body[data-theme="theme-marina"] .confirm-dialog-hero {
  background:
    radial-gradient(circle at top right, rgba(208, 112, 77, 0.14), transparent 34%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(239, 248, 247, 0.94));
}

body[data-theme="theme-marina"] .confirm-dialog-icon {
  background: linear-gradient(135deg, rgba(208, 112, 77, 0.14), rgba(23, 126, 137, 0.12));
  color: #d0704d;
}

.lookup {
  position: relative;
}

.lookup-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  display: grid;
  gap: 6px;
  z-index: 4;
}

.lookup-option {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-strong);
  padding: 12px 14px;
  text-align: left;
  transition: background 0.18s ease, border-color 0.18s ease;
}

.lookup-option:hover {
  background: rgba(244, 247, 238, 0.96);
  border-color: rgba(63, 125, 45, 0.18);
}

.line-adder-tools {
  display: grid;
  gap: 14px;
}

.quick-article-field {
  margin: 0;
}

.quick-article-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}

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

.field-hint-error {
  color: var(--danger);
}

.line-label {
  min-width: 220px;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.line-table {
  min-width: 980px;
}

.line-table th:last-child,
.line-table td.action-cell {
  width: 124px;
  min-width: 124px;
}

.line-table .action-cell {
  text-align: center;
}

.line-table .action-cell .button,
.line-table .action-cell .inline-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(118px, 100%);
  max-width: 100%;
  min-height: 44px;
  margin-inline: auto;
  padding-inline: 14px;
  text-align: center;
  line-height: 1.2;
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
  hyphens: auto;
}

.line-table .action-cell .inline-badge {
  border-radius: 18px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.loading-card,
.empty-state {
  display: grid;
  place-items: center;
  min-height: 180px;
  color: var(--muted);
}

.spinner {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 4px solid rgba(63, 125, 45, 0.15);
  border-top-color: var(--brand-green);
  border-right-color: var(--brand-red);
  animation: spin 0.8s linear infinite;
}

.toast-stack {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: grid;
  gap: 12px;
  z-index: 40;
}

.toast {
  min-width: 260px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(17, 19, 16, 0.92);
  color: white;
  transform: translateY(12px);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
  box-shadow: 0 18px 32px rgba(17, 19, 16, 0.22);
}

.toast-visible {
  transform: translateY(0);
  opacity: 1;
}

.toast-success {
  background: rgba(63, 125, 45, 0.96);
}

.toast-error {
  background: rgba(175, 22, 50, 0.96);
}

.design-hero {
  align-items: start;
}

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

.design-card {
  display: grid;
  gap: 14px;
}

.design-card h3 {
  margin: 0;
  font-family: var(--font-display);
  color: var(--surface-dark);
}

.design-card-active {
  outline: 2px solid rgba(63, 125, 45, 0.22);
}

.design-preview {
  position: relative;
  height: 190px;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.38);
}

.design-preview-sidebar {
  position: absolute;
  top: 14px;
  left: 14px;
  bottom: 14px;
  width: 62px;
  border-radius: 18px;
}

.design-preview-header {
  position: absolute;
  top: 18px;
  left: 92px;
  right: 18px;
  height: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
}

.design-preview-body {
  position: absolute;
  left: 92px;
  right: 18px;
  top: 62px;
  bottom: 18px;
  display: grid;
  gap: 10px;
}

.design-preview-body span {
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.design-preview-rail {
  position: absolute;
  top: 16px;
  left: 16px;
  bottom: 16px;
  width: 18px;
  border-radius: 999px;
  background: rgba(226, 232, 240, 0.98);
}

.design-preview-atlas-shell {
  position: absolute;
  inset: 16px 16px 16px 42px;
  display: grid;
  grid-template-columns: 62px 1fr;
  gap: 12px;
}

.design-preview-atlas-sidebar {
  border-radius: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid rgba(226, 232, 240, 0.96);
}

.design-preview-atlas-main {
  display: grid;
  gap: 12px;
}

.design-preview-atlas-header {
  height: 28px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.98);
}

.design-preview-atlas-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 10px;
  min-height: 0;
  flex: 1;
}

.design-preview-atlas-grid span {
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.98);
}

.design-preview-atlas-grid span:nth-child(1) {
  grid-row: span 2;
}

.design-preview-marina-top {
  position: absolute;
  top: 16px;
  left: 16px;
  right: 16px;
  height: 34px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(10, 39, 49, 0.88), rgba(23, 126, 137, 0.88));
}

.design-preview-marina-nav {
  position: absolute;
  top: 60px;
  left: 18px;
  right: 18px;
  display: flex;
  gap: 8px;
}

.design-preview-marina-nav span {
  height: 14px;
  border-radius: 999px;
  background: rgba(16, 54, 64, 0.22);
  flex: 1;
}

.design-preview-marina-main {
  position: absolute;
  left: 18px;
  right: 18px;
  top: 88px;
  bottom: 18px;
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 10px;
}

.design-preview-marina-hero,
.design-preview-marina-cards span {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
}

.design-preview-marina-cards {
  display: grid;
  gap: 10px;
}

.design-preview-body span:nth-child(1) { height: 42px; }
.design-preview-body span:nth-child(2) { height: 58px; }
.design-preview-body span:nth-child(3) { height: auto; }

.design-preview-default {
  background:
    radial-gradient(circle at 14% 18%, rgba(147, 193, 18, 0.22), transparent 26%),
    linear-gradient(145deg, #faf8f2 0%, #f4f1e7 52%, #ede9dc 100%);
}

.design-preview-default .design-preview-sidebar {
  background: linear-gradient(180deg, #3f7d2d 0%, #35632a 48%, #171c15 100%);
}

.design-preview-atlas {
  background:
    radial-gradient(circle at 14% 18%, rgba(191, 219, 254, 0.3), transparent 24%),
    linear-gradient(145deg, #fbfcfe 0%, #f4f7fb 52%, #eef2f7 100%);
}

.design-preview-marina {
  background:
    radial-gradient(circle at 14% 18%, rgba(120, 198, 163, 0.22), transparent 26%),
    linear-gradient(145deg, #f5fbfb 0%, #e9f3f3 52%, #dde8e8 100%);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 56px 290px minmax(0, 1fr);
  }

  .workspace.sidebar-collapsed {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .sidebar {
    min-height: auto;
  }

  .sidebar-nav,
  .toolbar-fields,
  .form-grid,
  .info-grid,
  .metrics-grid,
  .design-grid {
    grid-template-columns: 1fr;
  }

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

  body[data-theme="theme-atlas"] .login-view,
  body[data-theme="theme-marina"] .login-view {
    width: 100%;
  }

  body[data-theme="theme-marina"] .sidebar {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  body[data-theme="theme-marina"] .sidebar-footer {
    width: 100%;
  }

  body[data-theme="theme-atlas"] .workspace {
    grid-template-columns: 66px 280px minmax(0, 1fr);
  }

  body[data-theme="theme-atlas"] .workspace.sidebar-collapsed {
    grid-template-columns: 66px minmax(0, 1fr);
  }

  body[data-theme="theme-atlas"] .menu-toggle {
    width: 52px;
    height: 104px;
  }
}

@media (max-width: 900px) {
  .topbar,
  .drawer-header,
  .modal-header,
  .panel-header,
  .toolbar,
  .pagination {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 12px;
  }

  .login-view {
    min-height: calc(100vh - 24px);
    width: 100%;
  }

  body[data-theme="theme-atlas"] .login-view,
  body[data-theme="theme-marina"] .login-view {
    padding: 18px;
    min-height: auto;
    justify-content: flex-start;
    align-items: stretch;
  }

  body[data-theme="theme-atlas"] .login-panel,
  body[data-theme="theme-marina"] .login-panel {
    width: 100%;
  }

  .brand-block,
  .sidebar-brand {
    align-items: flex-start;
  }

  .workspace,
  .workspace.sidebar-collapsed {
    display: block;
    min-height: 100dvh;
  }

  body[data-theme="theme-atlas"] .workspace,
  body[data-theme="theme-atlas"] .workspace.sidebar-collapsed {
    display: block;
    min-height: 0;
  }

  .sidebar-toggle-rail {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 32;
    padding-top: 0;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 30;
    border: 0;
    padding: 0;
    background: rgba(17, 19, 16, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .workspace:not(.sidebar-collapsed) .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .menu-toggle {
    width: 44px;
    height: 44px;
    flex: 0 0 auto;
  }

  .login-copy,
  .login-panel,
  .hero-card,
  .panel-card,
  .metric-card,
  .sidebar,
  .modal-card,
  .drawer {
    padding: 18px;
  }

  .drawer {
    top: 14px;
    right: 14px;
    left: 14px;
    width: auto;
    bottom: 14px;
  }

  .sidebar {
    position: fixed;
    top: 12px;
    left: 12px;
    bottom: 12px;
    width: min(320px, calc(100vw - 72px));
    max-width: calc(100vw - 72px);
    max-height: calc(100dvh - 24px);
    border-radius: 24px;
    z-index: 31;
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    opacity: 0;
    visibility: hidden;
    transform: translateX(calc(-100% - 20px));
    transition: transform 0.22s ease, opacity 0.18s ease, visibility 0.18s ease;
  }

  body[data-theme="theme-atlas"] .sidebar {
    position: fixed;
    top: 12px;
    left: 12px;
    bottom: 12px;
    width: min(320px, calc(100vw - 72px));
    max-width: calc(100vw - 72px);
    max-height: calc(100dvh - 24px);
    right: auto;
    transform: translateX(calc(-100% - 20px));
  }

  body[data-theme="theme-atlas"] .sidebar-nav {
    padding-right: 4px;
  }

  .workspace.sidebar-collapsed .sidebar {
    display: flex;
    transform: translateX(calc(-100% - 20px));
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  body[data-theme="theme-atlas"] .workspace.sidebar-collapsed .sidebar {
    transform: translateX(calc(-100% - 20px));
  }

  body[data-theme="theme-marina"] .workspace.sidebar-collapsed .sidebar {
    display: grid;
  }

  .workspace:not(.sidebar-collapsed) .sidebar {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  body:not([data-theme="theme-atlas"]):not([data-theme="theme-marina"]) .sidebar {
    overflow: hidden;
  }

  body:not([data-theme="theme-atlas"]):not([data-theme="theme-marina"]) .sidebar-nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 12px;
  }

  body:not([data-theme="theme-atlas"]):not([data-theme="theme-marina"]) .sidebar-footer {
    margin-top: auto;
    padding-top: 12px;
  }

  .workspace-main {
    width: 100%;
    min-width: 0;
  }

  body[data-theme="theme-atlas"] .workspace-main {
    display: block;
    padding-top: 0;
    margin-top: 0;
  }

  .modal-card {
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
    margin: 12px auto;
  }

  .modal,
  .drawer-body,
  .modal-body {
    scrollbar-gutter: auto;
  }

  .topbar,
  .drawer-header,
  .modal-header,
  .panel-header,
  .toolbar,
  .pagination {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar {
    padding-top: 6px;
  }

  body[data-theme="theme-atlas"] .topbar {
    display: flex;
    margin-top: 0;
    min-height: auto;
  }

  .topbar-title {
    padding-left: 56px;
  }

  body[data-theme="theme-atlas"] .topbar-title {
    padding-left: 56px;
    padding-right: 0;
  }

  body[data-theme="theme-atlas"] .menu-toggle {
    width: 44px;
    height: 44px;
    border-radius: 16px;
  }

  body[data-theme="theme-marina"] .sidebar-toggle-rail {
    display: flex;
  }

  body[data-theme="theme-marina"] .sidebar {
    position: fixed;
    top: 12px;
    left: 12px;
    bottom: 12px;
    width: min(360px, calc(100vw - 72px));
    max-width: calc(100vw - 72px);
    max-height: calc(100dvh - 24px);
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-items: stretch;
    overflow: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    transform: translateX(calc(-100% - 20px));
    transition: transform 0.22s ease;
  }

  body[data-theme="theme-marina"] .workspace:not(.sidebar-collapsed) .sidebar {
    transform: translateX(0);
  }

  body[data-theme="theme-marina"] .sidebar-nav,
  body[data-theme="theme-marina"] .nav-group {
    display: grid;
  }

  body[data-theme="theme-marina"] .sidebar-nav {
    flex: 1 1 auto;
    min-height: 0;
  }

  body[data-theme="theme-marina"] .nav-group {
    min-width: 0;
  }

  body[data-theme="theme-marina"] .nav-group-toggle {
    width: 100%;
    min-width: 0;
  }

  body[data-theme="theme-marina"] .nav-group-menu {
    position: static;
    min-width: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    pointer-events: none;
    transform: none;
    transition: max-height 0.2s ease, opacity 0.18s ease;
  }

  body[data-theme="theme-marina"] .nav-group-open .nav-group-menu {
    opacity: 1;
    max-height: 320px;
    pointer-events: auto;
    padding-top: 4px;
  }

  body[data-theme="theme-marina"] .nav-link {
    white-space: normal;
  }

  body[data-theme="theme-marina"] .sidebar-footer {
    margin-top: auto;
  }

  body[data-theme="theme-marina"] .topbar {
    padding-top: 22px;
  }

  body[data-theme="theme-marina"] .hero-card,
  body[data-theme="theme-marina"] .panel-card,
  body[data-theme="theme-marina"] .metric-card,
  body[data-theme="theme-marina"] .modal-card,
  body[data-theme="theme-marina"] .drawer {
    padding: 20px;
  }

  body[data-theme="theme-marina"] .toolbar,
  body[data-theme="theme-marina"] .form-grid,
  body[data-theme="theme-marina"] .toolbar-fields {
    grid-template-columns: 1fr;
  }

  body[data-theme="theme-atlas"] .toolbar,
  body[data-theme="theme-atlas"] .toolbar-fields,
  body[data-theme="theme-atlas"] .form-grid,
  body[data-theme="theme-atlas"] .info-grid,
  body[data-theme="theme-atlas"] .metrics-grid,
  body[data-theme="theme-marina"] .info-grid,
  body[data-theme="theme-marina"] .metrics-grid {
    grid-template-columns: 1fr;
  }

  body[data-theme="theme-atlas"] .field-span-2,
  body[data-theme="theme-marina"] .field-span-2 {
    grid-column: auto;
  }

  body[data-theme="theme-atlas"] .modal-card,
  body[data-theme="theme-atlas"] .drawer,
  body[data-theme="theme-marina"] .modal-card,
  body[data-theme="theme-marina"] .drawer {
    width: calc(100vw - 24px);
    padding: 20px;
  }

  body[data-theme="theme-atlas"] .modal-body,
  body[data-theme="theme-atlas"] .drawer-body,
  body[data-theme="theme-marina"] .modal-body,
  body[data-theme="theme-marina"] .drawer-body {
    padding-right: 0;
  }

  body[data-theme="theme-atlas"] .inline-detail-sheet,
  body[data-theme="theme-marina"] .inline-detail-sheet {
    padding: 14px 0 0;
  }

  body[data-theme="theme-marina"] .data-table {
    min-width: 620px;
  }

  .topbar h1,
  .drawer h2,
  .modal-card h2 {
    font-size: 1.7rem;
    line-height: 1.15;
  }

  .topbar-actions,
  .drawer-actions,
  .toolbar-actions,
  .pagination-actions,
  .modal-actions {
    flex-wrap: wrap;
  }

  .button-block,
  .user-badge,
  .modal-actions .button,
  .drawer-actions .button,
  .topbar-actions .button,
  .pagination-actions .button,
  .toolbar-actions .button {
    width: 100%;
  }

  .sidebar-role,
  .inline-badge,
  .fixed-field {
    width: 100%;
    border-radius: 18px;
  }

  .modal.modal-confirm-variant {
    padding: 16px;
  }

  .modal.modal-confirm-variant .modal-card {
    width: min(100%, 100vw - 32px);
    padding: 18px;
  }

  .confirm-dialog-hero {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    text-align: center;
    padding: 18px;
  }

  .confirm-dialog-copy h3 {
    font-size: 1.25rem;
  }

  .confirm-dialog-details,
  .confirm-dialog-actions {
    justify-content: center;
  }

  .confirm-detail-pill {
    width: 100%;
  }

  .info-card strong,
  .fixed-field,
  .inline-badge,
  .lookup-option,
  .button {
    overflow-wrap: anywhere;
  }

  .data-table {
    min-width: 640px;
  }

  .line-table {
    min-width: 820px;
  }

  .toast-stack {
    left: 14px;
    right: 14px;
    bottom: 14px;
  }

  .toast {
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 10px;
  }

  .hero-card,
  .panel-card,
  .metric-card,
  .modal-card,
  .drawer,
  .sidebar,
  .login-panel,
  .login-copy {
    border-radius: 22px;
    padding: 16px;
  }

  .topbar-title {
    padding-left: 52px;
  }

  .toolbar,
  .toolbar-fields,
  .toolbar-actions,
  .form-grid,
  .info-grid,
  .metrics-grid,
  .panel-header,
  .drawer-header,
  .modal-header,
  .pagination,
  .pagination-actions,
  .modal-actions,
  .drawer-actions {
    grid-template-columns: 1fr;
  }

  .toolbar-actions,
  .pagination-actions,
  .modal-actions,
  .drawer-actions,
  .action-cell {
    width: 100%;
  }

  .table-shell {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .data-table,
  .line-table {
    min-width: 0;
    width: 100%;
    display: block;
  }

  .data-table thead,
  .line-table thead {
    display: none;
  }

  .data-table tbody,
  .line-table tbody {
    display: grid;
    gap: 12px;
    width: 100%;
  }

  .data-table tr,
  .line-table tr {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface-strong);
    box-shadow: var(--shadow-md);
    min-width: 0;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
  }

  .data-table td,
  .line-table td {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    align-items: start;
    padding: 0;
    border: 0;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
  }

  .data-table td > *,
  .line-table td > * {
    min-width: 0;
    max-width: 100%;
  }

  body[data-theme="theme-atlas"] .data-table td,
  body[data-theme="theme-atlas"] .line-table td,
  body[data-theme="theme-marina"] .data-table td,
  body[data-theme="theme-marina"] .line-table td {
    background: transparent;
  }

  .data-table td::before,
  .line-table td::before {
    content: attr(data-label);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 700;
    line-height: 1.2;
  }

  .data-table .action-cell,
  .line-table .action-cell {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    align-items: stretch;
    width: 100%;
    min-width: 0;
    justify-items: center;
  }

  .data-table .action-cell::before,
  .line-table .action-cell::before {
    align-self: start;
  }

  .data-table .action-cell .button,
  .line-table .action-cell .button,
  .line-table .action-cell .inline-badge {
    width: min(220px, 100%);
  }

  .data-table .action-cell > *,
  .line-table .action-cell > * {
    justify-self: stretch;
    min-width: 0;
  }

  .data-table .table-button,
  .line-table .table-button,
  .action-cell .button {
    display: inline-flex;
    width: min(220px, 100%);
    max-width: 100%;
    text-align: center;
  }

  .line-table td.action-cell {
    width: 100%;
    min-width: 0;
  }

  .data-table td .button,
  .line-table td .button,
  .data-table td .inline-badge,
  .line-table td .inline-badge,
  .data-table td input,
  .line-table td input,
  .line-table td select,
  .data-table td .line-label,
  .line-table td .line-label {
    width: 100%;
    min-width: 0;
  }

  .data-table td:not(.action-cell),
  .line-table td:not(.action-cell) {
    justify-items: start;
  }

  .data-table td:not(.action-cell)::before,
  .line-table td:not(.action-cell)::before {
    width: 100%;
    max-width: 100%;
  }

  body[data-theme="theme-atlas"] .data-table,
  body[data-theme="theme-atlas"] .line-table,
  body[data-theme="theme-marina"] .data-table,
  body[data-theme="theme-marina"] .line-table {
    table-layout: fixed;
  }

  body[data-theme="theme-atlas"] .data-table,
  body[data-theme="theme-atlas"] .line-table,
  body[data-theme="theme-marina"] .data-table,
  body[data-theme="theme-marina"] .line-table {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  body[data-theme="theme-atlas"] .data-table tbody,
  body[data-theme="theme-atlas"] .line-table tbody,
  body[data-theme="theme-marina"] .data-table tbody,
  body[data-theme="theme-marina"] .line-table tbody {
    display: grid !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  body[data-theme="theme-atlas"] .data-table tr,
  body[data-theme="theme-atlas"] .line-table tr,
  body[data-theme="theme-marina"] .data-table tr,
  body[data-theme="theme-marina"] .line-table tr {
    display: grid !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  body[data-theme="theme-atlas"] .data-table td,
  body[data-theme="theme-atlas"] .line-table td,
  body[data-theme="theme-marina"] .data-table td,
  body[data-theme="theme-marina"] .line-table td {
    display: grid !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }

  body[data-theme="theme-atlas"] .data-table .action-cell,
  body[data-theme="theme-atlas"] .line-table .action-cell,
  body[data-theme="theme-marina"] .data-table .action-cell,
  body[data-theme="theme-marina"] .line-table .action-cell {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    justify-items: stretch !important;
  }

  body[data-theme="theme-atlas"] .data-table .action-cell .button,
  body[data-theme="theme-atlas"] .line-table .action-cell .button,
  body[data-theme="theme-marina"] .data-table .action-cell .button,
  body[data-theme="theme-marina"] .line-table .action-cell .button,
  body[data-theme="theme-atlas"] .data-table .action-cell .inline-badge,
  body[data-theme="theme-atlas"] .line-table .action-cell .inline-badge,
  body[data-theme="theme-marina"] .data-table .action-cell .inline-badge,
  body[data-theme="theme-marina"] .line-table .action-cell .inline-badge {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    text-align: center !important;
  }

  body[data-theme="theme-atlas"] .data-table tbody,
  body[data-theme="theme-atlas"] .line-table tbody,
  body[data-theme="theme-marina"] .data-table tbody,
  body[data-theme="theme-marina"] .line-table tbody {
    gap: 14px;
  }

  body[data-theme="theme-atlas"] .data-table tr,
  body[data-theme="theme-atlas"] .line-table tr,
  body[data-theme="theme-marina"] .data-table tr,
  body[data-theme="theme-marina"] .line-table tr {
    align-content: start;
  }

  body[data-theme="theme-atlas"] .info-card,
  body[data-theme="theme-marina"] .info-card {
    padding: 16px;
    min-width: 0;
  }

  body[data-theme="theme-atlas"] .info-card strong,
  body[data-theme="theme-marina"] .info-card strong {
    min-width: 0;
  }

  body[data-theme="theme-atlas"] .toolbar,
  body[data-theme="theme-marina"] .toolbar {
    padding: 16px;
  }

  body[data-theme="theme-atlas"] .toolbar-fields,
  body[data-theme="theme-atlas"] .form-grid,
  body[data-theme="theme-atlas"] .info-grid,
  body[data-theme="theme-marina"] .toolbar-fields,
  body[data-theme="theme-marina"] .form-grid,
  body[data-theme="theme-marina"] .info-grid {
    gap: 12px;
  }

  body[data-theme="theme-atlas"] .field,
  body[data-theme="theme-marina"] .field,
  body[data-theme="theme-atlas"] .lookup,
  body[data-theme="theme-marina"] .lookup,
  body[data-theme="theme-atlas"] .fixed-field,
  body[data-theme="theme-marina"] .fixed-field {
    min-width: 0;
    width: 100%;
  }

  body[data-theme="theme-atlas"] .lookup-input,
  body[data-theme="theme-atlas"] .field input,
  body[data-theme="theme-atlas"] .field textarea,
  body[data-theme="theme-atlas"] .field select,
  body[data-theme="theme-marina"] .lookup-input,
  body[data-theme="theme-marina"] .field input,
  body[data-theme="theme-marina"] .field textarea,
  body[data-theme="theme-marina"] .field select,
  body[data-theme="theme-marina"] .line-table select {
    min-width: 0;
    width: 100%;
  }

  .line-label {
    min-width: 0;
  }

  .checkbox-field-control {
    min-height: 44px;
    justify-content: flex-start;
  }

  .inline-detail-row {
    display: block;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .inline-detail-row td {
    display: block;
    padding: 0;
  }

  .inline-detail-row td::before {
    content: none;
  }

  .metric-card-expanded {
    grid-column: auto;
  }

  .metric-card-top,
  .dashboard-metric-toolbar,
  .dashboard-metric-chart-summary {
    align-items: stretch;
  }

  .metric-card-top,
  .dashboard-metric-toolbar {
    flex-direction: column;
  }

  .metric-chart-toggle,
  .dashboard-metric-field select,
  .dashboard-metric-segmented {
    width: 100%;
  }

  .dashboard-metric-segmented {
    display: flex;
    flex-direction: column;
  }

}
