﻿:root {
  --bg: #f3f7fb;
  --panel: #ffffff;
  --text: #1e2a35;
  --muted: #617081;
  --primary: #0e6ba8;
  --danger: #ba2d2d;
  --border: #d9e2ec;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #edf4fb 0%, #f8fbff 100%);
  padding-bottom: 74px;
}
body.modal-open {
  overflow: hidden;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}

.topbar nav a { margin-right: 14px; color: var(--primary); text-decoration: none; }

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  padding: 0;
}

.stack { display: flex; flex-direction: column; gap: 8px; }
input, textarea, button {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
button {
  border: none;
  background: var(--primary);
  color: #fff;
  cursor: pointer;
}
button.secondary {
  background: #5f6f7f;
}
button.danger { background: var(--danger); }

.error {
  color: #8f1d1d;
  background: #ffe7e7;
  padding: 10px;
  border-radius: 8px;
}
.ok {
  color: #0a5f2d;
  background: #e7f9ee;
  padding: 10px;
  border-radius: 8px;
}
.muted { color: var(--muted); }

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.kpi-card h3 {
  margin: 0 0 8px;
  font-size: 14px;
  color: var(--muted);
}

.kpi-card p {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
}

.dash-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background:
    radial-gradient(circle at top right, #e2f3ff 0, transparent 45%),
    linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
}

.dash-hero h1 {
  margin: 0 0 6px;
}

.hero-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  border: 1px solid #d7e8f7;
  background: #f8fcff;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
}

.kpi-grid-modern .kpi-card.modern {
  border-color: #e2ebf3;
  box-shadow: 0 3px 12px rgba(11, 27, 42, 0.05);
}

.kpi-grid-modern .kpi-card.modern h3 {
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 12px;
}

.panel-soft {
  border-color: #dce8f3;
  box-shadow: 0 4px 14px rgba(11, 27, 42, 0.05);
}

.gauge-wrap {
  margin: 10px 0 14px;
}

.gauge-track {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(90deg, #c62828 0%, #f9a825 50%, #2e7d32 100%);
  overflow: hidden;
}

.gauge-track.modern {
  height: 16px;
  background: #edf3f9;
}

.gauge-fill {
  height: 100%;
  background: rgba(255, 255, 255, 0.45);
}

.health-ok {
  background: linear-gradient(90deg, #1f9d55 0%, #0f7f44 100%);
}

.health-warn {
  background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
}

.health-bad {
  background: linear-gradient(90deg, #ef4444 0%, #b91c1c 100%);
}

.metric-rows p {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px dashed #e6eef6;
  margin: 0;
  padding: 8px 0;
}

.metric-rows p:first-child {
  border-top: none;
}

.metric-rows span {
  color: var(--muted);
}

.list-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid #ecf1f6;
  padding: 8px 0;
}

.list-row:first-of-type {
  border-top: none;
}

.perf-table {
  margin-top: 8px;
}

.perf-row.head {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.perf-row {
  display: grid;
  grid-template-columns: 1.5fr repeat(5, 1fr);
  gap: 10px;
  border-bottom: 1px solid #edf1f5;
  padding: 8px 0;
}

.client-block {
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}

.token-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  border-top: 1px solid #edf1f5;
  padding-top: 8px;
  margin-top: 8px;
}
.inline-form { margin: 0; }

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
}
.auth-card { width: min(460px, 92vw); }

.modern-auth-bg {
  background:
    linear-gradient(rgba(11, 27, 42, 0.45), rgba(11, 27, 42, 0.45)),
    var(--auth-bg-image),
    radial-gradient(circle at 10% 10%, #dbeefe 0, transparent 35%),
    radial-gradient(circle at 90% 90%, #dff4ee 0, transparent 36%),
    linear-gradient(180deg, #eef6ff 0%, #f8fcff 100%);
  background-size: cover, cover, auto, auto, auto;
  background-position: center, center, center, center, center;
}

.auth-shell {
  width: min(980px, 95vw);
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 18px;
  align-items: stretch;
}

.auth-shell-single {
  width: min(520px, 95vw);
  grid-template-columns: 1fr;
}

.auth-brand {
  background:
    radial-gradient(circle at top right, #dff0ff 0, transparent 45%),
    #ffffff;
  border-color: #d5e6f7;
}

.auth-logo {
  max-width: 190px;
  width: 100%;
  height: auto;
  margin-bottom: 12px;
}

.auth-brand h1 {
  margin-top: 0;
}

.auth-points {
  margin: 12px 0 0;
  padding-left: 18px;
  color: #3a5167;
}

.auth-points li {
  margin-bottom: 8px;
}

.modern-auth-card {
  border-color: #dce8f4;
  box-shadow: 0 8px 24px rgba(10, 30, 48, 0.08);
}

.human-check {
  border: 1px solid #d8e8f5;
  background: #f7fbff;
  border-radius: 10px;
  padding: 10px;
}

.human-check p {
  margin: 0 0 6px;
}

.code-block {
  background: #0f1720;
  color: #d7e2ee;
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.page-head h1 {
  margin-bottom: 2px;
}

.page-head p {
  margin-top: 0;
}

.page-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.new-client-btn {
  background: linear-gradient(120deg, #0f7fc7 0%, #0a5f96 100%);
  color: #fff;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
}

.token-highlight {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.filters-card {
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.filters-grid > div {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filters-grid label {
  display: block;
  font-weight: 600;
  color: #29425a;
}

.filters-grid input,
.filters-grid select {
  width: 100%;
  min-height: 42px;
}

select {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
}

.clients-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.clients-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.client-card {
  border: 1px solid #d6e1ec;
  border-radius: 12px;
  padding: 14px;
  background: #fff;
  box-shadow: 0 4px 14px rgba(17, 38, 58, 0.05);
}

.client-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.client-card-head h3 {
  margin: 0;
}

.client-card-head p {
  margin: 4px 0 0;
}

.client-meta {
  margin: 12px 0;
}

.tiny {
  font-size: 12px;
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  margin-right: 6px;
}

.badge.active {
  background: #e8f8ef;
  color: #146c43;
}

.badge.paused {
  background: #fff4e5;
  color: #9a6100;
}

.badge.revoked {
  background: #ffe9e9;
  color: #a62525;
}

.token-table-wrap {
  overflow-x: auto;
}

.token-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

.token-table th,
.token-table td {
  border-top: 1px solid #ecf1f6;
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

.token-table thead th {
  color: var(--muted);
  font-size: 13px;
  background: #f8fbff;
}

.mini {
  padding: 7px 10px;
  font-size: 12px;
  border-radius: 6px;
}

.actions-inline {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.token-cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.token-mini-card {
  border: 1px solid #e5edf5;
  border-radius: 10px;
  padding: 10px;
  background: #fcfeff;
}

.token-mini-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.token-value {
  display: block;
  margin-top: 8px;
  margin-bottom: 8px;
  background: #f4f8fc;
  padding: 8px;
  border-radius: 8px;
  word-break: break-all;
}

.modal-shell {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 80;
}

.modal-shell.open {
  display: block;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 24, 36, 0.5);
}

.modal-card {
  position: relative;
  max-width: 560px;
  margin: 8vh auto 0;
  background: #fff;
  border-radius: 14px;
  border: 1px solid #dbe6f0;
  box-shadow: 0 18px 42px rgba(8, 24, 40, 0.25);
  padding: 16px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.modal-head h2 {
  margin: 0;
}

.icon-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  padding: 0;
  font-size: 20px;
  line-height: 1;
  background: #ebf2f8;
  color: #274056;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

.site-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  border-top: 1px solid #d5e1ed;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
}

.site-footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #26415a;
  font-weight: 700;
}

.site-footer-logo {
  width: 120px;
  height: auto;
  object-fit: contain;
}

@media (max-width: 780px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 10px; }
  .perf-row { grid-template-columns: 1fr; gap: 4px; }
  .dash-hero { flex-direction: column; align-items: flex-start; }
  .hero-pills { justify-content: flex-start; }
  .filters-grid { grid-template-columns: 1fr; }
  .client-card-head { flex-direction: column; align-items: flex-start; }
  .clients-grid-3 { grid-template-columns: 1fr; }
  .page-head-row { flex-direction: column; align-items: flex-start; }
  .modal-card { margin: 4vh 10px 0; }
  .auth-shell { grid-template-columns: 1fr; }
}

@media (min-width: 781px) and (max-width: 1180px) {
  .clients-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
