/* Agness Demo — Login + Admin dashboard */

:root {
  --ag-orange: #f97316;
  --ag-orange-2: #fb923c;
  --ag-ink: #0f172a;
  --ag-muted: #64748b;
  --ag-line: rgba(15, 23, 42, 0.08);
  --ag-bg: #f6f7fb;
  --ag-card: #ffffff;
  --ag-side: #0b1220;
  --ag-side-2: #111827;
  --ag-good: #10b981;
  --ag-warn: #f59e0b;
  --ag-bad: #ef4444;
  --ag-radius: 18px;
  --ag-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

/* Header Log in outline button */
.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.theme-btn.theme-btn-outline {
  background: transparent !important;
  color: var(--header, #151515) !important;
  border: 1.5px solid rgba(21, 21, 21, 0.18) !important;
  box-shadow: none !important;
}
.theme-btn.theme-btn-outline:hover {
  background: var(--theme, #ff6b35) !important;
  border-color: var(--theme, #ff6b35) !important;
  color: #fff !important;
}

/* ===== Login page ===== */
.ag-login-page {
  min-height: 100vh;
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(249, 115, 22, 0.22), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(56, 189, 248, 0.16), transparent 55%),
    linear-gradient(160deg, #0b1220 0%, #1e293b 45%, #0f172a 100%);
  color: #fff;
  display: grid;
  place-items: center;
  padding: 24px;
}
.ag-login-card {
  width: min(440px, 100%);
  background: rgba(255, 255, 255, 0.96);
  color: var(--ag-ink);
  border-radius: 24px;
  padding: 36px 32px 28px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  animation: ag-rise 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes ag-rise {
  from { opacity: 0; transform: translateY(18px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.ag-login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}
.ag-login-brand img {
  width: 44px;
  height: 44px;
}
.ag-login-brand strong {
  font-size: 20px;
  letter-spacing: -0.02em;
}
.ag-login-card h1 {
  font-size: 28px;
  margin: 0 0 8px;
  letter-spacing: -0.03em;
}
.ag-login-card .sub {
  color: var(--ag-muted);
  margin: 0 0 28px;
  font-size: 14px;
  line-height: 1.5;
}
.ag-field {
  margin-bottom: 16px;
}
.ag-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}
.ag-field input {
  width: 100%;
  border: 1px solid var(--ag-line);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}
.ag-field input:focus {
  border-color: var(--ag-orange);
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.15);
}
.ag-login-btn {
  width: 100%;
  border: 0;
  border-radius: 12px;
  padding: 15px 18px;
  margin-top: 8px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, #f97316, #ea580c);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.ag-login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 24px rgba(249, 115, 22, 0.35);
}
.ag-login-error {
  display: none;
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 13px;
}
.ag-login-error.show { display: block; }
.ag-login-hint {
  margin-top: 18px;
  font-size: 12px;
  color: var(--ag-muted);
  text-align: center;
}
.ag-login-back {
  display: inline-block;
  margin-top: 16px;
  color: var(--ag-muted);
  text-decoration: none;
  font-size: 13px;
}
.ag-login-back:hover { color: var(--ag-orange); }

/* ===== Admin shell ===== */
.ag-admin {
  min-height: 100vh;
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--ag-bg);
  color: var(--ag-ink);
  display: grid;
  grid-template-columns: 260px 1fr;
}
.ag-side {
  background: linear-gradient(180deg, var(--ag-side) 0%, var(--ag-side-2) 100%);
  color: #e2e8f0;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  box-sizing: border-box;
}
.ag-side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 22px;
}
.ag-side-brand img { width: 36px; height: 36px; }
.ag-side-brand strong { font-size: 17px; color: #fff; }
.ag-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.ag-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 12px;
  color: #94a3b8;
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: 0.15s;
}
.ag-nav a:hover { background: rgba(255,255,255,0.05); color: #fff; }
.ag-nav a.active {
  background: linear-gradient(135deg, rgba(249,115,22,0.95), rgba(251,146,60,0.85));
  color: #fff;
  box-shadow: 0 8px 20px rgba(249,115,22,0.3);
}
.ag-side-cta {
  margin-top: auto;
  background: linear-gradient(145deg, #1e293b, #0f172a);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 16px;
}
.ag-side-cta p {
  margin: 0 0 10px;
  font-size: 13px;
  color: #cbd5e1;
  line-height: 1.4;
}
.ag-side-cta a {
  display: inline-block;
  background: var(--ag-orange);
  color: #fff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 12px;
  border-radius: 999px;
}

.ag-main { padding: 22px 28px 40px; min-width: 0; }
.ag-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.ag-top h1 {
  margin: 0 0 6px;
  font-size: 28px;
  letter-spacing: -0.03em;
}
.ag-top p { margin: 0; color: var(--ag-muted); font-size: 14px; }
.ag-top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.ag-chip {
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--ag-line);
  color: var(--ag-muted);
}
.ag-btn {
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  background: #fff;
  border: 1px solid var(--ag-line);
  color: var(--ag-ink);
}
.ag-btn.primary {
  background: linear-gradient(135deg, #f97316, #ea580c);
  border: 0;
  color: #fff;
}
.ag-user {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--ag-line);
  border-radius: 999px;
  padding: 6px 12px 6px 6px;
}
.ag-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #f97316, #fb923c);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 13px;
}
.ag-user small { display: block; color: var(--ag-muted); font-size: 11px; }
.ag-user strong { font-size: 13px; }

.ag-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}
.ag-kpi {
  background: var(--ag-card);
  border-radius: var(--ag-radius);
  padding: 18px;
  box-shadow: var(--ag-shadow);
  border: 1px solid var(--ag-line);
}
.ag-kpi .label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ag-muted);
  font-size: 13px;
  margin-bottom: 10px;
}
.ag-kpi .icon {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: rgba(249,115,22,0.12);
  color: var(--ag-orange);
  font-size: 14px;
}
.ag-kpi .value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 6px;
}
.delta { font-size: 12px; font-weight: 600; }
.delta.up { color: var(--ag-good); }
.delta.down { color: var(--ag-bad); }

.ag-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 0.9fr;
  gap: 14px;
  margin-bottom: 14px;
}
.ag-grid-2 {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}
.ag-card {
  background: var(--ag-card);
  border-radius: var(--ag-radius);
  padding: 18px;
  box-shadow: var(--ag-shadow);
  border: 1px solid var(--ag-line);
  min-width: 0;
}
.ag-card h3 {
  margin: 0 0 4px;
  font-size: 16px;
  letter-spacing: -0.02em;
}
.ag-card .hint {
  margin: 0 0 14px;
  color: var(--ag-muted);
  font-size: 12px;
}
.chart-box { position: relative; height: 240px; }
.chart-box.sm { height: 210px; }

.ag-table-wrap { overflow: auto; }
table.ag-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.ag-table th, .ag-table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--ag-line);
  white-space: nowrap;
}
.ag-table th {
  color: var(--ag-muted);
  font-weight: 600;
  font-size: 12px;
}
.pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: capitalize;
}
.pill.ok { background: #d1fae5; color: #047857; }
.pill.warn { background: #ffedd5; color: #c2410c; }
.pill.bad { background: #fee2e2; color: #b91c1c; }

/* Heatmap */
#heatmap {
  display: grid;
  grid-template-columns: 42px repeat(8, 1fr);
  gap: 4px;
  align-items: center;
}
.hm-corner { height: 18px; }
.hm-h, .hm-d {
  font-size: 10px;
  color: var(--ag-muted);
  text-align: center;
}
.hm-d { text-align: left; }
.hm-cell {
  aspect-ratio: 1;
  border-radius: 6px;
  background: #ffedd5;
}
.hm-cell.l0 { background: #fff7ed; }
.hm-cell.l1 { background: #fed7aa; }
.hm-cell.l2 { background: #fdba74; }
.hm-cell.l3 { background: #fb923c; }
.hm-cell.l4 { background: #ea580c; }

@media (max-width: 1200px) {
  .ag-kpis { grid-template-columns: repeat(2, 1fr); }
  .ag-grid, .ag-grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .ag-admin { grid-template-columns: 1fr; }
  .ag-side {
    position: relative;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }
  .ag-nav { flex-direction: row; flex-wrap: wrap; width: 100%; }
  .ag-side-cta { display: none; }
}
