:root {
  --bg-start: #f6f8fb;
  --bg-end: #edf3ff;
  --surface: #ffffff;
  --primary: #1b66d2;
  --ink: #1c2530;
  --muted: #6b7785;
  --sidebar-width: 280px;
  --sidebar-collapsed-width: 88px;
  --page-accent-rgb: 27, 102, 210;
  --section-form-rgb: 5, 150, 105;
  --section-list-rgb: 3, 105, 161;
  --section-history-rgb: 180, 83, 9;
}

body {
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 0% 0%, #ffffff 0%, var(--bg-start) 45%, var(--bg-end) 100%);
  min-height: 100vh;
  margin: 0;
}

body.has-sidebar {
  overflow-x: hidden;
}

body.page-dashboard {
  --page-accent-rgb: 2, 132, 199;
}

body.page-quotes {
  --page-accent-rgb: 234, 88, 12;
}

body.page-orders {
  --page-accent-rgb: 5, 150, 105;
}

body.page-products {
  --page-accent-rgb: 147, 51, 234;
}

body.page-stock {
  --page-accent-rgb: 13, 148, 136;
}

body.page-finance {
  --page-accent-rgb: 220, 38, 38;
}

body.page-customers {
  --page-accent-rgb: 14, 116, 144;
}

body.page-suppliers {
  --page-accent-rgb: 161, 98, 7;
}

body.page-companies {
  --page-accent-rgb: 71, 85, 105;
}

body.page-users {
  --page-accent-rgb: 37, 99, 235;
}

body.page-auth {
  --page-accent-rgb: 99, 102, 241;
}

body.has-sidebar main.container-fluid {
  background: linear-gradient(
    180deg,
    rgba(var(--page-accent-rgb), 0.07) 0%,
    rgba(var(--page-accent-rgb), 0.02) 120px,
    rgba(255, 255, 255, 0) 280px
  );
  border-radius: 14px;
}

body.has-sidebar main h1.h3,
body.has-sidebar main h1.h4 {
  color: rgb(var(--page-accent-rgb));
}

body.has-sidebar main .card {
  border: 1px solid rgba(var(--page-accent-rgb), 0.16) !important;
  box-shadow: 0 10px 26px rgba(var(--page-accent-rgb), 0.07);
}

body.has-sidebar main .card .card-header {
  background: linear-gradient(
    90deg,
    rgba(var(--page-accent-rgb), 0.16),
    rgba(var(--page-accent-rgb), 0.05)
  ) !important;
  border-bottom: 1px solid rgba(var(--page-accent-rgb), 0.2) !important;
}

body.has-sidebar main .card:has(form) {
  border-left: 4px solid rgba(var(--section-form-rgb), 0.95) !important;
}

body.has-sidebar main .card:has(form) .card-header {
  background: linear-gradient(
    90deg,
    rgba(var(--section-form-rgb), 0.18),
    rgba(var(--section-form-rgb), 0.05)
  ) !important;
  border-bottom: 1px solid rgba(var(--section-form-rgb), 0.25) !important;
}

body.has-sidebar main .card:has(.timeline-list),
body.has-sidebar main .card:has(.list-group) {
  border-left: 4px solid rgba(var(--section-history-rgb), 0.85) !important;
}

body.has-sidebar main .card:has(.timeline-list) .card-header,
body.has-sidebar main .card:has(.list-group) .card-header {
  background: linear-gradient(
    90deg,
    rgba(var(--section-history-rgb), 0.17),
    rgba(var(--section-history-rgb), 0.05)
  ) !important;
  border-bottom: 1px solid rgba(var(--section-history-rgb), 0.25) !important;
}

body.has-sidebar main .card:has(.table-responsive table) {
  border-left: 4px solid rgba(var(--section-list-rgb), 0.95) !important;
}

body.has-sidebar main .card:has(.table-responsive table) .card-header {
  background: linear-gradient(
    90deg,
    rgba(var(--section-list-rgb), 0.18),
    rgba(var(--section-list-rgb), 0.05)
  ) !important;
  border-bottom: 1px solid rgba(var(--section-list-rgb), 0.25) !important;
}

body.has-sidebar main .table thead th {
  background: rgba(var(--page-accent-rgb), 0.12);
  color: #1f3144;
  border-bottom-color: rgba(var(--page-accent-rgb), 0.3);
}

body.has-sidebar main .table tbody tr:not(.table-danger):nth-child(even) {
  background: rgba(var(--page-accent-rgb), 0.04);
}

body.has-sidebar main .badge.text-bg-light {
  background-color: rgba(var(--page-accent-rgb), 0.14) !important;
  color: #1f3750 !important;
  border: 1px solid rgba(var(--page-accent-rgb), 0.28);
}

body.has-sidebar main .metric-card {
  border-color: rgba(var(--page-accent-rgb), 0.24);
}

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

.side-panel {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: linear-gradient(170deg, #0f1f36 0%, #152d4f 50%, #112645 100%);
  color: #eef5ff;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  transition: width 0.25s ease, min-width 0.25s ease;
  z-index: 1040;
}

.side-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 14px 10px;
  position: sticky;
  top: 0;
  z-index: 3;
  background: linear-gradient(170deg, #0f1f36 0%, #152d4f 50%, #112645 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.side-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #f2f7ff;
  text-decoration: none;
  font-weight: 700;
  min-height: 42px;
}

.side-brand-logo {
  display: block;
  width: 170px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.side-brand:hover,
.side-brand:focus {
  color: #ffffff;
}

.side-toggle-btn {
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #eef5ff;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.side-toggle-btn:hover,
.side-toggle-btn:focus {
  background: rgba(255, 255, 255, 0.17);
}

.side-nav {
  flex: 1;
  display: grid;
  gap: 6px;
  padding: 12px 10px;
}

.side-link {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  color: #d6e8ff;
  text-decoration: none;
  border-radius: 11px;
  padding: 10px 12px;
  border: 1px solid transparent;
  font-weight: 600;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.side-short {
  display: none;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #dcecff;
}

.side-link:hover,
.side-link:focus {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.side-link.active {
  color: #ffffff;
  background: rgba(87, 165, 255, 0.25);
  border-color: rgba(156, 207, 255, 0.46);
}

.content-shell {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.content-topbar {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 18px;
  border-bottom: 1px solid #dbe4f1;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(2px);
}

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

.content-topbar-company-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  object-fit: contain;
  background: #ffffff;
  border: 1px solid #d5e2f1;
  padding: 2px;
  box-shadow: 0 2px 8px rgba(20, 39, 60, 0.1);
  flex: 0 0 auto;
}

.content-topbar-company-logo-btn {
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  line-height: 0;
  border-radius: 10px;
  cursor: zoom-in;
}

.content-topbar-company-logo-btn:focus-visible {
  outline: 2px solid #3f83ea;
  outline-offset: 2px;
}

.company-logo-modal-image {
  width: min(90vw, 680px);
  max-height: 78vh;
  object-fit: contain;
  display: inline-block;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid #d7e4f4;
  padding: 8px;
}

.content-topbar-company {
  color: #1e3954;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.01em;
}

.content-topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.content-topbar-user {
  color: #3b4f67;
  font-size: 0.92rem;
  font-weight: 700;
}

.content-topbar-logout {
  font-weight: 700;
  border-color: #a9bdd3;
  color: #27415d;
  background: #ffffff;
}

.content-topbar-logout:hover,
.content-topbar-logout:focus {
  color: #1a3149;
  border-color: #8ea8c3;
  background: #f3f8ff;
}

.mobile-menu-btn {
  display: none;
  border: 1px solid #c8d6e8;
  background: #ffffff;
  color: #33465d;
  border-radius: 10px;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
}

.side-backdrop {
  display: none;
}

body.sidebar-collapsed .side-panel {
  width: var(--sidebar-collapsed-width);
  min-width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .side-label {
  opacity: 0;
  width: 0;
  max-width: 0;
  overflow: hidden;
  pointer-events: none;
  display: inline-block;
}

body.sidebar-collapsed .side-brand {
  justify-content: center;
}

body.sidebar-collapsed .side-link {
  justify-content: center;
  padding-left: 6px;
  padding-right: 6px;
  text-align: center;
}

body.sidebar-collapsed .side-short {
  display: inline-block;
}

body.sidebar-collapsed.sidebar-hover-open .side-panel {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
}

body.sidebar-collapsed.sidebar-hover-open .side-label {
  opacity: 1;
  width: auto;
  max-width: none;
  overflow: visible;
  pointer-events: auto;
  display: inline;
}

body.sidebar-collapsed.sidebar-hover-open .side-short {
  display: none;
}

body.sidebar-collapsed.sidebar-hover-open .side-link {
  justify-content: flex-start;
  padding-left: 12px;
  padding-right: 12px;
  text-align: left;
}

body.sidebar-collapsed .side-brand-logo {
  width: 46px;
}

body.sidebar-collapsed.sidebar-hover-open .side-brand-logo {
  width: 170px;
}

.public-top-nav {
  background: linear-gradient(120deg, #0f1f36, #183a62);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.public-top-nav .navbar-brand,
.public-top-nav .nav-link {
  color: #f2f7ff;
}

.public-brand-logo {
  display: block;
  width: 170px;
  height: auto;
  object-fit: contain;
}

.public-top-nav .nav-link:hover,
.public-top-nav .nav-link:focus {
  color: #ffffff;
}

.auth-login-shell {
  max-width: 1180px;
  margin: 16px auto 0;
}

.auth-login-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 420px);
  gap: 20px;
  align-items: stretch;
}

.auth-intro-card {
  background:
    radial-gradient(circle at 80% 10%, rgba(123, 193, 255, 0.26), rgba(123, 193, 255, 0) 32%),
    linear-gradient(140deg, #0f1f36 0%, #163152 55%, #1b66d2 100%);
  border: 1px solid rgba(117, 181, 255, 0.45) !important;
  color: #eef5ff;
}

.auth-intro-card .text-muted {
  color: #d2e4fb !important;
}

.auth-intro-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: rgba(169, 216, 255, 0.18);
  color: #e9f4ff;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  padding: 6px 12px;
}

.auth-intro-points {
  display: grid;
  gap: 10px;
}

.auth-intro-point {
  display: grid;
  gap: 2px;
  border: 1px solid rgba(164, 208, 255, 0.35);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  padding: 10px 12px;
}

.auth-intro-point strong {
  color: #eef6ff;
  font-size: 0.95rem;
}

.auth-intro-point span {
  color: #d6e7fb;
  font-size: 0.88rem;
}

.auth-form-card {
  min-height: 100%;
}

.auth-help-row {
  display: flex;
  justify-content: flex-end;
}

.auth-forgot-link {
  color: #1b66d2;
  font-weight: 700;
  text-decoration: none;
}

.auth-forgot-link:hover,
.auth-forgot-link:focus {
  color: #124a99;
  text-decoration: underline;
}

.auth-reset-shell {
  max-width: 520px;
  margin: 18px auto 0;
}

.auth-reset-card {
  border: 1px solid #d4e2f4 !important;
}

.company-logo-thumb {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: contain;
  background: #ffffff;
  border: 1px solid #d5e2f1;
  padding: 3px;
  box-shadow: 0 2px 8px rgba(20, 39, 60, 0.08);
}

.product-card {
  overflow: hidden;
}

.product-card-image-wrap {
  height: 132px;
  background: linear-gradient(145deg, #f3f7fc, #eef4fb);
  border-bottom: 1px solid #d9e5f3;
  display: flex;
  align-items: center;
  justify-content: center;
}

.product-card-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.product-card-placeholder {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #dfe8f6;
  color: #4c617b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.product-card-code {
  font-size: 0.8rem;
  color: #4b607a;
  font-weight: 800;
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.product-card-name {
  font-weight: 700;
  color: #20364f;
  line-height: 1.35;
  min-height: 44px;
}

.card {
  border-radius: 14px;
}

.metric-card {
  border-radius: 16px;
  background: var(--surface);
  padding: 18px;
  border: 1px solid #e8edf5;
  box-shadow: 0 8px 20px rgba(13, 43, 79, 0.06);
}

.metric-card.danger {
  background: linear-gradient(120deg, #fff4f4, #ffefef);
}

.metric-card.success {
  background: linear-gradient(120deg, #f3fff5, #ebfff0);
}

.metric-label {
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.metric-value {
  font-size: 1.75rem;
  font-weight: 800;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px dashed #e3e9f2;
}

.summary-row:last-child {
  border-bottom: none;
}

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

.timeline-list li {
  border-left: 3px solid #d7e5fd;
  padding-left: 10px;
}

.timeline-list span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 768px) {
  .metric-value {
    font-size: 1.45rem;
  }
}

@media (max-width: 860px) {
  .auth-login-grid {
    grid-template-columns: 1fr;
  }

  .auth-login-shell {
    max-width: 640px;
    margin-top: 6px;
  }

  body.sidebar-collapsed .side-panel {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
  }

  body.sidebar-collapsed .side-label {
    opacity: 1;
    width: auto;
    max-width: none;
    overflow: visible;
    pointer-events: auto;
    display: inline;
  }

  body.sidebar-collapsed .side-short {
    display: none;
  }

  .side-panel {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    transform: translateX(-105%);
    width: min(86vw, 320px);
    min-width: min(86vw, 320px);
    transition: transform 0.25s ease;
  }

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

  .side-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(11, 21, 33, 0.45);
    border: 0;
    padding: 0;
    display: none;
    z-index: 1030;
  }

  body.sidebar-open .side-backdrop {
    display: block;
  }

  .mobile-menu-btn {
    display: inline-flex;
  }

  .content-topbar-company {
    font-size: 0.86rem;
    max-width: 38vw;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .content-topbar-company-logo {
    width: 30px;
    height: 30px;
    border-radius: 9px;
  }

  .content-topbar-user {
    font-size: 0.84rem;
  }
}
