/* =========================================================================
   Завод CRM — design system
   Token-driven re-theme of Bootstrap 5.3 (which already exposes its palette
   as CSS custom properties) plus the app shell: sidebar + topbar + content.
   ========================================================================= */

:root {
  --brand: #2563EB;
  --brand-dark: #1D4ED8;
  --brand-rgb: 37, 99, 235;
  --accent: #F97316;

  --surface: #FFFFFF;
  --canvas: #F5F7FB;
  --border: #E7EAF0;
  --border-strong: #D6DBE5;

  --ink: #172033;
  --ink-muted: #667085;
  --ink-faint: #98A2B3;

  --sidebar-bg: #111827;
  --sidebar-bg-hover: #1F2937;
  --sidebar-bg-active: #263449;
  --sidebar-text: #B8C1D1;
  --sidebar-text-active: #FFFFFF;
  --sidebar-heading: #738099;
  --sidebar-width: 272px;
  --topbar-height: 72px;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04), 0 6px 18px rgba(16, 24, 40, 0.03);
  --shadow-md: 0 14px 40px rgba(16, 24, 40, 0.12);
}

/* Re-theme Bootstrap's own tokens so every stock component (buttons, links,
   form focus rings, badges, pagination) inherits the brand without needing
   per-component overrides. */
[data-bs-theme="light"],
:root {
  --bs-primary: var(--brand);
  --bs-primary-rgb: var(--brand-rgb);
  --bs-link-color: var(--brand);
  --bs-link-color-rgb: var(--brand-rgb);
  --bs-link-hover-color: var(--brand-dark);
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--canvas);
  --bs-border-color: var(--border);
  --bs-secondary-color: var(--ink-muted);
  --bs-font-sans-serif: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html, body {
  height: 100%;
}

body {
  background-color: var(--canvas);
  color: var(--ink);
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

a {
  text-decoration: none;
}

/* ---------------------------------------------------------------------
   App shell
   --------------------------------------------------------------------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

@media (min-width: 992px) {
  .sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
  }
}

.sidebar.offcanvas-lg {
  --bs-offcanvas-width: var(--sidebar-width);
  --bs-offcanvas-bg: var(--sidebar-bg);
  --bs-offcanvas-color: var(--sidebar-text);
  border: none;
  background-color: var(--sidebar-bg) !important;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1.2rem 1.15rem 1.25rem;
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}

.sidebar-brand .brand-mark {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.sidebar-brand .brand-mark img {
  height: 38px;
  width: auto;
}

.auth-logo {
  height: 88px;
  width: auto;
  max-width: 100%;
}

.auth-wordmark {
  color: #14183A;
  font-weight: 800;
  font-size: 1.9rem;
  letter-spacing: -0.02em;
}

.sidebar-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 0.75rem 1rem;
}

.sidebar-group + .sidebar-group {
  margin-top: 1.1rem;
}

.sidebar-group-title {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--sidebar-heading);
  padding: 0 0.6rem 0.4rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.3;
  position: relative;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.sidebar-link i {
  font-size: 1.02rem;
  width: 1.1rem;
  text-align: center;
  flex-shrink: 0;
  opacity: 0.85;
}

.sidebar-link:hover {
  background: var(--sidebar-bg-hover);
  color: #fff;
}

.sidebar-link.active {
  background: var(--sidebar-bg-active);
  color: var(--sidebar-text-active);
}

.sidebar-link.active i {
  opacity: 1;
}

.sidebar-link.active::before {
  content: "";
  position: absolute;
  left: -0.75rem;
  top: 0.3rem;
  bottom: 0.3rem;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
}

.sidebar-footer {
  padding: 1rem 1.1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.72rem;
  color: var(--sidebar-text);
  flex-shrink: 0;
}

.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-height);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-toggle {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-muted);
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.3rem 0.5rem 0.3rem 0.3rem;
  border-radius: 999px;
  color: var(--ink);
}

.topbar-user:hover {
  background: var(--canvas);
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #6C8CFF);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.topbar-user-meta {
  line-height: 1.15;
  text-align: left;
}

.topbar-user-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}

.topbar-user-role {
  font-size: 0.72rem;
  color: var(--ink-muted);
  text-transform: capitalize;
}

.content-area {
  padding: 2rem clamp(1.25rem, 3vw, 3rem) 3.5rem;
  flex: 1;
  width: 100%;
  max-width: 1680px;
  margin: 0 auto;
}

.auth-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background:
    radial-gradient(circle at 15% 20%, rgba(var(--brand-rgb), 0.16), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(242, 153, 74, 0.14), transparent 40%),
    var(--sidebar-bg);
  padding: 1.5rem;
}

.shadow-md {
  box-shadow: var(--shadow-md) !important;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  border: none;
}

.auth-shell .alert {
  width: 100%;
  max-width: 380px;
}

/* ---------------------------------------------------------------------
   Components
   --------------------------------------------------------------------- */

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-body h6 {
  font-weight: 700;
}

h3.page-title, h3 {
  letter-spacing: -0.01em;
}

.stat-card .card-body {
  padding: 1.15rem 1.25rem;
}

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

.stat-card .stat-icon {
  position: absolute;
  right: 1rem;
  top: 1rem;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  background: rgba(var(--brand-rgb), 0.1);
  color: var(--brand);
}

.stat-card .stat-value {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.stat-card .stat-label {
  color: var(--ink-muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.15rem;
}

.table-low-stock {
  background-color: #fff3cd !important;
}

.badge-status {
  font-size: 0.78rem;
}

.badge {
  font-weight: 600;
  letter-spacing: 0.01em;
  padding-top: 0.42em;
  padding-bottom: 0.42em;
}

.table {
  --bs-table-border-color: var(--border);
  font-size: 0.92rem;
}

.table > thead {
  background: var(--canvas);
}

.table > thead th {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--border);
  padding-top: 0.7rem;
  padding-bottom: 0.7rem;
}

.table-hover > tbody > tr:hover > * {
  background-color: rgba(var(--brand-rgb), 0.045);
}

.list-group-item {
  border-color: var(--border);
}

.list-group-item.disabled, .list-group-item:disabled {
  background-color: transparent;
}

.card > .list-group-flush:last-child .list-group-item:last-child,
.card > .table-responsive:last-child {
  border-bottom-right-radius: var(--radius);
  border-bottom-left-radius: var(--radius);
}

.btn {
  font-weight: 600;
  border-radius: var(--radius-sm);
}

.btn-sm {
  border-radius: 7px;
}

.btn-primary {
  --bs-btn-bg: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: var(--brand-dark);
  --bs-btn-hover-border-color: var(--brand-dark);
  --bs-btn-active-bg: var(--brand-dark);
  --bs-btn-active-border-color: var(--brand-dark);
  box-shadow: 0 1px 2px rgba(var(--brand-rgb), 0.35);
}

.form-control, .form-select {
  border-color: var(--border-strong);
}

.form-control:focus, .form-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 0.2rem rgba(var(--brand-rgb), 0.15);
}

.form-label {
  font-weight: 600;
  font-size: 0.86rem;
  color: var(--ink);
}

.nav-pills .nav-link {
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-muted);
  padding: 0.35rem 0.9rem;
}

.nav-pills .nav-link.active {
  background-color: var(--brand);
}

.alert {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
}

.pagination .page-link {
  border-color: var(--border);
  color: var(--ink);
}

.pagination .page-item.active .page-link {
  background-color: var(--brand);
  border-color: var(--brand);
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  background: rgba(20, 24, 51, 0.18);
  border-radius: 999px;
}

.sidebar ::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
}

/* =========================================================================
   Product UI refresh — dense operational data, calm visual hierarchy
   ========================================================================= */

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  margin-top: 0.28rem;
  color: #8290a8;
  font-size: 0.61rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sidebar::before {
  content: "";
  height: 4px;
  background: linear-gradient(90deg, #ed1577 0 25%, #168eea 25% 50%, #98d51b 50% 75%, #ff7a18 75%);
  flex: 0 0 auto;
}

.sidebar-link {
  padding: 0.62rem 0.72rem;
  border: 1px solid transparent;
}

.sidebar-link.active {
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.sidebar-link.active::before {
  left: -0.82rem;
  width: 4px;
  background: #60a5fa;
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.sidebar-footer span:last-child {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
}

.sidebar-footer strong {
  color: #e5e7eb;
  font-size: 0.74rem;
  font-weight: 650;
}

.sidebar-footer small {
  color: #738099;
  font-size: 0.64rem;
}

.system-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.12);
  flex: 0 0 auto;
}

.topbar {
  box-shadow: 0 1px 0 rgba(16, 24, 40, 0.02);
  backdrop-filter: blur(14px);
  background: rgba(255, 255, 255, 0.92);
}

.topbar-context {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.topbar-kicker {
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.topbar-caption {
  margin-top: 0.12rem;
  color: var(--ink-muted);
  font-size: 0.72rem;
}

.topbar-user {
  border: 1px solid transparent !important;
}

.topbar-user:hover,
.topbar-user:focus-visible {
  background: #f8fafc;
  border-color: var(--border) !important;
}

.avatar {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  box-shadow: 0 5px 16px rgba(37, 99, 235, 0.22);
}

.page-header,
.dashboard-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.page-heading {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.page-heading-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  flex: 0 0 auto;
  border-radius: 15px;
  color: #1d4ed8;
  background: linear-gradient(145deg, #eff6ff, #dbeafe);
  border: 1px solid #dbeafe;
  font-size: 1.25rem;
}

.page-eyebrow,
.panel-kicker {
  color: #7c879e;
  font-size: 0.67rem;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.dashboard-hero .page-eyebrow {
  display: flex;
  align-items: center;
  gap: 0.48rem;
  color: #2563eb;
}

.dashboard-hero .page-eyebrow span {
  width: 22px;
  height: 2px;
  border-radius: 99px;
  background: #2563eb;
}

h1.page-title,
.page-title {
  margin: 0.18rem 0 0;
  color: var(--ink);
  font-size: clamp(1.55rem, 2.5vw, 2.15rem);
  font-weight: 780;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.page-subtitle {
  margin: 0.35rem 0 0;
  color: var(--ink-muted);
  font-size: 0.9rem;
}

.page-actions,
.dashboard-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  padding-left: 0.9rem;
  padding-right: 0.9rem;
}

.btn-light {
  --bs-btn-bg: #fff;
  --bs-btn-border-color: var(--border);
  --bs-btn-hover-bg: #f8fafc;
  --bs-btn-hover-border-color: #d7dce6;
  color: #344054;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.03);
}

.list-toolbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.55rem 0.75rem 0.8rem;
}

.list-summary {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  color: var(--ink-muted);
  font-size: 0.78rem;
}

.list-summary strong {
  color: var(--ink);
  font-size: 1.05rem;
}

.table-search {
  width: min(300px, 100%);
  position: relative;
}

.table-search i {
  position: absolute;
  left: 0.78rem;
  top: 50%;
  z-index: 2;
  color: #98a2b3;
  transform: translateY(-50%);
  pointer-events: none;
}

.table-search .form-control {
  min-height: 40px;
  padding-left: 2.25rem;
  border-radius: 11px;
  background: #fff;
  font-size: 0.84rem;
}

.data-card,
.dashboard-panel {
  border: 1px solid rgba(226, 232, 240, 0.9);
  background: #fff;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.data-card .table > :not(caption) > * > * {
  padding: 0.92rem 1rem;
}

.data-card .table > thead {
  background: #f8fafc;
}

.data-card .table > thead th {
  white-space: nowrap;
  color: #7c879e;
  border-top: 0;
}

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

.data-card tr[data-filter-row] {
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.entity-cell {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  color: var(--ink);
}

.entity-cell:hover {
  color: var(--brand);
}

.entity-cell > span:last-child {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.entity-cell strong {
  font-size: 0.9rem;
  font-weight: 680;
  line-height: 1.25;
}

.entity-cell small {
  margin-top: 0.2rem;
  color: #98a2b3;
  font-size: 0.68rem;
}

.entity-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 10px;
  color: #2563eb;
  background: #eff6ff;
  font-size: 0.78rem;
  font-weight: 750;
}

.entity-avatar-warn {
  color: #b45309;
  background: #fff7ed;
}

.soft-badge,
.status-badge,
.status-pill,
.panel-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.soft-badge {
  padding: 0.45rem 0.62rem;
  color: #475467;
  background: #f2f4f7;
}

.status-badge {
  padding: 0.46rem 0.64rem;
}

.status-success {
  color: #067647;
  background: #ecfdf3;
}

.status-neutral {
  color: #667085;
  background: #f2f4f7;
}

.missing-value {
  color: #98a2b3;
  font-size: 0.78rem;
}

.data-value {
  color: #344054;
  font-weight: 650;
  white-space: nowrap;
}

.data-value small {
  color: #98a2b3;
  font-weight: 550;
}

.is-attention td:first-child {
  box-shadow: inset 3px 0 #f59e0b;
}

.table-actions {
  white-space: nowrap;
}

.btn-soft-success {
  color: #067647;
  background: #ecfdf3;
  border-color: #d1fadf;
}

.btn-soft-success:hover {
  color: #05603a;
  background: #dcfae6;
  border-color: #a6f4c5;
}

.btn-icon {
  width: 34px;
  min-height: 34px;
  padding: 0;
  color: #667085;
  background: #fff;
  border: 1px solid var(--border);
}

.btn-icon:hover {
  color: var(--brand);
  background: #f8fafc;
  border-color: #cfd6e2;
}

.btn-icon-danger:hover {
  color: #d92d20;
  background: #fef3f2;
  border-color: #fecdca;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.9rem;
}

.metric-card {
  position: relative;
  min-width: 0;
  overflow: hidden;
  padding: 1.12rem 1.15rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.metric-card-link {
  color: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.metric-card-link:hover {
  color: inherit;
  border-color: color-mix(in srgb, var(--metric-color) 34%, var(--border));
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.1);
  transform: translateY(-2px);
}

.metric-card-link:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--metric-color) 28%, transparent);
  outline-offset: 3px;
}

.metric-card-link:active {
  transform: translateY(0);
}

.metric-card::after {
  content: "";
  position: absolute;
  top: -38px;
  right: -38px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--metric-soft);
}

.metric-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #667085;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.metric-topline i {
  position: relative;
  z-index: 1;
  color: var(--metric-color);
  font-size: 1rem;
  transition: transform 160ms ease;
}

.metric-card-link:hover .metric-topline i,
.metric-card-link:focus-visible .metric-topline i {
  transform: scale(1.12);
}

.metric-value {
  margin-top: 0.7rem;
  overflow: hidden;
  color: #101828;
  font-size: 1.85rem;
  font-weight: 780;
  letter-spacing: -0.045em;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-value small {
  color: #667085;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0;
}

.metric-money {
  font-size: clamp(1.15rem, 1.55vw, 1.62rem);
}

.metric-caption {
  margin-top: 0.42rem;
  color: #98a2b3;
  font-size: 0.7rem;
}

.metric-blue { --metric-color: #2563eb; --metric-soft: #eff6ff; }
.metric-green { --metric-color: #079455; --metric-soft: #ecfdf3; }
.metric-amber { --metric-color: #d97706; --metric-soft: #fff7ed; }
.metric-red { --metric-color: #d92d20; --metric-soft: #fef3f2; }
.metric-violet { --metric-color: #7c3aed; --metric-soft: #f5f3ff; }

.card-header-clean {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.15rem 1.25rem 1rem;
}

.panel-title {
  margin: 0.18rem 0 0;
  color: #172033;
  font-size: 1rem;
  font-weight: 740;
  letter-spacing: -0.015em;
}

.panel-chip {
  padding: 0.45rem 0.62rem;
  color: #067647;
  background: #ecfdf3;
}

.panel-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: #667085;
  font-size: 0.74rem;
  font-weight: 650;
  white-space: nowrap;
}

.panel-link:hover {
  color: var(--brand);
}

.chart-wrap {
  height: 220px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(310px, 0.9fr);
  gap: 1rem;
}

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

.activity-list {
  border-top: 1px solid #f0f2f5;
}

.activity-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.75rem;
  min-height: 66px;
  padding: 0.75rem 1.25rem;
  color: var(--ink);
  border-bottom: 1px solid #f0f2f5;
  transition: background-color 0.15s ease;
}

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

.activity-row:hover {
  color: var(--ink);
  background: #f8fafc;
}

.activity-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  color: var(--tone);
  background: var(--tone-soft);
}

.tone-blue { --tone: #2563eb; --tone-soft: #eff6ff; }
.tone-green { --tone: #079455; --tone-soft: #ecfdf3; }
.tone-amber { --tone: #d97706; --tone-soft: #fff7ed; }
.tone-red { --tone: #d92d20; --tone-soft: #fef3f2; }
.tone-violet { --tone: #7c3aed; --tone-soft: #f5f3ff; }

.activity-main,
.activity-meta {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.activity-main strong {
  overflow: hidden;
  font-size: 0.82rem;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-main small,
.activity-meta small {
  margin-top: 0.17rem;
  color: #98a2b3;
  font-size: 0.67rem;
}

.activity-meta {
  align-items: flex-end;
  text-align: right;
}

.activity-meta strong {
  font-size: 0.78rem;
  font-weight: 720;
  white-space: nowrap;
}

.status-pill {
  margin-bottom: 0.22rem;
  padding: 0.34rem 0.5rem;
  color: #475467;
  background: #f2f4f7;
}

.empty-state {
  display: flex;
  min-height: 120px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0.55rem;
  color: #98a2b3;
  font-size: 0.78rem;
  text-align: center;
}

.empty-state i {
  font-size: 1.5rem;
}

.empty-state.positive i {
  color: #12b76a;
}

.filter-empty-row td {
  padding: 0 !important;
}

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

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

@media (max-width: 991.98px) {
  .content-area {
    padding-top: 1.5rem;
  }

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

@media (max-width: 767.98px) {
  .topbar {
    height: 64px;
    padding: 0 0.85rem;
  }

  .content-area {
    padding: 1.15rem 0.85rem 2.5rem;
  }

  .page-header,
  .dashboard-hero {
    align-items: stretch;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.15rem;
  }

  .page-heading {
    align-items: flex-start;
  }

  .page-heading-icon {
    width: 43px;
    height: 43px;
    border-radius: 13px;
  }

  .page-actions,
  .dashboard-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .page-actions .btn:only-child,
  .dashboard-actions .btn:only-child {
    grid-column: 1 / -1;
  }

  .list-toolbar {
    align-items: stretch;
    flex-direction: column;
    padding: 0 0 0.8rem;
  }

  .table-search {
    width: 100%;
  }

  .metric-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.7rem;
  }

  .metric-card {
    padding: 0.95rem;
  }

  .metric-value {
    font-size: 1.55rem;
  }

  .metric-money {
    font-size: 1.05rem;
  }

  .card-header-clean {
    padding: 1rem;
  }

  .panel-chip {
    display: none;
  }

  .chart-wrap {
    height: 190px;
  }

  .activity-row {
    grid-template-columns: 36px minmax(0, 1fr) auto;
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .data-card {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .data-card .table-responsive {
    overflow: visible;
  }

  .mobile-card-table,
  .mobile-card-table tbody {
    display: block;
    width: 100%;
  }

  .mobile-card-table thead {
    display: none;
  }

  .mobile-card-table tr[data-filter-row] {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    margin-bottom: 0.75rem;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 15px;
    background: #fff;
    box-shadow: var(--shadow-sm);
  }

  .mobile-card-table td {
    display: flex;
    min-width: 0;
    align-items: flex-start;
    justify-content: space-between;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.8rem 0.9rem !important;
    text-align: left !important;
    border: 0;
    border-top: 1px solid #f0f2f5;
  }

  .mobile-card-table td::before {
    content: attr(data-label);
    color: #98a2b3;
    font-size: 0.62rem;
    font-weight: 750;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .mobile-card-table td:first-child {
    grid-column: 1 / -1;
    border-top: 0;
    box-shadow: none;
  }

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

  .mobile-card-table td:last-child {
    grid-column: 1 / -1;
  }

  .mobile-card-table td.mobile-span-full {
    grid-column: 1 / -1;
  }

  .mobile-card-table .table-actions {
    grid-column: 1 / -1;
    align-items: center;
    flex-direction: row;
    flex-wrap: wrap;
  }

  .mobile-card-table .table-actions::before {
    width: 100%;
  }

  .mobile-card-table .filter-empty-row {
    display: block;
  }

  .mobile-card-table .filter-empty-row td {
    display: block;
  }
}

@media (max-width: 430px) {
  .metric-grid {
    grid-template-columns: 1fr;
  }

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

  .activity-row {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .activity-meta {
    grid-column: 2;
    align-items: flex-start;
    text-align: left;
  }
}
