/* ── Reset & base ──────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:      #1a3c5e;
  --accent:       #3b82f6;
  --bg:           #0f1923;
  --bg2:          #152030;
  --glass-bg:     rgba(255,255,255,0.05);
  --glass-border: rgba(255,255,255,0.09);
  --text:         #e2e8f0;
  --text-muted:   #8a9bb0;
  --green:        #22c55e;
  --red:          #ef4444;
  --yellow:       #f59e0b;
  --blue:         #3b82f6;
  --radius:       10px;
  --sidebar-w:    230px;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 13.5px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

.glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* ── Layout ─────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ─────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  border-right: 1px solid var(--glass-border);
  z-index: 10;
}

.sidebar-logo {
  display: flex; align-items: center; gap: 9px;
  font-size: 15px; font-weight: 700;
  color: var(--accent);
  margin-bottom: 28px; padding-left: 4px;
}
.sidebar-logo i { width: 20px; height: 20px; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.nav-link {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 7px;
  color: var(--text-muted);
  transition: all .15s; font-size: 13px;
}
.nav-link:hover, .nav-link.active {
  background: rgba(59,130,246,.12); color: var(--accent);
}
.nav-link i { width: 15px; height: 15px; flex-shrink: 0; }

.sidebar-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--glass-border); }
.sidebar-ts { font-size: 11px; color: var(--text-muted); padding: 4px 10px 8px; }
.logout:hover { color: var(--red) !important; background: rgba(239,68,68,.08) !important; }

/* ── Main ─────────────────────────────────────────── */
.main-content { margin-left: var(--sidebar-w); flex: 1; padding: 28px 32px; min-width: 0; }

/* ── Topbar ─────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.topbar h1 { font-size: 20px; font-weight: 700; }

/* ── Section ─────────────────────────────────────────── */
.section { margin-bottom: 40px; scroll-margin-top: 20px; }

.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.section-header h2 {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600; color: var(--text);
  text-transform: uppercase; letter-spacing: .05em;
}
.section-header h2 i { width: 16px; height: 16px; color: var(--accent); }

.mt-12 { margin-top: 12px; }

/* ── Overview cards ──────────────────────────────────── */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.ov-card {
  border-radius: var(--radius);
  padding: 18px 20px;
  display: flex; align-items: flex-start; gap: 14px;
}

.ov-icon {
  width: 38px; height: 38px; border-radius: 9px;
  background: rgba(255,255,255,.06);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ov-icon i { width: 18px; height: 18px; }

.ov-body { min-width: 0; }
.ov-label { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; }
.ov-val { display: block; font-size: 20px; font-weight: 700; line-height: 1.2; }
.ov-val.green { color: var(--green); }
.ov-val.red   { color: var(--red); }
.ov-sub { display: block; font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.skeleton {
  min-height: 80px;
  background: linear-gradient(90deg, rgba(255,255,255,.04) 25%, rgba(255,255,255,.07) 50%, rgba(255,255,255,.04) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ── App badges ──────────────────────────────────── */
.app-badges {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-bottom: 4px;
}

.app-badge {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 20px;
  font-size: 12.5px;
}

.badge-outline-ok   { border-color: rgba(34,197,94,.3) !important; }
.badge-outline-warn { border-color: rgba(245,158,11,.3) !important; }
.badge-outline-fail { border-color: rgba(239,68,68,.3) !important; }

.app-badge-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0;
}
.dot-ok   { background: var(--green); box-shadow: 0 0 6px rgba(34,197,94,.6); }
.dot-warn { background: var(--yellow); box-shadow: 0 0 6px rgba(245,158,11,.6); }
.dot-fail { background: var(--red); box-shadow: 0 0 6px rgba(239,68,68,.6); animation: pulse-red 1.5s infinite; }

@keyframes pulse-red {
  0%,100% { box-shadow: 0 0 4px rgba(239,68,68,.6); }
  50%      { box-shadow: 0 0 10px rgba(239,68,68,.9); }
}

.app-badge-name { font-weight: 600; color: var(--text); }
.app-badge-stat { font-size: 11.5px; color: var(--text-muted); }

/* ── Table ───────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--glass-border); }

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }

.tbl thead th {
  padding: 10px 14px; text-align: left;
  font-weight: 600; font-size: 11.5px;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em;
  background: rgba(255,255,255,.035);
  border-bottom: 1px solid var(--glass-border);
  white-space: nowrap;
}
.tbl thead th.num { text-align: right; }

.tbl tbody tr { border-bottom: 1px solid rgba(255,255,255,.04); }
.tbl tbody tr:last-child { border-bottom: none; }
.tbl tbody tr:hover { background: rgba(255,255,255,.025); }

.tbl td { padding: 10px 14px; vertical-align: middle; }
.tbl td.num { text-align: right; }
.tbl tfoot tr { border-top: 1px solid var(--glass-border); }
.tbl tfoot td { padding: 10px 14px; }
.tbl tfoot td.num { text-align: right; }

.tfoot-row td { background: rgba(255,255,255,.03); }

.td-loading, .td-error { color: var(--text-muted); font-style: italic; padding: 16px 14px !important; }
.td-error { color: var(--red); }
.na { color: var(--text-muted); opacity: .3; text-align: center; }
.route-cell { font-family: monospace; font-size: 12px; color: var(--text-muted); }
.dim { color: var(--text-muted); font-size: 12px; }

.green { color: var(--green); }
.yellow { color: var(--yellow); }
.red    { color: var(--red); }

.td-err-inline {
  display: inline-block; margin-left: 4px;
  color: var(--yellow); font-size: 11px; cursor: help;
}

/* ── Badges ──────────────────────────────────────── */
.badge {
  display: inline-block; font-size: 11px;
  padding: 2px 7px; border-radius: 20px; font-weight: 600;
}
.badge-ok   { background: rgba(34,197,94,.12);  color: var(--green); }
.badge-fail { background: rgba(239,68,68,.12);  color: var(--red); }
.badge-warn { background: rgba(245,158,11,.12); color: var(--yellow); }
.badge-skip { background: rgba(148,163,184,.08); color: var(--text-muted); }

.ms { font-size: 10px; color: var(--text-muted); margin-left: 4px; }

/* ── Buttons ─────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 7px; border: none;
  cursor: pointer; font-size: 13px; font-weight: 500;
  transition: all .15s;
}
.btn i { width: 14px; height: 14px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #2563eb; }
.btn-outline { background: transparent; color: var(--text-muted); border: 1px solid var(--glass-border); }
.btn-outline:hover { background: var(--glass-bg); color: var(--text); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── Alerts ──────────────────────────────────────── */
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; }
.alert-warning { background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.25); color: var(--yellow); }

/* ── Log ─────────────────────────────────────────── */
.log-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }

.tab-btn {
  padding: 5px 13px; border-radius: 6px;
  border: 1px solid var(--glass-border);
  background: var(--glass-bg); color: var(--text-muted);
  cursor: pointer; font-size: 12px; transition: all .15s;
}
.tab-btn:hover, .tab-btn.active {
  background: rgba(59,130,246,.12); color: var(--accent);
  border-color: rgba(59,130,246,.3);
}

.log-box { border-radius: var(--radius); padding: 14px; min-height: 220px; }

.log-meta { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.log-path { font-family: monospace; font-size: 11px; color: var(--text-muted); }
.log-lines-count { font-size: 11px; color: var(--text-muted); }

.log-pre {
  font-family: 'JetBrains Mono', 'Fira Mono', monospace;
  font-size: 11.5px; white-space: pre-wrap;
  word-break: break-all; color: var(--text);
  line-height: 1.65; max-height: 380px; overflow-y: auto;
}

/* ── Auth ─────────────────────────────────────────── */
.auth-wrap {
  min-height: 100vh; display: flex;
  align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse at 25% 40%, rgba(26,60,94,.7) 0%, transparent 55%),
    radial-gradient(ellipse at 75% 75%, rgba(59,130,246,.15) 0%, transparent 50%),
    var(--bg);
}

.auth-box { width: 100%; max-width: 360px; padding: 36px; border-radius: 14px; }

.auth-logo {
  display: flex; align-items: center; gap: 9px; justify-content: center;
  font-size: 18px; font-weight: 700; color: var(--accent);
  margin-bottom: 5px;
}
.auth-logo i { width: 24px; height: 24px; }

.auth-sub { text-align: center; color: var(--text-muted); font-size: 12.5px; margin-bottom: 26px; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; color: var(--text-muted); margin-bottom: 5px; }
.form-group input {
  width: 100%; padding: 9px 13px;
  border-radius: 7px; border: 1px solid var(--glass-border);
  background: rgba(255,255,255,.07); color: var(--text);
  font-size: 13.5px; outline: none; transition: border .15s;
}
.form-group input:focus { border-color: var(--accent); }

.btn-full { width: 100%; justify-content: center; margin-top: 4px; }

/* ── Scrollbar ───────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 3px; }

/* ── KPI řada ─────────────────────────────────────── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.kpi {
  border-radius: var(--radius);
  padding: 16px 18px;
}

.kpi-lbl {
  font-size: 11px; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-muted);
  margin-bottom: 6px;
}

.kpi-val {
  font-size: 22px; font-weight: 700; line-height: 1;
}
.kpi-val.green { color: var(--green); }
.kpi-val.yellow { color: var(--yellow); }
.kpi-val.red    { color: var(--red); }

/* ── App karty ─────────────────────────────────────── */
.app-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}

.app-card {
  border-radius: var(--radius);
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 14px;
}

.app-card-head {
  display: flex; align-items: center; gap: 8px;
}

.app-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
  background: var(--text-muted);
}
.dot-ok   { background: var(--green); box-shadow: 0 0 6px rgba(34,197,94,.5); }
.dot-warn { background: var(--yellow); box-shadow: 0 0 6px rgba(245,158,11,.5); }
.dot-fail { background: var(--red); animation: pulse-red 1.5s infinite; }
@keyframes pulse-red {
  0%,100%{ box-shadow: 0 0 4px rgba(239,68,68,.5); }
  50%    { box-shadow: 0 0 10px rgba(239,68,68,.9); }
}

.app-card-name { font-weight: 700; font-size: 13px; flex: 1; }
.app-card-status { font-size: 11px; color: var(--text-muted); }

.app-card-body {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.app-stat {}
.app-stat-val { font-size: 20px; font-weight: 700; line-height: 1; }
.app-stat-val.green  { color: var(--green); }
.app-stat-val.yellow { color: var(--yellow); }
.app-stat-val.red    { color: var(--red); }
.app-stat-lbl { font-size: 10.5px; color: var(--text-muted); margin-top: 2px; text-transform: uppercase; letter-spacing: .04em; }

.app-card-footer {
  display: flex; justify-content: space-between;
  padding-top: 10px; border-top: 1px solid var(--glass-border);
  font-size: 11.5px; color: var(--text-muted);
}
.app-mrr { color: var(--green); font-weight: 600; }

/* ── Stripe feed ─────────────────────────────────── */
.stripe-feed {
  padding: 0.5rem 0;
  max-height: 360px;
  overflow-y: auto;
}
.stripe-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--glass-border);
  font-size: 13px;
}
.stripe-row:last-child { border-bottom: none; }
.stripe-ts { min-width: 80px; font-size: 11.5px; }
.stripe-desc { flex: 1; }

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 1400px) {
  .kpi-row { grid-template-columns: repeat(3, 1fr); }
  .app-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .app-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; padding: 16px; }
  .kpi-row, .app-grid { grid-template-columns: 1fr; }
}
