:root {
  --blue-700: #253fb8;
  --blue-600: #3350d4;
  --blue-100: #eaf0ff;
  --section-gap: 18px;
  --bg: #edf1f8;
  --surface: #ffffff;
  --surface-soft: #f7f9fe;
  --text: #1e2746;
  --muted: #6e7898;
  --border: #dfe5f2;
  --success: #2fbf71;
  --danger: #e34d4d;
  --warning: #e2a72f;
  --shadow: 0 12px 36px rgba(37, 63, 184, 0.08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background: linear-gradient(180deg, #eef2fb 0%, #e8edf8 100%);
  color: var(--text);
}

button, select, input { font: inherit; }

.layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  min-width: 0;
  align-items: start;
}

.sidebar {
  background: linear-gradient(180deg, #233aa6 0%, #24388d 100%);
  color: #fff;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand { display: flex; gap: 14px; align-items: center; }
.brand__mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.16);
  font-size: 22px;
  font-weight: 700;
}
.brand__title { font-size: 22px; font-weight: 700; }
.brand__subtitle { font-size: 13px; opacity: 0.72; }
.sidebar__section-label {
  margin-top: 4px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.58);
}

.nav { display: grid; gap: 10px; }
.nav__item {
  border: 0;
  border-radius: 14px;
  padding: 14px 16px;
  text-align: left;
  background: transparent;
  color: rgba(255, 255, 255, 0.84);
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}
.nav__item--active,
.nav__item[aria-current="page"],
.nav__item:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.nav__item:active {
  transform: translateY(1px);
}
.sidebar__footer {
  margin-top: auto;
  display: grid;
  gap: 12px;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  font-size: 13px;
}

.sidebar__top-button {
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 14px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  text-align: left;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.sidebar__top-button:hover,
.sidebar__top-button:focus-visible {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.32);
  outline: none;
}

.sidebar__top-button:active {
  transform: translateY(1px);
}

.main {
  min-width: 0;
  padding: 28px 30px 40px;
}
.dashboard-section[hidden] {
  display: none !important;
}
.dashboard-section:not([hidden]) {
  margin-bottom: var(--section-gap);
}
.main > .dashboard-section:last-child {
  margin-bottom: 0;
}
.topbar {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(520px, auto);
  gap: 20px;
  align-items: start;
  margin-bottom: 0;
}
.topbar > * {
  min-width: 0;
}
.page-title { margin: 0; font-size: 34px; font-weight: 800; }
.page-subtitle {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.45;
  text-wrap: pretty;
  max-width: 56ch;
}
.topbar__side {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 16px;
  flex-wrap: nowrap;
  min-width: 0;
}
.topbar__controls {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  align-items: end;
  justify-content: flex-end;
  min-width: 0;
}
.topbar__filters,
.topbar__actions {
  display: flex;
  gap: 12px;
  align-items: end;
  min-width: 0;
}
.topbar__filters {
  flex-wrap: wrap;
  justify-content: flex-end;
}
.control { display: grid; gap: 8px; color: var(--muted); font-size: 13px; }
.control-group { display: flex; gap: 12px; align-items: end; }
.control-group--hidden { display: none; }
.topbar__user {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  gap: 10px;
  align-items: center;
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  padding: 10px 12px 10px 14px;
  border-radius: 18px;
  border: 1px solid rgba(37, 63, 184, 0.18);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 28px rgba(9, 18, 54, 0.08);
}
.topbar__user-meta {
  display: grid;
  gap: 2px;
  text-align: left;
  min-width: 0;
}
.topbar__user-name {
  margin: 0;
  font-size: 15px;
  line-height: 1.1;
}
.topbar__user-subtitle {
  font-size: 12px;
  line-height: 1.2;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
.topbar__user-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  height: 40px;
  border-radius: 12px;
  padding: 0 12px;
  line-height: 1;
  text-align: center;
}
.topbar__user-button--admin {
  background: var(--surface-soft);
  border-color: rgba(37, 63, 184, 0.16);
}
body[data-dashboard-view="site-lk"] .topbar__filters,
body[data-dashboard-view="turnkey-simple"] .topbar__filters,
body[data-dashboard-view="settings"] .topbar__filters {
  display: none;
}

select, input[type="date"], .button {
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: 0 14px;
}
.button { cursor: pointer; }
.button--ghost {
  background: transparent;
  color: var(--text);
}
.button--inline-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.button--primary {
  background: var(--blue-600);
  color: #fff;
  border-color: transparent;
}
.button--small {
  height: 34px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 13px;
}

.hero-card, .metrics-grid, .content-grid, .compact-grid {
  display: grid;
  gap: 18px;
  margin-bottom: 0;
  min-width: 0;
}
.hero-card > *,
.metrics-grid > *,
.content-grid > *,
.compact-grid > *,
.stats-row > *,
.sla-grid > *,
.attention-summary > *,
.attention-list > * {
  min-width: 0;
}
.hero-card {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: linear-gradient(135deg, #2743c4 0%, #2e4fdd 100%);
  color: #fff;
  border-radius: 24px;
  padding: 22px 24px;
  box-shadow: var(--shadow);
}
.hero-card__item { display: grid; gap: 8px; }
.hero-card__label { font-size: 13px; opacity: 0.78; }
.hero-card__value { font-size: 32px; font-weight: 800; }
.hero-card__value--green { color: #a5ffd0; }
.hero-card__value--blue { color: #dfe7ff; }

.metrics-grid { grid-template-columns: 1.2fr 1fr; }
.content-grid { grid-template-columns: 1.2fr 1fr; }
.compact-grid { grid-template-columns: 1.1fr 1fr; }
.compact-grid--tight { margin-bottom: 0; }
.panel--attention { margin-bottom: 18px; }

.panel {
  background: var(--surface);
  border: 1px solid rgba(37, 63, 184, 0.08);
  border-radius: 22px;
  padding: 20px 22px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.panel--nested {
  padding: 18px;
  box-shadow: none;
  border-color: var(--border);
}
.metrics-grid--tight,
.content-grid--tight {
  margin-bottom: 0;
}
.manager-control-stack {
  display: grid;
  gap: 16px;
}
.accordion-panel {
  padding: 0;
  overflow: hidden;
}
.accordion-summary {
  list-style: none;
  cursor: pointer;
  padding: 20px 22px;
}
.accordion-summary::-webkit-details-marker {
  display: none;
}
.accordion-summary > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.accordion-summary h2 {
  margin: 0;
  font-size: 22px;
}
.accordion-body {
  padding: 0 22px 22px;
  display: grid;
  gap: 18px;
}
.panel__header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
}
.panel__header h2 { margin: 0; font-size: 22px; }
.panel__hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  text-wrap: pretty;
}

.prose-block {
  display: grid;
  gap: 0.85rem;
  line-height: 1.6;
}

.prose-block p {
  margin: 0;
  color: var(--muted);
}

.prose-block strong {
  color: var(--text);
}

.stats-row, .sla-grid {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}
.stats-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sla-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel > .stats-row:last-child,
.panel > .sla-grid:last-child,
.panel--nested > .stats-row:last-child,
.panel--nested > .sla-grid:last-child {
  margin-bottom: 0;
}
.stat-box {
  border-radius: 18px;
  padding: 16px;
  background: var(--surface-soft);
  border-left: 5px solid var(--blue-600);
  display: grid;
  gap: 8px;
  align-content: start;
  min-height: 100%;
}
.stat-box span {
  display: block;
  color: var(--muted);
  margin-bottom: 0;
  line-height: 1.45;
  text-wrap: pretty;
}
.stat-box strong {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.08;
  text-wrap: balance;
}
.stat-box--success { border-left-color: var(--success); }
.stat-box--danger { border-left-color: var(--danger); }
.stat-box--neutral { border-left-color: var(--warning); }

.attention-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.attention-badge {
  padding: 14px 16px;
  border-radius: 16px;
  background: linear-gradient(180deg, #fff3f3, #fff9f9);
  border: 1px solid #f4d3d3;
  display: grid;
  gap: 8px;
  align-content: start;
}
.attention-badge span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 0;
  line-height: 1.45;
}
.attention-badge strong {
  color: var(--danger);
  font-size: 28px;
  line-height: 1.08;
}
.attention-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.attention-item {
  padding: 14px 16px;
  border-radius: 16px;
  background: #fff7f7;
  border: 1px solid #f2d9d9;
  display: grid;
  gap: 8px;
  align-content: start;
}
.attention-item__title {
  font-weight: 700;
  margin-bottom: 0;
  line-height: 1.4;
  text-wrap: pretty;
}
.attention-item__meta {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
