/* windlessPro admin console - single stylesheet, no external assets. */

:root {
  --bg: #0a0e17;
  --bg-soft: #0e1421;
  --panel: #121a2a;
  --panel-2: #162034;
  --line: #22304a;
  --line-soft: #1a2539;
  --text: #e8eefa;
  --muted: #8896b3;
  --accent: #4d8dff;
  --accent-soft: rgba(77, 141, 255, .14);
  --ok: #34d399;
  --danger: #f87171;
  --warn: #fbbf24;
  --role: #c084fc;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(77, 141, 255, .10), transparent 60%),
    radial-gradient(900px 500px at 110% 0%, rgba(52, 211, 153, .06), transparent 55%),
    var(--bg);
  color: var(--text);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2 { margin: 0; font-weight: 650; letter-spacing: .2px; }
h1 { font-size: 22px; }
h2 { font-size: 15px; }
p { margin: 0; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.right { text-align: right; }
.w-16 { width: 64px; }
.w-24 { width: 96px; }
.w-32 { width: 140px; }
.code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 12.5px;
}

/* ---------- top bar ---------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 28px;
  height: 62px;
  background: rgba(10, 14, 23, .82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 650; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 30px; height: 30px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #7c5cff);
  color: #fff;
  font-weight: 800;
  font-size: 15px;
  box-shadow: 0 4px 14px rgba(77, 141, 255, .35);
}
.brand-mark--lg { width: 46px; height: 46px; font-size: 22px; border-radius: 13px; }
.brand-text em { color: var(--muted); font-style: normal; font-weight: 500; margin-left: 6px; }
.nav { display: flex; gap: 4px; }
.nav a {
  color: var(--muted);
  padding: 7px 12px;
  border-radius: 8px;
  font-weight: 500;
}
.nav a:hover { color: var(--text); background: rgba(255, 255, 255, .04); text-decoration: none; }
.nav a.is-active { color: var(--text); background: var(--accent-soft); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.who { color: var(--muted); font-size: 13px; }

/* ---------- page shell ------------------------------------------------- */
.page {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 28px 48px;
  flex: 1;
}
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.page-head p { margin-top: 4px; font-size: 13px; }
.back { display: inline-block; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }

.footer {
  padding: 18px 28px 26px;
  text-align: center;
  color: #5b6781;
  font-size: 12px;
}

/* ---------- panels ----------------------------------------------------- */
.panel {
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  margin-bottom: 18px;
}
.panel-flush { padding: 6px 0; overflow: hidden; }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.panel-flush .panel-head { padding: 14px 20px 0; }

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.split-wide { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

/* ---------- stats ------------------------------------------------------ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 96px;
}
.stat-label { color: var(--muted); font-size: 12px; letter-spacing: .3px; }
.stat-value { font-size: 26px; font-weight: 700; line-height: 1.15; }
.stat-value small { font-size: 12px; color: var(--muted); margin-left: 3px; font-weight: 500; }
.stat-ok { color: var(--ok); }
.stat-sub { color: var(--muted); font-size: 12px; }

/* ---------- chart ------------------------------------------------------ */
.chart {
  display: grid;
  grid-template-columns: repeat(14, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
  height: 190px;
  padding-top: 8px;
}
.chart-col {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  height: 100%;
}
.chart-value { font-size: 11px; color: var(--muted); height: 14px; }
.chart-bar {
  width: 100%;
  max-width: 34px;
  min-height: 3px;
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, #5b9bff, rgba(77, 141, 255, .35));
  box-shadow: 0 0 18px rgba(77, 141, 255, .25);
  transition: height .2s ease;
}
.chart-col.is-today .chart-bar {
  background: linear-gradient(180deg, var(--ok), rgba(52, 211, 153, .35));
  box-shadow: 0 0 18px rgba(52, 211, 153, .25);
}
.chart-bar.is-zero { min-height: 0; background: transparent; box-shadow: none; }
.chart-label { font-size: 10.5px; color: #66738e; white-space: nowrap; }

/* ---------- tables ----------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left;
  font-size: 11.5px;
  letter-spacing: .4px;
  text-transform: uppercase;
  color: #6b7a97;
  font-weight: 600;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .015);
}
.table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: rgba(255, 255, 255, .022); }
.table .empty { text-align: center; color: var(--muted); padding: 22px; }
.table td.ua { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- badges ----------------------------------------------------- */
.badge {
  display: inline-block;
  font-size: 11.5px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  vertical-align: middle;
  font-weight: 500;
}
.badge + .badge { margin-left: 4px; }
.badge-ok { color: #6ee7b7; background: rgba(52, 211, 153, .10); border-color: rgba(52, 211, 153, .28); }
.badge-danger { color: #fca5a5; background: rgba(248, 113, 113, .10); border-color: rgba(248, 113, 113, .30); }
.badge-warn { color: #fcd34d; background: rgba(251, 191, 36, .10); border-color: rgba(251, 191, 36, .30); }
.badge-role { color: #d8b4fe; background: rgba(192, 132, 252, .10); border-color: rgba(192, 132, 252, .30); }
.badge-muted { color: var(--muted); background: rgba(255, 255, 255, .04); border-color: var(--line); }

/* ---------- forms / buttons -------------------------------------------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); }
.input {
  width: 100%;
  background: #0c1320;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(77, 141, 255, .16); }
.select { width: auto; min-width: 130px; }
.input::placeholder { color: #55617c; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}
.toolbar .input { width: 300px; max-width: 100%; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: #162035;
  color: var(--text);
  border-radius: 9px;
  padding: 9px 14px;
  font-size: 13.5px;
  font-weight: 520;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s ease, border-color .15s ease, transform .05s ease;
  white-space: nowrap;
}
.btn:hover { background: #1c2942; border-color: #2c3d5c; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: linear-gradient(180deg, #5a97ff, #3f7ff0);
  border-color: #4d8dff;
  color: #fff;
  box-shadow: 0 6px 18px rgba(63, 127, 240, .28);
}
.btn-primary:hover { background: linear-gradient(180deg, #6aa2ff, #4a89f5); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
.btn-danger { background: rgba(248, 113, 113, .12); border-color: rgba(248, 113, 113, .38); color: #fca5a5; }
.btn-danger:hover { background: rgba(248, 113, 113, .2); }
.btn-ok { background: rgba(52, 211, 153, .12); border-color: rgba(52, 211, 153, .35); color: #6ee7b7; }
.btn-ok:hover { background: rgba(52, 211, 153, .2); }
.btn-sm { padding: 6px 10px; font-size: 12.5px; }
.btn-block { width: 100%; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions form { margin: 0; }
.inline-form { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.inline-form .input { max-width: 160px; }

.danger-zone {
  margin-top: 18px;
  border: 1px solid rgba(248, 113, 113, .25);
  background: rgba(248, 113, 113, .05);
  border-radius: 10px;
  padding: 12px 14px;
}
.danger-zone summary {
  cursor: pointer;
  color: #fca5a5;
  font-size: 13px;
  font-weight: 520;
}
.danger-zone p { margin: 8px 0 0; }

/* ---------- key/value -------------------------------------------------- */
.kv { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 9px 12px; margin: 0; }
.kv dt { color: var(--muted); font-size: 12.5px; }
.kv dd { margin: 0; font-size: 13.5px; word-break: break-all; }

/* ---------- feed ------------------------------------------------------- */
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.feed li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line-soft);
}
.feed li:last-child { border-bottom: 0; }
.feed li.empty { color: var(--muted); justify-content: center; border: 0; }
.feed-action {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: #a9c4ff;
  background: rgba(77, 141, 255, .09);
  border-radius: 6px;
  padding: 2px 7px;
  white-space: nowrap;
}
.feed-meta { color: var(--muted); font-size: 12.5px; }
.feed-ip { margin-left: auto; color: #5f6d88; font-size: 11.5px; font-family: ui-monospace, monospace; }

/* ---------- flash ------------------------------------------------------ */
.flash {
  border-radius: 10px;
  padding: 11px 14px;
  margin-bottom: 16px;
  font-size: 13.5px;
  border: 1px solid var(--line);
  background: var(--panel);
}
.flash-ok { border-color: rgba(52, 211, 153, .35); background: rgba(52, 211, 153, .08); color: #a7f3d0; }
.flash-err { border-color: rgba(248, 113, 113, .38); background: rgba(248, 113, 113, .08); color: #fecaca; }
.flash-warn { border-color: rgba(251, 191, 36, .38); background: rgba(251, 191, 36, .08); color: #fde68a; }

/* ---------- pagination ------------------------------------------------- */
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; }
.pager-link {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  color: var(--text);
  font-size: 13px;
}
.pager-link:hover { background: rgba(255, 255, 255, .05); text-decoration: none; }
.pager-link.is-disabled { color: #4a556e; pointer-events: none; }
.pager-info { color: var(--muted); font-size: 12.5px; }

/* ---------- login ------------------------------------------------------ */
.body-auth { justify-content: center; }
.auth-page {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 40px 20px;
}
.auth-card {
  width: min(400px, 100%);
  background: linear-gradient(180deg, var(--panel-2), var(--bg-soft));
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
  padding: 30px 28px 24px;
}
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand h1 { font-size: 20px; margin: 12px 0 4px; }
.auth-brand p { color: var(--muted); font-size: 12.5px; }
.auth-card .form { margin-top: 4px; }
.auth-hint { margin-top: 16px; color: #5f6d88; font-size: 12px; text-align: center; line-height: 1.6; }

/* ---------- responsive ------------------------------------------------- */
@media (max-width: 1080px) {
  .stat-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .split, .split-wide { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  .topbar { padding: 0 16px; gap: 14px; height: auto; min-height: 58px; flex-wrap: wrap; }
  .brand-text em { display: none; }
  .nav { order: 3; width: 100%; padding-bottom: 8px; overflow-x: auto; }
  .page { padding: 18px 16px 36px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart { height: 150px; gap: 4px; }
  .chart-label { font-size: 9px; }
  .who { display: none; }
  .table th, .table td { padding: 9px 10px; }
  .toolbar .input { width: 100%; }
}
