:root {
  --ivory: #f7f2ea;
  --surface: #fffdf8;
  --surface-strong: #ffffff;
  --sand: #e8ddcb;
  --gold: #b9975b;
  --gold-soft: #f3ead8;
  --night: #141923;
  --ink: #222733;
  --muted: #727887;
  --line: #e6dfd3;
  --green: #4f7f67;
  --green-soft: #e7f1eb;
  --red: #b45f58;
  --red-soft: #f7e7e3;
  --blue: #2e3a59;
  --blue-soft: #e9edf5;
  --shadow: 0 18px 50px rgba(28, 31, 42, 0.08);
  --shadow-soft: 0 10px 28px rgba(28, 31, 42, 0.06);
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --sidebar-width: 272px;
  --topbar-height: 78px;
  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--ivory);
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

:focus-visible {
  outline: 3px solid rgba(185, 151, 91, 0.35);
  outline-offset: 3px;
}

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

.app-body {
  background:
    radial-gradient(circle at top left, rgba(185, 151, 91, 0.12), transparent 28%),
    linear-gradient(135deg, #fbf7ef 0%, #f3eee5 46%, #edf1ed 100%);
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--night);
  color: #f6f0e5;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  z-index: 30;
}

.brand-block {
  padding: 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark,
.login-logo {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-symbol {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  color: #1c1a16;
  font-weight: 800;
  background: linear-gradient(135deg, #f4dfad 0%, var(--gold) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4);
}

.brand-mark strong,
.login-logo span:last-child {
  display: block;
  font-size: 16px;
}

.brand-mark small,
.profile-mini small,
.user-chip small {
  display: block;
  color: rgba(246, 240, 229, 0.64);
  font-size: 12px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 12px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  padding: 9px 11px;
  margin-bottom: 3px;
  color: rgba(246, 240, 229, 0.76);
  border-radius: var(--radius-sm);
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-link:hover,
.nav-link.is-active {
  color: #fffaf0;
  background: rgba(255, 255, 255, 0.08);
}

.nav-link.is-active {
  box-shadow: inset 3px 0 0 var(--gold);
}

.nav-icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  color: #f3d89f;
  font-size: 12px;
  font-weight: 700;
}

.sidebar-footer {
  display: grid;
  gap: 8px;
  padding: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.profile-mini,
.user-chip,
.table-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.profile-mini {
  padding: 10px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.07);
}

.profile-mini strong,
.user-chip strong,
.table-user strong {
  display: block;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.avatar {
  display: inline-grid;
  place-items: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gold-soft);
  color: var(--night);
  font-size: 12px;
  font-weight: 800;
}

.avatar.soft {
  background: var(--blue-soft);
  color: var(--blue);
}

.logout-button {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  color: #f6f0e5;
}

.content-shell {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(280px, 380px) minmax(260px, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: var(--topbar-height);
  padding: 14px 28px;
  background: rgba(255, 253, 248, 0.86);
  border-bottom: 1px solid rgba(230, 223, 211, 0.8);
  backdrop-filter: blur(18px);
}

.topbar-filters {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(140px, 1fr);
  gap: 10px;
}

.select-control,
.form-control {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  color: var(--ink);
  padding: 0 12px;
  transition: border 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.form-control {
  min-height: 46px;
}

.select-control:hover,
.form-control:hover {
  border-color: #d4c5aa;
}

.select-control:focus,
.form-control:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(185, 151, 91, 0.14);
  outline: 0;
}

.global-search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
}

.global-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

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

.icon-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  color: var(--night);
  font-weight: 800;
}

.mobile-menu-button {
  display: none;
  gap: 4px;
}

.mobile-menu-button span {
  display: block;
  width: 18px;
  height: 2px;
  background: currentColor;
}

.notification-dot {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 3px var(--surface-strong);
}

.main-content {
  padding: 28px;
}

.page-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 22px;
}

.page-heading h1 {
  margin: 0;
  color: var(--night);
  font-size: 34px;
  line-height: 1.12;
  font-weight: 780;
}

.page-heading p {
  margin: 8px 0 0;
  max-width: 660px;
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.heading-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 15px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-weight: 760;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.primary-button {
  color: #fffaf0;
  background: var(--night);
  box-shadow: var(--shadow-soft);
}

.secondary-button {
  color: var(--night);
  background: var(--surface-strong);
  border-color: var(--line);
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.full-width {
  width: 100%;
}

.text-link {
  color: var(--gold);
  font-weight: 750;
}

.status-pill,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 750;
}

.status-pill,
.badge.neutral {
  color: var(--blue);
  background: var(--blue-soft);
}

.badge.success {
  color: var(--green);
  background: var(--green-soft);
}

.badge.warning {
  color: #856126;
  background: #f5ead0;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi-card,
.panel,
.spa-card,
.login-card,
.error-card {
  background: rgba(255, 253, 248, 0.86);
  border: 1px solid rgba(230, 223, 211, 0.82);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}

.kpi-card {
  min-height: 142px;
  padding: 17px;
}

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

.kpi-value {
  margin-top: 12px;
  color: var(--night);
  font-size: 27px;
  line-height: 1;
  font-weight: 820;
}

.trend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  font-size: 13px;
  font-weight: 760;
}

.trend small {
  color: var(--muted);
  font-weight: 620;
}

.trend-positive {
  color: var(--green);
}

.trend-negative {
  color: var(--red);
}

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

.panel {
  grid-column: span 4;
  padding: 20px;
  min-width: 0;
}

.panel-wide {
  grid-column: span 8;
}

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

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

.panel-header h2 {
  margin: 0;
  color: var(--night);
  font-size: 18px;
  line-height: 1.25;
}

.panel-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(6, minmax(72px, 1fr));
  gap: 12px;
  align-items: end;
  min-height: 270px;
  padding-top: 12px;
}

.bar-item {
  display: grid;
  grid-template-rows: 28px 180px 28px;
  gap: 8px;
  min-width: 0;
  text-align: center;
}

.bar-value,
.bar-label {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-value {
  color: var(--night);
  font-weight: 800;
}

.bar-track {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 180px;
  border-radius: var(--radius-sm);
  background: #f0e7d9;
  overflow: hidden;
}

.bar-fill {
  width: 100%;
  min-height: 10px;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  background: linear-gradient(180deg, #d7b98d 0%, #96733d 100%);
  transition: height 240ms ease;
}

.donut-wrap {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.donut-chart {
  width: 170px;
  height: 170px;
}

.donut-base,
.donut-segment {
  fill: none;
  stroke-width: 4.5;
}

.donut-base {
  stroke: #efe6d6;
}

.donut-segment {
  transform: rotate(-90deg);
  transform-origin: center;
}

.donut-total {
  fill: var(--night);
  font-size: 6px;
  font-weight: 800;
}

.donut-caption {
  fill: var(--muted);
  font-size: 3.2px;
}

.legend-list,
.people-list,
.alert-list,
.activity-list {
  display: grid;
  gap: 10px;
}

.legend-row,
.person-row,
.activity-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.legend-row span:nth-child(2),
.person-row span:nth-child(2),
.activity-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.line-chart {
  width: 100%;
  height: 210px;
  display: block;
  border-radius: var(--radius-sm);
  background:
    linear-gradient(to bottom, rgba(46, 58, 89, 0.05) 1px, transparent 1px) 0 0 / 100% 25%,
    #fffaf2;
}

.line-path {
  fill: none;
  stroke: var(--gold);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.line-dot {
  fill: var(--surface-strong);
  stroke: var(--gold);
  stroke-width: 3;
}

.chart-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}

.segmented-control {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 2px;
  padding: 3px;
  border-radius: var(--radius-sm);
  background: #efe6d6;
}

.segmented-control a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.segmented-control a.is-active {
  color: var(--night);
  background: var(--surface-strong);
  box-shadow: 0 4px 10px rgba(28, 31, 42, 0.08);
}

.rank-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rank-list li {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.rank-list li > span:nth-child(2) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-number {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gold-soft);
  color: var(--gold);
  font-size: 12px;
  font-weight: 820;
}

.person-row strong,
.rank-list strong,
.legend-row strong {
  white-space: nowrap;
  color: var(--night);
}

.alert-item {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
}

.alert-item span:nth-child(2) {
  min-width: 0;
}

.alert-item button {
  min-height: 30px;
  border: 0;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.68);
  color: inherit;
  font-size: 12px;
  font-weight: 800;
}

.alert-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  font-weight: 900;
}

.alert-warning {
  color: #755317;
  background: #f6eddc;
  border-color: #ead4ae;
}

.alert-info,
.alert-soft {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: #d8deeb;
}

.alert-danger {
  color: var(--red);
  background: var(--red-soft);
  border-color: #efcbc3;
}

.activity-row {
  grid-template-columns: 50px minmax(0, 1fr) minmax(90px, auto);
  min-height: 50px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

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

.activity-row time {
  color: var(--gold);
  font-weight: 800;
}

.activity-row small {
  display: block;
  color: var(--muted);
}

.activity-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  text-align: right;
}

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

.data-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

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

.data-table td:first-child {
  min-width: 210px;
}

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

.row-best {
  background: rgba(231, 241, 235, 0.52);
}

.row-attention {
  background: rgba(247, 231, 227, 0.38);
}

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

.spa-card {
  padding: 20px;
}

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

.spa-icon,
.empty-icon {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  color: var(--night);
  background: var(--gold-soft);
  font-weight: 860;
}

.spa-card h2 {
  margin: 0;
  color: var(--night);
  font-size: 20px;
}

.spa-card p {
  margin: 6px 0 16px;
  color: var(--muted);
}

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

.meta-grid dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.meta-grid dd {
  margin: 3px 0 0;
  color: var(--night);
  font-weight: 720;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 260px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  color: var(--night);
  font-size: 18px;
}

.empty-state.compact {
  min-height: 90px;
  padding: 16px;
}

.empty-row {
  color: var(--muted);
}

.placeholder-panel {
  max-width: 760px;
}

.toast-stack {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 60;
  display: grid;
  gap: 10px;
  max-width: min(380px, calc(100vw - 32px));
}

.toast {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  color: var(--night);
  box-shadow: var(--shadow);
}

.toast-success {
  border-color: #cfe4d6;
  background: var(--green-soft);
  color: var(--green);
}

.toast-error {
  border-color: #efcbc3;
  background: var(--red-soft);
  color: var(--red);
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: max-content;
  max-width: 220px;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--night);
  color: #fff;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity 150ms ease, transform 150ms ease;
}

[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateY(0);
}

.skeleton {
  min-height: 16px;
  border-radius: 6px;
  background: linear-gradient(90deg, #eee5d7 0%, #f8f3ea 50%, #eee5d7 100%);
  background-size: 220% 100%;
  animation: skeleton 1.3s linear infinite;
}

@keyframes skeleton {
  to {
    background-position: -220% 0;
  }
}

.login-body {
  min-height: 100vh;
  background: var(--ivory);
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(460px, 0.95fr);
  min-height: 100vh;
}

.login-visual {
  position: relative;
  display: grid;
  align-items: end;
  padding: 48px;
  overflow: hidden;
  color: #fffaf0;
  background:
    linear-gradient(135deg, rgba(20, 25, 35, 0.7), rgba(20, 25, 35, 0.2)),
    radial-gradient(circle at 30% 20%, rgba(185, 151, 91, 0.38), transparent 34%),
    linear-gradient(145deg, #151923 0%, #31423e 54%, #8d785a 100%);
}

.login-visual::before {
  content: "";
  position: absolute;
  inset: 9%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-lg);
}

.visual-card {
  position: relative;
  max-width: 620px;
  padding: 28px;
  border-radius: var(--radius-md);
  background: rgba(20, 25, 35, 0.42);
  backdrop-filter: blur(20px);
}

.visual-kicker {
  color: #f1d49a;
  font-size: 13px;
  font-weight: 850;
  text-transform: uppercase;
}

.visual-card h1 {
  margin: 12px 0;
  font-size: 42px;
  line-height: 1.08;
}

.visual-card p {
  max-width: 540px;
  color: rgba(255, 250, 240, 0.78);
}

.visual-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 24px;
}

.visual-metrics span {
  min-height: 68px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-sm);
}

.visual-metrics strong {
  display: block;
  font-size: 24px;
}

.login-panel {
  display: grid;
  place-items: center;
  padding: 34px;
  background: #fbf7ef;
}

.login-card {
  width: min(100%, 460px);
  padding: 34px;
  background: var(--surface-strong);
}

.login-logo {
  margin-bottom: 34px;
  color: var(--night);
  font-weight: 850;
}

.login-heading h2 {
  margin: 0;
  color: var(--night);
  font-size: 34px;
  line-height: 1.12;
}

.login-heading p {
  margin: 8px 0 0;
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 18px;
  margin-top: 28px;
}

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

.form-field label {
  color: var(--night);
  font-size: 13px;
  font-weight: 780;
}

.form-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}

.checkbox-input {
  width: 16px;
  height: 16px;
  accent-color: var(--gold);
}

.field-error,
.form-alert {
  color: var(--red);
}

.form-alert {
  margin-top: 18px;
  padding: 12px 14px;
  border: 1px solid #efcbc3;
  border-radius: var(--radius-sm);
  background: var(--red-soft);
}

.form-alert p {
  margin: 0;
}

.error-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, var(--ivory), #eef2ef);
}

.error-card {
  display: grid;
  gap: 14px;
  width: min(100%, 480px);
  padding: 34px;
  text-align: center;
}

.error-code {
  color: var(--gold);
  font-size: 14px;
  font-weight: 900;
}

.error-card h1 {
  margin: 0;
  color: var(--night);
}

.error-card p {
  margin: 0;
  color: var(--muted);
}

.bottom-nav,
.drawer-backdrop {
  display: none;
}

@media (max-width: 1600px) {
  .kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 1280px) {

  .panel,
  .panel-wide {
    grid-column: span 6;
  }

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

  .topbar {
    grid-template-columns: auto minmax(260px, 360px) minmax(220px, 1fr) auto;
    padding: 12px 20px;
  }
}

@media (max-width: 1024px) {
  .app-shell {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .sidebar {
    width: 88px;
  }

  .brand-mark span:last-child,
  .nav-link span:last-child,
  .profile-mini span:last-child,
  .sidebar-footer form {
    display: none;
  }

  .brand-block,
  .sidebar-footer {
    padding: 14px;
  }

  .nav-link {
    justify-content: center;
  }

  .topbar {
    grid-template-columns: minmax(220px, 320px) minmax(220px, 1fr) auto;
  }

  .mobile-menu-button {
    display: none;
  }

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

@media (max-width: 820px) {
  .app-shell {
    display: block;
    min-height: 100vh;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(320px, 88vw);
    transform: translateX(-104%);
    transition: transform 190ms ease;
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }

  body.sidebar-open .drawer-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 25;
    background: rgba(20, 25, 35, 0.38);
  }

  .brand-mark span:last-child,
  .nav-link span:last-child,
  .profile-mini span:last-child,
  .sidebar-footer form {
    display: block;
  }

  .nav-link {
    justify-content: flex-start;
  }

  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    min-height: auto;
    padding: 12px;
  }

  .mobile-menu-button {
    display: inline-grid;
  }

  .topbar-filters {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .global-search {
    min-width: 0;
  }

  .topbar-actions .user-chip {
    display: none;
  }

  .main-content {
    padding: 18px 14px 92px;
  }

  .page-heading {
    display: grid;
    gap: 14px;
  }

  .page-heading h1 {
    font-size: 28px;
  }

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

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

  .panel,
  .panel-wide,
  .panel-full {
    grid-column: 1;
  }

  .bar-chart {
    grid-template-columns: repeat(3, minmax(80px, 1fr));
    overflow-x: auto;
  }

  .donut-wrap {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .comparison-table {
    min-width: 0;
  }

  .comparison-table thead {
    display: none;
  }

  .comparison-table,
  .comparison-table tbody,
  .comparison-table tr,
  .comparison-table td {
    display: block;
    width: 100%;
  }

  .comparison-table tr {
    margin-bottom: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: rgba(255, 253, 248, 0.78);
  }

  .comparison-table tr:last-child {
    margin-bottom: 0;
  }

  .comparison-table td {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    min-width: 0;
    padding: 8px 0;
    border-bottom: 1px solid rgba(230, 223, 211, 0.72);
    white-space: normal;
    text-align: right;
  }

  .comparison-table td:first-child {
    display: grid;
    justify-items: start;
    min-width: 0;
    text-align: left;
  }

  .comparison-table td:last-child {
    border-bottom: 0;
  }

  .comparison-table td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 12px;
    font-weight: 820;
    text-transform: uppercase;
    text-align: left;
  }

  .comparison-table td:first-child::before {
    display: none;
  }

  .bottom-nav {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: rgba(255, 253, 248, 0.94);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
  }

  .bottom-nav a {
    display: grid;
    place-items: center;
    gap: 2px;
    min-height: 48px;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-size: 11px;
    font-weight: 760;
  }

  .bottom-nav a span {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--blue-soft);
    color: var(--blue);
    font-size: 10px;
  }

  .bottom-nav a.is-active {
    color: var(--night);
    background: var(--gold-soft);
  }

  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-visual {
    min-height: 320px;
    padding: 24px;
  }

  .visual-card {
    padding: 22px;
  }

  .visual-card h1 {
    font-size: 31px;
  }

  .login-panel {
    padding: 22px;
  }
}

@media (max-width: 560px) {
  .topbar {
    grid-template-columns: auto 1fr auto;
  }

  .global-search {
    grid-column: 1 / -1;
    grid-row: 3;
  }

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

  .heading-actions,
  .form-row {
    align-items: stretch;
    flex-direction: column;
  }

  .kpi-grid,
  .spa-grid {
    grid-template-columns: 1fr;
  }

  .kpi-card {
    min-height: 124px;
  }

  .bar-chart {
    grid-template-columns: repeat(2, minmax(96px, 1fr));
  }

  .panel {
    padding: 16px;
  }

  .panel-header {
    display: grid;
  }

  .segmented-control {
    grid-auto-flow: row;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .segmented-control a {
    justify-content: center;
  }

  .visual-metrics,
  .meta-grid {
    grid-template-columns: 1fr;
  }

  .login-card {
    padding: 24px;
  }
}
/* Stock workspace */
.stock-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 24px 0 18px; flex-wrap: wrap; }
.stock-heading h1 { font-size: 26px; margin: 0; }
.stock-heading h2 { font-size: 19px; margin: 0; }
.stock-heading p { color: #647067; margin: 8px 0 0; }
.stock-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.stock-button { display: inline-flex; align-items: center; justify-content: center; padding: 11px 16px; border: 1px solid #24634b; border-radius: 6px; background: #24634b; color: white; font: inherit; cursor: pointer; text-decoration: none; }
.stock-button.secondary { background: white; color: #24634b; border-color: #cdd9d1; }
.stock-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-block: 1px solid #dce3de; padding: 22px 0; gap: 16px; }
.stock-summary strong { display: block; font-size: 27px; color: #24634b; }
.stock-summary span { color: #536159; }
.stock-filters { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; margin: 22px 0; }
.stock-filters label, .stock-field { display: grid; gap: 7px; }
.stock-filters input, .stock-filters select, .stock-field input:not([type=checkbox]), .stock-field select { width: 100%; min-width: 0; padding: 11px; border: 1px solid #ccd5ce; border-radius: 5px; font: inherit; background: white; color: #25362b; }
.stock-table-wrap { width: 100%; overflow-x: auto; }
.stock-table { width: 100%; border-collapse: collapse; font-size: 13px; text-align: left; }
.stock-table th { background: #edf2ee; color: #506056; font-weight: 600; }
.stock-table th, .stock-table td { padding: 14px 12px; border-bottom: 1px solid #e1e6e2; vertical-align: middle; overflow-wrap: anywhere; min-width: 100px; }
.stock-table a { color: #24634b; }
.stock-alert { color: #a23738; font-weight: 600; }
.stock-ok { color: #24634b; }
.stock-pages { display: flex; justify-content: end; gap: 16px; margin: 14px 0 32px; }
.stock-form { max-width: 620px; display: grid; gap: 20px; padding-block: 16px; }
.stock-form .errorlist { color: #a23738; margin: 0; padding-left: 20px; }
.stock-form .stock-button { justify-self: start; }
.stock-remove { border: 0; padding: 0; background: none; color: #a23738; cursor: pointer; font: inherit; }
@media(max-width: 600px) { .stock-summary { grid-template-columns: 1fr; gap: 12px; } .stock-summary strong { display: inline; margin-right: 10px; } .stock-heading h1 { font-size: 23px; } .stock-filters label { width: 100%; } }
