/* MyPWB — PWB Exterior Cleaning
   Palette taken from the official PWB logo:
   cyan "PWB" #29abe2 · deep blue "Exterior Cleaning" #1b3576 · orange houses #f7941e */
:root {
  --navy: #1b3576;
  --navy-2: #24439a;
  --blue: #1a9cd8;
  --blue-dark: #127fb4;
  --orange: #f7941e;
  --sky: #e8f5fc;
  --ink: #1c2733;
  --muted: #5c6b7a;
  --line: #dde5ec;
  --bg: #f4f7fa;
  --white: #ffffff;
  --ok: #1a7f4e;
  --ok-bg: #e3f4ea;
  --warn: #9a6700;
  --warn-bg: #fff3d6;
  --danger: #b3261f;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(11, 42, 74, 0.08), 0 4px 14px rgba(11, 42, 74, 0.06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.55;
  font-size: 16px;
}
a { color: var(--blue-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: 0 0 0.25rem; color: var(--navy); }
h2 { font-size: 1.15rem; margin: 0 0 0.75rem; color: var(--navy); }
h3 { font-size: 1rem; margin: 0 0 0.25rem; color: var(--navy); }
h2.mt { margin-top: 1.5rem; }
hr { border: none; border-top: 1px solid var(--line); margin: 1.25rem 0; }

.muted { color: var(--muted); margin: 0.1rem 0; }
.muted-sm { color: var(--muted); font-size: 0.85rem; }

/* ---------- Top bar ---------- */
.topbar { background: var(--navy); color: #fff; }
.topbar-inner {
  max-width: 1200px; margin: 0 auto; padding: 0.6rem 1rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 0.6rem; color: #fff; }
.brand:hover { text-decoration: none; }
.brand-mark {
  background: linear-gradient(135deg, #29abe2, var(--blue-dark)); color: #fff; font-weight: 800; letter-spacing: 0.5px;
  padding: 0.35rem 0.55rem; border-radius: 8px; font-size: 1rem;
}
.brand-tag { color: var(--orange); }
.login-logo { max-width: 210px; height: auto; display: block; margin: 0 auto; }
.brand-mark-lg { font-size: 1.4rem; padding: 0.5rem 0.8rem; display: inline-block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 700; font-size: 1.05rem; }
.brand-tag { font-size: 0.68rem; opacity: 0.75; }
.mainnav { display: flex; gap: 0.15rem; flex-wrap: wrap; flex: 1; }
.mainnav a {
  color: rgba(255,255,255,0.85); padding: 0.45rem 0.7rem; border-radius: 8px; font-size: 0.95rem;
}
.mainnav a:hover { background: var(--navy-2); text-decoration: none; color: #fff; }
.mainnav a.active { background: var(--blue); color: #fff; font-weight: 600; }
.logout-form { display: flex; align-items: center; gap: 0.6rem; margin-left: auto; }
.user-chip { font-size: 0.85rem; opacity: 0.85; }

/* ---------- Layout ---------- */
.page { max-width: 1200px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
@media (max-width: 820px) { .grid-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; margin-bottom: 1rem; box-shadow: var(--shadow);
}
.card.narrow { max-width: 640px; }
.card-link { display: block; color: inherit; transition: transform 0.08s ease, box-shadow 0.08s ease; }
.card-link:hover { text-decoration: none; transform: translateY(-2px); box-shadow: 0 6px 20px rgba(11,42,74,0.12); }
.card-good { border-left: 4px solid var(--ok); }
.card-highlight { border-left: 4px solid var(--blue); }
.center-page { margin: 3rem auto; text-align: center; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; border: 1px solid transparent; border-radius: 8px; cursor: pointer;
  padding: 0.55rem 1rem; font-size: 0.95rem; font-weight: 600; font-family: inherit;
  text-align: center; transition: background 0.1s ease;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-outline { background: #fff; color: var(--blue-dark); border-color: var(--blue); }
.btn-outline:hover { background: var(--sky); }
.btn-ghost { background: transparent; color: inherit; border-color: rgba(255,255,255,0.4); }
.page .btn-ghost { color: var(--muted); border-color: var(--line); }
.btn-sm { padding: 0.3rem 0.65rem; font-size: 0.85rem; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ---------- Forms ---------- */
.stack { display: flex; flex-direction: column; gap: 0.85rem; }
.stack label { display: flex; flex-direction: column; gap: 0.25rem; font-weight: 600; font-size: 0.92rem; color: var(--navy); }
.stack label .muted-sm { font-weight: 400; }
input[type="text"], input[type="email"], input[type="tel"], input[type="password"],
input[type="date"], input[type="number"], input[type="search"], select, textarea {
  font-family: inherit; font-size: 1rem; padding: 0.55rem 0.7rem;
  border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: var(--blue); }
input[disabled] { background: var(--bg); color: var(--muted); }
textarea { resize: vertical; }
fieldset.checks { border: 1px solid var(--line); border-radius: 8px; padding: 0.6rem 0.8rem; margin: 0; }
fieldset.checks legend { font-weight: 600; font-size: 0.9rem; color: var(--navy); padding: 0 0.3rem; }
label.check { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; padding: 0.2rem 0; }
label.check input { width: auto; }
.inline-form { display: inline-flex; gap: 0.35rem; align-items: center; }
.inline-form input[type="date"] { width: auto; padding: 0.3rem 0.4rem; font-size: 0.85rem; }
.filter-bar { display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.filter-bar input[type="search"] { max-width: 320px; }
.filter-bar select { width: auto; }
.mt-sm { margin-top: 0.6rem; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
th { text-align: left; color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.5rem 0.6rem; border-bottom: 2px solid var(--line); white-space: nowrap; }
td { padding: 0.6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
.row-muted { opacity: 0.55; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block; padding: 0.15rem 0.55rem; border-radius: 999px;
  font-size: 0.78rem; font-weight: 700; white-space: nowrap;
}
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warning { background: var(--warn-bg); color: var(--warn); }
.badge-danger { background: #fdE7e7; color: #b3261f; }
.badge-role { background: var(--sky); color: var(--blue-dark); }
.badge-status-requested { background: #f3e8fd; color: #7a3ec2; }
.badge-status-booked { background: var(--sky); color: var(--blue-dark); }
.badge-status-in_progress { background: var(--warn-bg); color: var(--warn); }
.badge-status-complete { background: var(--ok-bg); color: var(--ok); }
.badge-status-cancelled { background: #eee; color: #777; }

/* ---------- Flash ---------- */
.flash { border-radius: 8px; padding: 0.8rem 1rem; margin-bottom: 1rem; font-size: 0.95rem; }
.flash-success { background: var(--ok-bg); color: var(--ok); border: 1px solid #bfe5cf; }
.flash-error { background: #fde7e7; color: #b3261f; border: 1px solid #f5c6c4; }
.flash-warning { background: var(--warn-bg); color: var(--warn); border: 1px solid #f0dfae; }

/* ---------- Stats ---------- */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.75rem; margin-bottom: 1rem; }
.stat {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.8rem 1rem; box-shadow: var(--shadow);
}
.stat-num { display: block; font-size: 1.7rem; font-weight: 800; color: var(--navy); line-height: 1.2; }
.stat-label { color: var(--muted); font-size: 0.82rem; }
.stat-danger .stat-num { color: #b3261f; }

/* ---------- Job lines / due lists ---------- */
.job-line {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.55rem 0;
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.job-line:last-of-type { border-bottom: none; }
.job-line > div { flex: 1; min-width: 180px; }
.due-list { list-style: none; margin: 0; padding: 0; }
.due-list li { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.due-list li:last-child { border-bottom: none; }
.link-list { list-style: none; margin: 0; padding: 0; }
.link-list li { padding: 0.35rem 0; border-bottom: 1px solid var(--line); }
.link-list li:last-child { border-bottom: none; }

/* ---------- Timeline ---------- */
.timeline { position: relative; }
.timeline-item { display: flex; gap: 1rem; padding: 0.9rem 0; border-bottom: 1px solid var(--line); }
.timeline-item:last-child { border-bottom: none; }
.timeline-date { flex: 0 0 105px; font-weight: 700; color: var(--blue-dark); font-size: 0.9rem; padding-top: 0.15rem; }
.timeline-body { flex: 1; min-width: 0; }
.timeline-body p { margin: 0.35rem 0; }
.photo-row { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.5rem; }
.photo { margin: 0; }
.photo img { width: 130px; height: 100px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.photo figcaption { font-size: 0.75rem; color: var(--muted); text-align: center; }

/* ---------- Mini bars ---------- */
.mini-bars { list-style: none; margin: 0; padding: 0; }
.mini-bars li { display: flex; align-items: center; gap: 0.5rem; padding: 0.3rem 0; }
.mini-bar-label { flex: 0 0 45%; font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-bar { height: 10px; background: var(--blue); border-radius: 5px; min-width: 6px; }

/* ---------- Calendar ---------- */
.calendar-card { padding: 0.75rem; }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: 0.75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; padding: 0.3rem 0; }
.cal-cell { background: var(--bg); border-radius: 6px; min-height: 84px; padding: 0.3rem; font-size: 0.8rem; }
.cal-empty { background: transparent; }
.cal-today { outline: 2px solid var(--blue); background: var(--sky); }
.cal-daynum { font-weight: 700; color: var(--muted); font-size: 0.75rem; }
.cal-job {
  display: block; background: var(--white); border-left: 3px solid var(--blue);
  border-radius: 4px; padding: 0.2rem 0.35rem; margin-top: 0.25rem; color: var(--ink);
  font-size: 0.72rem; line-height: 1.3; box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  overflow: hidden;
}
.cal-job:hover { text-decoration: none; background: var(--sky); }
.cal-job-in_progress { border-left-color: var(--warn); }
.cal-job-complete { border-left-color: var(--ok); opacity: 0.7; }
.cal-job-requested { border-left-color: #7a3ec2; }

/* ---------- Login ---------- */
.login-body { background: linear-gradient(160deg, var(--navy) 0%, var(--navy-2) 55%, var(--blue-dark) 100%); min-height: 100vh; margin: 0; }
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 1.5rem 1rem; }
.login-card {
  background: var(--white); border-radius: 14px; box-shadow: 0 12px 40px rgba(0,0,0,0.3);
  padding: 2rem 1.8rem; width: 100%; max-width: 400px;
}
.login-brand { text-align: center; margin-bottom: 1.25rem; }
.login-brand h1 { margin-top: 0.9rem; font-size: 1.35rem; }
.login-help { font-size: 0.85rem; text-align: center; margin-top: 1.25rem; }
.login-footer { color: rgba(255,255,255,0.75); font-size: 0.85rem; margin-top: 1.25rem; text-align: center; }
.login-footer a { color: #fff; }

/* ---------- Footer ---------- */
.footer { text-align: center; color: var(--muted); font-size: 0.85rem; padding: 1.5rem 1rem 2.5rem; }
.footer p { margin: 0.2rem 0; }
.footer-small { font-size: 0.75rem; }

/* ---------- Mobile ---------- */
@media (max-width: 640px) {
  .topbar-inner { padding: 0.5rem 0.75rem; }
  .brand-tag { display: none; }
  .mainnav { order: 3; flex: 0 0 100%; width: 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 0.2rem; }
  .mainnav a { white-space: nowrap; font-size: 0.88rem; padding: 0.4rem 0.55rem; }
  .user-chip { display: none; }
  .page { padding: 1rem 0.75rem 2.5rem; }
  .timeline-item { flex-direction: column; gap: 0.15rem; }
  .timeline-date { flex: none; }
  .cal-cell { min-height: 60px; }
}
