:root {
  --bg: #0d1117;
  --panel: #151b23;
  --panel-2: #1b222c;
  --line: #262f3b;
  --text: #dbe2ea;
  --muted: #8693a4;
  --dim: #5d6876;
  --accent: #5aa9ff;
  --ok: #3fb950;
  --warn: #d4a72c;
  --crit: #f0524a;
  --unknown: #6e7681;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --sans: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 var(--sans); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.num, .mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ---- üst bar ---- */
header.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px;
  padding: 0 24px; height: 52px;
  background: rgba(13, 17, 23, .92); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; letter-spacing: .2px; }
.brand .pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 rgba(63,185,80,.6); animation: pulse 2.4s infinite; }
.brand .pulse.warn { background: var(--warn); }
.brand .pulse.crit { background: var(--crit); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(255,255,255,.25); } 70% { box-shadow: 0 0 0 8px rgba(255,255,255,0); } 100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); } }
nav.tabs { display: flex; gap: 4px; }
nav.tabs a { color: var(--muted); padding: 6px 12px; border-radius: 6px; }
nav.tabs a.active, nav.tabs a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.top .spacer { flex: 1; }
.top .meta { color: var(--dim); font-size: 12px; }
.top .logout { color: var(--muted); font-size: 13px; }

main { padding: 20px 24px 48px; max-width: 1600px; margin: 0 auto; }

/* ---- özet şeridi ---- */
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.stat .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; }
.stat .v { font: 600 28px/1.2 var(--mono); margin-top: 6px; }
.stat .v small { font-size: 15px; color: var(--muted); font-weight: 400; }
.stat .v.ok { color: var(--ok); } .stat .v.warn { color: var(--warn); } .stat .v.crit { color: var(--crit); }

/* ---- alarm listesi ---- */
.alerts { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 20px; overflow: hidden; }
.alerts h3 { margin: 0; padding: 10px 16px; font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--line); font-weight: 600; }
.alert-row { display: grid; grid-template-columns: 8px 180px 1fr auto; gap: 14px; align-items: center; padding: 9px 16px; border-bottom: 1px solid var(--line); }
.alert-row:last-child { border-bottom: 0; }
.alert-row .bar { width: 4px; height: 20px; border-radius: 2px; }
.alert-row.crit .bar { background: var(--crit); } .alert-row.warn .bar { background: var(--warn); }
.alert-row .host { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alert-row .when { color: var(--dim); font-size: 12px; white-space: nowrap; }
.empty-ok { padding: 14px 16px; color: var(--ok); }

/* ---- sunucu kartları ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
.card { display: block; color: inherit; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; position: relative; transition: border-color .15s, transform .15s; }
.card:hover { border-color: #3a4656; text-decoration: none; transform: translateY(-1px); }
.card::before { content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px; border-radius: 0 3px 3px 0; background: var(--unknown); }
.card.ok::before { background: var(--ok); } .card.warn::before { background: var(--warn); } .card.crit::before { background: var(--crit); }
.card-head { display: flex; align-items: center; gap: 10px; }
.card-head .name { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { font-size: 11px; color: var(--muted); border: 1px solid var(--line); padding: 1px 7px; border-radius: 20px; white-space: nowrap; }
.card-sub { color: var(--dim); font-size: 12px; margin: 2px 0 10px; font-family: var(--mono); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--unknown); flex: none; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.crit { background: var(--crit); }

.meters { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.meter .lbl { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.meter .lbl b { font-family: var(--mono); color: var(--text); font-weight: 500; }
.track { height: 5px; background: var(--panel-2); border-radius: 3px; margin-top: 4px; overflow: hidden; }
.track > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.track > i.warn { background: var(--warn); } .track > i.crit { background: var(--crit); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-family: var(--mono); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pills { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.pill { font-size: 11px; font-family: var(--mono); padding: 2px 8px; border-radius: 4px; background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.pill.ok { color: var(--ok); border-color: rgba(63,185,80,.35); }
.pill.warn { color: var(--warn); border-color: rgba(212,167,44,.4); }
.pill.crit { color: var(--crit); border-color: rgba(240,82,74,.45); }
.card-foot { margin-top: 10px; color: var(--dim); font-size: 11px; display: flex; justify-content: space-between; }
.sep { border-top: 1px dashed var(--line); margin: 10px 0; }

/* ---- detay sayfası ---- */
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 22px; }
.page-head .sub { color: var(--muted); font-family: var(--mono); font-size: 13px; }
.back { color: var(--muted); font-size: 13px; }
.ranges { margin-left: auto; display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.ranges button { background: none; border: 0; color: var(--muted); padding: 5px 11px; border-radius: 6px; cursor: pointer; font: inherit; font-size: 13px; }
.ranges button.active { background: var(--panel-2); color: var(--text); }
section.box { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; margin-bottom: 16px; }
section.box > h2 { margin: 0; padding: 12px 16px; font-size: 14px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; }
section.box > h2 .right { margin-left: auto; color: var(--dim); font-weight: 400; font-size: 12px; }
.box-body { padding: 14px 16px; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; }
.chart { background: var(--panel-2); border-radius: 8px; padding: 10px 12px 6px; }
.chart .ct { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.chart .cw { position: relative; height: 170px; }
.info { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px 20px; margin-bottom: 14px; }
.info > div > span { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.info > div > b { font-family: var(--mono); font-weight: 500; }

table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr:last-child td { border-bottom: 0; }
table.t td.n { font-family: var(--mono); text-align: right; white-space: nowrap; }
table.t th.n { text-align: right; }
table.t td.sql { font-family: var(--mono); font-size: 12px; color: var(--muted); max-width: 520px; word-break: break-word; }
.tbl-wrap { overflow-x: auto; }
.st-ok { color: var(--ok); } .st-warn { color: var(--warn); } .st-crit { color: var(--crit); } .st-dim { color: var(--dim); }
.note { color: var(--dim); font-size: 12px; padding: 4px 0; }
.err { color: var(--crit); font-size: 13px; }
h4 { margin: 18px 0 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
h4:first-child { margin-top: 0; }

/* ---- giriş ---- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: 100%; max-width: 340px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 28px; }
.login h1 { margin: 0 0 4px; font-size: 18px; display: flex; align-items: center; gap: 10px; }
.login p { margin: 0 0 20px; color: var(--muted); font-size: 13px; }
.login label { display: block; font-size: 12px; color: var(--muted); margin: 12px 0 5px; }
.login input { width: 100%; padding: 9px 11px; background: var(--bg); border: 1px solid var(--line); border-radius: 7px; color: var(--text); font: inherit; }
.login input:focus { outline: none; border-color: var(--accent); }
.login button { width: 100%; margin-top: 20px; padding: 10px; border: 0; border-radius: 7px; background: var(--accent); color: #06121f; font: 600 14px var(--sans); cursor: pointer; }
.login .err { margin-top: 12px; }

@media (max-width: 700px) {
  header.top { padding: 0 14px; gap: 12px; }
  .top .meta { display: none; }
  main { padding: 14px 14px 40px; }
  .grid { grid-template-columns: 1fr; }
  .charts { grid-template-columns: 1fr; }
  .alert-row { grid-template-columns: 6px 1fr; }
  .alert-row .host, .alert-row .when { grid-column: 2; }
}

/* ---- açıklama ipuçları ---- */
.tip {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; margin-left: 4px; border-radius: 50%;
  border: 1px solid var(--dim); color: var(--muted); font: 600 9px/1 var(--sans);
  text-transform: none; letter-spacing: 0; cursor: help; vertical-align: 1px; outline: none;
}
.tip:hover, .tip:focus { border-color: var(--accent); color: var(--accent); }
.tip::after {
  content: attr(data-tip); position: absolute; z-index: 50; left: 50%; top: calc(100% + 8px);
  transform: translateX(-50%); width: max-content; max-width: 300px; white-space: normal;
  padding: 9px 11px; border-radius: 7px; background: #0b0f15; border: 1px solid var(--line);
  box-shadow: 0 8px 24px rgba(0,0,0,.45); color: var(--text); font: 400 12px/1.45 var(--sans);
  text-align: left; opacity: 0; visibility: hidden; transition: opacity .12s; pointer-events: none;
}
.tip:hover::after, .tip:focus::after { opacity: 1; visibility: visible; }
.card .tip::after, .stat .tip::after { left: 0; transform: none; }

/* ---- çağrı analizi ---- */
.sel { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font: inherit; font-size: 13px; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cols2 > section.box { min-width: 0; }
@media (max-width: 1100px) { .cols2 { grid-template-columns: 1fr; } }

/* ---- kullanıcı yönetimi / formlar ---- */
.top .user { color: var(--muted); font-size: 13px; }
.top .user:hover { color: var(--text); }
.btn { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 7px; padding: 6px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.btn:hover { border-color: #3a4656; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #06121f; font-weight: 600; }
.btn.danger { color: var(--crit); }
.form .row { margin-bottom: 14px; }
.form .row > label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.form input[type=text], .form input:not([type]), .form input[type=password] {
  width: 100%; max-width: 360px; padding: 8px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 7px; color: var(--text); font: inherit; }
.form input:disabled { opacity: .6; }
.form input:focus { outline: none; border-color: var(--accent); }
.chks { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 8px 20px; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text) !important; cursor: pointer; }
.form .actions { margin-top: 18px; }
.form .err { margin: 6px 0; }
