:root {
  --teal: #0F766E; --teal-dark: #115E59; --teal-bg: #F0FDFA;
  --ink: #1F2937; --muted: #6B7280; --line: #E5E7EB; --bg: #F3F4F6;
  --green: #15803D; --amber: #B45309; --amber-bg: #FEF3C7; --red: #B91C1C;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
button, input, select, textarea { font: inherit; }

/* Top bar */
.fs-bar {
  position: sticky; top: 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 16px; background: var(--teal); color: #fff;
}
.fs-bar h1 { margin: 0; font-size: 1.1rem; font-weight: 600; }
.signal { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: .85rem; }
.signal input { width: 18px; height: 18px; accent-color: #fff; }
.signal-pill { padding: 2px 10px; border-radius: 999px; background: #22C55E; color: #052e16; font-weight: 600; font-size: .78rem; }
.signal-pill.off { background: #FCD34D; color: #451a03; }
@media (max-width: 480px) { .signal-hint { display: none; } }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); }
.toolbar select { padding: 7px 8px; border: 1px solid #D1D5DB; border-radius: 6px; min-width: 170px; background: #fff; }
.btn { padding: 8px 14px; border: 0; border-radius: 6px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-teal { background: var(--teal); color: #fff; }
.btn-teal:hover { background: var(--teal-dark); }
.btn-green { background: var(--green); color: #fff; }
.btn-outline { background: #fff; color: var(--teal); border: 1.5px solid var(--teal); }
.btn-outline:hover { background: var(--teal-bg); }
.btn-plain { background: none; color: var(--red); padding: 4px 8px; }
.btn-small { padding: 5px 10px; font-size: .85rem; }
.count { display: inline-block; min-width: 20px; margin-left: 4px; padding: 0 6px; border-radius: 999px; background: #fff; color: var(--green); font-size: .78rem; }

.wrap { max-width: 1000px; margin: 0 auto; padding: 16px; }

/* Job list */
.list-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.list-head h2 { margin: 0; font-size: 1.1rem; }
.list-head p { margin: 0; color: var(--muted); font-size: .88rem; }
.jobs { display: grid; gap: 10px; }
.job {
  display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; text-align: left; width: 100%;
  padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--teal);
  border-radius: 8px; cursor: pointer;
}
.job:hover { border-color: #9CA3AF; border-left-color: var(--teal-dark); }
.job-title { font-weight: 600; }
.job-meta { grid-column: 1 / -1; color: var(--muted); font-size: .88rem; }
.status { align-self: start; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: #E5E7EB; color: #374151; }
.status.inprogress { background: #DBEAFE; color: #1E40AF; }
.status.queued { background: var(--amber-bg); color: #92400E; }
.status.synced { background: #DCFCE7; color: #166534; }
.empty { padding: 32px; text-align: center; color: var(--muted); background: #fff; border-radius: 8px; border: 1px dashed #D1D5DB; }

/* Ticket */
.ticket-head { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 16px; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 10px; }
.ticket-head label { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.ticket-head span { font-weight: 600; }
.banner { padding: 8px 12px; border-radius: 6px; margin-bottom: 10px; font-size: .9rem; background: var(--amber-bg); color: #78350F; }
.banner.done { background: #DCFCE7; color: #14532D; }

.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; border-bottom: 2px solid var(--teal); }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 8px 14px; border: 0; border-radius: 6px 6px 0 0; background: #E5E7EB; color: var(--ink); font-weight: 500; cursor: pointer; white-space: nowrap; }
.tab.active { background: var(--teal); color: #fff; }
.tab.back { background: #fff; color: var(--teal); border: 1px solid var(--line); border-bottom: 0; }
.tab .dot { display: inline-block; width: 8px; height: 8px; margin-left: 6px; border-radius: 50%; background: #22C55E; vertical-align: middle; }
.panel { background: #fff; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 8px 8px; padding: 16px; }

.section { border: 1px solid var(--line); border-radius: 8px; margin-bottom: 14px; }
.section h3 { margin: 0; padding: 8px 12px; font-size: .95rem; color: var(--teal); background: var(--teal-bg); border-bottom: 1px solid var(--line); border-radius: 8px 8px 0 0; }
.section .body { padding: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 14px; }
.field { display: flex; flex-direction: column; gap: 3px; font-size: .85rem; font-weight: 500; color: #374151; }
.field input, .field select, .field textarea, .tbl input, .tbl select {
  padding: 7px 9px; border: 1px solid #D1D5DB; border-radius: 6px; background: #fff; color: var(--ink); width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus, .tbl input:focus, .tbl select:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15,118,110,.15); }
input:disabled, select:disabled, textarea:disabled { background: #F9FAFB; color: #4B5563; }
.field-wide { grid-column: 1 / -1; }

.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 14px; }
.checks label { display: flex; gap: 8px; align-items: center; font-size: .92rem; }
.checks input { width: 18px; height: 18px; accent-color: var(--teal); }

.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 6px; border-bottom: 2px solid var(--line); white-space: nowrap; }
.tbl td { padding: 5px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl td.num { text-align: right; white-space: nowrap; font-weight: 600; }
.tbl textarea { width: 100%; min-width: 160px; padding: 6px; border: 1px solid #D1D5DB; border-radius: 6px; resize: vertical; }
.total-row td { font-weight: 700; border-bottom: 0; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 12px; }
.photo { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #F9FAFB; }
.photo img { display: block; width: 100%; height: 120px; object-fit: cover; }
.photo .cap { display: flex; gap: 4px; padding: 6px; }
.photo .cap input { flex: 1; min-width: 0; padding: 4px 6px; border: 1px solid #D1D5DB; border-radius: 4px; font-size: .82rem; }
.upload { display: inline-flex; align-items: center; gap: 8px; }
.upload input { display: none; }

.actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 14px; }
.actions .left { margin-right: auto; }
.note { color: var(--muted); font-size: .85rem; margin: 0 0 10px; }

.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 100;
  max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 8px;
  background: #1F2937; color: #fff; box-shadow: 0 8px 24px rgba(0,0,0,.25); font-size: .92rem;
}
.toast.warn { background: #92400E; }

@media (max-width: 600px) {
  .wrap { padding: 12px; }
  .panel { padding: 12px; }
  .toolbar select { flex: 1 1 100%; }
}
