/* Shared styles for every RefrigSense dashboard page. */
:root {
  --red: #c62828;   --red-bg: #fdecea;
  --amber: #f9a825; --amber-bg: #fff8e1; --amber-text: #5f4b00;
  --green: #2e7d32; --green-bg: #e8f5e9;
  --ink: #1f2937;   --muted: #6b7280;
  --line: #e5e7eb;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: #f3f4f6; color: var(--ink);
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
#app { max-width: 900px; margin: 0 auto; padding: 24px 20px 60px; }

h1 { font-size: 28px; margin: 0 0 4px; }
h2.section-title { font-size: 18px; margin: 30px 0 12px; }
.muted { color: var(--muted); }
p.muted { margin: 0 0 18px; font-size: 16px; }

.back {
  display: inline-block; margin-bottom: 14px; color: var(--muted);
  text-decoration: none; font-size: 14px; font-weight: 600;
}
.back:hover { color: var(--ink); }

/* ---- Three summary count boxes ---- */
.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 26px; }
.summary-box { border-radius: 12px; padding: 18px; text-align: center; color: #fff; }
.summary-box .num { display: block; font-size: 40px; font-weight: 700; line-height: 1; }
.summary-box .lbl { display: block; margin-top: 6px; font-size: 15px; font-weight: 600; }
.summary-box.act-now { background: var(--red); }
.summary-box.watch   { background: var(--amber); color: var(--amber-text); }
.summary-box.healthy { background: var(--green); }

/* ---- Clickable cards (locations and units) ---- */
.cards { display: grid; gap: 14px; }
.card {
  display: block; width: 100%; text-align: left; cursor: pointer;
  border: 0; border-left: 8px solid #ccc; border-radius: 12px;
  padding: 16px 18px; background: #fff; font: inherit; color: inherit;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
  transition: transform .05s ease, box-shadow .15s ease;
}
.card:hover  { box-shadow: 0 3px 10px rgba(0,0,0,.12); }
.card:active { transform: scale(.995); }
.card .name     { display: block; font-size: 20px; font-weight: 700; margin: 10px 0 4px; }
.card .headline { display: block; font-size: 16px; color: var(--muted); }

/* ---- Colored badge / pill ---- */
.badge {
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .02em;
  text-transform: uppercase; padding: 3px 10px; border-radius: 999px; color: #fff;
}
.card.act-now { border-left-color: var(--red);   background: var(--red-bg); }
.card.act-now .badge { background: var(--red); }
.card.watch   { border-left-color: var(--amber); background: var(--amber-bg); }
.card.watch .badge   { background: var(--amber); color: var(--amber-text); }
.card.healthy { border-left-color: var(--green); background: var(--green-bg); }
.card.healthy .badge { background: var(--green); }

/* ---- Large status badge on the unit pages ---- */
.status {
  display: inline-block; font-size: 13px; font-weight: 700; letter-spacing: .03em;
  text-transform: uppercase; padding: 5px 14px; border-radius: 999px; color: #fff; margin-bottom: 6px;
}
.status.act-now { background: var(--red); }
.status.watch   { background: var(--amber); color: var(--amber-text); }
.status.healthy { background: var(--green); }

.page-title { margin: 6px 0 2px; }
.summary-text { font-size: 18px; line-height: 1.5; margin: 14px 0 6px; max-width: 65ch; }

/* ---- Work-order block ---- */
.workorder {
  background: #0f172a; color: #e2e8f0; border-radius: 10px; padding: 16px;
  font-family: "Consolas", "Courier New", monospace; font-size: 13px; line-height: 1.45;
  white-space: pre-wrap; overflow-x: auto; margin: 0 0 12px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-block; cursor: pointer; border: 0; border-radius: 10px;
  padding: 11px 18px; font: inherit; font-weight: 600; font-size: 15px;
  background: var(--ink); color: #fff; text-decoration: none; margin: 0 10px 10px 0;
}
.btn:hover { opacity: .92; }
.btn-secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }

/* ---- Readings table (technician view) ---- */
.readings { width: 100%; border-collapse: collapse; margin: 6px 0 18px; }
.readings th, .readings td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.readings th { font-size: 13px; color: var(--muted); font-weight: 600; }
.readings td.value { font-weight: 700; font-variant-numeric: tabular-nums; }
.readings td.trend { color: var(--muted); }

/* ---- Equipment facts (technician view) ---- */
.facts { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 8px 0; padding: 0; list-style: none; }
.facts li { font-size: 15px; }
.facts .k { color: var(--muted); margin-right: 6px; }

/* ---- Parts list ---- */
.parts { margin: 6px 0 18px; padding-left: 20px; }
.parts li { margin: 3px 0; }

/* ---- Data-entry table (boring, clean lists) ---- */
.data-table {
  width: 100%; border-collapse: collapse; background: #fff;
  border-radius: 12px; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.data-table th, .data-table td {
  text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.data-table th { font-size: 13px; color: var(--muted); font-weight: 600; background: #fafafa; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table a { color: var(--ink); font-weight: 600; text-decoration: none; }
.data-table a:hover { text-decoration: underline; }
.empty { color: var(--muted); padding: 24px 2px; }

/* ---- Data-entry form ---- */
.form { max-width: 560px; }
.field { margin: 0 0 16px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 5px; }
.field .req { color: var(--red); }
.field input, .field select {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--ink);
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  /* Comfortable tap target on a phone. */
  min-height: 44px;
}
.field select { appearance: auto; }
.field input:focus, .field select:focus {
  outline: none; border-color: #93c5fd; box-shadow: 0 0 0 3px rgba(147,197,253,.45);
}
.field .hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
/* Two fields side by side (e.g. City + State, ZIP + Region). */
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-error {
  background: var(--red-bg); color: var(--red); border: 1px solid var(--red);
  border-radius: 8px; padding: 10px 12px; margin: 0 0 16px; font-size: 14px; font-weight: 600;
}
.form-actions { margin-top: 8px; }

/* Checkboxes (location checklist + the equipment toggle) opt out of the
   full-width text-input styling above. */
.field input[type="checkbox"] { width: auto; min-height: 0; margin: 0; }
.checklist { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 8px; }
.checklist li { border-bottom: 1px solid var(--line); }
.checklist li:last-child { border-bottom: 0; }
.checklist label { display: flex; align-items: center; gap: 10px; font-weight: 400; padding: 10px 12px; margin: 0; cursor: pointer; }
.toggle { display: flex; align-items: center; gap: 10px; }
.toggle label { font-weight: 400; margin: 0; cursor: pointer; }

/* ---- Manager home: Setup panel (left) + system-health area (right) ----
   Used only on index.html. A two-column row: a collapsible card of setup
   links on the left, the system-health visuals filling the rest on the right. */
.dash-layout { display: flex; align-items: flex-start; gap: 20px; }
.health-area { flex: 1 1 auto; min-width: 0; }  /* grows to fill freed space */

.setup-panel {
  flex: 0 0 220px;
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,.06);
  padding: 12px; transition: flex-basis .18s ease, padding .18s ease;
}
.setup-panel__head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 8px;
}
.setup-panel__title {
  font-size: 13px; font-weight: 700; letter-spacing: .03em;
  text-transform: uppercase; color: var(--muted);
}
.setup-panel__toggle {
  flex: 0 0 auto; cursor: pointer; padding: 0;
  width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--ink); font-size: 18px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.setup-panel__toggle:hover { background: #f3f4f6; }
.setup-panel .chev { display: inline-block; transition: transform .18s ease; }

/* The links keep their .back look but stack vertically and fill the panel. */
.setup-panel__links { display: flex; flex-direction: column; gap: 2px; }
.setup-panel__links .back {
  display: block; margin: 0; padding: 9px 10px; border-radius: 8px; white-space: nowrap;
}
.setup-panel__links .back:hover { background: #f3f4f6; }

/* Collapsed: a slim strip with only the chevron (flipped to point outward). */
.setup-panel.collapsed { flex-basis: 46px; padding: 8px; }
.setup-panel.collapsed .setup-panel__title,
.setup-panel.collapsed .setup-panel__links { display: none; }
.setup-panel.collapsed .setup-panel__head { justify-content: center; margin-bottom: 0; }
.setup-panel.collapsed .chev { transform: rotate(180deg); }

/* On a narrow screen, stack the panel above the health area instead. */
@media (max-width: 640px) {
  .dash-layout { flex-direction: column; }
  .setup-panel, .setup-panel.collapsed { flex-basis: auto; width: 100%; }
}

/* ---- Demo (sandbox) card — shown ONLY for the demo company ----
   A distinct indigo accent marks it as not-a-real-customer, while reusing the
   same card shape and the existing .btn / .btn-secondary buttons. */
.demo-card {
  background: #eef2ff; border: 1px solid #c7d2fe; border-radius: 12px;
  padding: 16px 18px; margin-bottom: 22px;
}
.demo-card__head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.demo-badge {
  display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; padding: 3px 8px; border-radius: 6px;
  background: #4f46e5; color: #fff;
}
.demo-card__title { font-size: 15px; font-weight: 700; color: #3730a3; }
.demo-card__text { margin: 0 0 12px; font-size: 14px; line-height: 1.5; color: #3730a3; max-width: 60ch; }
.demo-card__actions { display: flex; flex-wrap: wrap; }
.demo-card__actions .btn { margin: 0 10px 0 0; }

/* ===========================================================================
   Login / front door (login.html + forgot-password.html). Deliberately more
   polished and welcoming than the internal screens: a centered white card on a
   soft, calm gradient, with plenty of breathing room. Works phone ↔ desktop.
   =========================================================================== */
body.login {
  min-height: 100vh; margin: 0; display: grid; place-items: center; padding: 24px 16px;
  background:
    radial-gradient(1100px 520px at 50% -10%, #e0f2fe 0%, rgba(224,242,254,0) 60%),
    linear-gradient(160deg, #f8fafc 0%, #eef2f7 100%);
}
.login-wrap { width: 100%; max-width: 420px; }
.login-card {
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 32px 28px 26px;
  box-shadow: 0 10px 30px rgba(15,23,42,.08), 0 2px 6px rgba(15,23,42,.04);
}
.brand { margin: 0 0 20px; text-align: center; }
.brand-logo { display: block; width: 100%; max-width: 300px; height: auto; margin: 0 auto; }
.login-tagline { text-align: center; color: var(--muted); font-size: 15px; line-height: 1.55; margin: 10px 0 22px; }
.login-h2 { font-size: 18px; margin: 14px 0 4px; }

/* Neutral notice (sign-out / expiry) + error (bad credentials). */
.login-notice, .login-error {
  border-radius: 10px; padding: 11px 13px; margin: 0 0 16px;
  font-size: 14px; font-weight: 600; line-height: 1.45;
}
.login-notice { background: #ecfeff; border: 1px solid #a5f3fc; color: #155e75; }
.login-error  { background: var(--red-bg); border: 1px solid var(--red); color: var(--red); }

/* Full-width buttons + a login-tuned calm teal primary. */
.btn-block { display: block; width: 100%; text-align: center; margin: 8px 0 0; padding: 13px 18px; font-size: 16px; }
body.login .btn { background: #2f80c4; border-radius: 11px; }
body.login .btn:hover { background: #246aa6; opacity: 1; }
body.login .btn-secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
body.login .btn-secondary:hover { background: #f8fafc; }

.login-links { text-align: center; margin: 16px 0 0; font-size: 14px; }
.login-links a { color: #2f80c4; font-weight: 600; text-decoration: none; }
.login-links a:hover { text-decoration: underline; }

.login-or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 20px 0 14px; }
.login-or::before, .login-or::after { content: ""; flex: 1 1 auto; height: 1px; background: var(--line); }
.login-or span { text-transform: uppercase; letter-spacing: .06em; }

.login-demo-note { text-align: center; color: var(--muted); font-size: 13px; margin: 9px 0 0; }
.login-foot { text-align: center; color: var(--muted); font-size: 13px; line-height: 1.5; margin: 18px auto 0; max-width: 360px; }

@media (max-width: 480px) {
  .login-card { padding: 26px 20px 22px; border-radius: 14px; }
}

/* ===========================================================================
   Signed-in chrome injected by common.js on every internal page:
   a DEMO ribbon (only for the demo company) and a Sign out control.
   =========================================================================== */
#rs-topchrome { position: sticky; top: 0; z-index: 1000; }
.app-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 16px; background: #fff; border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(15,23,42,.05);
}
.app-brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; }
.app-brand img { display: block; height: 30px; width: auto; }
.app-brand__name { font-size: 18px; font-weight: 800; letter-spacing: -.01em; color: #1e3a5f; }
.app-brand__name span { color: #2f80c4; }
.app-actions { display: flex; align-items: center; gap: 10px; }
.app-bell {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%; background: #fff; border: 1px solid var(--line);
  text-decoration: none; font-size: 19px; line-height: 1;
}
.app-bell:hover { background: #f3f4f6; }
.app-bell__badge {
  position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: 9px; background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
  line-height: 18px; text-align: center; display: none;
}
.app-signout {
  display: inline-flex; align-items: center; height: 40px; padding: 0 15px; border-radius: 20px;
  background: #fff; border: 1px solid var(--line); color: var(--ink);
  font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer;
}
.app-signout:hover { background: #f3f4f6; }
/* The DEMO ribbon now sits inside the sticky chrome, above the bar. */
.demo-ribbon {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 8px 14px; font-size: 13px; font-weight: 600; line-height: 1.3;
  background: #4f46e5; color: #fff; text-align: center;
}
.demo-ribbon .demo-badge { background: rgba(255,255,255,.22); color: #fff; }

/* Staff "inside a customer" banner — deliberately UNLIKE the white app and the
   indigo demo ribbon (bold amber), pinned at the very top of the sticky chrome so
   staff can never forget whose data they're editing. */
.staff-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: #b45309; color: #fff;
  font-size: 14px; font-weight: 600; line-height: 1.3;
  border-bottom: 2px solid #7c2d12;
}
.staff-banner__tag {
  display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .06em;
  text-transform: uppercase; padding: 3px 8px; border-radius: 6px;
  background: rgba(255,255,255,.22); color: #fff; margin-right: 8px;
}
.staff-banner__exit {
  flex: none; cursor: pointer; border: 0; border-radius: 8px;
  padding: 7px 14px; font-size: 13px; font-weight: 700;
  background: #fff; color: #7c2d12;
}
.staff-banner__exit:hover { background: #fde68a; }
.staff-banner__exit:disabled { opacity: .7; cursor: default; }
/* Quiet "Staff console" link in the header for staff who aren't inside anyone. */
.app-staff-link {
  display: inline-flex; align-items: center; padding: 6px 12px; border-radius: 8px;
  font-size: 14px; font-weight: 700; text-decoration: none;
  background: #b45309; color: #fff;
}
.app-staff-link:hover { background: #92400e; }

@media (max-width: 380px) { .app-brand__name { display: none; } }
