:root {
  --iu-red: #c81e1e;
  --iu-red-dark: #991b1b;
  --iu-red-soft: #fef2f2;
  --iu-red-border: #fca5a5;
  --slate-900: #1e293b;
  --slate-800: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --ticket-gray: #dce1e7;
  --ticket-border: #525b66;
  --ok-green: #15803d;
  --ok-bg: #f0fdf4;
  --ok-border: #bbf7d0;
  --bg: #eef2f6;
  --surface: #ffffff;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--slate-900);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
.topbar {
  background: #ffffff;
  border-bottom: 3px solid var(--iu-red);
  padding: 0 24px;
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}
.iu-brand-lockup { display: flex; align-items: center; gap: 12px; }
.iu-logo-box {
  width: 44px; height: 44px; border-radius: 10px; background: #f4f5f7; border: 1px solid #d1d5db;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 900; font-size: 22px;
  color: var(--iu-red); letter-spacing: -1px; flex-shrink: 0;
}
.iu-brand-text-main { font-size: 17px; font-weight: 800; color: var(--iu-red); letter-spacing: 1.2px; line-height: 1.15; }
.iu-brand-text-sub { font-size: 10px; font-weight: 600; color: var(--slate-500); letter-spacing: 2.2px; margin-top: 2px; }
.topbar-divider { width: 1px; height: 28px; background: var(--slate-200); margin: 0 6px; }
.system-module-tag {
  font-size: 13px; font-weight: 700; color: var(--slate-800); background: var(--slate-100);
  border: 1px solid var(--slate-300); padding: 4px 10px; border-radius: 6px;
}
.topbar-right { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--slate-600); }
.container { max-width: 1380px; margin: 0 auto; padding: 20px 24px 40px; }
.card { background: var(--surface); border: 1px solid var(--slate-300); border-radius: 6px; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 7px 14px;
  font-size: 13px; font-weight: 600; border-radius: 5px; border: 1px solid transparent; cursor: pointer;
  transition: all 0.14s ease; text-decoration: none; white-space: nowrap; font-family: inherit;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--iu-red); color: #fff; border-color: var(--iu-red); }
.btn-primary:hover:not(:disabled) { background: var(--iu-red-dark); }
.btn-dark { background: var(--slate-900); color: #fff; border-color: var(--slate-900); }
.btn-dark:hover:not(:disabled) { background: #0f172a; }
.btn-outline { background: #fff; border-color: var(--slate-300); color: var(--slate-800); }
.btn-outline:hover:not(:disabled) { background: var(--slate-100); border-color: #94a3b8; }
.btn-danger { background: #fff; border-color: var(--iu-red-border); color: var(--iu-red); }
.btn-danger:hover:not(:disabled) { background: var(--iu-red-soft); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-lg { width: 100%; padding: 10px 16px; font-size: 14px; }
.input, .select, .textarea {
  width: 100%; padding: 7px 10px; font-size: 13px; border: 1px solid var(--slate-300);
  border-radius: 5px; background: #fff; color: var(--slate-900); font-family: inherit;
}
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--slate-800); box-shadow: 0 0 0 2px rgba(30, 41, 59, 0.12); }
.textarea { min-height: 68px; resize: vertical; }
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--slate-600); margin-bottom: 4px; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: #e2e8f0; }
.login-card {
  width: 100%; max-width: 450px; background: #fff; border-top: 5px solid var(--iu-red);
  border-radius: 6px; padding: 34px 32px; box-shadow: 0 12px 32px rgba(15, 23, 42, 0.14);
}
.demo-box { margin-top: 20px; padding-top: 14px; border-top: 1px dashed var(--slate-300); font-size: 12px; color: var(--slate-500); }
.demo-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.workorder-header-bar { padding: 18px 20px; margin-bottom: 14px; display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; align-items: flex-start; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.kpi-card {
  background: #fff; border: 1px solid var(--slate-300); border-left: 4px solid var(--slate-800);
  border-radius: 5px; padding: 13px 16px; cursor: pointer; transition: box-shadow 0.12s ease;
}
.kpi-card:hover { box-shadow: 0 3px 10px rgba(15, 23, 42, 0.08); }
.kpi-card.kpi-ok { border-left-color: var(--ok-green); }
.kpi-card.kpi-att { border-left-color: var(--iu-red); }
.kpi-card.active { background: #f8fafc; box-shadow: inset 0 0 0 1px var(--slate-800); }
.kpi-label { font-size: 12px; font-weight: 700; color: var(--slate-500); }
.kpi-value { font-size: 26px; font-weight: 800; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12px; color: var(--slate-600); }
.filter-bar { padding: 12px 16px; margin-bottom: 14px; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.view-mode-switch { display: inline-flex; border: 1px solid var(--slate-300); border-radius: 5px; overflow: hidden; }
.view-mode-btn { padding: 6px 12px; font-size: 12px; font-weight: 700; background: #fff; border: none; color: var(--slate-600); cursor: pointer; }
.view-mode-btn.active { background: var(--slate-900); color: #fff; }
.table-wrap { overflow-x: auto; }
table.summary-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.summary-table th { background: var(--ticket-gray); color: var(--slate-900); font-weight: 700; text-align: left; padding: 9px 12px; border: 1px solid #b8c0cc; white-space: nowrap; }
table.summary-table td { padding: 10px 12px; border: 1px solid var(--slate-300); vertical-align: top; }
table.summary-table tr:hover td { background: #f8fafc; }
table.summary-table tr.row-att td { background: #fffafa; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.sub-line { font-size: 11.5px; color: var(--slate-500); margin-top: 2px; }
.sec-dots { display: flex; flex-wrap: wrap; gap: 4px; }
.sec-pill { display: inline-flex; align-items: center; gap: 3px; padding: 2px 6px; font-size: 11px; font-weight: 600; border-radius: 3px; border: 1px solid #cbd5e1; background: #f8fafc; color: var(--slate-800); }
.sec-pill.ok { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok-green); }
.sec-pill.att { background: var(--iu-red-soft); border-color: var(--iu-red-border); color: var(--iu-red); font-weight: 700; }
.att-item-list { margin-top: 5px; display: flex; flex-direction: column; gap: 2px; }
.att-item-line { font-size: 11.5px; color: var(--iu-red); font-weight: 700; }
.part-tag { display: inline-block; background: var(--slate-100); border: 1px solid var(--slate-300); border-radius: 3px; padding: 1px 6px; font-size: 11px; margin: 3px 4px 0 0; color: var(--slate-800); }
.thumb-chip { display: inline-flex; align-items: center; gap: 3px; padding: 2px 7px; background: #f1f5f9; border: 1px solid #94a3b8; color: var(--slate-900); border-radius: 3px; font-size: 11px; font-weight: 600; cursor: pointer; margin: 4px 4px 0 0; }
.thumb-chip.att-photo { background: var(--iu-red-soft); border-color: var(--iu-red-border); color: var(--iu-red); }
.ticket-sheet { background: #ffffff; max-width: 860px; margin: 0 auto 24px; padding: 24px 28px 26px; border: 1px solid #94a3b8; box-shadow: 0 4px 16px rgba(15, 23, 42, 0.08); color: #111827; }
.ts-header-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; }
.ts-brand-block { display: flex; align-items: center; gap: 12px; }
.ts-iu-badge { width: 48px; height: 48px; border-radius: 11px; background: #f3f4f6; border: 1px solid #e5e7eb; display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 900; color: var(--iu-red); letter-spacing: -1.5px; }
.ts-iu-title { font-size: 19px; font-weight: 800; color: var(--iu-red); letter-spacing: 1.4px; line-height: 1.15; }
.ts-iu-sub { font-size: 10px; color: #6b7280; letter-spacing: 2.5px; font-weight: 600; margin-top: 2px; }
.ts-right-title { flex: 1; text-align: center; border-bottom: 2px solid #1f2937; padding-bottom: 4px; font-size: 25px; font-weight: 800; color: #1f2937; }
.ts-company-contact { font-size: 11.5px; color: #4b5563; margin-top: 5px; }
.ts-address-line { font-size: 12.5px; font-weight: 600; color: #1f2937; margin: 6px 0 6px; }
table.ts-grid { width: 100%; border-collapse: collapse; font-size: 12px; border: 1.5px solid var(--ticket-border); }
table.ts-grid td, table.ts-grid th { border: 1px solid var(--ticket-border); padding: 4.5px 8px; vertical-align: middle; }
table.ts-grid td.ts-lbl { background: var(--ticket-gray); font-weight: 700; width: 16%; color: #1f2937; }
table.ts-grid td.ts-val { background: #ffffff; width: 34%; font-weight: 600; color: #111827; }
.ts-legend { display: flex; align-items: center; gap: 20px; margin: 7px 0 5px; font-size: 12px; font-weight: 600; color: #1f2937; }
.ts-box { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border: 1.5px solid #374151; font-size: 11.5px; font-weight: 900; line-height: 1; background: #fff; flex-shrink: 0; }
.ts-box.box-ok { color: var(--ok-green); }
.ts-box.box-att { color: var(--iu-red); border-color: var(--iu-red); background: #fee2e2; }
.ts-box.box-na { color: #6b7280; }
table.ts-checklist { width: 100%; border-collapse: collapse; font-size: 11.8px; border: 1.5px solid var(--ticket-border); border-bottom: none; }
table.ts-checklist td { border: 1px solid var(--ticket-border); padding: 4px 7px; vertical-align: middle; }
table.ts-checklist tr.ts-sec-row td { background: var(--ticket-gray); font-weight: 800; font-size: 12px; color: #111827; padding: 4.5px 8px; }
table.ts-checklist td.ts-chk-cell { width: 32px; text-align: center; padding: 3px; }
table.ts-checklist td.ts-item-cell { width: calc(50% - 32px); }
table.ts-checklist td.cell-is-att { background: #fff1f2; color: #991b1b; font-weight: 700; }
table.ts-bottom { width: 100%; border-collapse: collapse; font-size: 11.8px; border: 1.5px solid var(--ticket-border); }
table.ts-bottom td { border: 1px solid var(--ticket-border); padding: 5px 8px; vertical-align: top; }
table.ts-bottom td.ts-gray { background: var(--ticket-gray); font-weight: 700; color: #1f2937; }
.ts-sign-row { display: flex; justify-content: space-between; gap: 36px; margin-top: 16px; font-size: 12.5px; font-weight: 700; color: #1f2937; break-inside: avoid; }
.ts-sign-line { display: inline-block; width: 210px; border-bottom: 1.5px solid #1f2937; margin-left: 6px; }
.timeline-list { display: flex; flex-direction: column; gap: 12px; }
.timeline-item { border: 1px solid var(--slate-300); border-left: 4px solid var(--slate-800); border-radius: 5px; background: #fff; padding: 12px 16px; }
.timeline-item.is-att { border-left-color: var(--iu-red); }
.admin-cl-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 5px 8px; border: 1px solid var(--slate-300); border-radius: 4px; background: #fff; font-size: 12px; }
.admin-cl-row.is-att { background: var(--iu-red-soft); border-color: var(--iu-red-border); }
.tri-btns { display: inline-flex; gap: 3px; flex-shrink: 0; }
.tri-btn { width: 26px; height: 24px; border: 1px solid var(--slate-300); background: #fff; border-radius: 3px; font-weight: 800; font-size: 12px; cursor: pointer; }
.tri-btn.active-ok { background: var(--ok-green); border-color: var(--ok-green); color: #fff; }
.tri-btn.active-att { background: var(--iu-red); border-color: var(--iu-red); color: #fff; }
.tri-btn.active-na { background: var(--slate-600); border-color: var(--slate-600); color: #fff; }
.admin-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; border-bottom: 1px solid var(--slate-300); padding-bottom: 10px; }
.admin-tab { padding: 7px 15px; border-radius: 5px; font-size: 13px; font-weight: 700; cursor: pointer; border: 1px solid transparent; background: transparent; color: var(--slate-600); }
.admin-tab.active { background: var(--slate-900); color: #fff; }
.admin-grid { display: grid; grid-template-columns: 310px 1fr; gap: 16px; align-items: start; }
.batch-list-item { padding: 12px 14px; border-bottom: 1px solid var(--slate-200); cursor: pointer; }
.batch-list-item:hover { background: var(--slate-100); }
.batch-list-item.active { background: #fef2f2; border-left: 4px solid var(--iu-red); }
.upload-zone { background: var(--slate-100); border: 1px dashed #94a3b8; border-radius: 6px; padding: 12px 16px; margin-bottom: 14px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.6); display: flex; align-items: center; justify-content: center; padding: 18px; z-index: 100; }
.modal-panel { background: #fff; border-radius: 6px; width: 100%; max-width: 920px; max-height: 92vh; overflow-y: auto; box-shadow: 0 24px 48px rgba(15, 23, 42, 0.35); }
.modal-header { padding: 13px 20px; border-bottom: 1px solid var(--slate-300); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: #fff; z-index: 5; }
.modal-header h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 18px 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--slate-300); display: flex; justify-content: flex-end; gap: 8px; position: sticky; bottom: 0; background: #fff; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.photo-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; margin-top: 8px; }
.photo-card { border: 1px solid var(--slate-300); border-radius: 5px; overflow: hidden; background: #fff; }
.photo-card img { width: 100%; height: 124px; object-fit: cover; display: block; cursor: zoom-in; }
.photo-card-meta { padding: 6px 8px; font-size: 11.5px; display: flex; justify-content: space-between; align-items: center; gap: 4px; }
.lightbox-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.9); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; z-index: 200; }
.lightbox-backdrop img { max-width: 92vw; max-height: 82vh; border-radius: 6px; background: #fff; }
.lightbox-caption { color: #fff; margin-top: 10px; font-size: 13.5px; font-weight: 600; }
#toast-root { position: fixed; bottom: 20px; right: 20px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--slate-900); color: #fff; padding: 10px 16px; border-radius: 5px; font-size: 13px; font-weight: 600; max-width: 420px; }
.toast.error { background: var(--iu-red); }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 4px; font-size: 11.5px; font-weight: 700; border: 1px solid transparent; }
.badge-ok { background: var(--ok-bg); color: var(--ok-green); border-color: var(--ok-border); }
.badge-att { background: var(--iu-red-soft); color: var(--iu-red); border-color: var(--iu-red-border); }
.badge-neutral { background: var(--slate-100); color: var(--slate-800); border-color: var(--slate-300); }
#single-ticket-print-area { display: none; }
@media (max-width: 960px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-grid, .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
}
@media print {
  @page { margin: 7mm; }
  body { background: #fff; }
  .no-print, .topbar, .filter-bar, #modal-root, #lightbox-root, #toast-root { display: none !important; }
  .container { max-width: 100%; padding: 0; }
  .ticket-sheet { box-shadow: none; border: none; padding: 2mm 4mm; max-width: 100%; page-break-after: always; break-inside: avoid; margin: 0; }
  .ticket-sheet table.ts-grid td, .ticket-sheet table.ts-checklist td, .ticket-sheet table.ts-bottom td { padding: 2.8px 6px; font-size: 10.5px; }
  .ticket-sheet .ts-sign-row { margin-top: 10px; }
  .ticket-sheet:last-child { page-break-after: auto; }
  body.printing-single-ticket #app { display: none !important; }
  body.printing-single-ticket #single-ticket-print-area { display: block !important; }
}