@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');
:root {
  --bg: #f4f6fb;
  --white: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #4f46e5;
  --primary-soft: #eef2ff;
  --ok: #059669;
  --err: #dc2626;
  --warn: #d97706;
  --radius: 16px;
  --shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.1);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: Inter, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { color: var(--primary); text-decoration: none; }
button, input, select { font: inherit; }
.hidden { display: none !important; }

.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #4f46e5, #06b6d4);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 800;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--muted);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 18px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: 0.15s;
}
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-ghost {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-block { width: 100%; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 28px 18px 48px; }
.h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 6px; }
.sub { color: var(--muted); font-size: 0.92rem; margin-bottom: 22px; }

/* Login */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(800px 400px at 0% 0%, #e0e7ff 0%, transparent 50%),
    radial-gradient(600px 300px at 100% 0%, #cffafe 0%, transparent 45%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: var(--shadow-lg);
}
.login-card .brand { margin-bottom: 18px; }
.login-card h1 { font-size: 1.35rem; font-weight: 800; margin-bottom: 6px; }
.login-card .lead { color: var(--muted); font-size: 0.9rem; margin-bottom: 22px; }
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text);
  outline: none;
}
.field input:focus { border-color: var(--primary); background: #fff; }
.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  background: var(--bg);
  padding: 4px;
  border-radius: 12px;
}
.tabs button {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
}
.tabs button.on {
  background: var(--white);
  color: var(--primary);
  box-shadow: var(--shadow);
}
.msg { font-size: 0.85rem; margin-top: 12px; min-height: 1.3em; }
.msg.err { color: var(--err); }
.msg.ok { color: var(--ok); }
.hint {
  margin-top: 16px;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
}

/* Apps grid */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.app-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
  transition: 0.18s;
  cursor: pointer;
  text-align: left;
  display: block;
  color: inherit;
}
.app-card:hover {
  transform: translateY(-3px);
  border-color: #c7d2fe;
  box-shadow: var(--shadow-lg);
}
.app-card.disabled {
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}
.app-card .badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 8px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.badge.live { background: #ecfdf5; color: var(--ok); }
.badge.soon { background: #f1f5f9; color: var(--muted); }
.app-card h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 6px; }
.app-card p { font-size: 0.84rem; color: var(--muted); line-height: 1.45; }

/* Dashboard widgets */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.kpi {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.kpi .label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 6px;
}
.kpi .value {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.panel h3 { font-size: 0.95rem; font-weight: 700; margin-bottom: 12px; }
.grid-2 {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 16px;
}
@media (max-width: 860px) {
  .grid-2 { grid-template-columns: 1fr; }
}
table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
th {
  text-align: left;
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
}
td { padding: 10px 6px; border-bottom: 1px solid var(--border); }
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
}
.tag.ok { background: #ecfdf5; color: var(--ok); }
.tag.err { background: #fef2f2; color: var(--err); }
.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 0.8rem;
}
.bar-row .name {
  width: 110px;
  color: var(--muted);
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-track {
  flex: 1;
  height: 8px;
  background: #e2e8f0;
  border-radius: 99px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #4f46e5, #06b6d4);
  border-radius: 99px;
}
.pending-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 12px;
  padding: 14px;
  font-size: 0.88rem;
  color: #92400e;
  margin-bottom: 16px;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: contain;
  background: #0a0a0a;
  padding: 3px;
}
.login-card .brand-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  padding: 4px;
  margin-bottom: 4px;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  align-items: end;
}
.filters .field { margin: 0; min-width: 120px; }
.filters select, .filters input {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text);
}
.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  background: #059669;
}
.status-dot.down { background: #dc2626; }
.status-dot.warn { background: #d97706; }
