:root {
  --rail-width: 72px;
  --topbar-height: 88px;
  --dash-bg: #f5f5f5;
  --dash-surface: #ffffff;
  --dash-border: #e5e5e5;
  --dash-text: #262626;
  --dash-muted: #8a8f98;
  --dash-accent: #ff4b1f;
  --dash-accent-dark: #e43f17;
  --dash-accent-soft: #fff0ea;
  --dash-shadow: 0 10px 28px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }

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

body.dashbo-shell {
  background: var(--dash-bg);
  color: var(--dash-text);
  overflow-x: hidden;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--dash-accent-dark); text-decoration: none; }
a:hover { color: var(--dash-accent); }

.dash-rail {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--rail-width);
  height: 100vh;
  background: #fff;
  border-right: 1px solid var(--dash-border);
  z-index: 1040;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px 0;
}

.dash-rail-logo {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--dash-accent), #8c1d09);
  color: #fff !important;
  font-size: 20px;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 22px;
  box-shadow: 0 12px 24px rgba(255, 75, 31, .2);
}

.dash-workspace {
  min-height: 100vh;
  margin-left: var(--rail-width);
  background: var(--dash-bg);
}

.dash-topbar {
  position: sticky;
  top: 0;
  z-index: 1030;
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid var(--dash-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 40px;
}

.dash-topbar-left { min-width: 0; }

.dash-eyebrow {
  color: var(--dash-accent-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.dash-page-title {
  margin: 4px 0 0;
  color: var(--dash-text);
  font-size: clamp(22px, 2vw, 28px);
  font-weight: 850;
  letter-spacing: -.035em;
  line-height: 1.1;
}

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

.dash-search,
.dash-current-user {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 0 13px;
  border: 1px solid var(--dash-border);
  border-radius: 999px;
  background: #fff;
  color: var(--dash-muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.dash-current-user small { color: var(--dash-muted); text-transform: capitalize; }

.dash-content {
  padding: 32px 40px;
  max-width: 1440px;
}

.dash-content > h1:first-child { display: none; }

.dash-rail-nav {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  align-items: center;
}

.dash-rail-bottom {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  align-items: center;
  margin-top: auto;
}

.dash-rail-link {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4b5563;
  text-decoration: none;
  font-size: 20px;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}

.dash-rail-link:hover {
  background: #f4f4f5;
  color: var(--dash-accent);
  transform: translateY(-1px);
}

.dash-rail-link.active {
  background: var(--dash-accent-soft);
  color: var(--dash-accent);
}

.dash-rail-link span,
.dash-rail-link .label,
.sidebar-label,
.nav-label {
  display: none !important;
}

.dash-tabs {
  display: flex;
  align-items: center;
  gap: 24px;
  margin: -32px -40px 32px;
  padding: 0 40px;
  min-height: 54px;
  background: #fff;
  border-bottom: 1px solid var(--dash-border);
  overflow-x: auto;
}

.dash-tab {
  display: inline-flex;
  align-items: center;
  min-height: 54px;
  border-bottom: 2px solid transparent;
  color: var(--dash-muted);
  font-size: 14px;
  font-weight: 750;
  white-space: nowrap;
}

.dash-tab:hover,
.dash-tab.active {
  color: var(--dash-text);
  border-bottom-color: var(--dash-accent);
}

label {
  color: var(--dash-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: 5px;
}

input,
select,
textarea,
.form-control,
.form-select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--dash-border) !important;
  border-radius: 8px !important;
  background: #fff !important;
  color: var(--dash-text) !important;
  font-size: 14px !important;
  box-shadow: none !important;
}

input:focus,
select:focus,
textarea:focus,
.form-control:focus,
.form-select:focus {
  border-color: rgba(255, 75, 31, .5) !important;
  box-shadow: 0 0 0 4px rgba(255, 75, 31, .10) !important;
}

.filter-toolbar {
  background: #fff;
  border: 1px solid var(--dash-border);
  border-radius: 0;
  padding: 18px;
  margin-bottom: 24px;
}

.filter-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: end;
}

.filter-grid > * { min-width: 170px; }
.toolbar-actions, .filter-toolbar p { margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }

.table-shell {
  background: #fff;
  border: 1px solid var(--dash-border);
  overflow: hidden;
}

.data-table {
  width: 100%;
  margin: 0;
}

.data-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #687083;
  font-weight: 700;
  padding: 14px 18px;
  border-bottom: 1px solid var(--dash-border);
}

.data-table td {
  font-size: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid #efefef;
}

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

.table,
.data-table { margin-bottom: 0 !important; }
.table th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #687083 !important; font-weight: 700; padding: 14px 18px !important; border-bottom: 1px solid var(--dash-border) !important; white-space: nowrap; }
.table td { font-size: 14px; padding: 16px 18px !important; border-bottom: 1px solid #efefef !important; vertical-align: middle; white-space: nowrap; }
.table-hover tbody tr:hover > * { background: #fafafa !important; }

.card {
  background: var(--dash-surface);
  border: 1px solid var(--dash-border);
  border-radius: 0;
  box-shadow: none;
  padding: 18px;
  margin-bottom: 24px;
}

.card:has(table) { padding: 0; overflow: hidden; }
.card:has(form.grid) { border-radius: 0; box-shadow: none; }
.grid { display: flex; flex-wrap: wrap; gap: 14px; align-items: end; }
.grid > * { min-width: 170px; }
.cards,
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.cards .card,
.kpi-grid .card { margin-bottom: 0; }
.metric { margin-top: 8px; color: var(--dash-text); font-size: clamp(24px, 3vw, 34px); font-weight: 900; letter-spacing: -.05em; }
.empty-state,
td[colspan] { text-align: center; color: var(--dash-muted) !important; }
.form-text,
small { color: var(--dash-muted); }
.badge { border-radius: 999px; padding: .4em .65em; font-weight: 800; }

.btn {
  border-radius: 8px;
  font-weight: 700;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.btn-primary,
.button-primary,
a.button {
  background: var(--dash-accent) !important;
  border-color: var(--dash-accent) !important;
  color: #fff !important;
  border-radius: 8px;
  font-weight: 700;
}

.btn-primary:hover,
.button-primary:hover,
a.button:hover {
  background: var(--dash-accent-dark) !important;
  border-color: var(--dash-accent-dark) !important;
}

.btn-secondary,
.btn-outline-secondary { background: #fff !important; border-color: var(--dash-border) !important; color: var(--dash-text) !important; }
.btn-sm { min-height: 32px; padding: .25rem .65rem; }

.login-page { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at top left, rgba(255, 75, 31, .10), transparent 34%), var(--dash-bg); }
.login-page .card { width: min(100% - 32px, 430px); padding: 28px; box-shadow: var(--dash-shadow); }
.login-page .btn-primary { width: 100%; }

@media (max-width: 991.98px) {
  .dash-rail {
    display: none;
  }

  .dash-workspace {
    margin-left: 0;
  }

  .dash-topbar {
    height: auto;
    min-height: 72px;
    padding: 16px 20px;
  }

  .dash-topbar-right { display: none; }

  .dash-content {
    padding: 20px;
  }

  .dash-tabs { margin: -20px -20px 20px; padding: 0 20px; }
  .filter-grid,
  .grid { display: grid; grid-template-columns: 1fr; }
  .filter-grid > *,
  .grid > * { min-width: 0; }
}
