/* Dashboard-specific styles, layered on colors_and_type.css */
body { margin: 0; min-height: 100vh; overflow: hidden; }

.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: 100vh;
  position: relative;
}

/* Floating blobs for atmosphere */
.app::before, .app::after {
  content: '';
  position: absolute;
  border-radius: 999px;
  filter: blur(80px);
  pointer-events: none;
  z-index: 0;
}
.app::before { width: 480px; height: 480px; background: #B8D4F8; opacity: 0.5; top: -120px; right: -80px; }
.app::after  { width: 380px; height: 380px; background: #9B8CFF; opacity: 0.22; bottom: -100px; left: 180px; }

/* =============== SIDEBAR =============== */
.sidebar {
  position: relative; z-index: 2;
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border-right: 1px solid var(--border-hairline);
  padding: 20px 14px;
  display: flex; flex-direction: column; gap: 4px;
}
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; border-bottom: 1px solid var(--border-hairline-2); margin-bottom: 12px; }
.sb-brand .mark { width: 28px; height: 28px; color: var(--fg-1); }
.sb-brand .name { font-family: var(--font-display); font-weight: 700; font-size: 16px; letter-spacing: -0.02em; color: var(--fg-1); }
.sb-brand .env  { margin-left: auto; font-size: 10.5px; color: var(--fg-3); font-family: var(--font-mono); }

.sb-section { font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-4); padding: 14px 12px 6px; }
.sb-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 10px;
  font-size: 13.5px; color: var(--fg-2); font-weight: 500;
  cursor: pointer; transition: background 140ms, color 140ms;
}
.sb-item svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.75; fill:none; stroke-linecap: round; stroke-linejoin: round; }
.sb-item:hover { background: rgba(255,255,255,0.7); color: var(--fg-1); }
.sb-item.active { background: var(--fg-1); color: #fff; box-shadow: var(--shadow-sm); }
.sb-item .badge { margin-left: auto; font-size: 11px; padding: 2px 7px; border-radius: 999px; background: var(--err); color: #fff; font-weight: 600; }
.sb-item.active .badge { background: var(--accent-400); }

.sb-footer { margin-top: auto; padding: 12px; border-top: 1px solid var(--border-hairline-2); display:flex; align-items:center; gap:10px; font-size: 12.5px; color: var(--fg-2); }
.sb-footer .avatar { width: 30px; height: 30px; border-radius: 999px; background: var(--accent-200); color: var(--accent-600); display:flex; align-items:center; justify-content:center; font-weight: 600; font-size: 12px; }
.sb-footer .who { display:flex; flex-direction: column; line-height: 1.2; }
.sb-footer .who b { color: var(--fg-1); font-weight: 600; font-size: 13px; }
.sb-footer .who span { font-size: 11px; color: var(--fg-3); }

/* =============== MAIN =============== */
.main {
  position: relative; z-index: 2;
  overflow: auto;
  padding: 20px 28px 28px;
  display: flex; flex-direction: column; gap: 18px;
}

.topbar { display: flex; align-items: center; gap: 12px; }
.crumbs { font-size: 13px; color: var(--fg-3); }
.crumbs b { color: var(--fg-1); font-weight: 600; }
.search { position: relative; margin-left: auto; width: 280px; }
.search input {
  width: 100%; box-sizing: border-box;
  background: rgba(255,255,255,0.7); border: 1px solid var(--border-hairline);
  border-radius: 12px; padding: 9px 12px 9px 34px; font-size: 13px; color: var(--fg-1);
  font-family: inherit; outline: none;
}
.search input:focus { border-color: var(--accent-400); box-shadow: 0 0 0 3px rgba(47,128,237,0.22); }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); stroke: var(--fg-3); }

.topbar-btn {
  width: 36px; height: 36px; border-radius: 11px;
  background: rgba(255,255,255,0.7); border: 1px solid var(--border-hairline);
  display:flex; align-items:center; justify-content:center; cursor: pointer; color: var(--fg-2); position: relative;
}
.topbar-btn:hover { color: var(--fg-1); }
.topbar-btn svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 1.75; fill:none; stroke-linecap: round; stroke-linejoin: round; }
.topbar-btn .unread { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 999px; background: var(--err); border: 1.5px solid #fff; }

.page-head { display:flex; align-items:flex-end; justify-content: space-between; gap: 16px; }
.page-head h1 { font-family: var(--font-display); font-weight: 700; font-size: 32px; letter-spacing:-0.02em; color: var(--fg-1); margin: 0; line-height: 1.1; }
.page-head .sub { color: var(--fg-2); font-size: 14px; margin-top: 4px; }
.page-head .actions { display:flex; gap: 8px; }

.btn { font-family: var(--font-sans); font-weight: 500; font-size: 13.5px; padding: 9px 14px; border-radius: 11px; border: 1px solid transparent; cursor: pointer; transition: all 140ms; display: inline-flex; align-items: center; gap: 7px; }
.btn svg { width: 15px; height: 15px; stroke: currentColor; stroke-width: 1.75; fill:none; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 6px 20px rgba(47,128,237,0.24); }
.btn-primary:hover { background: var(--accent-600); }
.btn-secondary { background: rgba(255,255,255,0.7); color: var(--fg-1); border-color: var(--border-hairline); }
.btn-secondary:hover { background: #fff; }

/* =============== KPI ROW =============== */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi-card {
  position: relative;
  background: var(--surface-glass);
  backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--border-hairline);
  border-radius: 20px; padding: 18px 20px;
  box-shadow: var(--shadow-md), inset 0 1px 0 var(--border-inner);
}
.kpi-card .k-label { font-size: 11px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--fg-3); }
.kpi-card .k-num { font-family: var(--font-display); font-weight: 600; font-size: 44px; letter-spacing:-0.02em; color: var(--fg-1); font-variant-numeric: tabular-nums; line-height: 1; margin-top: 10px; }
.kpi-card .k-num .u { font-size: 16px; color: var(--fg-3); font-weight: 500; margin-left: 4px; }
.kpi-card .k-foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.kpi-card .k-delta { font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 999px; display: inline-flex; align-items: center; gap: 3px; }
.kpi-card .k-delta.up { color: #0B6E45; background: #E6F7EF; }
.kpi-card .k-delta.down { color: #8B2929; background: #FBE9E9; }
.kpi-card .k-delta.flat { color: var(--fg-3); background: rgba(155,174,200,0.16); }
.kpi-card .k-spark { flex: 1; height: 26px; opacity: 0.9; }
.kpi-card .k-icon { position: absolute; top: 18px; right: 20px; width: 34px; height: 34px; border-radius: 10px; background: var(--accent-050); color: var(--accent); display:flex; align-items:center; justify-content:center; }
.kpi-card .k-icon svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.75; fill:none; stroke-linecap: round; stroke-linejoin: round; }

/* =============== CONTENT GRID =============== */
.grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 14px; }

.panel {
  background: var(--surface-glass);
  backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--border-hairline);
  border-radius: 20px;
  box-shadow: var(--shadow-md), inset 0 1px 0 var(--border-inner);
  padding: 18px 20px;
}
.panel-head { display:flex; align-items:center; justify-content:space-between; margin-bottom: 14px; }
.panel-head .p-title { font-family: var(--font-display); font-weight: 600; font-size: 16px; color: var(--fg-1); letter-spacing:-0.01em; }
.panel-head .p-sub { font-size: 12px; color: var(--fg-3); margin-top: 2px; }

/* segmented control */
.seg { display: inline-flex; padding: 3px; background: rgba(255,255,255,0.6); border: 1px solid var(--border-hairline); border-radius: 10px; font-size: 12px; }
.seg span { padding: 5px 11px; border-radius: 7px; color: var(--fg-3); cursor: pointer; font-weight: 500; }
.seg span.on { background: #fff; color: var(--fg-1); box-shadow: var(--shadow-xs); }

/* chart */
.chart-wrap { position: relative; height: 240px; }
.chart-wrap svg { width: 100%; height: 100%; display: block; }

/* turbine list */
.t-row { display: grid; grid-template-columns: 16px 1fr 70px 50px 80px; align-items: center; gap: 12px; padding: 11px 6px; border-bottom: 1px solid var(--border-hairline-2); cursor: pointer; transition: background 140ms; border-radius: 8px; }
.t-row:hover { background: rgba(255,255,255,0.5); }
.t-row.selected { background: var(--accent-050); }
.t-row:last-child { border-bottom: none; }
.t-dot { width: 8px; height: 8px; border-radius: 999px; }
.t-dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(27,182,115,0.18); }
.t-dot.warn { background: var(--warn); box-shadow: 0 0 0 3px rgba(232,161,60,0.18); }
.t-dot.err { background: var(--err); box-shadow: 0 0 0 3px rgba(225,91,91,0.18); }
.t-name { font-weight: 600; color: var(--fg-1); font-size: 13.5px; }
.t-site { font-size: 11px; color: var(--fg-3); margin-top: 1px; }
.t-num { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--fg-1); font-weight: 500; text-align: right; }
.t-spark { height: 22px; }

.t-head { display: grid; grid-template-columns: 16px 1fr 70px 50px 80px; gap: 12px; padding: 0 6px 8px; font-size: 11px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--fg-4); }
.t-head .right { text-align: right; }

/* alerts */
.alert { display: grid; grid-template-columns: 24px 1fr auto; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border-hairline-2); }
.alert:last-child { border-bottom: none; }
.alert .icon { width: 24px; height: 24px; border-radius: 8px; display:flex; align-items:center; justify-content:center; }
.alert .icon svg { width: 14px; height: 14px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.alert.warn .icon { background: #FBF1E1; color: #8A5B14; }
.alert.err  .icon { background: #FBE9E9; color: #8B2929; }
.alert.info .icon { background: var(--accent-050); color: var(--accent-600); }
.alert .body { font-size: 13px; color: var(--fg-1); line-height: 1.4; }
.alert .body .meta { font-size: 11px; color: var(--fg-3); margin-top: 2px; }
.alert .time { font-size: 11px; color: var(--fg-3); white-space: nowrap; font-family: var(--font-mono); }

/* Map */
.map-wrap { position: relative; height: 220px; border-radius: 16px; overflow: hidden; background: linear-gradient(180deg, #DCEAF7 0%, #B8D0E6 100%); border: 1px solid var(--border-hairline); }
.map-wrap svg.map-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.site-dot { cursor: pointer; transition: r 140ms; }
.site-label { font-size: 10.5px; font-family: var(--font-sans); font-weight: 600; fill: var(--fg-1); }
.map-legend { position: absolute; left: 12px; bottom: 10px; background: rgba(255,255,255,0.8); backdrop-filter: blur(10px); border: 1px solid var(--border-hairline); border-radius: 10px; padding: 6px 10px; font-size: 11px; color: var(--fg-2); display: flex; gap: 10px; }
.map-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 999px; margin-right: 4px; vertical-align: middle; }
