/* Clock In/Out Portal — clean, professional, phone-first. */
:root {
  --blue: #1e5aa8;
  --blue-dark: #16467f;
  --red: #c0392b;
  --green: #1e8e4f;
  --amber: #b7791f;
  --ink: #1f2a37;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f4f7fb;
  --card: #ffffff;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
}

.hidden { display: none !important; }

h1, h2, h3 { margin: 0 0 8px; }
p { margin: 0 0 12px; }
a { color: var(--blue); }

button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 10px; width: 100%; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 1px; border-color: var(--blue); }
label { display: block; font-weight: 600; margin: 12px 0 4px; font-size: 14px; }
label .hint { font-weight: 400; color: var(--muted); }
textarea { min-height: 84px; resize: vertical; }

/* ---------- buttons ---------- */
.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 600;
  background: var(--blue);
  color: #fff;
}
.btn:hover { background: var(--blue-dark); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-secondary { background: #e8eef5; color: var(--ink); }
.btn-secondary:hover { background: #dbe4ef; }
.btn-danger { background: var(--red); }
.btn-danger:hover { background: #a93226; }
.btn-success { background: var(--green); }
.btn-success:hover { background: #166b3c; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: #eef2f7; }
.btn-big { padding: 14px 22px; font-size: 17px; }
.btn-small { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; margin-top: 10px; }

/* ---------- header / nav ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo { height: 46px; width: auto; max-width: 180px; object-fit: contain; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: 18px; }
.brand-text span { font-size: 13px; color: var(--muted); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.user-chip { font-size: 14px; color: var(--muted); }
.clock-now { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--blue); }

.tabs {
  display: flex;
  gap: 6px;
  padding: 10px 16px 0;
  overflow-x: auto;
  background: var(--bg);
}
.tab {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px 10px 0 0;
  border-bottom: 0;
  padding: 9px 14px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.tab.active { color: var(--blue); background: #fff; border-color: var(--blue); }

.view { padding: 16px; max-width: 980px; margin: 0 auto; }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.view-head h2 { margin: 0; }

.badge {
  display: inline-block;
  background: var(--red);
  color: #fff;
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 12px;
  font-weight: 700;
}

/* ---------- banners (Scheduled / Unscheduled / Completed) ---------- */
.banners { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.banner {
  border: 0;
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: left;
  color: #fff;
  background: var(--blue);
}
.banner .count { display: block; font-size: 30px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.banner .label { font-size: 14px; font-weight: 600; opacity: 0.95; }
.banner.scheduled { background: #1e5aa8; }
.banner.unscheduled { background: #b7791f; }
.banner.completed { background: #1e8e4f; }
.banner.active { outline: 3px solid var(--ink); outline-offset: 2px; }
@media (max-width: 560px) {
  .banner .count { font-size: 24px; }
  .banner { padding: 10px 8px; }
}

/* ---------- cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.card h3 { font-size: 18px; margin-bottom: 2px; }
.card .sub { color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.card .meta { font-size: 14px; margin: 2px 0; }
.card .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.card .actions .btn { flex: 1 1 auto; }
.pill {
  display: inline-block;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 700;
}
.pill.scheduled { background: #dbeafe; color: #16467f; }
.pill.unscheduled { background: #fef3c7; color: #92400e; }
.pill.completed { background: #dcfce7; color: #166534; }
.pill.incomplete { background: #fee2e2; color: #991b1b; }
.pill.open { background: #dcfce7; color: #166534; }
.flag { color: #991b1b; font-weight: 600; font-size: 14px; margin-top: 6px; }
.muted { color: var(--muted); font-size: 14px; }
.empty { text-align: center; color: var(--muted); padding: 32px 12px; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: top; }
th { background: #eef2f7; font-size: 13px; }
tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.ot { color: var(--amber); font-weight: 700; }

/* ---------- summary ---------- */
.summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.summary-stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: center; }
.summary-stat .num { display: block; font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; }
.summary-stat .lbl { font-size: 13px; color: var(--muted); font-weight: 600; }
.summary-stat.ot .num { color: var(--amber); }

/* ---------- auth (login) ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: linear-gradient(160deg, #0f2a4d 0%, #1e5aa8 55%, #2e7fc2 100%);
  position: relative;
  overflow: hidden;
}
.auth-clock-bg {
  position: absolute;
  width: 520px;
  height: 520px;
  right: -140px;
  top: -120px;
  opacity: 0.9;
  pointer-events: none;
}
.auth-card {
  position: relative;
  background: #fff;
  border-radius: 18px;
  padding: 28px 24px;
  max-width: 420px;
  width: 100%;
  text-align: center;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}
.auth-logo { max-width: 260px; width: 100%; height: auto; margin-bottom: 6px; }
.auth-card h1 { font-size: 24px; }
.auth-card form { text-align: left; }
.auth-card .btn { width: 100%; margin-top: 14px; }
.auth-sub { color: var(--muted); }
.auth-note { font-size: 13px; color: var(--muted); margin-top: 14px; }

/* ---------- modal / toast / error ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 12px;
  z-index: 50;
  overflow-y: auto;
}
.modal-card { background: #fff; border-radius: 16px; padding: 20px; width: 100%; max-width: 520px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.modal-head h2 { margin: 0; font-size: 20px; }
.error { background: #fee2e2; color: #991b1b; border-radius: 10px; padding: 10px 12px; margin: 10px 0; font-size: 14px; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  z-index: 60;
  font-size: 14px;
  max-width: 92vw;
  text-align: center;
}

.reason-list { display: grid; gap: 10px; margin-top: 12px; }

/* ---------- job detail header ---------- */
.job-number-line { font-size: 13px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--blue); }
.job-title { font-size: 26px; line-height: 1.2; margin: 2px 0 4px; }
.directions-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.directions-row .job-address { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.directions-row .btn { flex-shrink: 0; text-decoration: none; }

/* ---------- job detail sections (five separate banners) ---------- */
.section-banner { border-top: 4px solid var(--blue); }
.sec-contacts { border-top-color: #1e5aa8; }
.sec-items { border-top-color: #b7791f; }
.sec-attachments { border-top-color: #1e8e4f; }
.sec-services { border-top-color: #7c3aed; }
.sec-comments { border-top-color: #0e7490; }
.section-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.section-head h3 { margin: 0; flex: 1; font-size: 17px; }
.contact-row, .item-row, .service-row, .comment-row { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.contact-row:last-child, .item-row:last-child, .service-row:last-child, .comment-row:last-child { border-bottom: 0; }
.row-actions { display: flex; gap: 6px; margin-top: 6px; }
.comment-row .who { font-weight: 700; }
.used-item { text-decoration: line-through; color: var(--muted); }
.reason-btn {
  border: 2px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  font-weight: 600;
  text-align: left;
  font-size: 16px;
}
.reason-btn:hover { border-color: var(--blue); }
.reason-btn.selected { border-color: var(--blue); background: #dbeafe; }

.file-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.file-row:last-child { border-bottom: 0; }
.file-row img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
.file-row .grow { flex: 1; min-width: 0; overflow-wrap: anywhere; }

footer { text-align: center; padding: 18px 12px 24px; color: var(--muted); font-size: 12px; }

@media (max-width: 560px) {
  .view { padding: 12px; }
  .summary-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .summary-stat .num { font-size: 22px; }
  .card .actions .btn { flex-basis: 100%; }
}
