:root {
  --ink: #17212b;
  --muted: #697586;
  --line: #d9e0e8;
  --soft: #f4f7fa;
  --panel: #ffffff;
  --blue: #1f6f8b;
  --green: #1f7a5a;
  --red: #b42318;
  --shadow: 0 18px 45px rgba(25, 38, 54, 0.1);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: Arial, "Noto Sans Thai", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, #e8f0f5 0%, #f6f8fa 44%, #edf2f6 100%);
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 42px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 22px;
  padding: 18px;
  border: 1px solid rgba(217, 224, 232, 0.9);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(240, 247, 250, 0.96)),
    linear-gradient(90deg, rgba(31, 111, 139, 0.16), rgba(215, 154, 34, 0.12));
  box-shadow: 0 12px 36px rgba(25, 38, 54, 0.08);
}

.session-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.bottom-session-actions {
  justify-content: center;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid rgba(217, 224, 232, 0.9);
}

.session-actions span {
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
}

.login-view {
  min-height: calc(100vh - 180px);
  display: grid;
  place-items: center;
}

.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 22px;
  border: 1px solid rgba(217, 224, 232, 0.9);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-panel label {
  display: grid;
  gap: 7px;
}

.login-panel label span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.login-status {
  min-height: 18px;
  margin: 0;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.expense-date-section {
  padding: 12px;
}

.expense-date-section label {
  display: grid;
  gap: 7px;
  max-width: 220px;
}

.expense-date-section span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.brand-lockup {
  display: flex;
  gap: 14px;
  align-items: center;
}

.brand-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid rgba(245, 126, 32, 0.28);
  border-radius: 8px;
  color: white;
  background:
    linear-gradient(135deg, #07335f 0%, #0c5b99 58%, #f57e20 100%);
  box-shadow: 0 14px 30px rgba(12, 91, 153, 0.24);
  font-size: 16px;
  font-weight: 900;
}

.home-button {
  min-height: 40px;
  padding: 9px 14px;
  color: var(--green);
  border: 1px solid #b8d8c9;
  background: #eaf6f0;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(26px, 4vw, 42px);
  line-height: 1.15;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.home-view {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.sub-view {
  margin-top: 0;
}

.module-card {
  position: relative;
  min-height: 178px;
  display: grid;
  align-content: space-between;
  gap: 18px;
  padding: 18px;
  text-align: left;
  border: 1px solid rgba(217, 224, 232, 0.95);
  border-radius: 8px;
  box-shadow: 0 16px 36px rgba(25, 38, 54, 0.1);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 252, 0.98));
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.module-card::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 5px;
  background: var(--card-accent, var(--blue));
}

.module-card:hover {
  transform: translateY(-2px);
  border-color: rgba(31, 111, 139, 0.24);
  box-shadow: 0 22px 42px rgba(25, 38, 54, 0.14);
}

.module-card > span:not(.module-symbol) {
  width: fit-content;
  padding: 4px 9px;
  border-radius: 999px;
  color: var(--blue);
  background: #e8f2f7;
  font-size: 12px;
  font-weight: 900;
}

.module-card strong {
  position: relative;
  z-index: 1;
  font-size: 24px;
  line-height: 1.2;
}

.module-card small {
  max-width: 360px;
}

.expense-module-card {
  --card-accent: var(--green);
}

.maintenance-module-card {
  --card-accent: var(--blue);
}

.inspection-module-card {
  --card-accent: #6a7a20;
}

.document-module-card {
  --card-accent: #7b5ea7;
}

.module-symbol {
  position: relative;
  z-index: 1;
  width: 52px;
  height: 52px;
  display: block;
  padding: 0;
  border-radius: 8px;
  background: #f3f8fa;
  border: 1px solid #d8e7ee;
  background: color-mix(in srgb, var(--card-accent, var(--blue)) 13%, white);
  border: 1px solid color-mix(in srgb, var(--card-accent, var(--blue)) 28%, white);
}

.module-symbol::before,
.module-symbol::after {
  content: "";
  position: absolute;
  border-radius: 3px;
}

.maintenance-symbol::before {
  left: 23px;
  top: 10px;
  width: 7px;
  height: 32px;
  background: #1f6f8b;
  transform: rotate(42deg);
}

.maintenance-symbol::after {
  left: 13px;
  top: 13px;
  width: 26px;
  height: 8px;
  border: 3px solid #1f6f8b;
  border-left: 0;
  border-radius: 0 8px 8px 0;
  transform: rotate(42deg);
}

.inspection-symbol::before {
  left: 12px;
  top: 10px;
  width: 28px;
  height: 32px;
  border: 3px solid #6a7a20;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.6);
}

.inspection-symbol::after {
  left: 18px;
  top: 18px;
  width: 16px;
  height: 3px;
  border-radius: 3px;
  background: #6a7a20;
  box-shadow: 0 8px 0 #6a7a20, 0 16px 0 #6a7a20;
}

.expense-symbol::before {
  left: 12px;
  top: 15px;
  width: 28px;
  height: 22px;
  border: 3px solid #1f7a5a;
  background: rgba(255, 255, 255, 0.55);
}

.expense-symbol::after {
  left: 24px;
  top: 20px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #1f7a5a;
}

.document-symbol::before {
  left: 15px;
  top: 11px;
  width: 22px;
  height: 30px;
  border: 3px solid #7b5ea7;
  background: rgba(255, 255, 255, 0.55);
}

.document-symbol::after {
  left: 20px;
  top: 20px;
  width: 13px;
  height: 3px;
  background: #7b5ea7;
  box-shadow: 0 7px 0 #7b5ea7;
}

.section-card {
  width: min(900px, 100%);
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.full-width-card {
  width: 100%;
}

.entry-panel,
.list-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.entry-panel {
  padding: 18px;
  display: grid;
  gap: 18px;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf3f7;
}

.mode-switch button {
  min-height: 42px;
  color: var(--muted);
  background: transparent;
}

.mode-switch button.active {
  color: white;
  background: var(--green);
}

.expense-choice-view {
  margin-bottom: 16px;
}

.expense-repair-history-view {
  margin-top: 0;
}

.selected-repair-context {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid #b8d8c9;
  border-radius: 8px;
  color: #123524;
  background: #eef8f3;
}

.selected-repair-context strong {
  font-size: 14px;
}

.selected-repair-context span {
  font-size: 13px;
  line-height: 1.4;
}

.form-section {
  display: grid;
  gap: 14px;
}

.manual-section {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.manual-inputs {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
}

.section-title::after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.upload-zone {
  position: relative;
  min-height: 118px;
  border: 2px dashed #a9b8c8;
  border-radius: 8px;
  background: var(--soft);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 18px;
}

.upload-zone.dragging {
  border-color: var(--blue);
  background: #e6f4f8;
}

.upload-zone > input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.upload-copy strong {
  display: block;
  font-size: 18px;
}

.upload-copy {
  width: 100%;
}

.upload-copy span,
small,
.ocr-status,
.list-head p,
.expense-card p {
  color: var(--muted);
  font-size: 13px;
}

.upload-buttons {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 14px;
}

.upload-buttons button {
  min-height: 44px;
  padding: 10px 12px;
}

#uploadButton {
  color: white;
  background: var(--green);
}

.preview-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.preview-list figure {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #f8fafc;
}

.preview-list img {
  width: 100%;
  height: 150px;
  display: block;
  object-fit: contain;
}

.preview-list figcaption {
  padding: 7px 9px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  background: white;
}

select:disabled {
  color: #445568;
  background: #eef3f7;
  opacity: 1;
}

label.is-invalid span {
  color: var(--red);
}

label.is-invalid input,
label.is-invalid select,
label.is-invalid textarea {
  border-color: var(--red);
  background: #fff7f6;
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.12);
}

.field-error {
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
}

.inspection-panel {
  align-content: start;
}

.inspection-checkall-row {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid #d9e8df;
  border-radius: 8px;
  background: #f0f8f4;
}

.inspection-checkall {
  display: flex;
  grid-template-columns: none;
  gap: 9px;
  align-items: center;
  cursor: pointer;
}

.inspection-checkall input,
.inspection-check-item input {
  width: 22px;
  height: 22px;
  min-height: 22px;
  padding: 0;
  flex: 0 0 auto;
  accent-color: var(--green);
}

.inspection-check-item input[data-inspection-status="failed"] {
  appearance: none;
  border: 2px solid var(--red);
  border-radius: 4px;
  position: relative;
  background: #fff5f5;
}

.inspection-check-item input[data-inspection-status="failed"]::after {
  content: '×';
  position: absolute;
  inset: -5px 0 0;
  color: var(--red);
  font-size: 25px;
  font-weight: 900;
  line-height: 22px;
  text-align: center;
}

.inspection-checkall span {
  font-weight: 900;
}

.inspection-checkall-row p {
  margin: 0;
  color: var(--blue);
  font-size: 13px;
  font-weight: 900;
  text-align: right;
}

.inspection-checklist {
  display: grid;
  gap: 12px;
}

.inspection-section {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #d6e2dc;
  border-radius: 8px;
  background: #f8fbf9;
}

.inspection-section-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.inspection-section-head strong {
  color: #123f63;
  font-size: 15px;
}

.inspection-section-list {
  display: grid;
  gap: 8px;
}

.inspection-check-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
  cursor: pointer;
  width: 100%;
  font: inherit;
  text-align: left;
}

.inspection-status-mark {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border: 2px solid var(--line);
  border-radius: 4px;
  background: #fff;
  position: relative;
}

.inspection-check-item[data-inspection-status="passed"] .inspection-status-mark {
  border-color: var(--green);
  background: var(--green);
}

.inspection-check-item[data-inspection-status="passed"] .inspection-status-mark::after {
  content: '✓';
  color: #fff;
  font-size: 17px;
  font-weight: 900;
  line-height: 18px;
  position: absolute;
  inset: 0;
  text-align: center;
}

.inspection-check-item[data-inspection-status="failed"] .inspection-status-mark {
  border-color: var(--red);
  background: #fff5f5;
}

.inspection-check-item[data-inspection-status="failed"] .inspection-status-mark::after {
  content: '×';
  color: var(--red);
  font-size: 25px;
  font-weight: 900;
  line-height: 18px;
  position: absolute;
  inset: 0;
  text-align: center;
}

.inspection-check-item b {
  display: block;
  margin-bottom: 3px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
}

.inspection-check-item small {
  display: block;
  color: var(--muted);
  line-height: 1.35;
}

.inspection-history-card h3 {
  margin-bottom: 4px;
}

.transport-job-card {
  border-left: 4px solid #e07a22;
}

.transport-job-driver-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.transport-job-driver-fields label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.transport-job-driver-fields input {
  min-height: 40px;
}

.transport-job-driver-fields p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--blue);
  font-weight: 800;
}

.transport-job-driver-fields button {
  grid-column: 1 / -1;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.manual-field-grid {
  align-items: start;
}

.manual-entry-row {
  grid-template-columns: minmax(0, 1fr) minmax(118px, 150px);
  align-items: start;
}

.manual-note-row {
  min-width: 0;
}

.compact-field-grid {
  grid-template-columns: repeat(2, minmax(0, 150px));
  column-gap: 24px;
  align-items: start;
}

.manual-field-grid label {
  min-width: 0;
}

.compact-field-grid label {
  min-width: 0;
}

.edit-repair-fields {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #d9e8df;
  border-radius: 8px;
  background: #f0f8f4;
}

.repair-edit-grid {
  grid-template-columns: minmax(0, 1fr);
}

.repair-date-field {
  width: min(160px, 100%);
}

.repair-date-field input {
  min-height: 40px;
  height: 40px;
  padding: 7px 8px;
}

.repair-edit-grid .repair-part-row,
.repair-edit-grid > label:not(.repair-date-field) {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

label span {
  font-size: 14px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid #bcc8d4;
  border-radius: 8px;
  padding: 11px 12px;
  color: var(--ink);
  background: white;
}

.calendar-date-input {
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

textarea {
  resize: vertical;
}

#note {
  height: 46px;
}

#billDate,
#amount {
  height: 48px;
  min-height: 48px;
  max-height: 48px;
  padding-top: 0;
  padding-bottom: 0;
  line-height: 48px;
}

.entry-panel.mode-upload .manual-section,
.entry-panel.mode-manual .upload-section {
  display: none;
}

.line-item-preview {
  border: 1px solid #b8d8c9;
  border-radius: 8px;
  background: #eef8f3;
  padding: 12px;
}

.line-item-preview strong {
  display: block;
  margin-bottom: 8px;
}

.line-items {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
}

.ocr-sessions {
  display: grid;
  gap: 12px;
  margin-bottom: 8px;
}

.ocr-session {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #cfe1d8;
  border-radius: 8px;
  background: white;
}

.ocr-session h3 {
  margin: 0;
  font-size: 16px;
}

.ocr-session-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.ocr-session-head span {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  color: #1f7a5a;
  background: #e6f5ee;
  font-size: 12px;
  font-weight: 800;
}

.session-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.session-fields label {
  gap: 5px;
}

.session-fields input {
  min-height: 42px;
  height: 42px;
  padding: 8px 10px;
}

.line-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 7px 8px;
  background: white;
  border: 1px solid #d5e8de;
  border-radius: 7px;
}

.line-item span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.line-item input {
  width: 96px;
  min-height: 36px;
  height: 36px;
  padding: 6px 8px;
  text-align: right;
  font-weight: 800;
}

.line-item .line-item-input {
  width: 100%;
  text-align: left;
  font-weight: 700;
}

.line-item .line-item-amount-input {
  width: 96px;
  text-align: right;
}

.line-item.summary {
  background: #17212b;
  border-color: #17212b;
  color: white;
}

.form-command {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #cfe1d8;
  border-radius: 8px;
  background: #f3faf6;
}

.inline-actions {
  display: grid;
  gap: 10px;
}

.upload-command {
  margin-top: 14px;
  text-align: left;
}

.manual-command {
  margin-top: 2px;
}

.command-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: end;
}

.command-title span {
  color: var(--ink);
  font-weight: 900;
}

.command-title small {
  text-align: right;
}

.actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 11px 14px;
  cursor: pointer;
  font-weight: 800;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.primary {
  color: white;
  background: var(--green);
}

.secondary {
  color: var(--ink);
  background: #e7edf3;
}

.history-nav-panel {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.notification-status {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.repair-history-view {
  width: min(900px, 100%);
  margin: 0 auto;
}

.list-panel {
  min-height: 520px;
}

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.list-head h2 {
  margin-bottom: 3px;
  font-size: 22px;
}

.list-head p {
  margin-bottom: 0;
}

.list-head input {
  max-width: 260px;
}

.list-tools {
  display: flex;
  align-items: center;
  gap: 10px;
}

.date-filter {
  display: grid;
  gap: 4px;
  min-width: 135px;
}

.date-filter span {
  color: var(--muted);
  font-size: 12px;
}

.date-filter input {
  min-height: 44px;
  height: 44px;
  padding: 8px 10px;
}

.date-filter select {
  min-height: 44px;
  height: 44px;
  padding: 8px 10px;
}

.month-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.month-filter input {
  width: 170px;
}

.repair-history-view .month-filter input,
.expense-repair-history-view .month-filter input {
  width: 132px;
}

.repair-history-view .date-filter,
.expense-repair-history-view .date-filter {
  min-width: 0;
}

.repair-history-view .month-filter,
.repair-history-view .vehicle-filter,
.expense-repair-history-view .month-filter,
.expense-repair-history-view .vehicle-filter {
  display: grid;
  gap: 4px;
}

.vehicle-filter select {
  width: 170px;
}

.repair-history-view .vehicle-filter select,
.expense-repair-history-view .vehicle-filter select {
  width: 132px;
}

.export-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 13px;
  border-radius: 8px;
  color: white;
  background: var(--blue);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.compact-button {
  min-height: 44px;
  padding: 9px 12px;
  white-space: nowrap;
}

.export-button.is-loading {
  opacity: 0.7;
  pointer-events: none;
}

.expense-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.expense-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.expense-month-group {
  display: grid;
  gap: 10px;
}

.expense-month-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #c8d8e5;
  border-radius: 8px;
  background: #eef5f8;
}

.expense-month-head strong {
  font-size: 15px;
}

.expense-month-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}

.expense-card time {
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
}

.expense-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  margin-bottom: 4px;
}

.source-badge {
  padding: 3px 7px;
  border-radius: 999px;
  color: #1f7a5a;
  background: #e6f5ee;
  font-size: 12px;
  font-weight: 800;
}

.expense-repair-reference {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 6px 0;
}

.expense-repair-reference button {
  min-height: 30px;
  padding: 5px 8px;
  color: white;
  background: var(--blue);
}

.expense-repair-reference span {
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.expense-repair-card.is-focused {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(238, 128, 35, 0.2), var(--shadow);
}

.expense-repair-card > .repair-details {
  grid-column: 1 / -1;
}

.expense-add-button {
  display: inline-grid;
  align-items: center;
  justify-content: center;
  min-width: 168px;
  min-height: 48px;
  padding: 10px 14px;
  color: var(--green);
  background: white;
  border: 2px solid var(--green);
  box-shadow: 0 8px 18px rgba(27, 127, 90, 0.12);
}

.expense-add-button b {
  font-size: 14px;
  line-height: 1.2;
  white-space: nowrap;
}

.expense-repair-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  width: 100%;
}

.expense-edit-toggle {
  min-width: 96px;
  min-height: 40px;
  color: var(--green);
  background: #e6f5ee;
  border: 1px solid #b8d8c9;
}

.expense-card h3 {
  margin-bottom: 4px;
  font-size: 17px;
  line-height: 1.35;
}

.expense-card p {
  margin-bottom: 0;
}

.maintenance-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0;
}

.maintenance-meta span {
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--muted);
  background: #eef2f6;
  font-size: 12px;
  font-weight: 700;
}

.maintenance-status-group {
  gap: 12px;
}

.maintenance-status-head {
  background: #e8f1f8;
}

.maintenance-card.is-pending {
  border-left: 4px solid #d79a22;
}

.maintenance-card.is-scheduled h3 {
  color: #123f63;
  font-size: 22px;
}

.maintenance-card.is-scheduled .scheduled-date-chip {
  color: #123f63;
  background: #dcecf7;
  font-size: 15px;
  font-weight: 900;
}

.scheduled-summary-line {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  margin-bottom: 8px;
}

.scheduled-summary-line span {
  padding: 5px 9px;
  border-radius: 999px;
  color: #344054;
  background: #edf3f7;
  font-size: 13px;
  font-weight: 800;
}

.scheduled-summary-line .repair-status-chip {
  color: #8a4b00;
  background: #fff3d8;
}

.scheduled-summary-line .scheduled-plate-chip {
  font-size: 15px;
  font-weight: 900;
}

.scheduled-summary-card .maintenance-meta {
  margin-bottom: 10px;
}

.scheduled-summary-card .repair-details {
  margin-top: 6px;
}

.maintenance-card.is-repaired {
  border-left: 4px solid var(--green);
}

.repaired-summary-card {
  grid-template-columns: 1fr;
}

.repaired-summary-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 6px;
}

.repaired-summary-line span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.expense-repair-card .repaired-summary-line span {
  color: var(--blue);
}

.repaired-summary-line strong {
  color: var(--green);
  font-size: 18px;
  font-weight: 900;
}

.repair-details {
  margin-top: 10px;
}

.repair-details summary {
  width: max-content;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--ink);
  background: #e7edf3;
  cursor: pointer;
  font-weight: 900;
}

.repair-details[open] summary {
  margin-bottom: 10px;
}

.repair-details-costs {
  align-items: flex-start;
  margin: 8px 0;
}

.details-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.maintenance-dates {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 6px;
}

.maintenance-dates span {
  padding: 4px 8px;
  border-radius: 999px;
  color: #344054;
  background: #edf3f7;
  font-size: 12px;
  font-weight: 800;
}

.repair-complete-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  margin: 10px 0 8px;
  padding: 10px;
  border: 1px solid #d9e8df;
  border-radius: 8px;
  background: #f0f8f4;
}

.repair-complete-fields label {
  gap: 4px;
  font-size: 12px;
}

.repair-complete-fields input {
  min-height: 36px;
  padding: 7px 8px;
}

.repair-part-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(96px, 142px);
  gap: 8px;
  align-items: start;
  min-width: 0;
}

.repair-part-row label {
  min-width: 0;
}

.repair-part-row input[type="number"] {
  text-align: right;
}

.repair-schedule-fields {
  grid-template-columns: minmax(0, 1fr);
  background: #fff7ed;
  border-color: #f3d3a6;
}

.repair-waiting-note {
  margin: 10px 0 8px;
  padding: 10px;
  border: 1px solid #ead8b8;
  border-radius: 8px;
  color: #7a4b12;
  background: #fff8ec;
  font-size: 13px;
  font-weight: 800;
}

.acknowledge-repair-button {
  color: white;
  background: #1f6f8b !important;
}

.mark-repaired-button {
  color: white;
  background: var(--green) !important;
}

.pending-cost {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.maintenance-costs {
  display: grid;
  justify-items: end;
  gap: 3px;
}

.maintenance-costs span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.maintenance-costs strong {
  font-size: 20px;
}

.saved-details {
  display: grid;
  gap: 4px;
  margin: 8px 0;
  padding: 8px 10px;
  border-left: 3px solid var(--green);
  background: #eef8f3;
}

.saved-details div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  color: #324253;
  font-size: 13px;
}

.saved-details span {
  overflow-wrap: anywhere;
}

.linked-expense-list {
  display: grid;
  gap: 6px;
  width: 100%;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid #d5e8de;
  border-radius: 8px;
  background: #f6fbf8;
}

.linked-expense-list strong {
  color: #17624b;
  font-size: 13px;
}

.linked-expense-list div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.linked-expense-list span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.linked-expense-list .repair-expense-item {
  grid-template-columns: minmax(0, 1fr) minmax(112px, auto);
  column-gap: 16px;
  padding-top: 8px;
  border-top: 1px solid #dcebe4;
}

.repair-expense-item span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.repair-expense-item small {
  color: var(--muted);
  font-weight: 800;
}

.repair-expense-date-line {
  display: block;
  font-size: 11.5px;
  line-height: 1.45;
}

.repair-expense-source-line {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 800;
  line-height: 1.45;
}

.repair-expense-item em {
  color: var(--muted);
  font-style: normal;
}

.repair-expense-amount,
.repair-card-total {
  color: #123524;
  font-size: 16px;
  font-weight: 800;
  justify-self: end;
  text-align: right;
}

.card-side .repair-card-total {
  font-size: 16px;
}

.repair-expense-amount-input {
  display: none;
  width: 112px;
  min-height: 36px;
  padding: 6px 8px;
  text-align: right;
  font-weight: 800;
}

.repair-expense-item-input {
  display: none;
  width: 100%;
  min-height: 36px;
  padding: 6px 8px;
  font-weight: 800;
}

.expense-repair-card.is-editing-expenses .repair-expense-amount {
  display: none;
}

.expense-repair-card.is-editing-expenses .repair-expense-amount-input {
  display: block;
}

.expense-repair-card.is-editing-expenses .repair-expense-name {
  display: none;
}

.expense-repair-card.is-editing-expenses .repair-expense-item-input {
  display: block;
}

.repair-expense-group .saved-details {
  margin: 4px 0;
}

.expense-total {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid #b8d8c9;
  border-radius: 8px;
  color: white;
  background: #17212b;
}

.expense-total span,
.expense-total strong {
  font-weight: 900;
}

.expense-total strong {
  font-size: 22px;
}

.card-side {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.card-side strong {
  font-size: 20px;
}

.card-side button {
  padding: 7px 9px;
  margin-left: 4px;
  background: #e8eef5;
}

.card-side button[data-delete] {
  color: var(--red);
}

.empty {
  padding: 34px 12px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 18px, 560px);
    padding-top: 18px;
  }

  .topbar,
  .home-view,
  .workspace,
  .list-head,
  .expense-card {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
    align-items: stretch;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .topbar-actions .home-button {
    flex: 1;
  }

  .brand-lockup {
    align-items: start;
  }

  .brand-mark {
    width: 50px;
    height: 50px;
    font-size: 14px;
  }

  .module-card {
    min-height: 138px;
  }

  .workspace {
    display: grid;
  }

  .actions,
  .upload-buttons {
    grid-template-columns: 1fr;
  }

  .command-title {
    display: grid;
    align-items: start;
  }

  .command-title small {
    text-align: left;
  }

  .list-head {
    display: grid;
  }

  .list-head input {
    max-width: none;
  }

  .list-tools {
    display: grid;
    grid-template-columns: 1fr;
  }

  .repair-history-view .list-tools,
  .expense-repair-history-view .list-tools {
    grid-template-columns: 140px 140px;
    justify-content: start;
    column-gap: 14px;
    row-gap: 10px;
  }

  .repair-history-view .list-tools .compact-button,
  .expense-repair-history-view .list-tools .compact-button {
    grid-column: 1 / -1;
  }

  .repair-history-view .vehicle-filter select,
  .expense-repair-history-view .vehicle-filter select {
    width: 100%;
    min-width: 0;
    height: 38px;
    min-height: 38px;
    padding: 5px 7px;
    font-size: 13px;
    appearance: none;
    -webkit-appearance: none;
  }

  .repair-history-view .month-filter input,
  .expense-repair-history-view .month-filter input {
    width: 100%;
    min-width: 0;
    height: 38px;
    min-height: 38px;
    padding: 5px 7px;
    font-size: 13px;
    appearance: none;
    -webkit-appearance: none;
  }

  .session-fields {
    grid-template-columns: 1fr;
  }

  .card-side {
    justify-items: start;
  }

  .expense-add-button {
    width: 100%;
    min-width: 0;
  }

  .expense-edit-toggle {
    min-width: 92px;
  }

  .expense-month-head {
    display: grid;
    align-items: start;
  }

  .expense-month-head span {
    text-align: left;
  }

  .repair-complete-fields {
    grid-template-columns: 1fr;
  }

  .repair-part-row {
    grid-template-columns: minmax(0, 1fr) 96px;
    gap: 7px;
  }

}

/* Modern UI refresh */
:root {
  --orange: #f07b22;
  --surface: #ffffff;
  --surface-soft: #f7fafc;
  --blue-deep: #0b3f68;
  --green-deep: #14664b;
  --shadow: 0 14px 34px rgba(12, 35, 56, 0.12);
  --shadow-soft: 0 8px 22px rgba(12, 35, 56, 0.08);
}

body {
  background:
    linear-gradient(180deg, #dcecf4 0%, #f5f8fb 34%, #edf4f7 100%);
}

.topbar {
  overflow: hidden;
  border-color: rgba(11, 63, 104, 0.12);
  background:
    linear-gradient(135deg, rgba(11, 63, 104, 0.96), rgba(31, 111, 139, 0.94) 58%, rgba(240, 123, 34, 0.9));
  box-shadow: 0 18px 38px rgba(11, 63, 104, 0.18);
}

.topbar .eyebrow,
.topbar h1 {
  color: white;
}

.topbar .eyebrow {
  opacity: 0.82;
}

.brand-mark {
  border-color: rgba(255, 255, 255, 0.28);
  background:
    linear-gradient(135deg, #ffffff 0%, #e9f3f8 48%, #f5a15c 100%);
  color: var(--blue-deep);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
}

.home-button {
  color: white;
  border-color: rgba(255, 255, 255, 0.34);
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.home-button:hover {
  background: rgba(255, 255, 255, 0.22);
}

#logoutButton {
  color: #ffffff;
  border-color: #0f766e;
  background: linear-gradient(135deg, #0f5f73 0%, #0f766e 58%, #148f86 100%);
  box-shadow: 0 10px 22px rgba(15, 118, 110, 0.22);
}

#logoutButton:hover {
  background: linear-gradient(135deg, #0b4f63 0%, #0d665f 58%, #117a72 100%);
}

.module-card,
.entry-panel,
.list-panel,
.section-card {
  border-color: rgba(167, 184, 199, 0.62);
  background: linear-gradient(180deg, #ffffff 0%, #f9fbfd 100%);
  box-shadow: var(--shadow-soft);
}

.module-card {
  min-height: 168px;
  padding: 20px;
  border-color: rgba(148, 166, 184, 0.48);
}

.module-card::after {
  height: 6px;
}

.module-card:hover {
  border-color: rgba(31, 111, 139, 0.32);
  box-shadow: 0 18px 36px rgba(12, 35, 56, 0.14);
}

.module-symbol {
  width: 48px;
  height: 48px;
  border-color: color-mix(in srgb, var(--card-accent, var(--blue)) 32%, white);
  background: color-mix(in srgb, var(--card-accent, var(--blue)) 12%, white);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74);
}

.module-card strong {
  color: #111827;
  font-size: 23px;
}

.entry-panel {
  gap: 16px;
}

.form-section,
.manual-inputs,
.edit-repair-fields,
.repair-complete-fields,
.line-item-preview,
.selected-repair-context {
  border-color: rgba(184, 216, 201, 0.75);
  background: #f8fcfa;
}

.section-title {
  color: var(--blue);
  font-size: 12px;
  text-transform: uppercase;
}

.mode-switch {
  gap: 4px;
  padding: 4px;
  background: #eaf1f5;
}

.mode-switch button.active,
.primary,
#uploadButton,
.mark-repaired-button {
  background: linear-gradient(180deg, #248b68, var(--green-deep));
  box-shadow: 0 10px 22px rgba(20, 102, 75, 0.18);
}

.secondary,
.card-side button,
.repair-details summary {
  background: #eaf0f5;
}

button,
.export-button {
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease, border-color 120ms ease;
}

button:hover,
.export-button:hover {
  transform: translateY(-1px);
}

input,
select,
textarea {
  border-color: #b9c7d4;
  background: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(31, 111, 139, 0.14);
}

.list-head {
  background: linear-gradient(180deg, #ffffff 0%, #f6fafc 100%);
}

.list-head h2 {
  color: #111827;
  font-size: 24px;
}

.expense-list {
  gap: 12px;
}

.expense-card,
.inspection-check-item,
.inspection-section {
  border-color: rgba(190, 202, 214, 0.72);
  background: #ffffff;
  box-shadow: 0 6px 18px rgba(12, 35, 56, 0.06);
}

.maintenance-card.is-pending {
  border-left-color: var(--orange);
}

.maintenance-card.is-repaired {
  border-left-color: var(--green-deep);
}

.linked-expense-list,
.saved-details {
  background: #f1faf5;
  border-color: #cfe8da;
}

.source-badge {
  color: var(--green-deep);
  background: #e8f6ef;
}

.expense-total {
  border-color: rgba(11, 63, 104, 0.2);
  background: linear-gradient(135deg, #0f2f4a, #173c58);
  box-shadow: 0 14px 28px rgba(15, 47, 74, 0.18);
}

.export-button {
  background: linear-gradient(180deg, #2782a2, var(--blue));
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 16px, 560px);
    padding-top: 14px;
  }

  .topbar {
    padding: 16px;
    margin-bottom: 16px;
  }

  h1 {
    font-size: clamp(28px, 8vw, 38px);
  }

  .home-view {
    gap: 12px;
  }

  .module-card {
    min-height: 132px;
    padding: 16px;
  }

  .module-card strong {
    font-size: 22px;
  }

  .entry-panel,
  .list-panel,
  .section-card {
    box-shadow: 0 8px 24px rgba(12, 35, 56, 0.08);
  }

  .list-head {
    padding: 16px;
  }

  .expense-list {
    padding: 12px;
  }

  .manual-inputs {
    padding: 12px;
  }

  .manual-entry-row {
    grid-template-columns: minmax(0, 1fr) minmax(104px, 132px);
    gap: 10px;
  }
}
.transport-movement-list { display: grid; gap: 8px; margin-top: 12px; }
.transport-movement-item { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 9px 10px; border: 1px solid var(--border, #dbe3ee); border-radius: 8px; background: #f8fafc; }
.transport-movement-item small { color: #526174; }

/* Dispatch job rows: confirmed in order */
.transport-movement-item.is-done { background: #f0fdf4; }
.transport-stop-anywhere { font-size: 0.8em; font-weight: 700; letter-spacing: 0.04em; opacity: 0.7; }
.transport-job-state { font-size: 12px; font-weight: 800; padding: 2px 8px; border-radius: 999px; background: #e2e8f0; color: #334155; }
.transport-job-state-completed { background: #dcfce7; color: #166534; }
.transport-job-state-cancelled { background: #fee2e2; color: #991b1b; }
.transport-stop-km { display: grid; gap: 2px; font-size: 11px; font-weight: 700; color: #475569; }
.transport-stop-km input { width: 110px; padding: 6px 8px; }
/* Trip costs the driver enters on a job card */
.transport-costs { margin-top: 10px; padding-top: 10px; border-top: 1px dashed #cbd5e1; display: grid; gap: 8px; }
.transport-costs ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.transport-costs li { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.transport-costs li span { flex: 1; }
.transport-cost-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end; }
.transport-cost-inputs label { display: grid; gap: 3px; font-size: 12px; font-weight: 700; }
.transport-cost-inputs label:first-child, .transport-cost-inputs button { grid-column: 1 / -1; }
.transport-costs-finished { margin: 0; color: #15803d; font-weight: 800; }
/* Notifications: home bar and new-job badge */
.notify-bar { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid #fcd34d; border-radius: 12px; background: #fffbeb; color: #92400e; font-size: 13px; font-weight: 700; }
.module-card { position: relative; }
.module-card > span.new-job-badge { position: absolute; top: 8px; right: 8px; padding: 2px 8px; border-radius: 999px; background: #dc2626; color: #fff; font-size: 11px; font-weight: 800; }
.new-job-badge[hidden] { display: none; }
/* Driver advance balance on the home page */
.advance-card { grid-column: 1 / -1; display: grid; gap: 2px; padding: 12px 14px; border-radius: 12px; border: 1px solid #bbf7d0; background: #f0fdf4; color: #14532d; }
.advance-card span { font-size: 12px; font-weight: 800; }
.advance-card b { font-size: 22px; }
.advance-card small { font-size: 12px; }
.advance-card.advance-low { border-color: #fde68a; background: #fefce8; color: #854d0e; }
.advance-card.advance-over { border-color: #fecaca; background: #fef2f2; color: #991b1b; }
.advance-card[hidden] { display: none; }
