:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --ink: #16202f;
  --muted: #67748c;
  --line: #e2e7f0;
  --brand: #2f5bea;
  --brand-soft: #eaf0ff;
  --good: #12916b;
  --bad: #d4453c;
  --warn: #c07a12;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,32,64,.06), 0 8px 24px rgba(16,32,64,.06);
  font-synthesis: none;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 "Segoe UI", Inter, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }

.logo-mark {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  background: linear-gradient(135deg, #2f5bea, #6f4ce8);
  position: relative;
}
.logo-mark::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(#fff, #fff) 7px 17px / 3px 7px no-repeat,
    linear-gradient(#fff, #fff) 13px 12px / 3px 12px no-repeat,
    linear-gradient(#fff, #fff) 19px 15px / 3px 9px no-repeat;
  opacity: .95;
}

/* ---------------- giriş ---------------- */
.login-wrap {
  min-height: 100%; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 20% -10%, #dfe8ff 0%, transparent 60%), var(--bg);
}
.login-card {
  width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 28px; box-shadow: var(--shadow); display: grid; gap: 16px;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.login-brand strong { display: block; font-size: 17px; }
.login-brand small { color: var(--muted); }
.login-card label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); font-weight: 600; }
.login-card input {
  padding: 11px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfe;
  color: var(--ink); outline: none;
}
.login-card input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.login-foot { margin: 0; text-align: center; font-size: 12.5px; color: var(--muted); }

/* ---------------- düğmeler ---------------- */
.btn {
  border: 1px solid var(--line); background: var(--panel); border-radius: 9px;
  padding: 9px 14px; cursor: pointer; font-weight: 600; font-size: 14px; transition: .12s;
}
.btn:hover { border-color: #c9d3e6; background: #f8faff; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: #2549c8; }
.btn.danger { color: var(--bad); border-color: #f2cfcd; }
.btn.danger:hover { background: #fdf3f2; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: #eef2fa; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.ctl {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel); outline: none; max-width: 220px;
}
.ctl:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }

/* ---------------- üst çubuk ---------------- */
.topbar {
  height: 60px; background: var(--panel); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; padding: 0 18px; gap: 14px;
  position: sticky; top: 0; z-index: 30;
}
.topbar-left { display: flex; align-items: center; gap: 11px; }
.brand-text strong { display: block; font-size: 15px; line-height: 1.2; }
.brand-text small { color: var(--muted); font-size: 12px; }
.topbar-right { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.range-inputs { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.range-inputs .ctl { max-width: 148px; }

.usermenu { position: relative; }
.dropdown {
  position: absolute; right: 0; top: calc(100% + 6px); background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
  min-width: 178px; padding: 5px; display: grid; z-index: 40;
}
.dropdown button {
  text-align: left; border: 0; background: transparent; padding: 9px 11px;
  border-radius: 7px; cursor: pointer; font-size: 14px;
}
.dropdown button:hover { background: #eef2fa; }

/* ---------------- yerleşim ---------------- */
.layout { display: grid; grid-template-columns: 232px 1fr; min-height: calc(100vh - 60px); }
.sidenav {
  background: var(--panel); border-right: 1px solid var(--line); padding: 14px 10px;
  display: flex; flex-direction: column; gap: 2px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; text-align: left; border: 0; background: transparent;
  padding: 10px 12px; border-radius: 9px; cursor: pointer; color: #3b4a63; font-weight: 600; font-size: 14px;
}
.nav-item i { font-style: normal; width: 18px; text-align: center; opacity: .6; }
.nav-item:hover { background: #f2f5fb; }
.nav-item.active { background: var(--brand-soft); color: var(--brand); }
.nav-item.active i { opacity: 1; }
.nav-group { margin-top: 16px; display: grid; gap: 2px; }
.nav-label {
  font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted);
  padding: 6px 12px; font-weight: 700;
}
.nav-foot { margin-top: auto; padding: 10px 12px; }
.sync-badge { font-size: 12px; color: var(--muted); display: block; }

.content { padding: 22px 26px 60px; max-width: 1420px; }

/* ---------------- başlıklar ---------------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { margin: 0 0 3px; font-size: 21px; }
.page-head p { margin: 0; color: var(--muted); font-size: 13.5px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------------- kartlar ---------------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(212px, 1fr)); gap: 13px; margin-bottom: 20px; }
.kpi {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 16px; box-shadow: var(--shadow);
}
.kpi .k-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kpi .k-value { font-size: 25px; font-weight: 700; margin-top: 5px; letter-spacing: -.02em; }
.kpi .k-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.delta { font-size: 12.5px; font-weight: 700; margin-left: 7px; white-space: nowrap; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.delta.flat { color: var(--muted); }

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 17px 18px; box-shadow: var(--shadow); margin-bottom: 18px;
}
.panel > h2 { margin: 0 0 3px; font-size: 15.5px; }
.panel > .panel-note { margin: 0 0 13px; color: var(--muted); font-size: 12.5px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 18px; }
.chart-box { position: relative; height: 300px; }
.chart-box.short { height: 230px; }

/* ---------------- tablolar ---------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 9px 11px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  font-weight: 700; cursor: pointer; user-select: none; position: sticky; top: 0; background: var(--panel);
}
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: #f8faff; }
tbody tr:last-child td { border-bottom: 0; }
td.name-cell { font-weight: 600; white-space: normal; min-width: 170px; }
td .dept { display: block; font-weight: 400; color: var(--muted); font-size: 12px; }
.bar-cell { position: relative; min-width: 110px; }
.bar-cell .bar { position: absolute; left: 0; top: 6px; bottom: 6px; background: var(--brand-soft); border-radius: 4px; }
.bar-cell span { position: relative; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pill.ok { background: #e4f6ef; color: var(--good); }
.pill.bad { background: #fdecea; color: var(--bad); }
.pill.warn { background: #fdf3e2; color: var(--warn); }
.pill.mute { background: #eef1f7; color: var(--muted); }

.alert { padding: 11px 13px; border-radius: 9px; font-size: 13.5px; margin: 0; }
.alert.error { background: #fdecea; color: #93211a; border: 1px solid #f6cfcb; }
.alert.info { background: var(--brand-soft); color: #1f3ea8; border: 1px solid #cfdcff; }
.alert.ok { background: #e4f6ef; color: #0c6b50; border: 1px solid #bfe6d7; }
.alert.warn { background: #fdf3e2; color: #86560a; border: 1px solid #f2ddb8; }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty strong { display: block; font-size: 15px; color: var(--ink); margin-bottom: 5px; }

.skeleton { background: linear-gradient(90deg, #eef1f7 25%, #f6f8fc 50%, #eef1f7 75%); background-size: 400% 100%;
  animation: sk 1.3s infinite; border-radius: 8px; height: 14px; }
@keyframes sk { from { background-position: 100% 0 } to { background-position: 0 0 } }

/* ---------------- form / modal ---------------- */
.form-grid { display: grid; gap: 13px; }
.form-grid label { display: grid; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 600; }
.form-grid input[type=text], .form-grid input[type=email], .form-grid input[type=password],
.form-grid input[type=number], .form-grid input[type=url], .form-grid select, .form-grid textarea {
  padding: 10px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfe; outline: none; width: 100%;
}
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
.form-grid .hint { font-weight: 400; font-size: 12px; color: var(--muted); }
.checks { display: grid; gap: 7px; max-height: 210px; overflow: auto; border: 1px solid var(--line);
  border-radius: 9px; padding: 10px; background: #fbfcfe; }
.checks label { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink); font-size: 13.5px; }
.form-actions { display: flex; gap: 9px; justify-content: flex-end; margin-top: 4px; }

.modal-back {
  position: fixed; inset: 0; background: rgba(16,26,45,.42); display: grid; place-items: center;
  padding: 20px; z-index: 100;
}
.modal {
  background: var(--panel); border-radius: 14px; box-shadow: 0 20px 60px rgba(16,32,64,.25);
  width: 100%; max-width: 520px; max-height: 88vh; overflow: auto; padding: 20px 22px;
}
.modal.wide { max-width: 1040px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h3 { margin: 0; font-size: 16.5px; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  background: #16202f; color: #fff; padding: 11px 18px; border-radius: 10px; z-index: 200;
  box-shadow: var(--shadow); font-size: 14px; max-width: 90vw;
}
.toast.err { background: #a3261e; }

.scope-list { display: grid; gap: 7px; margin: 10px 0 0; padding: 0; list-style: none; }
.scope-list li { display: flex; align-items: center; gap: 9px; font-size: 13.5px; }
.scope-list .mark { width: 18px; }

.conn-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px; background: var(--panel);
  box-shadow: var(--shadow); margin-bottom: 13px; }
.conn-card .head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.conn-card h3 { margin: 0 0 3px; font-size: 15.5px; }
.conn-card .meta { color: var(--muted); font-size: 12.5px; }
.conn-card .acts { display: flex; gap: 7px; flex-wrap: wrap; }
.tagrow { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidenav { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav-group { margin-top: 0; display: flex; }
  .nav-label, .nav-foot { display: none; }
  .content { padding: 16px; }
  .topbar { height: auto; padding: 10px 14px; flex-wrap: wrap; }
}
