/* The repair order as a live document. The "paper" is light like the printed
   ALLDATA sheet so what the desk sees is what the customer gets; the controls
   around it (toolbar, approval, invoice, history) use the app's dark theme. */
.docs-pane { padding: 0; border: 0; background: transparent; }
.ro-wrap { display: flex; flex-direction: column; gap: 12px; min-width: 0; }

/* Toolbar */
.ro-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.ro-steps { display: flex; gap: 4px; }
.ro-step { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; color: var(--muted); border: 1px solid var(--line); }
.ro-step.done { color: #5fd38e; border-color: #1f8a4c; }
.ro-step.now { background: #1f6feb; color: #fff; border-color: #1f6feb; }
.ro-saved { margin-left: auto; font-size: 12px; color: #5fd38e; white-space: nowrap; }
.ro-saved.busy { color: #f6b955; }
.ro-tools { display: flex; flex-wrap: wrap; gap: 6px; }
.ro-tools button, .ro-approve-btns button, .ro-btns button, .ro-invoice button, .ro-paybtns button { min-height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.ro-tools button.primary, .ro-approve-btns button.primary, .ro-btns button.primary, .ro-invoice button.primary { background: #1f6feb; border-color: #1f6feb; color: #fff; }
.ro-btns button.ghost { background: transparent; }
button[disabled].primary, .ro-approve-btns button[disabled] { opacity: .45; cursor: default; }

/* Approval and invoice strips */
.ro-approve { padding: 12px 14px; border-radius: 10px; border: 2px solid #f0a020; background: rgba(240,160,32,.1); }
.ro-approve.additional { border-color: #e2563b; background: rgba(226,86,59,.1); }
.ro-approve-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: baseline; font-size: 15px; }
.ro-approve-btns { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; margin-top: 10px; }
.ro-verbal { margin-top: 8px; }
.ro-verbal summary { cursor: pointer; font-size: 13px; color: var(--muted); }
.ro-invoice { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); }
.ro-invoice.owing { border-color: #e2563b; }
.ro-invoice.paid { border-color: #1f8a4c; color: #5fd38e; }
.ro-pay { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.ro-pay label { display: flex; align-items: center; gap: 8px; }
.ro-pay input { min-height: 40px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; width: 140px; }
.ro-paybtns { display: flex; flex-wrap: wrap; gap: 6px; }

/* The paper */
.ro-paper { background: #fff; color: #111827; border-radius: 6px; padding: 22px 24px; box-shadow: 0 2px 14px rgba(0,0,0,.35); font-size: 13.5px; line-height: 1.35; }
.ro-paper a { color: #1d4ed8; }
.ro-head { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 10px; border-bottom: 2px solid #111827; }
.ro-shop-name { font-size: 22px; font-weight: 800; letter-spacing: .01em; }
.ro-shop-tag { color: #6b7280; }
.ro-title { text-align: right; min-width: 260px; }
.ro-kind { font-size: 19px; font-weight: 800; }
.ro-stamp { color: #b91c1c; font-weight: 800; }
.ro-meta { display: grid; grid-template-columns: auto auto; gap: 2px 10px; justify-content: end; margin-top: 6px; font-size: 12.5px; }
.ro-meta > span:nth-child(odd) { color: #6b7280; text-align: right; }
.ro-meta > span:nth-child(even) { text-align: left; }
.ro-inline { border: 1px solid transparent; border-bottom: 1px dashed #9ca3af; background: transparent; color: inherit; font: inherit; padding: 1px 4px; min-width: 60px; border-radius: 3px; }
.ro-inline:hover { border-color: #cbd5e1; background: #f8fafc; }
.ro-inline:focus { outline: 2px solid #1f6feb; border-color: transparent; background: #fff; }
.ro-num { width: 96px; text-align: right; }
.ro-boxes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.ro-box { border: 1px solid #9ca3af; border-radius: 4px; padding: 8px 10px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ro-box-label { display: flex; justify-content: space-between; align-items: center; font-size: 11px; font-weight: 800; letter-spacing: .08em; color: #6b7280; }
.ro-strong { font-weight: 800; font-size: 14.5px; }
.ro-link { background: none; border: 0; padding: 0; color: #1d4ed8; text-decoration: underline; font: inherit; cursor: pointer; text-align: left; }
.ro-mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; }
.ro-mini { border: 1px solid #cbd5e1; background: #f8fafc; color: #1f2937; border-radius: 6px; padding: 2px 8px; font: inherit; font-size: 12px; cursor: pointer; }
.ro-warn { color: #b45309; font-size: 12.5px; }
.ro-chip { display: inline-block; padding: 2px 8px; border-radius: 999px; background: #eef2ff; color: #3730a3; font-size: 12px; font-weight: 700; border: 0; font-family: inherit; }
.ro-chip.link { cursor: pointer; text-decoration: none; }
.ro-odo { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.ro-carfax { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 4px; }
.ro-carfax-add summary { cursor: pointer; color: #1d4ed8; font-size: 12.5px; }
.ro-carfax-add input[type=url] { flex: 1 1 220px; min-height: 36px; padding: 0 8px; border: 1px solid #cbd5e1; border-radius: 6px; font: inherit; }
.ro-upload { position: relative; overflow: hidden; display: inline-flex; align-items: center; }
.ro-file { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.ro-edit .ro-field input { min-height: 36px; padding: 0 8px; border: 1px solid #cbd5e1; border-radius: 6px; font: inherit; width: 100%; box-sizing: border-box; }
.ro-field { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; }
.ro-field > span { color: #6b7280; font-size: 11.5px; }
.ro-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ro-grid3 { display: grid; grid-template-columns: 2fr 1fr 1.2fr; gap: 8px; }
.ro-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; }
.ro-paper .ro-btns button { background: #f8fafc; color: #1f2937; border-color: #cbd5e1; }
.ro-paper .ro-btns button.primary { background: #1f6feb; color: #fff; border-color: #1f6feb; }
.ro-concern { display: flex; gap: 8px; align-items: baseline; margin: 12px 0 8px; }
.ro-concern > span:first-child { color: #6b7280; font-size: 12px; white-space: nowrap; }
.ro-concernbox { flex: 1; resize: vertical; min-height: 26px; }

/* Line table */
.ro-tablewrap { overflow-x: auto; }
.ro-table { width: 100%; border-collapse: collapse; min-width: 720px; }
.ro-table th { background: #e5e7eb; font-size: 11px; letter-spacing: .06em; text-align: left; padding: 6px 6px; border-bottom: 1px solid #9ca3af; }
.ro-table td { padding: 3px 6px; border-bottom: 1px solid #e5e7eb; vertical-align: middle; }
.ro-r { text-align: right; }
.ro-sub { color: #6b7280; font-size: 12.5px; }
.ro-cell { width: 100%; box-sizing: border-box; min-height: 34px; padding: 4px 6px; border: 1px solid transparent; border-radius: 4px; background: transparent; font: inherit; color: inherit; }
.ro-cell:hover { border-color: #cbd5e1; background: #f8fafc; }
.ro-cell:focus { outline: 2px solid #1f6feb; background: #fff; }
.ro-cell.ro-r { text-align: right; }
select.ro-cell { appearance: auto; }
.ro-total { font-weight: 700; white-space: nowrap; }
.ro-x { border: 0; background: transparent; color: #9ca3af; font-size: 15px; cursor: pointer; padding: 4px; border-radius: 4px; }
.ro-x:hover { color: #b91c1c; background: #fef2f2; }
.ro-xcell { width: 34px; }
.ro-job td { background: #f3f4f6; border-top: 2px solid #d1d5db; padding: 6px; }
.ro-jobhead { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ro-jobno { display: inline-flex; width: 22px; height: 22px; border-radius: 50%; background: #111827; color: #fff; font-size: 12px; font-weight: 800; align-items: center; justify-content: center; }
.ro-jobtitle { flex: 1 1 240px; font-weight: 800; font-size: 14.5px; }
.ro-status { font-size: 11.5px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: #e5e7eb; color: #374151; }
.ro-status.ok { background: #dcfce7; color: #166534; }
.ro-status.todo { background: #fef3c7; color: #92400e; }
.ro-status.wait { background: #dbeafe; color: #1e40af; }
.ro-jobsum { font-weight: 800; margin-left: auto; }
.ro-ccc { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 6px; }
.ro-ccc.ro { grid-template-columns: 1fr; font-size: 12.5px; color: #374151; }
.ro-ccc .ro-inline { width: 100%; box-sizing: border-box; }
.ro-addrow td { background: #fafafa; padding: 4px 6px; }
.ro-addrow button, .ro-newjob button { border: 1px dashed #9ca3af; background: #fff; color: #374151; border-radius: 6px; padding: 5px 10px; font: inherit; font-size: 12.5px; cursor: pointer; margin-right: 4px; }
.ro-addrow button:hover { border-color: #1f6feb; color: #1f6feb; }
.ro-newjob td { padding: 10px 6px; }
.ro-newjob .ro-cell { border: 1px solid #cbd5e1; flex: 1 1 320px; }
.ro-newjob button.primary { border-style: solid; }

/* Bottom: notes, signature, totals */
.ro-bottom { display: grid; grid-template-columns: 1fr 280px; gap: 16px; margin-top: 14px; align-items: start; }
.ro-bottom-left { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.ro-notes { display: flex; flex-direction: column; gap: 8px; }
.ro-notes textarea { width: 100%; box-sizing: border-box; border: 1px solid #cbd5e1; border-radius: 6px; padding: 6px 8px; font: inherit; font-size: 13px; resize: vertical; }
.ro-sign { display: flex; align-items: flex-end; gap: 8px; margin-top: 6px; }
.ro-sigline { flex: 1; border-bottom: 1px solid #111827; min-height: 20px; font-size: 12px; color: #374151; font-style: italic; }
.ro-lug { font-size: 11.5px; font-weight: 700; color: #374151; margin: 4px 0 0; }
.ro-totals { border: 1px solid #111827; padding: 6px 10px; font-size: 13px; }
.ro-trow { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
.ro-trow.strong { font-weight: 800; }
.ro-trow.rule { border-top: 1px solid #9ca3af; margin-top: 3px; padding-top: 4px; }
.ro-trow.big { font-size: 15px; font-weight: 800; }
.ro-trow.owing { color: #b91c1c; }
.ro-trow.paid { color: #6b7280; }
.ro-foot { margin-top: 14px; padding-top: 8px; border-top: 1px solid #d1d5db; font-size: 11px; color: #6b7280; text-align: center; }

/* History and library (dark) */
.ro-history { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.ro-history section { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.ro-history h4, .ro-library summary { margin: 0 0 6px; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.ro-history ul, .ro-library ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ro-history li { padding: 6px 8px; border-radius: 6px; background: var(--panel); font-size: 13px; }
.ro-library { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.ro-library summary { cursor: pointer; }
.ro-library li { display: flex; align-items: center; gap: 6px; }
.ro-library .ro-x { color: var(--muted); }

@media (max-width: 900px) {
  .ro-head { flex-direction: column; }
  .ro-title { text-align: left; }
  .ro-meta { justify-content: start; }
  .ro-meta > span:nth-child(odd) { text-align: left; }
  .ro-boxes, .ro-bottom, .ro-ccc { grid-template-columns: 1fr; }
  .ro-paper { padding: 14px; }
}
@media print {
  .ro-toolbar, .ro-approve, .ro-invoice, .ro-history, .ro-library, .ro-xcell, .ro-addrow, .ro-newjob, .ro-mini, .ro-carfax-add { display: none !important; }
}
/* Shop-only cost column (never printed) */
.ro-table th:nth-child(7), .ro-costcell, .ro-cost { background: #fdf6e3; color: #7c5a00; }
.ro-cost::placeholder { color: #b8a36a; }
@media print { .ro-table th:nth-child(7), .ro-costcell, .ro-cost { display: none !important; } }

/* Reports */
.reports-page { display: flex; flex-direction: column; gap: 14px; }
.rep-picker { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.rep-modes { display: flex; gap: 6px; }
.rep-picker select, .rep-picker input { min-height: 40px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; }
.rep-dates { display: flex; gap: 8px; align-items: center; }
.rep-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.rep-tile { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.rep-tile.good { border-color: #1f8a4c; }
.rep-tile.warn { border-color: #f0a020; }
.rep-tile-label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.rep-tile-value { font-size: 24px; font-weight: 800; margin-top: 2px; }
.rep-tile-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.rep-section { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.rep-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.rep-head h2 { margin: 0; font-size: 16px; }
.rep-exports { display: flex; flex-wrap: wrap; gap: 6px; }
.rep-tablewrap { overflow-x: auto; }
.rep-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rep-table th { text-align: left; font-size: 11px; letter-spacing: .05em; color: var(--muted); padding: 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.rep-table td { padding: 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.rep-table .r { text-align: right; }
.rep-table tr.total td { font-weight: 800; border-top: 2px solid var(--line); }
.rep-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 900px) { .rep-two { grid-template-columns: 1fr; } }
