:root {
  --bg: #0e1114;
  --surface: #171b20;
  --surface-2: #20262d;
  --surface-3: #2a313a;
  --text: #f6f7f9;
  --muted: #98a3af;
  --border: rgba(255, 255, 255, .11);
  --accent: #f2b33d;
  --accent-2: #52d273;
  --danger: #ff6868;
  --info: #63b3ff;
  --cash: #79df9d;
  --card: #73b7ff;
  --shadow: 0 18px 48px rgba(0, 0, 0, .34);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(760px 520px at 18% -12%, rgba(242, 179, 61, .14), transparent 60%),
    radial-gradient(680px 480px at 96% 3%, rgba(99, 179, 255, .12), transparent 62%),
    linear-gradient(180deg, #11161b, var(--bg));
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.d-none {
  display: none !important;
}

.d-lg-none {
  display: none !important;
}

button,
input,
select {
  font: inherit;
}

button {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  margin: 0;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
  background: rgba(12, 15, 18, .86);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 4px 12px;
  border-bottom: 1px solid var(--border);
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #151515;
  background: linear-gradient(135deg, var(--accent), #ffe39a);
  font-weight: 900;
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.sidebar-footer span,
.metric span,
.metric small,
.panel p,
.mini-card span,
.revenue-card span,
.revenue-card small,
.forecast-card span,
.forecast-card small,
.cash-ledger span,
.payroll-total span,
.payroll-total small {
  color: var(--muted);
}

.nav-list {
  display: grid;
  gap: 8px;
  overflow-y: auto;
  padding-right: 2px;
}

.section-toggle,
.side-item {
  width: 100%;
  display: flex;
  align-items: center;
  border: 1px solid transparent;
  color: var(--muted);
  background: transparent;
  text-align: left;
}

.section-toggle {
  justify-content: space-between;
  padding: 10px 11px;
  border-radius: 10px;
  color: rgba(246, 247, 249, .86) !important;
  background: rgba(255, 255, 255, .035) !important;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}

.section-toggle span,
.side-item span {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.section-toggle .bi-chevron-down {
  transition: transform .16s ease;
}

.section-toggle:not(.active) .bi-chevron-down {
  transform: rotate(-90deg);
}

.section-toggle:hover,
.section-toggle.active {
  background: rgba(255, 255, 255, .075) !important;
  border-color: var(--border) !important;
}

.section-items {
  display: none;
  gap: 5px;
  padding: 0 0 2px 8px;
}

.section-items.open {
  display: grid;
}

.side-item {
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: transparent !important;
  color: var(--muted) !important;
  text-decoration: none;
}

.side-item:hover,
.side-item.active {
  color: var(--text) !important;
  background: rgba(255, 255, 255, .075) !important;
  border-color: var(--border) !important;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, .045);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 0 6px rgba(82, 210, 115, .12);
}

.content {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 84px;
  padding: 16px 24px;
  background: rgba(14, 17, 20, .78);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
}

.topbar-title {
  min-width: 220px;
}

.eyebrow {
  color: var(--accent);
  font-size: .76rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.35rem, 2vw, 1.9rem);
}

h2 {
  font-size: 1.02rem;
}

h3 {
  font-size: .95rem;
}

.topbar-actions,
.button-row,
.date-range {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  border: 1px solid var(--border) !important;
  border-radius: 10px;
  padding: 7px 12px;
  color: var(--text) !important;
  background: rgba(255, 255, 255, .055) !important;
  font-weight: 800;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
}

.btn-sm {
  min-height: 32px;
  padding: 6px 10px;
  font-size: .86rem;
}

.btn-warning {
  color: #17130b !important;
  border-color: rgba(242, 179, 61, .95) !important;
  background: var(--accent) !important;
}

.btn-outline-light {
  color: var(--text) !important;
  border-color: rgba(255, 255, 255, .22) !important;
  background: rgba(255, 255, 255, .05) !important;
}

.filter-shift {
  width: 240px;
}

.date-range span {
  color: var(--muted);
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255, 255, 255, .045);
}

.segmented button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  border: 0 !important;
  border-radius: 9px;
  color: var(--muted) !important;
  background: transparent !important;
  padding: 5px 10px;
  white-space: nowrap;
}

.segmented button.active {
  color: #17130b !important;
  background: var(--accent) !important;
}

.form-control,
.form-select,
.input-group-text {
  color: var(--text);
  background: rgba(255, 255, 255, .06);
  border-color: var(--border);
}

.form-control::placeholder {
  color: rgba(246, 247, 249, .45);
}

.form-control:focus,
.form-select:focus {
  color: var(--text);
  background: rgba(255, 255, 255, .08);
  border-color: rgba(242, 179, 61, .62);
  box-shadow: 0 0 0 .2rem rgba(242, 179, 61, .14);
}

.icon-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  background: rgba(255, 255, 255, .06);
}

.main {
  padding: 24px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.metric,
.panel,
.placeholder-card,
.subpanel,
.revenue-card,
.forecast-card,
.mini-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .065), rgba(255, 255, 255, .032));
  box-shadow: var(--shadow);
}

.metric {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 112px;
  padding: 16px;
}

.metric strong {
  display: block;
  margin: 3px 0;
  font-size: 1.34rem;
}

.metric-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 10px;
  color: #121212;
  background: var(--accent);
}

.metric-icon.tips {
  background: #ff86c8;
  color: #231018;
}

.metric-icon.payroll {
  background: var(--info);
}

.metric-icon.warning {
  background: #ffd166;
}

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

.employees-grid {
  grid-template-columns: minmax(460px, 1.35fr) minmax(340px, .85fr);
}

.employees-grid .span-7,
.employees-grid .span-5 {
  grid-column: auto;
}

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

.span-7 {
  grid-column: span 7;
}

.span-5 {
  grid-column: span 5;
}

.span-4 {
  grid-column: span 4;
}

.panel {
  padding: 18px;
}

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

.badge-soft {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: .8rem;
  font-weight: 800;
  white-space: nowrap;
}

.badge-soft.success {
  color: #a8f3c0;
  background: rgba(82, 210, 115, .12);
}

.badge-soft.danger {
  color: #ffb4b4;
  background: rgba(255, 104, 104, .13);
}

.shift-summary {
  display: grid;
  gap: 14px;
}

.cash-flow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: transparent;
}

.cash-flow div,
.cash-ledger div {
  display: grid;
  gap: 3px;
}

.cash-flow span,
.cash-ledger span,
.employee-row small {
  color: var(--muted);
  font-size: .82rem;
}

.cash-flow strong {
  font-size: 1.12rem;
}

.cash-flow > div {
  min-height: 86px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, .16);
}

.split-grid,
.revenue-layout,
.forecast-grid,
.placeholder-grid {
  display: grid;
  gap: 12px;
}

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

.mini-card,
.revenue-card,
.forecast-card {
  padding: 14px;
}

.mini-card strong,
.revenue-card strong,
.forecast-card strong {
  display: block;
  margin-top: 4px;
  font-size: 1.2rem;
}

.mini-card.danger strong {
  color: var(--danger);
}

.check-list,
.signal-list,
.employee-list,
.shift-timeline,
.data-map,
.product-rank {
  display: grid;
  gap: 10px;
}

.check-list div,
.employee-row,
.timeline-item,
.data-map div,
.product-rank div {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, .045);
}

.check-list div {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
}

.check-list i {
  color: var(--accent-2);
}

.revenue-layout {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.revenue-card.primary {
  grid-column: span 2;
  color: #15120d;
  background: linear-gradient(135deg, var(--accent), #ffe39a);
}

.revenue-card.primary span,
.revenue-card.primary small {
  color: rgba(21, 18, 13, .72);
}

.two-column {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 14px;
}

.subpanel {
  padding: 14px;
}

.hour-bars {
  height: 190px;
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  align-items: end;
  gap: 8px;
  margin-top: 14px;
}

.hour-bars span {
  position: relative;
  display: grid;
  place-items: end center;
  height: var(--h);
  min-height: 28px;
  border-radius: 8px 8px 0 0;
  color: rgba(255, 255, 255, .82);
  background: linear-gradient(180deg, rgba(242, 179, 61, .92), rgba(242, 179, 61, .28));
  font-size: .72rem;
  padding-bottom: 6px;
}

.stacked-line {
  height: 22px;
  display: flex;
  overflow: hidden;
  margin: 20px 0 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
}

.stacked-line span:first-child {
  background: var(--card);
}

.stacked-line span:last-child {
  background: var(--cash);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: .88rem;
}

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

.card-dot {
  background: var(--card);
}

.cash-dot {
  background: var(--cash);
}

.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text);
  --bs-table-border-color: var(--border);
  --bs-table-hover-bg: rgba(255, 255, 255, .055);
  color: var(--text);
}

.table thead th {
  color: var(--muted);
  font-size: .76rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.status {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 800;
}

.status.success {
  color: #a8f3c0;
  background: rgba(82, 210, 115, .14);
}

.status.warning {
  color: #ffe08a;
  background: rgba(242, 179, 61, .16);
}

.employee-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(80px, auto);
  gap: 6px 12px;
  padding: 12px;
}

.employee-row span {
  font-weight: 800;
}

.employee-row small {
  grid-column: 1 / -1;
  overflow-wrap: anywhere;
}

.employee-row span,
.employee-row strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.payroll-total {
  padding: 18px;
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(82, 210, 115, .16), rgba(255, 255, 255, .045));
}

.payroll-total strong {
  display: block;
  margin: 4px 0;
  font-size: 1.8rem;
}

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

.placeholder-grid.compact .placeholder-card {
  min-height: 132px;
}

.placeholder-card {
  display: grid;
  gap: 8px;
  min-height: 150px;
  padding: 18px;
}

.placeholder-card i,
.empty-state i {
  color: var(--accent);
  font-size: 1.6rem;
}

.placeholder-card span,
.empty-state p {
  color: var(--muted);
}

.timeline-item {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 14px;
  padding: 13px;
  border-left: 4px solid var(--info);
}

.timeline-item.ok {
  border-left-color: var(--accent-2);
}

.timeline-item.warn {
  border-left-color: var(--accent);
}

.timeline-item.danger {
  border-left-color: var(--danger);
}

.timeline-item span {
  color: var(--muted);
  font-weight: 800;
}

.timeline-item small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}

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

.cash-ledger div {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, .045);
}

.cash-ledger .total {
  background: linear-gradient(135deg, rgba(242, 179, 61, .18), rgba(255, 255, 255, .05));
}

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

.forecast-card.hot {
  color: #17130b;
  background: linear-gradient(135deg, var(--accent), #ffe39a);
}

.forecast-card.hot span,
.forecast-card.hot small {
  color: rgba(23, 19, 11, .72);
}

.signal-list span {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: rgba(246, 247, 249, .84);
  background: rgba(255, 255, 255, .045);
  font-size: .86rem;
}

.product-rank div {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  overflow: hidden;
  padding: 13px;
}

.product-rank i {
  grid-column: 1 / -1;
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), rgba(242, 179, 61, .22));
}

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

.data-map div {
  padding: 14px;
}

.data-map strong,
.data-map span {
  display: block;
}

.data-map span {
  color: var(--muted);
  margin-top: 4px;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 430px;
  text-align: center;
}

@media (max-width: 1220px) {
  .metrics-grid,
  .forecast-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .span-8,
  .span-7,
  .span-5,
  .span-4 {
    grid-column: 1 / -1;
  }

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

  .employees-grid .span-7,
  .employees-grid .span-5 {
    grid-column: 1 / -1;
  }

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

@media (max-width: 991px) {
  .d-lg-none {
    display: grid !important;
  }

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

  .sidebar {
    position: fixed;
    z-index: 40;
    width: min(88vw, 330px);
    transform: translateX(-105%);
    transition: transform .18s ease;
  }

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

  .topbar {
    align-items: start;
    flex-wrap: wrap;
  }

  .topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .topbar,
  .main {
    padding: 14px;
  }

  .metrics-grid,
  .placeholder-grid,
  .revenue-layout,
  .two-column,
  .data-map,
  .cash-flow,
  .split-grid,
  .cash-ledger {
    grid-template-columns: 1fr;
  }

  .filter-shift,
  .date-range,
  .topbar-actions,
  .topbar-actions .btn,
  .segmented {
    width: 100%;
  }

  .date-range {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
  }

  .segmented button {
    flex: 1;
    justify-content: center;
  }
}
