/* PrePoint by MIDHub Solutions — design tokens
   Brand colors sampled directly from the MIDHub Solutions logo:
   orange #F47820, green #03A56A, charcoal #545454.
   Primary actions/links use brand orange; status "up"/success reuses
   brand green (a happy match with monitoring semantics). Status
   red/amber stay semantic (down/warning) rather than brand-tied.
   Type: Poppins for UI text, JetBrains Mono for anything numeric/technical —
   uptime %, response times, timestamps — so data reads like data.
*/

@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
  --brand-orange: #f47820;
  --brand-orange-dark: #d9660f;
  --brand-orange-dim: #fdeee2;
  --brand-green: #03a56a;
  --brand-green-dark: #028656;
  --brand-green-dim: #e2f6ee;
  --brand-charcoal: #545454;

  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-alt: #f1f4fa;
  --line: #e2e7f2;

  --blue: var(--brand-orange);
  --blue-bright: var(--brand-orange-dark);
  --blue-dim: var(--brand-orange-dim);

  --up: var(--brand-green);
  --up-dim: var(--brand-green-dim);
  --down: #d0273c;
  --down-dim: #fdeaec;
  --warn: #b8790b;
  --warn-dim: #fdf1de;
  --info: var(--brand-orange-dark);

  --text-hi: #131a2c;
  --text-mid: #5b6784;
  --text-low: #8894ac;

  --radius: 10px;
  --font-ui: 'Poppins', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SFMono-Regular', monospace;
  --shadow-card: 0 1px 2px rgba(19, 26, 44, 0.04), 0 1px 12px rgba(19, 26, 44, 0.03);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text-hi);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

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

.mono { font-family: var(--font-mono); }

/* ---------- Layout shell ---------- */

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 22px;
  color: var(--text-hi);
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand img { width: 34px; height: 34px; flex-shrink: 0; }
.brand .brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand .brand-name { font-weight: 800; font-size: 17px; letter-spacing: 0.2px; color: var(--brand-charcoal); }
.brand .brand-by { font-size: 10.5px; font-weight: 600; letter-spacing: 0.15px; }
.brand .brand-by .by { color: var(--text-low); font-weight: 500; }
.brand .brand-by .mid { color: var(--brand-orange); }
.brand .brand-by .hub { color: var(--brand-green); }
.brand .brand-by .solutions { color: var(--brand-charcoal); }

.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-mid);
  font-size: 14px;
  font-weight: 500;
}
.nav-link:hover { background: var(--surface-alt); color: var(--text-hi); text-decoration: none; }
.nav-link.active { background: var(--blue-dim); color: var(--blue-bright); }
.nav-link svg { width: 17px; height: 17px; flex-shrink: 0; }

.sidebar-footer {
  margin-top: auto;
  padding: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}
.sidebar-user { font-size: 13px; color: var(--text-mid); margin-bottom: 8px; }
.btn-logout {
  width: 100%; padding: 8px 10px; border-radius: 8px;
  background: transparent; border: 1px solid var(--line);
  color: var(--text-mid); font-size: 13px; cursor: pointer; font-family: var(--font-ui);
}
.btn-logout:hover { border-color: var(--down); color: var(--down); }

.main {
  flex: 1;
  padding: 28px 34px 60px;
  max-width: 1240px;
}

.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 26px;
  flex-wrap: wrap;
  gap: 12px;
}
.page-header h1 { font-size: 22px; margin: 0 0 4px; font-weight: 700; }
.page-header p { margin: 0; color: var(--text-mid); font-size: 13.5px; }

/* ---------- Cards / grid ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
}

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }

.stat-card { padding: 16px 18px; }
.stat-card .label { font-size: 12px; color: var(--text-low); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 8px; }
.stat-card .value { font-family: var(--font-mono); font-size: 28px; font-weight: 700; }
.stat-card .value.up { color: var(--up); }
.stat-card .value.down { color: var(--down); }

/* ---------- Status pill ---------- */

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; font-family: var(--font-mono);
  text-transform: uppercase; letter-spacing: 0.4px;
}
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; }
.pill.up { background: var(--up-dim); color: var(--up); }
.pill.up::before { background: var(--up); }
.pill.down { background: var(--down-dim); color: var(--down); }
.pill.down::before { background: var(--down); }
.pill.unknown { background: var(--surface-alt); color: var(--text-low); }
.pill.unknown::before { background: var(--text-low); }
.pill.warning { background: var(--warn-dim); color: var(--warn); }
.pill.warning::before { background: var(--warn); }
.pill.critical { background: var(--down-dim); color: var(--down); }
.pill.critical::before { background: var(--down); }
.pill.info { background: var(--blue-dim); color: var(--blue-bright); }
.pill.info::before { background: var(--blue-bright); }

/* ---------- Tables / lists ---------- */

.site-list { display: flex; flex-direction: column; gap: 10px; }
.site-row {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  transition: border-color .15s;
}
.site-row:hover { border-color: var(--blue); }
.site-row .site-info { flex: 1; min-width: 0; }
.site-row .site-name { font-weight: 600; font-size: 14.5px; }
.site-row .site-url { font-size: 12.5px; color: var(--text-low); font-family: var(--font-mono); }
.site-row .site-meta { font-size: 12px; color: var(--text-low); font-family: var(--font-mono); white-space: nowrap; }

.incident-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.incident-row:last-child { border-bottom: none; }
.incident-row .msg { flex: 1; }
.incident-row .msg strong { font-weight: 600; }
.incident-row .time { color: var(--text-low); font-family: var(--font-mono); font-size: 12px; white-space: nowrap; }

/* ---------- Forms ---------- */

label { display: block; font-size: 13px; color: var(--text-mid); margin-bottom: 6px; font-weight: 500; }
input, select, textarea {
  width: 100%;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  color: var(--text-hi);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: var(--font-ui);
  margin-bottom: 16px;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(59,109,240,0.14);
}
.field-hint { font-size: 12px; color: var(--text-low); margin-top: -12px; margin-bottom: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px; font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: var(--font-ui);
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-bright); }
.btn-secondary { background: var(--surface); border-color: var(--line); color: var(--text-hi); }
.btn-secondary:hover { border-color: var(--blue); }
.btn-danger { background: transparent; border-color: var(--down-dim); color: var(--down); }
.btn-danger:hover { background: var(--down-dim); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }

/* ---------- Misc ---------- */

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-low); }
.empty-state h3 { color: var(--text-hi); margin-bottom: 6px; }

.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--surface); border: 1px solid var(--line);
  padding: 12px 18px; border-radius: 8px; font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(19,26,44,0.12);
  z-index: 999; max-width: 320px;
}
.toast.error { border-color: var(--down); color: var(--down); }
.toast.success { border-color: var(--up); color: var(--up); }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(19,26,44,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 26px; width: 100%; max-width: 460px;
  max-height: 88vh; overflow-y: auto;
  box-shadow: 0 20px 50px rgba(19,26,44,0.18);
}
.modal h2 { margin: 0 0 18px; font-size: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 6px; }

.section-title {
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.6px;
  color: var(--text-low); margin: 30px 0 12px;
}

.uptime-bars { display: flex; gap: 2px; align-items: flex-end; height: 34px; }
.uptime-bars .bar { flex: 1; min-width: 3px; border-radius: 1px; background: var(--up); }
.uptime-bars .bar.down { background: var(--down); }
.uptime-bars .bar.empty { background: var(--surface-alt); }

.metric-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 700px) { .metric-row { grid-template-columns: 1fr 1fr; } }
.metric-box { background: var(--surface-alt); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.metric-box .label { font-size: 11.5px; color: var(--text-low); text-transform: uppercase; letter-spacing: 0.4px; }
.metric-box .value { font-family: var(--font-mono); font-size: 20px; font-weight: 700; margin-top: 4px; }

.loading { text-align: center; padding: 40px; color: var(--text-low); font-family: var(--font-mono); font-size: 13px; }

.checkbox-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.checkbox-row input { width: auto; margin: 0; }
.checkbox-row label { margin: 0; }

/* ---------- cPanel / WordPress quick-login buttons ---------- */

.service-logo-btn { padding-top: 7px; padding-bottom: 7px; }
.service-logo { height: 16px; width: auto; display: block; }
.service-logo-sm { height: 13px; width: auto; display: block; }
.service-logo-round { border-radius: 50%; height: 20px; }
.service-logo-btn.btn-sm .service-logo-round { height: 17px; }

/* ---------- Core Web Vitals / page speed scores ---------- */

.vitals-scores { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.score-badge { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 96px; }
.score-badge .ring {
  width: 72px; height: 72px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 21px; font-weight: 700;
  border: 5px solid var(--line);
}
.score-badge .ring.good { border-color: var(--up); color: var(--up); background: var(--up-dim); }
.score-badge .ring.warn { border-color: var(--warn); color: var(--warn); background: var(--warn-dim); }
.score-badge .ring.poor { border-color: var(--down); color: var(--down); background: var(--down-dim); }
.score-badge .ring.unknown { color: var(--text-low); background: var(--surface-alt); }
.score-badge .name { font-size: 12.5px; color: var(--text-mid); font-weight: 600; text-align: center; }

.metric-box .metric-sub { margin-top: 6px; }

.vitals-trend { display: flex; gap: 2px; align-items: flex-end; height: 36px; }
.vitals-trend .bar { flex: 1; min-width: 3px; border-radius: 1px; }
.vitals-trend .bar.good { background: var(--up); }
.vitals-trend .bar.warn { background: var(--warn); }
.vitals-trend .bar.poor { background: var(--down); }
.vitals-trend .bar.empty { background: var(--surface-alt); }

/* ---------- Search Console keyword table ---------- */

.sc-header-row {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 14px; flex-wrap: wrap; gap: 6px;
}
.sc-period { font-size: 12px; color: var(--text-low); font-family: var(--font-mono); }
.sc-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.sc-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--text-low); font-weight: 600; padding: 0 10px 8px; border-bottom: 1px solid var(--line);
}
.sc-table th.num, .sc-table td.num { text-align: right; }
.sc-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); }
.sc-table tr:last-child td { border-bottom: none; }
.sc-table td.query { font-weight: 500; color: var(--text-hi); max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-table td.num { font-family: var(--font-mono); color: var(--text-mid); }
.sc-connect-btn { margin-top: 14px; }

.sc-trend-block { margin-bottom: 18px; }
.sc-trend-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; color: var(--text-low); text-transform: uppercase; letter-spacing: 0.4px;
  margin-bottom: 6px;
}
.sc-trend-label .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.sc-trend-label .dot.clicks { background: var(--brand-green); }
.sc-trend-label .dot.impressions { background: var(--brand-orange); }
.sc-trend-label .total { margin-left: auto; font-family: var(--font-mono); color: var(--text-mid); font-weight: 600; }
.vitals-trend .bar.clicks { background: var(--brand-green); }
.vitals-trend .bar.impressions { background: var(--brand-orange); }
