:root {
  --bg: #f6f7fb;
  --sidebar: #ffffff;
  --primary: #3563e9;
  --primary-dark: #1d4ed8;
  --primary-soft: #ecf2ff;
  --accent: #16b9c2;
  --card: #ffffff;
  --card-muted: #f8fafc;
  --text: #0f172a;
  --muted: #6b7280;
  --border: #e5e7eb;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --shadow: 0 16px 35px rgba(15, 23, 42, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", sans-serif;
  color: var(--text);
  background: var(--bg);
}

button,
input,
select,
textarea {
  font-family: inherit;
  color: inherit;
}

input::placeholder {
  color: #94a3b8;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(53, 99, 233, 0.08), transparent 45%);
  pointer-events: none;
  z-index: -1;
}

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

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

.sidebar {
  width: 270px;
  background: var(--sidebar);
  color: #111827;
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  position: fixed;
  inset: 0 auto 0 0;
  border-right: 1px solid var(--border);
  z-index: 20;
  transition: width 0.2s ease, transform 0.2s ease;
}

.sidebar-brand {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 8px 12px 20px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), #63b3ff);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 12px 22px rgba(47, 111, 237, 0.35);
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.brand-sub {
  font-size: 12px;
  color: var(--muted);
}

.brand-tag {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.nav-section {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  padding: 10px 14px 6px;
}

.sidebar-nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  color: #475569;
  border: 1px solid transparent;
  transition: 0.2s ease;
}

.nav-item:hover {
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border-color: rgba(53, 99, 233, 0.25);
}

.nav-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: #f1f5f9;
}

.nav-item.active .nav-icon {
  background: var(--primary-soft);
}

.nav-icon svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 12px 0;
}

.upgrade-card {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  display: grid;
  gap: 8px;
}

.upgrade-title {
  font-weight: 600;
  color: var(--text);
}

.upgrade-text {
  font-size: 12px;
  color: var(--muted);
}

.main {
  margin-left: 270px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left 0.2s ease;
}

.topbar {
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--border);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
}

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

.search {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0 12px;
  background: #f8fafc;
  min-width: 280px;
}

.search input {
  border: none;
  background: transparent;
  padding: 12px 6px;
  outline: none;
  width: 100%;
  font-size: 14px;
}

.search-icon svg {
  width: 16px;
  height: 16px;
  fill: #94a3b8;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

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

.store-toggle {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid var(--border);
  box-shadow: 0 10px 18px rgba(15, 23, 42, 0.08);
  cursor: pointer;
}

.store-toggle input {
  display: none;
}

.toggle-track {
  width: 64px;
  height: 34px;
  border-radius: 999px;
  background: #e2e8f0;
  position: relative;
  transition: background 0.2s ease;
}

.toggle-thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 6px 12px rgba(15, 23, 42, 0.15);
  transition: transform 0.2s ease;
}

.store-toggle input:checked + .toggle-track {
  background: rgba(22, 163, 74, 0.25);
}

.store-toggle input:checked + .toggle-track .toggle-thumb {
  transform: translateX(30px);
}

.toggle-label {
  display: grid;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.toggle-off {
  display: none;
}

.store-toggle input:not(:checked) ~ .toggle-label .toggle-on {
  display: none;
}

.store-toggle input:not(:checked) ~ .toggle-label .toggle-off {
  display: inline;
  color: var(--danger);
}

.store-toggle input:checked ~ .toggle-label .toggle-on {
  display: inline;
  color: var(--success);
}

.icon-button {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 12px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  position: relative;
  cursor: pointer;
}

.icon-button svg {
  width: 18px;
  height: 18px;
  fill: #475569;
}

.dot {
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  position: absolute;
  top: 8px;
  right: 10px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-menu {
  position: relative;
}

.user-menu-toggle {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 14px;
  padding: 4px 10px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.user-chevron {
  font-size: 14px;
  color: var(--muted);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 30;
}

.user-dropdown a {
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
}

.user-dropdown a:hover {
  background: #f1f5f9;
}

.user-dropdown a.danger {
  color: var(--danger);
}

.user-menu.open .user-dropdown {
  display: flex;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e2e8f0, #cbd5f5);
  display: grid;
  place-items: center;
  font-weight: 600;
  color: #0f172a;
}

.user-name {
  font-weight: 600;
  font-size: 14px;
}

.user-role {
  font-size: 12px;
  color: var(--muted);
}

.content {
  padding: 24px;
  display: grid;
  gap: 24px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.breadcrumbs .crumb {
  font-weight: 600;
  color: #94a3b8;
}

.page-header h1 {
  margin: 0;
  font-size: 28px;
}

.page-header p {
  margin: 6px 0 0;
  color: var(--muted);
}

.page-actions {
  display: flex;
  gap: 10px;
}

.btn {
  border: 1px solid var(--border);
  background: #fff;
  padding: 10px 16px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 12px 18px rgba(47, 111, 237, 0.25);
}

.btn-ghost {
  background: #fff;
  color: var(--primary);
  border-color: var(--border);
}

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

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

.card-header h3 {
  margin: 0;
}

.card-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.stat-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 14px;
}

.stat-content {
  display: grid;
  gap: 4px;
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
}

.stat-icon svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.stat-title {
  color: var(--muted);
  font-size: 13px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
}

.stat-meta {
  font-size: 12px;
}

.stat-meta.positive {
  color: var(--success);
}

.stat-meta.neutral {
  color: var(--muted);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.chart-card {
  min-height: 280px;
}

.chart-placeholder {
  position: relative;
  height: 190px;
  border-radius: 16px;
  background: linear-gradient(180deg, #eff6ff 0%, #ffffff 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed #c7d2fe;
}

.chart-bars {
  position: absolute;
  inset: 20px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  align-items: flex-end;
}

.chart-bars span {
  background: linear-gradient(180deg, #7dd3fc 0%, #2563eb 100%);
  border-radius: 8px;
}

.chart-lines {
  position: absolute;
  inset: 20px;
  border: 1px dashed rgba(99, 102, 241, 0.35);
  border-radius: 12px;
}

.quick-actions {
  display: grid;
  gap: 12px;
}

.action-tile {
  border: 1px solid var(--border);
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--card-muted);
  text-align: left;
  display: grid;
  gap: 4px;
  transition: 0.2s ease;
}

.action-tile:hover {
  border-color: rgba(47, 111, 237, 0.5);
  box-shadow: 0 12px 24px rgba(47, 111, 237, 0.12);
}

.action-tile span {
  display: block;
  font-weight: 600;
}

.action-tile small {
  color: var(--muted);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  padding-bottom: 12px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.table td {
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.table tr:hover td {
  background: #f8fafc;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: #e2e8f0;
  color: #1e293b;
}

.badge-success {
  background: #dcfce7;
  color: #166534;
}

.badge-warning {
  background: #fef9c3;
  color: #92400e;
}

.badge-danger {
  background: #fee2e2;
  color: #991b1b;
}

.status-list {
  display: grid;
  gap: 16px;
}

.status-item {
  display: grid;
  gap: 8px;
}

.status-title {
  font-size: 14px;
  color: var(--muted);
}

.status-value {
  font-size: 18px;
  font-weight: 700;
}

.progress {
  width: 100%;
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #60a5fa, #2563eb);
}

.legend {
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 6px;
}

.dot-primary { background: #2563eb; }
.dot-secondary { background: #38bdf8; }
.dot-accent { background: #16b9c2; }

.pie-placeholder {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: conic-gradient(#2563eb 0deg 160deg, #38bdf8 160deg 260deg, #16b9c2 260deg 360deg);
}

.form-grid {
  display: grid;
  gap: 14px;
}

.form-grid label {
  display: grid;
  gap: 6px;
  font-size: 14px;
}

.form-grid input {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #f8fafc;
}

.schedule-grid {
  display: grid;
  gap: 12px;
}

.schedule-row {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 12px;
  align-items: center;
}

.schedule-header {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.schedule-day {
  font-weight: 600;
}

.schedule-row input,
.schedule-row select {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #f8fafc;
}

.schedule-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.filter-card {
  display: grid;
  gap: 16px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.filter-grid label {
  display: grid;
  gap: 6px;
  font-size: 13px;
}

.filter-grid input {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #f8fafc;
}

.filter-grid select {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: #f8fafc;
}

.filter-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.tree {
  display: grid;
  gap: 12px;
}

.tree details {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 10px 12px;
}

.tree summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
}

.tree summary::-webkit-details-marker {
  display: none;
}

.tree summary span {
  font-size: 12px;
  color: var(--muted);
}

.tree-product {
  margin-top: 10px;
  padding-left: 6px;
}

.presentation-list {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
}

.presentation-button {
  text-align: left;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #f8fafc;
  cursor: pointer;
  font-weight: 600;
  transition: 0.2s ease;
}

.presentation-button small {
  display: block;
  font-weight: 400;
  color: var(--muted);
  margin-top: 4px;
}

.presentation-button:hover,
.presentation-button.active {
  border-color: rgba(53, 99, 233, 0.35);
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.product-details {
  display: grid;
  gap: 16px;
}

.product-image {
  height: 200px;
  border-radius: 16px;
  background: #f1f5f9;
  border: 1px solid var(--border);
  overflow: hidden;
  display: grid;
  place-items: center;
  color: #94a3b8;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.product-image.has-image img {
  display: block;
}

.product-image.has-image .image-placeholder {
  display: none;
}

.product-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.product-tags span {
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 600;
}

.product-title {
  font-size: 20px;
  font-weight: 700;
}

.product-short {
  color: var(--muted);
}

.product-long {
  background: #f8fafc;
  border-radius: 12px;
  padding: 12px;
  border: 1px dashed #dbeafe;
  color: #475569;
  line-height: 1.5;
}

.line-chart {
  display: grid;
  gap: 12px;
  padding: 12px;
  border-radius: 16px;
  border: 1px dashed #dbeafe;
  background: #f8fafc;
}

.line-chart svg {
  width: 100%;
  height: 140px;
}

.line-path {
  fill: none;
  stroke: var(--primary);
  stroke-width: 3;
}

.line-point {
  fill: #fff;
  stroke: var(--primary);
  stroke-width: 2;
}

.line-labels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

.link {
  color: var(--primary);
  font-weight: 600;
}

.footer {
  padding: 16px 24px 32px;
  color: var(--muted);
  font-size: 12px;
}

.hamburger,
.hamburger::before,
.hamburger::after {
  content: "";
  display: block;
  width: 18px;
  height: 2px;
  background: #475569;
  border-radius: 2px;
  position: relative;
}

.hamburger::before {
  position: absolute;
  top: -6px;
  left: 0;
}

.hamburger::after {
  position: absolute;
  top: 6px;
  left: 0;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
}

body.sidebar-collapsed .sidebar {
  width: 88px;
}

body.sidebar-collapsed .sidebar-brand {
  grid-template-columns: auto;
  justify-content: center;
}

body.sidebar-collapsed .brand-sub,
body.sidebar-collapsed .brand-title,
body.sidebar-collapsed .brand-tag,
body.sidebar-collapsed .nav-section,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .sidebar-footer {
  display: none;
}

body.sidebar-collapsed .nav-item {
  grid-template-columns: auto;
  justify-content: center;
}

body.sidebar-collapsed .main {
  margin-left: 88px;
}

@media (max-width: 1100px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s ease;
  }

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

  .sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .main {
    margin-left: 0;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .topbar-left,
  .topbar-right {
    justify-content: space-between;
  }

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

  .topbar-actions {
    display: none;
  }

  .schedule-row {
    grid-template-columns: 1fr;
  }

  .line-chart svg {
    height: 120px;
  }
}
