:root { --blue: #1b5fae; --ink: #1d2733; --line: #d7dde5; --bg: #f6f8fb; --ext: #0b6b3a; --ext-bg: #dff3e7; --int: #8a4b00; --int-bg: #ffe9cc; }
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.45 system-ui, sans-serif; color: var(--ink); background: var(--bg); }
.topbar { display: flex; gap: 1rem; align-items: center; padding: .6rem 1rem; background: var(--blue); color: #fff; }
.topbar .brand { color: #fff; font-weight: 700; text-decoration: none; margin-right: auto; }
.topbar .link { color: #fff; background: none; border: 0; text-decoration: underline; cursor: pointer; font: inherit; }
.menu { display: flex; flex-wrap: wrap; gap: .25rem; padding: .4rem 1rem; background: #fff; border-bottom: 1px solid var(--line); }
.menu a { padding: .35rem .7rem; border-radius: 6px; color: var(--ink); text-decoration: none; }
.menu a.active { background: var(--blue); color: #fff; }
.page { max-width: 1100px; margin: 1rem auto; padding: 0 1rem 3rem; }
.narrow { max-width: 420px; margin: 2rem auto; background: #fff; padding: 1.5rem; border: 1px solid var(--line); border-radius: 8px; }
label { display: block; margin: .75rem 0; font-weight: 600; }
input, select, textarea { display: block; width: 100%; padding: .5rem; margin-top: .25rem; font: inherit; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
input[type=checkbox] { display: inline-block; width: auto; }
button, .button { display: inline-block; padding: .5rem 1rem; background: var(--blue); color: #fff; border: 0; border-radius: 6px; font: inherit; cursor: pointer; text-decoration: none; }
button.secondary, .button.secondary { background: #fff; color: var(--blue); border: 1px solid var(--blue); }
button.danger { background: #b3261e; }
form.inline { display: inline; }
.flash { background: #e6f4ea; border: 1px solid #9fd3ae; padding: .6rem .9rem; border-radius: 6px; }
.error { background: #fdeceb; border: 1px solid #f0b4b0; padding: .6rem .9rem; border-radius: 6px; color: #8c1d18; }
.field-error { color: #8c1d18; font-weight: 400; font-size: .9rem; }
.muted { color: #5b6776; }
table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--line); }
th, td { text-align: left; padding: .5rem .65rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #eef2f7; }
.tabs { display: flex; gap: .5rem; flex-wrap: wrap; margin: 1rem 0; }
.tabs a { padding: .45rem .9rem; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); text-decoration: none; }
.tabs a.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; margin-bottom: 1rem; }
.filters label { margin: 0; flex: 1 1 150px; }
.tag { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .85rem; font-weight: 700; }
.tag-externo { background: var(--ext-bg); color: var(--ext); border: 1px solid var(--ext); }
.tag-interno { background: var(--int-bg); color: var(--int); border: 1px solid var(--int); }
.badge-in { color: var(--ext); font-weight: 700; }
.badge-out { color: #8c1d18; font-weight: 700; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 1rem; }
.panel h2 { margin-top: 0; font-size: 1.1rem; }
.cards { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.cards li { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 1rem; }
.qr svg { max-width: 220px; height: auto; }
.photo { max-width: 160px; border-radius: 8px; border: 1px solid var(--line); }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; margin: 0; }
dl.facts dt { font-weight: 600; }
dl.facts dd { margin: 0; }
@media (max-width: 700px) { table, thead, tbody, tr, td, th { display: block; } thead { display: none; } tr { margin-bottom: .75rem; border: 1px solid var(--line); } }
.state { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .85rem; font-weight: 700; border: 1px solid; }
.state-overdue { background: #fdeceb; color: #8c1d18; border-color: #8c1d18; }
.state-soon { background: #fff4d6; color: #7a5200; border-color: #7a5200; }
.state-ok { background: #e6f4ea; color: #1b5e30; border-color: #1b5e30; }
.state-no_base { background: #eef2f7; color: #5b6776; border-color: #5b6776; }
.wo { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .85rem; font-weight: 700; border: 1px solid; }
.wo-open { background: #eef2f7; color: #5b6776; border-color: #5b6776; }
.wo-assigned { background: #e8f0fb; color: var(--blue); border-color: var(--blue); }
.wo-in_progress { background: #fff4d6; color: #7a5200; border-color: #7a5200; }
.wo-done { background: #e6f4ea; color: #1b5e30; border-color: #1b5e30; }
.wo-cancelled { background: #fdeceb; color: #8c1d18; border-color: #8c1d18; }
fieldset { border: 1px solid var(--line); border-radius: 6px; margin: .75rem 0; }
.note { border-left: 3px solid var(--line); padding-left: .6rem; }
details { margin-top: .75rem; }
/* Technician phone screens (step 3 part B) */
.pager { display: flex; gap: .75rem; align-items: center; justify-content: center; margin: 1rem 0; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: .4rem 0; border-bottom: 1px solid var(--line); }
tr.low td { background: #fff4d6; }
.jobs { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .75rem; }
.job { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .9rem; display: grid; gap: .6rem; }
.job-link { color: var(--ink); text-decoration: none; display: block; }
.job .button { text-align: center; padding: .8rem 1rem; }
.job-group h2 { font-size: 1.05rem; margin: 1rem 0 .5rem; }
#scan-video { width: 100%; max-height: 60vh; border-radius: 10px; background: #000; }
.draft-status { font-size: .9rem; }
.phonebar { display: none; }
@media (max-width: 700px) {
  body.tech .menu { display: none; }
  body.tech .page { padding-bottom: 5.5rem; }
  .phonebar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); z-index: 10; }
  .phonebar a { padding: 1rem .25rem; text-align: center; color: var(--ink); text-decoration: none; font-weight: 600; font-size: .9rem; }
  .phonebar a.active { background: var(--blue); color: #fff; }
  .close-form input, .close-form textarea, .close-form select { font-size: 1.05rem; padding: .7rem; }
  .close-form input[type=checkbox] { width: 1.4rem; height: 1.4rem; margin-right: .5rem; }
  .close-form button[type=submit] { width: 100%; padding: .9rem; font-size: 1.05rem; }
}

/* Photos and signature of a work order */
.photo-grid { display: flex; flex-wrap: wrap; gap: .75rem; list-style: none; padding: 0; margin: 0 0 .75rem; }
.photo-grid img { width: 140px; height: 105px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.signature-pad { width: 100%; max-width: 640px; height: auto; aspect-ratio: 8 / 3; background: #fff; border: 1px solid var(--line); border-radius: 8px; touch-action: none; display: block; }
.signature-saved { max-width: 320px; width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
