@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800&display=swap");
/* INTERVAL portal prototype — clean professional SaaS */
:root {
  /* Brand guide v1.0 — locked color system */
  --navy: #0f2a3c;
  --teal: #0e7490;
  --teal-hover: #0c5f76;
  --page-bg: #f6f8fb;
  --card: #ffffff;
  --border: #e2e8f0;
  --ink: #1a2332;
  --ink-2: #5b6b82;
  --table-head-bg: #f1f5f9;
  /* Status palette (4.5:1 contrast) */
  --danger: #991b1b; --danger-bg: #fef2f2;
  --warn: #92400e; --warn-bg: #fffbeb;
  --ok: #166534; --ok-bg: #f0fdf4;
  --info: #1d4ed8; --info-bg: #eff6ff;
  --reg: #075985; --reg-bg: #e0f2fe;
  --accent: #5b21b6; --accent-bg: #f5f3ff;
  --primary: var(--teal); --muted-bg: #f1f5f9;
  /* Legacy aliases */
  --muted: var(--ink-2);
  --line: var(--border);
  --bg: var(--page-bg);
  --accent-old: var(--teal);
  --accent-dark: var(--teal-hover);
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.5;
}
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }

/* top bar */
.topbar { background: var(--navy); color: #fff; }
.topbar-inner { max-width: 1100px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 7px; background: var(--accent);
  color: #fff; font-weight: 800; font-size: 17px; }
.brand-mark.lg { width: 52px; height: 52px; font-size: 30px; border-radius: 12px; }
.brand-name { font-weight: 800; letter-spacing: 2px; font-size: 17px; }
.brand-sub { color: #9fb3c8; font-size: 12px; }
.nav { display: flex; gap: 4px; }
.nav a { color: #cbd5e1; padding: 8px 14px; border-radius: 6px; font-weight: 600; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.08); text-decoration: none; }
.nav a.active { color: #fff; background: rgba(255,255,255,.14); }
.userbox { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.user-name { font-weight: 600; font-size: 13px; text-align: right; line-height: 1.3; }
.user-name small { display: block; color: #9fb3c8; font-weight: 400; }
.demo-badge { background: #fef3c7; color: #92400e; font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 20px; letter-spacing: .4px; text-transform: uppercase; white-space: nowrap; }
.link-btn { background: none; border: none; color: #9fb3c8; cursor: pointer; font-size: 13px; padding: 0; }
.link-btn:hover { color: #fff; text-decoration: underline; }
.inline-form { display: inline; margin: 0; }

/* page */
.page { max-width: 1100px; margin: 0 auto; padding: 28px 20px 60px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.page-head h1 { margin: 0 0 4px; font-size: 26px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.crumbs { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.bnotes { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; margin: 0 0 18px; }

/* stats */
.stat-row { display: flex; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 20px; min-width: 150px; }
.stat-num { display: block; font-size: 24px; font-weight: 800; }
.stat-label { color: var(--muted); font-size: 13px; }
.stat-danger .stat-num { color: var(--danger); }
.stat-warn .stat-num { color: var(--warn); }

/* building cards */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.bcard { background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 18px; color: var(--ink); display: block; }
.bcard:hover { text-decoration: none; border-color: var(--accent); box-shadow: 0 2px 10px rgba(14,116,144,.12); }
.bcard h2 { margin: 0 0 2px; font-size: 18px; }
.bcard-meta { color: var(--muted); font-size: 13px; display: flex; gap: 8px; margin: 8px 0 12px; }
.bcard-status { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.bcard-link { color: var(--teal); font-weight: 600; font-size: 14px; }

/* pills & tags */
/* R2-B3: deduped pill rules (aliases share one definition) */
.pill-progress, .pill-in_progress { background: var(--info-bg); color: #1d4ed8; }
.pill-complete, .pill-stale { background: #f1f5f9; color: var(--muted); }
.pill-lg { font-size: 14px; padding: 6px 16px; }
.disclaimer { background: #fffbeb; border: 1px solid #fde68a; color: #92400e;
  padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 18px; }
.filter-row { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.filter-row select { padding: 6px 10px; border-radius: 6px; border: 1px solid #cbd5e1; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; background: #f1f5f9;
  color: #475569; padding: 2px 8px; border-radius: 5px; }
.tag-reg { background: #e0f2fe; color: #075985; }

/* tables */
h2 { font-size: 19px; margin: 28px 0 12px; }
.tbl { width: 100%; border-collapse: collapse; background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden; font-size: 14px; }
.tbl th { text-align: left; background: #f1f5f9; color: var(--muted); font-size: 12px;
  text-transform: uppercase; letter-spacing: .5px; padding: 10px 14px; }
.tbl td { padding: 11px 14px; border-top: 1px solid var(--line); vertical-align: top; }
.tbl tr:hover td { background: #f8fafc; }

/* detail */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 8px; }
.detail-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.detail-card h3 { margin: 0 0 10px; font-size: 15px; }
.detail-card h3:not(:first-child) { margin-top: 18px; }
.detail-card dl { margin: 0; display: grid; grid-template-columns: 130px 1fr; row-gap: 8px; }
.detail-card dt { color: var(--muted); font-size: 13px; }
.detail-card dd { margin: 0; font-weight: 600; }

/* alerts */
.alert-list { display: flex; flex-direction: column; gap: 12px; }
.alert { background: var(--card); border: 1px solid var(--line); border-left-width: 5px; border-radius: 10px; padding: 16px 18px; }
.alert-critical { border-left-color: var(--danger); }
.alert-warning { border-left-color: var(--warn); }
.alert-info { border-left-color: #1d4ed8; }
/* R5-3: severity-named alert variants */
.alert-blocked { border-left-color: var(--danger); }
.alert-high { border-left-color: var(--danger); }
.alert-medium { border-left-color: var(--warn); }
.alert-ack { opacity: .62; }
.alert h3 { margin: 8px 0 6px; font-size: 16px; }
.alert p { margin: 0 0 10px; color: #334155; }
.alert-top { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.alert-actions { display: flex; gap: 10px; align-items: center; }

/* buttons */
.btn-lg { font-size: 17px; padding: 13px 34px; }
.btn-small { display: inline-block; background: var(--teal); color: #fff; border-radius: 6px;
  padding: 7px 14px; font-size: 13px; font-weight: 700; border: none; cursor: pointer; }
.btn-small:hover { background: var(--teal-hover); text-decoration: none; color: #fff; }
.btn-ghost { background: #f1f5f9; color: var(--ink); }
.btn-ghost:hover { background: #e2e8f0; color: var(--ink); }

/* search */
.searchbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }
.searchbar input[type="search"] { flex: 1; min-width: 220px; padding: 10px 14px; font-size: 14px;
  border: 1px solid var(--line); border-radius: 8px; }
.searchbar select { padding: 10px 12px; font-size: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* landing */
.landing { display: flex; justify-content: center; padding: 40px 0; }
.landing-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 44px 52px; max-width: 560px; text-align: center; box-shadow: 0 4px 24px rgba(15,42,60,.08); }
.landing-card h1 { letter-spacing: 4px; margin: 16px 0 8px; font-size: 30px; }
.lede { color: var(--muted); font-size: 16px; margin-bottom: 20px; }
.landing-points { text-align: left; margin: 0 auto 26px; max-width: 420px; padding-left: 20px; color: #334155; }
.landing-points li { margin-bottom: 8px; }
.fineprint { color: var(--muted); font-size: 12px; margin-top: 18px; }

.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 18px; border-top: 1px solid var(--line); }

/* iteration 1: upload + review */
.flash-wrap { margin-bottom: 16px; }
.flash { background: #eff6ff; border: 1px solid #bfdbfe; color: var(--info);
  border-radius: 8px; padding: 10px 14px; margin-bottom: 8px; font-size: 14px; }
.card.form { background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 24px; max-width: 560px; display: flex; flex-direction: column; gap: 14px; }
.card.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
.card.form input[type="text"], .card.form select { padding: 10px 12px; font-size: 14px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; font-weight: 400; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.nowrap { white-space: nowrap; }


/* ========== Brand Guide v1.0 — Component Specs ========== */

/* Pills — one system (999px radius, 12px/700) */
.pill {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  font-size: 12px; font-weight: 700; white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.pill-critical { background: var(--danger-bg); color: var(--danger); }
.pill-warning { background: var(--warn-bg); color: var(--warn); }
.pill-ok { background: var(--ok-bg); color: var(--ok); }
.pill-info { background: var(--info-bg); color: var(--info); }
.pill-extracted { background: var(--info-bg); color: var(--info); }
.pill-reg { background: var(--reg-bg); color: var(--reg); }
/* Legacy aliases (retired but kept for compat) */
.pill-red, .pill-overdue, .pill-alert, .pill-blocked { background: var(--danger-bg); color: var(--danger); }
.pill-amber, .pill-due { background: var(--warn-bg); color: var(--warn); }
.pill-green, .pill-compliant, .pill-fresh { background: var(--ok-bg); color: var(--ok); }
/* R4-F1: dynamic pill-{{value}} classes (work-order / SLA / priority / maintenance statuses) */
.pill-breached, .pill-declined { background: var(--danger-bg); color: var(--danger); }
.pill-high, .pill-due_soon { background: var(--warn-bg); color: var(--warn); }
.pill-accepted { background: var(--ok-bg); color: var(--ok); }
.pill-open, .pill-dispatched, .pill-scheduled, .pill-medium { background: var(--info-bg); color: #1d4ed8; }
.pill-low { background: var(--ok-bg); color: var(--ok); }
.pill-completed, .pill-cancelled { background: #f1f5f9; color: var(--muted); }
/* .tag is retired — use .pill */

/* Buttons — one spec */
.btn-primary, .btn {
  display: inline-block; font-size: 14px; font-weight: 600;
  padding: 10px 20px; border-radius: 8px; border: none; cursor: pointer;
  background: var(--teal); color: #fff; text-decoration: none;
}
.btn-primary:hover, .btn:hover { background: var(--teal-hover); text-decoration: none; color: #fff; }
.btn-secondary {
  display: inline-block; font-size: 14px; font-weight: 600;
  padding: 10px 20px; border-radius: 8px; border: none; cursor: pointer;
  background: #f1f5f9; color: var(--ink); text-decoration: none;
}
.btn-secondary:hover { background: #e2e8f0; text-decoration: none; }
.btn-danger {
  display: inline-block; font-size: 14px; font-weight: 600;
  padding: 10px 20px; border-radius: 8px; border: none; cursor: pointer;
  background: var(--danger-bg); color: var(--danger); text-decoration: none;
}

/* Tables — one style with inner scroll */
.data-table {
  width: 100%; border-collapse: collapse; background: var(--card);
  border-radius: 12px; overflow: hidden; border: 1px solid var(--border);
}
.data-table thead th {
  background: var(--table-head-bg); font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px; text-align: left;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
}
.data-table tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.data-table tbody tr:hover { background: #f8fafc; }
.data-table tbody tr:last-child td { border-bottom: none; }
/* Right-align money/date/count columns */
.data-table td.num, .data-table th.num {
  text-align: right; font-variant-numeric: tabular-nums;
}
.table-scroll { overflow-x: auto; border-radius: 12px; border: 1px solid var(--border); }
.table-scroll .data-table { border: none; border-radius: 0; }

/* Typography scale */
h1 { font-size: 26px; font-weight: 700; margin: 0 0 8px 0; }
h2 { font-size: 19px; font-weight: 700; margin: 24px 0 12px 0; }
h3 { font-size: 15px; font-weight: 700; margin: 16px 0 8px 0; }
.stat-num { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* Focus visibility */
a:focus, button:focus, input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--teal); outline-offset: 2px;
}

/* 8pt spacing utilities */
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }

/* ========== Mobile-Friendly Sprint ========== */

/* Responsive base */
@media (max-width: 768px) {
  /* Page container */
  .topbar-inner { padding: 12px 16px; gap: 16px; flex-wrap: wrap; }
  .nav { order: 3; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
    display: flex; gap: 8px; padding: 4px 0; }
  .nav a { white-space: nowrap; padding: 12px 16px; font-size: 15px; flex-shrink: 0; } /* Big tap targets, no overlap */
  
  /* Page head */
  .page-head { flex-direction: column; align-items: flex-start; gap: 12px; }
  .page-head h1 { font-size: 22px; }
  
  /* Stat rows: stack on mobile */
  .stat-row { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .stat-num { font-size: 20px; }
  
  /* Cards */
  .card-grid { grid-template-columns: 1fr; }
  .bcard { padding: 16px; }
  
  /* Tables: horizontal scroll on mobile */
  .table-scroll { margin: 0 -16px; border-radius: 0; border-left: none; border-right: none; }
  .data-table { font-size: 14px; }
  .data-table thead th { padding: 10px 12px; font-size: 11px; }
  .data-table tbody td { padding: 10px 12px; }
  
  /* Forms: full width, big inputs */
  .form-card { margin: 16px 0; padding: 16px; }
  .form-group input, .form-group select, .form-group textarea {
    font-size: 16px; /* Prevents iOS zoom */
    padding: 12px; min-height: 48px; /* Big touch target */
  }
  
  /* Buttons: full width on mobile, big */
  .btn-primary, .btn-secondary, .btn-danger {
    display: block; width: 100%; text-align: center;
    padding: 14px 20px; font-size: 16px; min-height: 52px;
  }
  .btn-sm { display: inline-block; width: auto; padding: 10px 16px; min-height: 44px; }
  
  /* Pills: slightly larger for touch */
  .pill { padding: 6px 14px; font-size: 13px; }
}

/* Touch-first: minimum 44px tap targets */
@media (pointer: coarse) {
  a, button { min-height: 44px; min-width: 44px; }
  .nav a { padding: 12px 16px; }
  .pill { padding: 8px 16px; }
}

/* Small phones */
@media (max-width: 480px) {
  .stat-row { grid-template-columns: 1fr; }
  .board-cards { grid-template-columns: 1fr; }
  .system-grid { grid-template-columns: 1fr; }
  h1 { font-size: 20px; }
}

/* Mobile fixes: filter selects and table links */
@media (max-width: 768px) {
  /* Filter selects: 44px minimum */
  .filter-row select,
  select[name="building"],
  select[name="rag"],
  select[name="status"] {
    min-height: 44px;
    font-size: 16px;
    padding: 10px 12px;
  }
  
  /* Inline table links: bigger touch targets */
  .data-table a, .tbl a {
    display: inline-block;
    padding: 8px 4px;
    min-height: 44px;
    line-height: 28px;
  }
}

/* Touch devices: bigger links */
@media (pointer: coarse) {
  .data-table a, .tbl a {
    padding: 10px 8px;
  }
}

/* Mobile table fixes: 44px selects, bigger links */
@media (max-width: 768px) {
  .filter-row select,
  select[name="building"],
  select[name="rag"],
  select[name="status"] {
    min-height: 44px;
    font-size: 16px;
  }
  .table-scroll a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 8px 4px;
  }
}

/* Finding 8: Skip link (WCAG 2.4.1) */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--teal);
  color: #fff;
  padding: 8px 16px;
  z-index: 1000;
  text-decoration: none;
}
.skip-link:focus {
  top: 0;
}

/* Finding 2: Footer */
.site-footer {
  text-align: center;
  padding: 24px 16px;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--line);
  margin-top: 40px;
}

/* Finding 9: Prevent horizontal overflow */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Finding 21: Sidebar labels single-line */
.sidebar-label { white-space: nowrap; }
.sidebar-link { white-space: nowrap; overflow: hidden; }
