:root {
  --blue: #078bbb;
  --blue-dark: #07658e;
  --green: #38b62e;
  --orange: #ff7112;
  --red: #ef2f24;
  --ink: #152b36;
  --muted: #6f818a;
  --page: #f3f7f8;
  --card: #ffffff;
  --line: #e4ecef;
  --sidebar: #0d2835;
  --sidebar-muted: #9fb2bb;
  --shadow: 0 14px 40px rgba(18, 48, 62, .08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body.app-body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: 274px;
  padding: 18px 14px 24px;
  overflow-y: auto;
  color: #fff;
  background:
    radial-gradient(circle at 20% 0%, rgba(7, 139, 187, .22), transparent 35%),
    linear-gradient(180deg, #102f3e 0%, var(--sidebar) 45%, #0a202c 100%);
  border-right: 1px solid rgba(255,255,255,.06);
  transition: transform .28s ease;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 68px;
  padding: 8px 9px 16px;
  border-bottom: 1px solid rgba(255,255,255,.09);
}
.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 13px;
  background: linear-gradient(135deg, var(--blue), var(--green));
  color: #fff;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(0,0,0,.18);
}
.brand-name strong { display: block; font-size: 14px; letter-spacing: .02em; }
.brand-name span { display: block; margin-top: 4px; color: #a9c0ca; font-size: 10px; }
.nav-section { margin-top: 19px; }
.nav-title {
  margin: 0 10px 7px;
  color: #71909e;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  margin: 3px 0;
  padding: 9px 11px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--sidebar-muted);
  font-weight: 600;
  transition: .18s ease;
}
.nav-link:hover { color: #fff; background: rgba(255,255,255,.055); }
.nav-link.active {
  color: #fff;
  background: linear-gradient(115deg, rgba(7,139,187,.94), rgba(56,182,46,.82));
  box-shadow: 0 9px 24px rgba(0, 113, 151, .24);
}
.nav-icon {
  display: grid;
  place-items: center;
  flex: 0 0 25px;
  width: 25px;
  height: 25px;
  border-radius: 8px;
  background: rgba(255,255,255,.07);
}
.nav-link.active .nav-icon { background: rgba(255,255,255,.18); }
.nav-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidebar-footer {
  margin: 24px 4px 0;
  padding: 13px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  background: rgba(255,255,255,.035);
}
.sidebar-footer small { display: block; color: #7f9aa7; font-size: 11px; }
.sidebar-footer strong { display: block; margin-top: 5px; color: #d9e8ed; font-size: 12px; }

.main { min-height: 100vh; margin-left: 274px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 76px;
  padding: 0 28px;
  border-bottom: 1px solid rgba(213,225,230,.85);
  background: rgba(243,247,248,.89);
  backdrop-filter: blur(16px);
}
.menu-toggle {
  display: none;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: #fff;
}
.breadcrumb { display: flex; align-items: center; gap: 8px; color: #82939b; font-size: 11px; }
.breadcrumb a { color: var(--blue-dark); font-weight: 750; }
.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.profile-wrap { position: relative; }
.profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: 12px;
  cursor: pointer;
  border: 1px solid transparent;
}
.profile:hover { background: #fff; border-color: var(--line); }
.avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), var(--green));
  font-size: 12px;
  font-weight: 800;
}
.profile-text strong, .profile-text span { display: block; }
.profile-text strong { font-size: 12px; }
.profile-text span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.user-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 54px;
  width: 240px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 12px 30px rgba(0,0,0,.12);
  padding: 8px;
  z-index: 50;
}
.user-menu.show { display: block; }
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 9px;
  background: none;
  font-size: 12px;
  color: var(--ink);
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.user-menu-item:hover { background: var(--page); color: var(--blue); }
.user-menu-item.danger { color: var(--red); }
.user-menu-divider { height: 1px; background: var(--line); margin: 6px 0; }
.content { max-width: 1600px; margin: 0 auto; padding: 28px; }
.overlay {
  position: fixed;
  inset: 0;
  z-index: 35;
  visibility: hidden;
  opacity: 0;
  background: rgba(4,22,31,.48);
  transition: .25s ease;
}
.overlay.show { visibility: visible; opacity: 1; }

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}
.eyebrow {
  margin: 0 0 7px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.page-heading h1 { margin: 0; font-size: clamp(24px, 2.3vw, 32px); letter-spacing: -.03em; }
.page-heading p:not(.eyebrow) { max-width: 680px; margin: 8px 0 0; color: var(--muted); line-height: 1.55; }
.heading-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 800;
  transition: .18s ease;
  white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.btn-primary {
  color: #fff;
  background: linear-gradient(115deg, var(--blue), #149aab 57%, var(--green));
  box-shadow: 0 9px 20px rgba(7,139,187,.18);
}
.btn-primary:hover { transform: translateY(-1px); }
.btn-secondary { color: #49616c; background: #fff; border-color: var(--line); }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.kpi-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 148px;
  padding: 18px 20px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: radial-gradient(circle at 100% 0%, var(--tone-soft), transparent 55%), var(--card);
  box-shadow: var(--shadow);
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.kpi-label { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.kpi-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: var(--tone);
  background: var(--tone-bg);
}
.kpi-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.kpi-value { font-size: clamp(23px, 2.3vw, 29px); font-weight: 850; letter-spacing: -.03em; margin-top: 8px; }
.kpi-meta { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--muted); font-size: 11px; }
.trend {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 800;
  color: #1c8834;
  background: #eaf8ec;
}
.trend.warn { color: #b46010; background: #fff3e5; }

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 20px;
  margin-bottom: 22px;
}
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 19px 20px 14px;
}
.card-title { display: flex; align-items: center; gap: 11px; }
.title-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: var(--blue);
  background: #e8f7fb;
}
.title-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; }
.card-title h2 { margin: 0; font-size: 15px; letter-spacing: -.02em; }
.card-title p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.pipeline { padding: 4px 20px 20px; display: flex; flex-direction: column; gap: 14px; }
.pipeline-item { display: flex; flex-direction: column; gap: 6px; }
.pipeline-row { display: flex; justify-content: space-between; font-size: 11px; }
.pipeline-row strong { color: #3c525d; }
.pipeline-row span { color: var(--muted); font-weight: 700; }
.pipeline-bar { height: 9px; border-radius: 99px; background: #edf3f5; overflow: hidden; }
.pipeline-bar span { display: block; height: 100%; border-radius: 99px; width: var(--width); background: var(--color); }
.alerts { padding: 4px 18px 18px; display: flex; flex-direction: column; gap: 11px; }
.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  border: 1px solid #eef4f6;
  border-radius: 13px;
  background: #fafcfd;
}
.alert-icon {
  display: grid;
  place-items: center;
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  color: var(--color);
  background: var(--bg);
}
.alert-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.alert-copy { min-width: 0; flex: 1; }
.alert-copy strong { display: block; font-size: 11px; color: var(--ink); }
.alert-copy p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.alert-copy time { display: block; margin-top: 4px; color: #9bb0ba; font-size: 9px; }

.table-wrap { overflow-x: auto; padding: 0 12px 14px; }
.dash-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.dash-table th {
  padding: 10px 12px;
  color: #81939c;
  background: #f8fafb;
  font-size: 9px;
  letter-spacing: .075em;
  text-align: left;
  text-transform: uppercase;
}
.dash-table td {
  padding: 12px;
  border-bottom: 1px solid #edf2f4;
  color: #506671;
  font-size: 12px;
  vertical-align: middle;
}
.dash-table tr:last-child td { border-bottom: 0; }
.dash-table tbody tr:hover td { background: #f6fafc; }
.code-pill {
  display: inline-block;
  padding: 3px 7px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 600;
  color: #174253;
  background: #edf5f8;
  border: 1px solid #dae8ed;
  border-radius: 6px;
}
.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: 99px;
  font-size: 9px;
  font-weight: 800;
  white-space: nowrap;
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.green { color: #238d34; background: #eaf8ec; }
.status.orange { color: #b46010; background: #fff3e5; }
.status.red { color: #bf3e36; background: #fff0ee; }
.status.blue { color: #0879a5; background: #e6f6fb; }
.status.gray { color: #657982; background: #eef2f3; }
.mini-progress { display: flex; align-items: center; gap: 8px; width: 110px; }
.progress { height: 6px; border-radius: 99px; background: #e8eff2; overflow: hidden; flex: 1; }
.progress span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--blue), var(--green)); }
.mini-progress em { font-style: normal; font-size: 10px; font-weight: 800; color: #435b66; width: 28px; }

@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-105%); box-shadow: 18px 0 45px rgba(3,21,30,.23); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-toggle { display: grid; }
  .topbar { padding: 0 20px; }
  .content { padding: 24px 20px; }
}
@media (max-width: 640px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .page-heading { flex-direction: column; align-items: flex-start; }
  .profile-text { display: none; }
  .content { padding: 20px 14px; }
}
