:root {
  --bg: #f4f6f9;
  --card: #ffffff;
  --ink: #1c2530;
  --muted: #6b7785;
  --line: #e2e7ee;
  --obs: #d92f2f;
  --pred: #2a6df0;
  --accent: #0a7d3b;
  --warn: #c47f00;
  --bad: #c0392b;
  --shadow: 0 1px 3px rgba(20,30,45,.08), 0 1px 2px rgba(20,30,45,.06);
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
header {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 20px; background: var(--card); border-bottom: 1px solid var(--line);
}
.brand h1 { margin: 0; font-size: 20px; letter-spacing: .2px; }
.brand .tag { color: var(--muted); font-size: 12px; }
.controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.controls label { display: flex; flex-direction: column; font-size: 11px; color: var(--muted); gap: 3px; }
.controls select, .controls input {
  font-size: 14px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px;
  background: #fff; color: var(--ink); min-width: 110px;
}
.controls input { width: 110px; }
#refresh {
  align-self: end; padding: 7px 12px; border: 1px solid var(--line); background: #fff;
  border-radius: 7px; cursor: pointer; font-size: 13px;
}
#refresh:hover { background: #f0f3f8; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 12px; padding: 16px 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; box-shadow: var(--shadow); }
.card .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.card .v { font-size: 26px; font-weight: 650; margin-top: 2px; }
.card .v small { font-size: 13px; font-weight: 500; color: var(--muted); }
.card .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 13px; font-weight: 650; }
.b-HIGH { background: #e3f6ea; color: var(--accent); }
.b-MEDIUM { background: #fdf3df; color: var(--warn); }
.b-LOW { background: #fde6e3; color: var(--bad); }
.locked { color: var(--accent); }
.open { color: var(--warn); }

.chartwrap, .verifywrap { background: var(--card); margin: 4px 20px 16px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow); }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.chart-head h2 { margin: 0 0 6px; font-size: 16px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.lg-obs { color: var(--obs); }
.lg-pred { color: var(--pred); }
#chart { position: relative; }
#chart svg { width: 100%; height: auto; display: block; }
#charttip { position: absolute; pointer-events: none; opacity: 0; transition: opacity .08s;
  background: #1c2530; color: #fff; font-size: 12px; line-height: 1.35; padding: 6px 9px;
  border-radius: 7px; white-space: nowrap; z-index: 5; box-shadow: 0 2px 8px rgba(20,30,45,.28); }
#charttip b { font-weight: 600; }

h2 { font-size: 16px; }
.muted { color: var(--muted); font-size: 12px; }
#engine-note { margin: 8px 2px 0; }

table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: right; padding: 6px 10px; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
thead th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .3px; }

footer { padding: 8px 20px 24px; }

.pbar { height: 8px; background: var(--line); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.pbar > i { display: block; height: 100%; background: var(--pred); }

#proxywarn { display: none; margin: 0 20px 14px; padding: 10px 14px; border-radius: 10px;
  background: #fdf3df; border: 1px solid var(--warn); color: #7a4f00; font-size: 13px; line-height: 1.4; }

.notif { position: relative; }
#bell { position: relative; padding: 7px 11px; border: 1px solid var(--line); background: #fff; border-radius: 7px; cursor: pointer; font-size: 15px; }
#bell:hover { background: #f0f3f8; }
#bellbadge { display: none; position: absolute; top: -6px; right: -6px; min-width: 17px; height: 17px;
  padding: 0 4px; background: var(--bad); color: #fff; border-radius: 999px; font-size: 11px; line-height: 17px; text-align: center; font-weight: 600; }
#notifpanel { display: none; position: absolute; right: 0; top: 116%; width: 330px; max-height: 380px; overflow-y: auto;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 22px rgba(20,30,45,.18); z-index: 20; padding: 4px; }
#notifpanel .nrow { padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 13px; cursor: pointer; border-radius: 6px; }
#notifpanel .nrow:hover { background: #f0f3f8; }
#notifpanel .nrow:last-child { border-bottom: 0; }
#notifpanel .nempty { padding: 16px; color: var(--muted); font-size: 13px; text-align: center; }
