:root {
  --bg: #f5efe6;
  --panel: #fffaf4;
  --panel-2: #f3e4d2;
  --ink: #2d2118;
  --muted: #776555;
  --line: rgba(72, 47, 26, 0.12);
  --accent: #9b5c2a;
  --accent-strong: #6f3d18;
  --success: #2d7a54;
  --danger: #9b3340;
  --warning: #b27b1f;
  --shadow: 0 12px 36px rgba(78, 46, 22, 0.08);
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 8px;
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(circle at top right, rgba(155, 92, 42, 0.1), transparent 28%),
    linear-gradient(180deg, #fffaf4 0%, var(--bg) 100%);
  color: var(--ink);
  font-family: 'Inter', Arial, Helvetica, sans-serif;
  overflow-x: hidden;
  -webkit-tap-highlight-color: rgba(111, 61, 24, 0.14);
}

body.mobile-nav-open {
  overflow: hidden;
}

body[data-page]:not([data-page="login"]):not(.auth-ready) {
  visibility: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

.shell {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: 100vh;
  min-height: 100dvh;
}

.login-shell {
  min-height: 100vh;
  min-height: 100dvh;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 28px;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 420px);
  gap: 24px;
  align-items: stretch;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  height: 100dvh;
  padding: 28px 20px;
  border-right: 1px solid var(--line);
  background: rgba(255, 248, 239, 0.82);
  backdrop-filter: blur(18px);
  overflow-y: auto;
}

.mobile-shell-header,
.mobile-nav-backdrop,
.mobile-record-list,
.mobile-sort-bar {
  display: none;
}

.mobile-shell-header {
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.mobile-shell-home {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-shell-home .brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  flex: 0 0 auto;
  font-size: 1rem;
}

.mobile-shell-home-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mobile-shell-home-copy strong,
.mobile-shell-home-copy span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-shell-home-copy strong {
  font-size: 0.94rem;
}

.mobile-shell-context {
  color: var(--muted);
  font-size: 0.78rem;
}

.mobile-nav-toggle {
  flex: 0 0 auto;
  min-height: 44px;
  touch-action: manipulation;
}

.mobile-nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 95;
  border: 0;
  background: rgba(45, 33, 24, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

body.mobile-nav-open .mobile-nav-backdrop {
  opacity: 1;
  pointer-events: auto;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 24px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: linear-gradient(135deg, #c9894c, #7b431b);
  color: #fff8f2;
  box-shadow: 0 4px 14px rgba(123, 67, 27, 0.25);
  font-size: 1.2rem;
}

.brand h1 {
  margin: 0;
  font-size: 1rem;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-section-label {
  margin: 20px 0 6px;
  padding: 0 14px;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  font-weight: 700;
}

.nav-section-label:first-child {
  margin-top: 0;
}

.nav-divider {
  height: 1px;
  margin: 12px 8px;
  background: var(--line);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  color: var(--muted);
  border: 1px solid transparent;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
  font-weight: 500;
  touch-action: manipulation;
}

.nav-link i {
  font-size: 1.2rem;
  opacity: 0.8;
}

.nav-link:hover,
.nav-link.active {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: 0 2px 6px rgba(78, 46, 22, 0.04);
}

.nav-link[aria-disabled="true"] {
  opacity: 0.6;
  cursor: default;
  pointer-events: none;
}

.nav-link.nav-dashboard-link {
  align-items: center;
  justify-content: space-between;
  white-space: normal;
}

.nav-dashboard-link .dashboard-module-badges {
  margin-left: auto;
  flex-shrink: 0;
}

.nav-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  touch-action: manipulation;
}

.nav-section-toggle span,
.nav-subsection-toggle span {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-section-toggle span i,
.nav-subsection-toggle span i {
  font-size: 1rem;
  opacity: 0.85;
}

.nav-section-toggle:hover,
.nav-section-toggle.active {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
}

.nav-section-toggle > i,
.nav-subsection-toggle > i {
  font-size: 0.9rem;
  transition: transform 0.2s ease;
}

.nav-section-toggle[aria-expanded="true"] > i,
.nav-subsection-toggle[aria-expanded="true"] > i {
  transform: rotate(180deg);
}

.nav-subsection-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-top: 4px;
  padding: 10px 12px 10px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  touch-action: manipulation;
}

.nav-link:focus-visible,
.nav-section-toggle:focus-visible,
.nav-subsection-toggle:focus-visible,
.button:focus-visible,
.button-icon:focus-visible,
.sort-button:focus-visible,
.filter-list-trigger:focus-visible,
.filter-list-toggle:focus-visible,
.mobile-sort-select:focus-visible,
.mobile-nav-backdrop:focus-visible,
.modal-close:focus-visible {
  outline: 3px solid rgba(155, 92, 42, 0.22);
  outline-offset: 2px;
}

.nav-subsection-toggle:hover,
.nav-subsection-toggle.active {
  background: rgba(255, 250, 244, 0.9);
  border-color: var(--line);
}

.nav-section-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-left: 8px;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateY(-4px);
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.25s ease,
              transform 0.25s ease;
}

.nav-section-body.expanded {
  max-height: 3200px;
  opacity: 1;
  transform: translateY(0);
}

.nav-subsection-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 4px 16px;
  padding: 4px 0 4px 12px;
  border-left: 1px solid rgba(72, 47, 26, 0.12);
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateY(-2px);
  transition: max-height 0.25s ease, opacity 0.2s ease, transform 0.2s ease;
}

.nav-subsection-body.expanded {
  max-height: 1400px;
  opacity: 1;
  transform: translateY(0);
}

.nav-group-label {
  margin: 10px 0 4px;
  padding: 0 14px;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
  font-weight: 700;
}

.nav-group-label-nested {
  margin-top: 12px;
  padding-left: 16px;
}

.nav-sublink {
  padding-left: 22px;
  font-size: 0.9rem;
}

.nav-section-overview {
  margin-bottom: 4px;
}

.nav-overview-link {
  font-size: 0.88rem;
}

.nav-leaf-link {
  padding-left: 28px;
  font-size: 0.87rem;
  align-items: flex-start;
  white-space: normal;
  line-height: 1.35;
}

.nav-leaf-link i {
  font-size: 1rem;
}

.nav-link {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.main {
  padding: 28px;
  min-width: 0;
}

.hero,
.section,
.table-wrap,
.empty-state,
.stat-card,
.view-card,
.hero-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.hero {
  padding: 28px;
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 20px;
}

.hero h2,
.page-header h2,
.section h3,
.login-brand-copy h1 {
  text-wrap: balance;
}

.home-hero {
  margin-bottom: 24px;
}

.login-showcase,
.login-card {
  padding: 32px;
}

.login-showcase {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.login-brand {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 24px;
}

.login-brand-copy h1,
.login-card h2,
.session-panel h3 {
  margin: 0;
}

.login-brand-copy p,
.login-point p,
.session-panel p {
  margin: 0;
}

.login-brand-copy p + h1,
.login-card p + form,
.session-panel .toolbar {
  margin-top: 16px;
}

.login-points {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-top: 28px;
}

.login-point {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 248, 239, 0.78);
}

.login-point h3 {
  margin: 0 0 8px;
}

.login-point p {
  color: var(--muted);
  line-height: 1.55;
}

.login-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-card > p {
  margin: 8px 0 0;
}

.button.block {
  width: 100%;
  justify-content: center;
}

.session-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 18px;
}

.session-panel .auth-status {
  margin-bottom: 0;
}

.session-panel .toolbar {
  justify-content: space-between;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.74rem;
  color: var(--accent);
  font-weight: 700;
}

.lead {
  max-width: 70ch;
  color: var(--muted);
  line-height: 1.55;
}

.hero h2,
.section h3 {
  margin: 0 0 12px;
}

.page-header h2 {
  margin: 0;
}

.hero-card,
.section {
  padding: 22px;
}

.section {
  margin-bottom: 22px;
}

.section-header {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  min-width: 0;
}

.section-header p,
.hint,
.helper,
.empty-state p,
.muted {
  color: var(--muted);
}

.summary-grid,
.view-grid,
.tips-grid,
.stats-grid {
  display: grid;
  gap: 16px;
}

.summary-grid,
.view-grid,
.tips-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.home-stack {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.home-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.home-entry-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dashboard-entry-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dashboard-module-badges {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.dashboard-module-badge {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #f7ecdd;
  color: var(--accent-strong);
  border: 1px solid rgba(111, 61, 24, 0.18);
  box-shadow: 0 1px 3px rgba(78, 46, 22, 0.06);
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 18px;
}

.stat-card,
.view-card {
  padding: 18px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover,
.view-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 40px rgba(78, 46, 22, 0.12);
}

.stat-card h4,
.view-card h4,
.tips-grid h4 {
  margin: 0 0 8px;
}

.metric {
  font-size: 1.85rem;
  font-weight: 800;
}

.metric-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.button {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  touch-action: manipulation;
}

.button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff8f2;
  border-color: transparent;
}

.button.ghost {
  background: transparent;
}

.button.ghost:hover {
  background: var(--panel-2);
}

.button[disabled],
.button-disabled {
  opacity: 0.62;
  cursor: not-allowed;
}

.button[disabled]:hover,
.button-disabled:hover {
  background: white;
  transform: none;
}

.button.danger {
  background: var(--danger);
  color: white;
  border-color: transparent;
}

.button.danger:hover {
  opacity: 0.9;
}

.button.toggle.active {
  background: var(--panel-2);
  border-color: rgba(155, 92, 42, 0.24);
}

.token-panel label,
.filter-label {
  display: block;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 8px;
}

.token-row,
.toolbar,
.filter-row,
.range-row,
.toggle-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.section-header .toolbar {
  flex-wrap: nowrap;
  min-width: 0;
}

.section-header .toolbar > * {
  min-width: 0;
}

.auth-form {
  display: grid;
  gap: 12px;
}

.auth-actions {
  margin-top: 4px;
}

.auth-status {
  margin: 14px 0 0;
}

.auth-status.success {
  color: var(--success);
}

.auth-status.error {
  color: var(--danger);
}

input,
select,
textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(155, 92, 42, 0.12);
}

input[type="range"] {
  padding: 0;
}

select[multiple] {
  padding: 6px;
  border-radius: var(--radius-sm);
  min-height: 140px;
}

select[multiple] option {
  padding: 6px 10px;
  border-radius: 6px;
  margin-bottom: 2px;
}

select[multiple] option:checked {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff8f2;
}

.page-header {
  margin-bottom: 12px;
}

#filters-root {
  margin-bottom: 18px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  color: var(--accent-strong);
  font-weight: 700;
  transition: opacity 0.2s ease;
}

.back-link:hover {
  opacity: 0.8;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.toolbar-host-wide {
  min-width: 220px;
  flex: 1 1 220px;
}

.toolbar-host-filter {
  min-width: 280px;
  flex: 1 1 280px;
}

body[data-page="product-name-relations"] .filter-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}

.table-wrap {
  overflow: auto;
}

.table-wrap-fixed {
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

.desktop-table-view {
  display: block;
}

.mobile-record-list {
  display: none;
  gap: 12px;
}

.mobile-record-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.mobile-record-field {
  display: grid;
  gap: 4px;
}

.mobile-record-field + .mobile-record-field {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(72, 47, 26, 0.08);
}

.mobile-record-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.mobile-record-value {
  min-width: 0;
  overflow-wrap: anywhere;
}

.mobile-record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mobile-record-actions-field {
  align-items: start;
}

.manage-record-card .mobile-record-value,
.view-record-card .mobile-record-value,
.table-actions-cell {
  min-width: 0;
}

.mobile-sort-bar {
  display: none;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.mobile-sort-select-wrap {
  min-width: 0;
}

.mobile-sort-label {
  margin-bottom: 6px;
}

.mobile-sort-select {
  width: 100%;
}

.mobile-sort-direction {
  min-height: 46px;
  justify-content: center;
}

.id-cell {
  white-space: nowrap;
}

.id-chip {
  display: inline-flex;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 0.78rem;
}

table th,
table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  text-align: left;
}

tbody tr {
  transition: background-color 0.15s ease;
}

tbody tr:hover {
  background-color: rgba(155, 92, 42, 0.04);
}

th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--panel);
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sort-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.sort-button:hover,
.sort-button.active {
  color: var(--ink);
}

.sort-indicator {
  min-width: 0.9em;
  color: var(--muted);
}

td.numeric {
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: #f7ecdd;
  color: #744821;
  border: 1px solid rgba(116, 72, 33, 0.2);
}

.tag.success {
  background: rgba(45, 122, 84, 0.12);
  color: var(--success);
  border-color: rgba(45, 122, 84, 0.2);
}

.tag.warning {
  background: rgba(178, 123, 31, 0.14);
  color: var(--warning);
  border-color: rgba(178, 123, 31, 0.2);
}

.tag.danger {
  background: rgba(155, 51, 64, 0.12);
  color: var(--danger);
  border-color: rgba(155, 51, 64, 0.2);
}

.tag-cluster {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

table .tag {
  padding: 3px 8px;
  font-size: 0.72rem;
  line-height: 1;
}

table .tag-cluster {
  gap: 4px;
  align-items: center;
}

.empty-state {
  padding: 48px 28px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.empty-state h3 {
  margin: 0;
}

.empty-state p {
  margin: 0;
  max-width: 400px;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  padding: 8px 12px;
  border-radius: 999px;
  background: #f8ecdf;
  color: #6f4420;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.muted-panel {
  background: rgba(255, 248, 239, 0.8);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(45, 33, 24, 0.45);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.2s ease-out forwards;
}

.modal-overlay.hidden {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleUp {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal {
  width: 100%;
  max-width: 620px;
  max-height: 85vh;
   max-height: min(85vh, calc(100dvh - 32px));
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 28px;
  animation: scaleUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.modal-wide {
  max-width: 880px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.modal-header h3 {
  margin: 0;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: white;
  cursor: pointer;
  font-size: 1.1rem;
  display: grid;
  place-items: center;
  color: var(--muted);
  touch-action: manipulation;
}

.modal-close:hover {
  background: var(--panel-2);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-sections {
  display: grid;
  gap: 18px;
}

.form-section {
  padding: 18px;
  border: 1px solid rgba(72, 47, 26, 0.08);
  border-radius: 18px;
  background: rgba(255, 248, 239, 0.6);
}

.form-section-header {
  margin-bottom: 14px;
}

.form-section-header h4 {
  margin: 0;
  font-size: 0.98rem;
}

.form-section-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.form-section-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-field.full-width {
  grid-column: 1 / -1;
}

.form-field label {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 600;
}

.form-field input,
.form-field select,
.form-field textarea {
  padding: 11px 13px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  font-size: 0.95rem;
  width: 100%;
}

.form-field textarea {
  min-height: 70px;
  resize: vertical;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(155, 92, 42, 0.12);
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.action-col {
  display: flex;
  align-items: center;
  gap: 4px;
}

.button-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: white;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 0.92rem;
  padding: 0;
  color: var(--muted);
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
  touch-action: manipulation;
}

table .button-icon {
  width: 24px;
  height: 24px;
}

.button-icon:hover {
  background: var(--panel-2);
  color: var(--ink);
}

.button-icon[disabled],
.button-icon-disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: #fffaf4;
}

.button-icon[disabled]:hover,
.button-icon-disabled:hover,
.button-icon-disabled:focus {
  background: #fffaf4;
  color: var(--muted);
  border-color: var(--line);
  outline: none;
}

.button-icon.delete:hover {
  background: rgba(155, 51, 64, 0.1);
  color: var(--danger);
  border-color: rgba(155, 51, 64, 0.25);
}

.button-icon-disabled.delete:hover,
.button-icon-disabled.delete:focus {
  background: #fffaf4;
  color: var(--muted);
  border-color: var(--line);
}

.confirm-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(155, 51, 64, 0.08);
  border: 1px solid rgba(155, 51, 64, 0.18);
  margin-bottom: 14px;
}

.confirm-bar p {
  margin: 0;
  flex: 1;
  color: var(--danger);
  font-weight: 600;
  font-size: 0.9rem;
}

.confirm-bar-success {
  background: rgba(45, 122, 84, 0.08);
  border-color: rgba(45, 122, 84, 0.18);
}

.confirm-bar-success p {
  color: var(--success);
}

.import-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.meta-card {
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 248, 239, 0.7);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.meta-card span {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.meta-card strong {
  font-size: 1.35rem;
}

.import-section {
  margin-top: 18px;
}

.import-section h4 {
  margin: 0 0 10px;
}

.import-list {
  margin: 0;
  padding-left: 20px;
  color: var(--ink);
}

.import-error-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.import-error-table {
  width: 100%;
  border-collapse: collapse;
}

.import-error-table th,
.import-error-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.import-error-table th {
  background: rgba(255, 248, 239, 0.9);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.import-error-table tbody tr:last-child td {
  border-bottom: 0;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  padding: 14px 22px;
  border-radius: var(--radius-md);
  background: var(--ink);
  color: #fff8f2;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  max-width: min(420px, calc(100vw - 32px));
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.toast.success {
  background: var(--success);
}

.toast.error {
  background: var(--danger);
}

.toast.fade-out {
  opacity: 0;
  transform: translateY(8px);
}

.loading {
  padding: 40px 22px;
  text-align: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.loading::before {
  content: "";
  width: 28px;
  height: 28px;
  border: 3px solid var(--panel-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.small {
  font-size: 0.86rem;
}

.dashboard-shell {
  align-items: start;
}

.dashboard-main {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.dashboard-main .section {
  margin-bottom: 0;
}

.dashboard-top-grid {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(280px, 0.8fr) minmax(320px, 1.8fr);
  gap: 18px;
  align-items: stretch;
}

.dashboard-middle-grid {
  display: grid;
  grid-template-columns: minmax(540px, 1.1fr) minmax(360px, 0.9fr);
  gap: 22px;
}

.dashboard-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.dashboard-panel-header {
  margin-bottom: 14px;
}

.dashboard-control-card,
.dashboard-actions-panel {
  padding: 16px;
}

.dashboard-control-card {
  background: linear-gradient(180deg, rgba(255, 252, 248, 0.98), rgba(255, 248, 239, 0.9));
}

.dashboard-control-card-header,
.dashboard-kpis-header {
  margin-bottom: 12px;
  align-items: flex-start;
}

.dashboard-control-card-header h3,
.dashboard-kpis-header h3,
.dashboard-actions-copy h3 {
  margin-bottom: 0;
}

.grouper-filter-grid {
  display: block;
}

.grouper-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dashboard-grouper-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.dashboard-grouper-option {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  cursor: pointer;
}

.dashboard-grouper-radio-wrap {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.dashboard-grouper-row.active .dashboard-grouper-radio-wrap {
  background: rgba(243, 228, 210, 0.42);
  border-color: rgba(72, 47, 26, 0.08);
}

.dashboard-grouper-option input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.dashboard-grouper-row:hover .dashboard-grouper-radio-wrap {
  border-color: rgba(72, 47, 26, 0.1);
}

.dashboard-grouper-row:focus-within .dashboard-grouper-radio-wrap {
  border-color: rgba(155, 92, 42, 0.26);
  background: rgba(243, 228, 210, 0.32);
}

.dashboard-grouper-filter-slot {
  flex: 1 1 auto;
  min-width: 0;
}

.dashboard-grouper-filter-slot.filter-list-host {
  min-width: 0;
}

.dashboard-grouper-filter-slot .filter-list-trigger {
  min-height: 48px;
  background: rgba(255, 252, 248, 0.96);
  border-radius: 14px;
}

.dashboard-grouper-filter-slot .filter-list-trigger-copy {
  min-width: 0;
}

.dashboard-grouper-filter-slot .filter-list-trigger-title {
  font-size: 0.9rem;
}

.dashboard-grouper-filter-slot .filter-list-trigger-meta {
  font-size: 0.74rem;
}

.dashboard-control-card .filter-list {
  overflow: visible;
}

.dashboard-control-card .filter-list.open .filter-list-trigger {
  background: rgba(255, 252, 248, 0.99);
}

.dashboard-grouper-filter-slot .filter-list.open .filter-list-trigger {
  border-top-left-radius: 14px;
  border-top-right-radius: 14px;
}

.dashboard-control-card .filter-list-panel {
  width: min(420px, calc(100vw - 48px));
}

.dashboard-filter-stack,
.date-filter-grid {
  display: grid;
  gap: 10px;
}

.dashboard-filter-card {
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 248, 239, 0.72);
  border: 1px solid rgba(72, 47, 26, 0.08);
}

.dashboard-filter-card.compact {
  padding: 10px 12px;
}

.dashboard-filter-card p {
  margin: 8px 0 0;
}

.filter-list-host {
  min-width: 0;
}

.text-filter-host {
  min-width: 0;
}

.range-filter-host {
  min-width: 0;
}

.text-filter {
  display: grid;
  gap: 8px;
}

.range-filter {
  display: grid;
  gap: 8px;
}

.text-filter-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: white;
}

.text-filter-input-wrap i {
  color: var(--muted);
  font-size: 1rem;
}

.text-filter-input {
  border: none;
  border-radius: 0;
  background: transparent;
  padding-left: 0;
  padding-right: 0;
}

.text-filter-input:focus {
  box-shadow: none;
}

.filter-list {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  background: rgba(255, 252, 248, 0.92);
  border: 1px solid rgba(72, 47, 26, 0.1);
  overflow: visible;
}

.filter-list-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.filter-list.compact .filter-list-trigger {
  padding: 10px 12px;
}

.filter-list-trigger-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.filter-list-trigger-title {
  font-size: 0.92rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-list-trigger-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.filter-list-trigger > i {
  color: var(--muted);
  transition: transform 0.2s ease;
}

.filter-list.open .filter-list-trigger {
  border-bottom: 1px solid rgba(72, 47, 26, 0.08);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.filter-list.open .filter-list-trigger > i {
  transform: rotate(180deg);
}

.filter-list-panel {
  position: fixed;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  min-height: 300px;
  max-height: 360px;
  border: 1px solid rgba(72, 47, 26, 0.1);
  border-radius: 14px;
  background: rgba(255, 252, 248, 0.98);
  box-shadow: 0 18px 36px rgba(78, 46, 22, 0.16);
  overflow: hidden;
}

.filter-list-panel.compact {
  min-height: 0;
  max-height: 280px;
}

.filter-list-panel.no-search .filter-list-search {
  display: none;
}

.filter-list-panel[hidden] {
  display: none;
}

.filter-list-header,
.filter-list-search {
  position: sticky;
  z-index: 1;
}

.filter-list-header {
  top: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 8px 10px;
  background: rgba(232, 222, 208, 0.95);
  border-bottom: 1px solid rgba(72, 47, 26, 0.08);
}

.filter-list-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.filter-list-toggle {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid rgba(72, 47, 26, 0.18);
  border-radius: 4px;
  background: white;
  color: var(--accent-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
}

.filter-list-toggle.active {
  border-color: rgba(155, 92, 42, 0.36);
  background: rgba(255, 248, 239, 0.95);
}

.filter-list-toggle.indeterminate {
  font-size: 1rem;
}

.filter-list-title,
.filter-list-metric-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
}

.filter-list-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.filter-list-metric-label {
  text-align: right;
}

.filter-list-search {
  top: 41px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: rgba(255, 252, 248, 0.97);
  border-bottom: 1px solid rgba(72, 47, 26, 0.08);
}

.filter-list-panel.no-search .filter-list-header {
  border-bottom: 1px solid rgba(72, 47, 26, 0.08);
}

.filter-list-search i {
  color: var(--muted);
  font-size: 1rem;
}

.filter-list-search-input {
  border: none;
  padding: 0;
  background: transparent;
  border-radius: 0;
  min-width: 0;
  font-size: 0.8rem;
}

.filter-list-search-input:focus {
  box-shadow: none;
}

.filter-list-body {
  overflow: auto;
  flex: 1 1 auto;
}

.filter-list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 42px;
  padding: 10px 12px;
  border-bottom: 1px solid rgba(72, 47, 26, 0.06);
  transition: background 0.18s ease;
}

.filter-list-item:last-child {
  border-bottom: none;
}

.filter-list-item:hover {
  background: rgba(243, 228, 210, 0.3);
}

.filter-list-item.selected {
  background: rgba(243, 228, 210, 0.48);
}

.filter-list-item-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin: 0;
  cursor: pointer;
}

.filter-list-item-checkbox {
  width: 16px;
  height: 16px;
  margin: 0;
  flex: 0 0 auto;
}

.filter-list-item-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.75rem;
}

.filter-list-item-secondary {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 74px;
}

.filter-list-item-metric {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

.filter-list-item-only {
  display: none;
  padding: 2px 4px;
  border-radius: 999px;
  border: 1px solid rgba(155, 92, 42, 0.22);
  background: rgba(255, 248, 239, 0.98);
  color: var(--accent-strong);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  font-weight: 800;
  cursor: pointer;
}

.filter-list-item:hover .filter-list-item-metric {
  display: none;
}

.filter-list-item:hover .filter-list-item-only {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.filter-list-empty {
  padding: 18px 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.period-filter-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.period-checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dashboard-control-card-period .filter-list-trigger {
  min-height: 46px;
}

.dashboard-control-card-period .filter-list-trigger-title {
  font-size: 0.88rem;
}

.dashboard-control-card-period .filter-list-trigger-meta,
.dashboard-control-card-period .filter-list-item-metric {
  font-size: 0.72rem;
}

.dashboard-period-option {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(255, 248, 239, 0.72);
  border: 1px solid rgba(72, 47, 26, 0.08);
}

.dashboard-period-option input {
  width: auto;
  margin: 0;
}

.dashboard-period-label {
  font-size: 0.92rem;
  font-weight: 600;
}

.dashboard-period-meta {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

.dashboard-kpis-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.dashboard-kpi-card {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(72, 47, 26, 0.12);
  background: rgba(255, 253, 249, 0.96);
  min-width: 0;
}

.dashboard-kpi-card p {
  margin: 0 0 8px;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.dashboard-kpi-card strong {
  font-size: 1.25rem;
  line-height: 1.1;
  display: block;
}

.dashboard-kpi-card.tone-cyan {
  box-shadow: inset 0 0 0 1px rgba(0, 174, 239, 0.28);
}

.dashboard-kpi-card.tone-pink {
  box-shadow: inset 0 0 0 1px rgba(219, 112, 147, 0.28);
}

.dashboard-kpi-card.tone-blue {
  box-shadow: inset 0 0 0 1px rgba(72, 130, 201, 0.28);
}

.dashboard-kpi-card.tone-amber {
  box-shadow: inset 0 0 0 1px rgba(205, 140, 43, 0.28);
}

.dashboard-actions-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: flex-start;
  background: linear-gradient(180deg, rgba(255, 252, 248, 0.98), rgba(255, 248, 239, 0.9));
}

.dashboard-actions-copy p {
  margin: 0 0 6px;
}

.dashboard-actions-group {
  display: flex;
}

.dashboard-action-button {
  width: 100%;
  justify-content: center;
  min-height: 44px;
}

.dashboard-actions-kpis {
  display: grid;
  gap: 10px;
}

.dashboard-grouper-radio-wrap {
  width: 36px;
  height: 36px;
}

.dashboard-grouper-option input {
  width: 16px;
  height: 16px;
}

.dashboard-grouper-filter-slot .filter-list-trigger {
  min-height: 48px;
}

.dashboard-grouper-filter-slot .filter-list-trigger-title {
  font-size: 0.9rem;
}

.dashboard-grouper-filter-slot .filter-list-trigger-meta {
  font-size: 0.74rem;
}

.dashboard-table-panel,
.dashboard-chart-panel,
.dashboard-line-panel,
.dashboard-controls-section {
  overflow: hidden;
}

.dashboard-chart {
  width: 100%;
  min-height: 420px;
}

.dashboard-chart-wide {
  min-height: 360px;
}

.dashboard-table-component {
  width: 100%;
}

.dashboard-table-component .dashboard-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.dashboard-table-component .dashboard-table-wrap.no-horizontal-scroll {
  overflow-x: hidden;
}

.dashboard-table-component .dashboard-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}

.dashboard-table-component.dashboard-table-density-compact .dashboard-table {
  font-size: 0.92rem;
}

.dashboard-table-component.dashboard-table-density-comfortable .dashboard-table {
  font-size: 1rem;
}

.dashboard-table-component.dashboard-table-density-compact .dashboard-table th,
.dashboard-table-component.dashboard-table-density-compact .dashboard-table td {
  padding: 0.4rem 0.5rem;
  vertical-align: middle;
}

.dashboard-table-component.dashboard-table-density-comfortable .dashboard-table th,
.dashboard-table-component.dashboard-table-density-comfortable .dashboard-table td {
  padding: 0.55rem 0.7rem;
  vertical-align: middle;
}

.dashboard-table-component .dashboard-table th {
  font-size: 0.65rem;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.2;
}

.dashboard-table-component.dashboard-table-density-comfortable .dashboard-table th {
  font-size: 0.72rem;
}

.dashboard-table-component .dashboard-table th .sort-button {
  width: 100%;
  align-items: flex-start;
  justify-content: flex-start;
  white-space: normal;
  line-height: inherit;
}

.dashboard-table-component .dashboard-table th .sort-indicator {
  flex: 0 0 auto;
}

.dashboard-table-component .dashboard-table td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-table-component.dashboard-table-density-compact .dashboard-table td {
  height: 2rem;
  font-size: 0.8rem;
}

.dashboard-table-component.dashboard-table-density-comfortable .dashboard-table td {
  height: 2.4rem;
  font-size: 0.9rem;
}

.dashboard-table-component .dashboard-table td.dashboard-row-index,
.dashboard-table-component .dashboard-table td.dashboard-heat-cell,
.dashboard-table-component .dashboard-table td.align-right,
.dashboard-table-component .dashboard-table th.align-right {
  text-align: right;
}

.dashboard-table-component .dashboard-table td.dashboard-row-index {
  font-size: 0.6rem;
}

.dashboard-table-component .dashboard-table th.align-right .sort-button {
  justify-content: flex-end;
}

.dashboard-table-component .dashboard-table tbody tr {
  cursor: default;
}

.dashboard-table-component .dashboard-table tbody tr.dashboard-table-record.interactive:hover {
  background: rgba(155, 92, 42, 0.03);
}

.dashboard-table-component .dashboard-table tbody tr.dashboard-table-record.selected {
  background: rgba(155, 92, 42, 0.08);
}

.dashboard-table-component .dashboard-table tbody tr.dashboard-table-record.dimmed td {
  opacity: 0.38;
}

.dashboard-table-component .dashboard-table tbody tr.dashboard-table-record.selected td {
  opacity: 1;
}

.dashboard-table-component .dashboard-table tbody tr.dashboard-table-record.interactive {
  cursor: pointer;
}

.dashboard-table-component .dashboard-table tbody tr.dashboard-table-placeholder,
.dashboard-table-component .dashboard-table tbody tr.dashboard-table-placeholder:hover {
  background: transparent;
  cursor: default;
}

.dashboard-table-component .dashboard-table tbody tr.dashboard-table-placeholder td {
  background: transparent !important;
}

.dashboard-table-component .dashboard-row-index {
  width: 44px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.dashboard-table-component .dashboard-group-cell {
  font-weight: 600;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dashboard-table-component .dashboard-heat-cell {
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
}

@media (max-width: 900px) {
  .login-shell,
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 110;
    width: min(86vw, 360px);
    max-width: 360px;
    height: 100dvh;
    border-right: 1px solid var(--line);
    border-bottom: none;
    transform: translateX(-100%);
    transition: transform 0.24s ease;
    box-shadow: 0 18px 42px rgba(45, 33, 24, 0.16);
    padding-top: max(24px, env(safe-area-inset-top));
    padding-bottom: max(24px, env(safe-area-inset-bottom));
    overscroll-behavior: contain;
  }

  body.mobile-nav-open .sidebar {
    transform: translateX(0);
  }

  .mobile-shell-header {
    display: flex;
  }

  .main {
    padding-top: 20px;
  }

  .hero,
  .login-shell {
    grid-template-columns: 1fr;
  }

  .section-header,
  .dashboard-entry-title-row,
  .modal-header,
  .form-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-header .toolbar,
  .session-panel .toolbar,
  .toolbar {
    width: 100%;
  }

  .toolbar > * {
    min-width: 0;
  }

  .toolbar-host-wide,
  .toolbar-host-filter,
  #table-search-host,
  #recipe-filter-host {
    min-width: 0;
    flex: 1 1 100%;
    width: 100%;
  }

  .form-grid,
  .form-section-grid,
  .dashboard-top-grid,
  .dashboard-middle-grid,
  .period-filter-grid {
    grid-template-columns: 1fr;
  }

  .import-summary-grid {
    grid-template-columns: 1fr 1fr;
  }

  .dashboard-grouper-row {
    align-items: stretch;
  }

  .dashboard-actions-panel {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .dashboard-actions-group,
  .dashboard-actions-kpis {
    width: 100%;
  }

  .dashboard-action-button {
    width: auto;
    flex: 1 1 0;
  }

  .dashboard-chart {
    min-height: 340px;
  }

  .dashboard-chart-wide {
    min-height: 320px;
  }

  .filter-list {
    overflow: visible;
  }

  .filter-list-panel {
    max-height: min(360px, calc(100dvh - 110px));
  }
}

@media (max-width: 640px) {
  .login-shell,
  .main {
    padding: 16px;
  }

  .section,
  .hero,
  .hero-card,
  .mobile-record-card {
    padding: 16px;
    border-radius: 20px;
  }

  .login-shell {
    gap: 16px;
  }

  .login-showcase,
  .login-card {
    padding: 22px;
  }

  .mobile-shell-header {
    position: sticky;
    top: 0;
    z-index: 80;
    margin: -16px -16px 16px;
    padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
    background: rgba(245, 239, 230, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(72, 47, 26, 0.08);
  }

  .mobile-shell-home {
    flex: 1 1 auto;
  }

  .view-grid,
  .summary-grid,
  .tips-grid,
  .stats-grid,
  .filter-grid,
  body[data-page="product-name-relations"] .filter-grid {
    grid-template-columns: 1fr;
  }

  .section-header,
  .toolbar,
  .token-row,
  .filter-row,
  .range-row,
  .toggle-row,
  .pagination-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .section-header > *,
  .toolbar > *,
  .pagination-bar > * {
    width: 100%;
  }

  .meta-pill {
    justify-content: center;
    text-align: center;
  }

  .button,
  .button.block,
  .dashboard-action-button,
  .mobile-sort-direction {
    width: 100%;
  }

  .mobile-sort-bar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .desktop-table-view {
    display: none;
  }

  .mobile-record-list {
    display: grid;
  }

  table {
    min-width: 0;
  }

  table th,
  table td {
    padding: 8px 10px;
  }

  .dashboard-kpis-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-actions-panel {
    flex-direction: column;
  }

  .dashboard-actions-group {
    width: 100%;
  }

  .filter-list {
    overflow: visible;
  }

  .filter-list-panel {
    min-height: 220px;
    max-height: calc(100dvh - 120px);
    border-radius: 18px;
  }

  .filter-list-item {
    grid-template-columns: minmax(0, 1fr) 64px;
  }

  .filter-list-search {
    top: 49px;
  }

  .dashboard-chart {
    min-height: 280px;
  }

  .dashboard-chart-wide {
    min-height: 260px;
  }

  .toast {
    left: 16px;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom));
    max-width: none;
  }

  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    max-width: none;
    max-height: calc(100dvh - 12px);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    padding: 20px 16px calc(20px + env(safe-area-inset-bottom));
  }

  .form-section {
    padding: 14px;
    border-radius: 16px;
  }
}
