:root {
  --app-bg: #eef3f8;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #64748b;
  --line: #dbe4ef;
  --primary: #1f6feb;
  --primary-dark: #174ea6;
  --success: #14805e;
  --warning: #b7791f;
  --danger: #c2413b;
  --sidebar: #10243f;
}

body {
  background: var(--app-bg);
  color: var(--ink);
  font-size: 15px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 278px 1fr;
}

.app-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 18px;
  background: var(--sidebar);
  color: #e9f2ff;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand:hover { color: inherit; }
.brand small { display: block; color: #a8bfd9; font-size: .78rem; font-weight: 500; margin-top: 2px; }
.brand.compact { color: var(--ink); }

.brand-mark {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
  background: #dceafe;
  color: var(--primary-dark);
  font-size: 1.25rem;
}

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

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #c7d7ea;
  padding: 11px 12px;
  border-radius: 10px;
  text-decoration: none;
  font-weight: 600;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: #1b3d68;
  color: #fff;
}

.sidebar-nav i { width: 20px; text-align: center; }
.sidebar-nav.mobile a { color: var(--ink); }
.sidebar-nav.mobile a.active { background: #edf5ff; color: var(--primary-dark); }

.sidebar-card {
  margin-top: auto;
  padding: 16px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 14px;
  background: rgba(255,255,255,.08);
}

.sidebar-card span { color: #9fb8d8; letter-spacing: .08em; }
.sidebar-card strong { display: block; margin: 5px 0; }
.sidebar-card p { color: #c5d5e8; margin: 0; font-size: .88rem; line-height: 1.35; }

.app-main { min-width: 0; }
.content-wrap { max-width: 1640px; margin: 0 auto; padding: 28px; }
.mobile-topbar { display: none; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 20px;
}

.page-title { margin: 0; font-size: 1.65rem; font-weight: 750; letter-spacing: 0; }
.page-subtitle { margin: 6px 0 0; color: var(--muted); max-width: 760px; }

.module-card,
.filters-panel,
.table-module,
.metric,
.field {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .06);
}

.module-card { padding: 18px; }
.module-card h2, .module-card h3 { font-weight: 720; }

.metric {
  padding: 18px;
  min-height: 120px;
  position: relative;
  overflow: hidden;
}

.metric::after {
  content: "";
  position: absolute;
  right: -18px;
  top: -22px;
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: rgba(31, 111, 235, .10);
}

.metric span { display: block; color: var(--muted); font-size: .9rem; font-weight: 650; }
.metric strong { display: block; font-size: 2rem; line-height: 1.15; margin-top: 10px; }
.metric .metric-icon { color: var(--primary); font-size: 1.25rem; }

.field { padding: 12px 14px; min-height: 76px; box-shadow: none; }
.field span { display: block; color: var(--muted); font-size: .75rem; text-transform: uppercase; font-weight: 700; }
.field strong { display: block; font-weight: 650; overflow-wrap: anywhere; margin-top: 4px; }

.form-narrow { max-width: 860px; }
.filters-panel { padding: 16px; margin-bottom: 22px; }
.filters-panel .form-label { font-size: .82rem; color: #52627a; font-weight: 700; }
.filters-panel .form-control,
.filters-panel .form-select,
.form-control,
.form-select {
  border-color: #cfd9e6;
  border-radius: 10px;
}

.btn {
  border-radius: 10px;
  font-weight: 650;
}

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

.table-module { overflow: hidden; }
.table-module .table { margin-bottom: 0; }
.table td, .table th { vertical-align: middle; }
.table thead th {
  color: #52627a;
  background: #f8fafc;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--line);
}

.imports-table {
  overflow-x: auto;
}

.imports-table .table {
  min-width: 1540px;
}

.imports-table th,
.imports-table td {
  white-space: nowrap;
}

.imports-table .imports-file {
  white-space: normal;
  min-width: 280px;
}

.badge-soft {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 9px;
  border-radius: 999px;
  background: #edf5ff;
  color: var(--primary-dark);
  font-weight: 700;
  font-size: .78rem;
}

.action-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar-card { padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }

@media (max-width: 1040px) {
  .app-shell { display: block; }
  .app-sidebar { display: none; }
  .mobile-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
  }
  .content-wrap { padding: 18px; }
  .page-header { flex-direction: column; }
}

@media (max-width: 640px) {
  .content-wrap { padding: 14px; }
  .page-title { font-size: 1.35rem; }
  .metric { min-height: 104px; }
  .action-row .btn { width: 100%; }
}
