/* Advance Care staff portal — same purple/green brand as the website. */
:root {
  --ink: #1c1530; --ink-2: #3b3350; --muted: #5b5470; --line: #e7e3f0; --line-2: #d8d2e6;
  --bg: #faf9fc; --soft: #f3f0f9; --lav: #f5f3ff; --lav-2: #ede9fe; --lav-3: #ddd6fe;
  --night: #2e1065; --purple: #4c1d95; --purple-2: #6d28d9; --green: #15803d; --green-2: #22c55e;
  --amber-bg: #fef3c7; --amber: #78350f; --red: #991b1b; --red-bg: #fef2f2; --wa: #1fa855;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--purple); }
h1 { font-size: 24px; margin: 0 0 4px; line-height: 1.25; }
h2 { font-size: 18px; margin: 24px 0 10px; }
.card h2:first-child, .stack > h2:first-child { margin-top: 0; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.main { padding-top: 20px; padding-bottom: 48px; }
:focus-visible { outline: 3px solid var(--purple-2); outline-offset: 2px; }

/* Header */
.top { background: var(--night); color: #fff; position: sticky; top: 0; z-index: 10; }
.top-row { display: flex; align-items: center; gap: 16px; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 700; }
.brand span { font-size: 12px; background: var(--purple-2); padding: 2px 8px; border-radius: 999px; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav a { color: var(--lav-3); text-decoration: none; font-weight: 600; padding: 8px 12px; border-radius: 8px; white-space: nowrap; }
.nav a.on, .nav a:hover { background: var(--purple); color: #fff; }
.me { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.me a { color: var(--lav-3); text-decoration: none; }
.me form { margin: 0; }
.link-light { background: none; border: 0; color: #fff; font: inherit; font-weight: 700; cursor: pointer; padding: 6px 0; text-decoration: underline; }
@media (max-width: 760px) {
  .top-row { gap: 8px; }
  .brand { order: 1; }
  .me { order: 2; margin-left: auto; }
  .nav { order: 3; flex-basis: 100%; }
}

/* Buttons and forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 9px 16px; border-radius: 10px; font: inherit; font-weight: 700; border: 1.5px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn-lg { min-height: 50px; padding: 12px 22px; font-size: 16px; }
.btn-primary { background: var(--purple); color: #fff; }
.btn-primary:hover { background: var(--night); }
.btn-green { background: var(--green); color: #fff; }
.btn-whatsapp { background: var(--wa); color: #fff; }
.btn-ghost { background: #fff; color: var(--purple); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--purple); }
.btn.danger { color: var(--red); }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px; }
input, select, textarea { font: inherit; font-size: 16px; font-weight: 400; padding: 10px 12px; border: 1.5px solid var(--line-2); border-radius: 10px; background: #fff; color: var(--ink); width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--purple-2); outline: none; }
textarea { resize: vertical; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack.tight { gap: 6px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.tight { gap: 6px; flex-wrap: nowrap; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.narrow { max-width: 720px; }
.search { display: flex; gap: 8px; margin: 12px 0; max-width: 520px; }

/* Blocks */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 14px; }
.flash { padding: 12px 14px; border-radius: 10px; margin: 0 0 14px; background: #dcfce7; color: #14532d; font-weight: 600; }
.flash.err { background: var(--red-bg); color: var(--red); }
.empty { color: var(--muted); background: #fff; border: 1px dashed var(--line-2); border-radius: 12px; padding: 24px; text-align: center; }
.tabs { display: flex; gap: 6px; margin: 12px 0 16px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 8px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--ink-2); font-weight: 600; white-space: nowrap; font-size: 14px; }
.tabs a.on { background: var(--purple); border-color: var(--purple); color: #fff; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 16px 0; }
.tile { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--ink); }
a.tile:hover { border-color: var(--purple-2); }
.tile strong { font-size: 22px; line-height: 1.2; }
.tile span { color: var(--muted); font-size: 13px; }
.tile.warn { border-color: #fcd34d; background: #fffbeb; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.job-card { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--ink); margin: 0; }
.job-card:hover { border-color: var(--purple-2); }
.msg { white-space: pre-wrap; background: var(--soft); border-radius: 10px; padding: 12px; font: inherit; margin: 0; }
.temp { border-color: #fcd34d; background: #fffbeb; }
.pw { font-size: 26px; font-weight: 800; letter-spacing: .08em; background: #fff; padding: 8px 12px; border-radius: 8px; align-self: flex-start; user-select: all; }
details.edit { margin-top: 24px; }
details.edit summary { cursor: pointer; font-weight: 700; color: var(--purple); margin-bottom: 12px; }

/* Tags */
.tag { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--lav-2); color: var(--purple); white-space: nowrap; }
.t-pending, .t-scheduled, .t-new, .t-issue { background: var(--amber-bg); color: var(--amber); }
.t-received, .t-sent, .t-ok, .t-won, .t-submitted { background: #dcfce7; color: #14532d; }
.t-cancelled, .t-na, .t-lost { background: #f3f4f6; color: #6b7280; }
.t-Gold { background: #fef3c7; color: #854d0e; }
.t-Platinum { background: var(--night); color: #fff; }
.t-survey { background: #dcfce7; color: #14532d; }

/* Tables become cards on phones */
.box { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; padding: 10px 14px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; background: var(--soft); }
.tbl td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: top; }
.tbl td.actions { text-align: right; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.actions form { margin: 0; }
.tbl td.actions { display: table-cell; }
.tbl td.actions > * { margin: 0 0 6px 6px; }
@media (max-width: 760px) {
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { border-top: 1px solid var(--line); padding: 8px 0; }
  .tbl tr:first-child { border-top: 0; }
  .tbl td { border: 0; padding: 6px 14px; }
  .tbl td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
  .tbl td.actions { display: flex; text-align: left; justify-content: flex-start; }
  .tbl td.actions > * { margin: 0; }
}

/* Technician checklist */
fieldset.check { border: 0; padding: 10px 0; margin: 0; border-top: 1px solid var(--line); }
fieldset.check legend { font-weight: 700; padding: 0; margin-bottom: 8px; float: left; width: 100%; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; clear: both; }
.seg label { flex-direction: row; align-items: center; justify-content: center; gap: 6px; border: 1.5px solid var(--line-2); border-radius: 10px; padding: 10px 6px; cursor: pointer; font-size: 15px; }
.seg input { width: auto; margin: 0; accent-color: var(--purple); }
.seg label:has(input:checked).seg-ok { background: #dcfce7; border-color: #86efac; }
.seg label:has(input:checked).seg-issue { background: var(--amber-bg); border-color: #fcd34d; }
.seg label:has(input:checked).seg-na { background: #f3f4f6; border-color: #d1d5db; }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.checklist li:first-child { border-top: 0; }

/* Login */
.login { max-width: 380px; margin: 48px auto; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.login img { align-self: flex-start; }

/* Public report */
.report-page { background: var(--soft); }
.report { max-width: 720px; padding-top: 20px; padding-bottom: 40px; }
.report-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.report-head div { display: flex; flex-direction: column; text-align: right; }
.summary { font-weight: 700; padding: 10px 14px; border-radius: 10px; margin: 8px 0 0; }
.summary.good { background: #dcfce7; color: #14532d; }
.summary.warn { background: var(--amber-bg); color: var(--amber); }
.report-foot { text-align: center; margin-top: 20px; }
@media print { .report-page { background: #fff; } .card { break-inside: avoid; } }

/* Monthly report */
.tile em { font-style: normal; font-size: 12px; color: var(--muted); }
.tile.good { border-color: #86efac; background: #f0fdf4; }
.bars { display: flex; align-items: flex-end; gap: 6px; overflow-x: auto; padding-top: 8px; }
.bars div { flex: 1 0 36px; display: flex; flex-direction: column; align-items: center; line-height: 1.3; }
.bars i { display: block; width: 70%; background: var(--purple-2); border-radius: 4px 4px 0 0; }
.bars span { font-size: 11px; color: var(--ink-2); }
.bars small { font-size: 10px; color: var(--muted); white-space: nowrap; }
.visits { list-style: none; margin: 0; padding: 0; }
.visits li { padding: 10px 0; border-top: 1px solid var(--line); }
.visits li:first-child { border-top: 0; }
.visits p { margin: 4px 0 0; }
.note { background: var(--lav); }
.pdf-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 8px 0 24px; }
.preview { background: var(--soft); border-radius: 16px; padding: 16px; max-width: 760px; }
label.inline { flex-direction: row; align-items: center; gap: 8px; }
label.inline input { width: auto; }
.report-body { padding: 4px 0; }
.report-body .tiles { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
