:root {
  color-scheme: light;
  --ink: #17283c;
  --muted: #77869a;
  --line: #e8edf3;
  --surface: #ffffff;
  --canvas: #f4f7fb;
  --blue: #2265d8;
  --navy: #10243a;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-size: 14px; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; }
.topbar {
  height: 72px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 5.2%; background: var(--navy); color: #fff; gap: 24px;
}
.brand { display: inline-flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand-mark {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px;
  background: #2873e2; color: white; font-size: 23px; font-weight: 800; font-style: italic;
}
.brand strong { display: block; font-size: 16px; letter-spacing: -.3px; }
.brand small { display: block; margin-top: 3px; color: #a9bed1; font-size: 9px; letter-spacing: 1.4px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.local-badge { color: #bfcedd; display: inline-flex; align-items: center; gap: 8px; margin-right: 12px; font-size: 12px; }
.local-badge > span:first-child, .status-dot { width: 7px; height: 7px; border-radius: 50%; background: #35c99a; }
.local-badge.offline > span:first-child { background: #e7a548; }
.local-badge.shared { color: #c4e7da; }
.button {
  min-height: 38px; border-radius: 8px; padding: 0 13px; border: 1px solid transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-weight: 600;
  transition: background .15s, border-color .15s, transform .15s;
}
.button:active { transform: translateY(1px); }
.button-quiet { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.15); color: #edf4fb; }
.button-quiet:hover { background: rgba(255,255,255,.15); }
.button-primary { background: var(--blue); color: #fff; box-shadow: 0 3px 10px #2265d82e; }
.button-primary:hover { background: #1959c7; }
.main-content { max-width: 1500px; padding: 35px 5.2% 26px; margin: 0 auto; }
.welcome-row { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 22px; }
.eyebrow { margin: 0 0 8px; color: var(--blue); font-size: 10px; font-weight: 750; letter-spacing: 1.25px; }
h1, h2, p { margin-top: 0; }
.welcome-row h1 { margin-bottom: 7px; font-size: 28px; letter-spacing: -.8px; }
.subtitle { margin: 0; color: var(--muted); font-size: 13px; }
.updated-note { display: flex; align-items: center; gap: 8px; color: #607287; font-size: 12px; padding-bottom: 2px; }
.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; margin-bottom: 22px; }
.summary-card {
  min-height: 104px; display: flex; align-items: center; gap: 13px; padding: 17px 20px;
  background: var(--surface); border: 1px solid #edf0f5; border-radius: 11px;
  box-shadow: 0 2px 8px #10243a05;
}
.summary-icon { display: grid; place-items: center; width: 41px; height: 41px; border-radius: 10px; font-size: 20px; }
.icon-blue { color: #3477df; background: #edf4ff; }
.icon-green { color: #159b70; background: #e8f8f1; }
.icon-amber { color: #cb8b25; background: #fff5e3; }
.summary-label { display: block; color: #708096; font-size: 11px; }
.summary-card strong { display: block; margin-top: 4px; font-size: 24px; line-height: 1; letter-spacing: -.5px; }
.summary-caption { margin-left: auto; align-self: flex-end; padding-bottom: 4px; color: #99a5b3; font-size: 10px; white-space: nowrap; }
.records-panel { overflow: hidden; background: var(--surface); border: 1px solid #e9edf3; border-radius: 12px; box-shadow: 0 3px 14px #10243a06; }
.panel-heading { min-height: 91px; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 17px 20px; }
.panel-heading h2 { margin: 0 0 5px; font-size: 16px; letter-spacing: -.2px; }
.panel-heading p { margin: 0; color: #8693a3; font-size: 11px; }
.toolbar { display: flex; align-items: center; gap: 8px; }
.search-box, .select-wrap select {
  height: 36px; border: 1px solid #e5eaf0; border-radius: 7px; background: #fff; color: #34455b;
}
.search-box { display: flex; align-items: center; gap: 8px; width: 245px; padding: 0 9px; color: #8190a2; }
.search-box > span { font-size: 20px; line-height: 1; transform: rotate(-20deg); }
.search-box input { min-width: 0; flex: 1; outline: 0; border: 0; color: var(--ink); font-size: 11px; }
.search-box input::placeholder { color: #a2adba; }
kbd { padding: 2px 4px; border: 1px solid #e7ebf0; border-radius: 4px; color: #9ba7b3; font: 9px "Segoe UI", sans-serif; }
.select-wrap select { max-width: 145px; padding: 0 26px 0 9px; outline: 0; font-size: 11px; }
.table-wrap { overflow-x: auto; border-top: 1px solid #edf0f4; }
table { border-collapse: collapse; width: 100%; }
thead { background: #f8fafc; }
th { height: 39px; padding: 0 12px; color: #8390a1; font-size: 9px; font-weight: 700; letter-spacing: .45px; text-align: left; white-space: nowrap; }
td { height: 57px; padding: 8px 12px; border-top: 1px solid #f0f2f6; color: #596b7f; font-size: 11px; white-space: nowrap; }
tbody tr:hover { background: #fbfcfe; }
.item-cell { color: #607185; font-variant-numeric: tabular-nums; }
.plant-cell { color: #263a52; font-weight: 650; }
.equipment-cell { color: #263f61; font-weight: 600; }
.description-cell { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 20px; padding: 5px 8px; color: #16805e; background: #e9f8f1; font-size: 10px; font-weight: 650; }
.status-pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: #22ac79; }
.status-pill.status-other { color: #8b641e; background: #fff5df; }
.status-pill.status-other::before { background: #dfa43e; }
.status-pill.status-removed { color: #16805e; background: #e9f8f1; }
.status-pill.status-removed::before { background: #22ac79; }
.action-cell { text-align: right; }
.row-action { padding: 5px 7px; border: 0; background: transparent; color: #73849a; font-size: 11px; }
.row-action:disabled { cursor: wait; opacity: .55; }
.row-action:hover { color: var(--blue); }
.row-action.delete:hover { color: #cb4d4d; }
.action-column { text-align: right; }
.pagination { display: flex; align-items: center; justify-content: space-between; min-height: 53px; padding: 0 18px; color: #8996a6; font-size: 11px; }
.page-controls { display: flex; align-items: center; gap: 6px; }
.page-button, .page-indicator { display: grid; place-items: center; width: 27px; height: 27px; border: 1px solid #e6ebf1; border-radius: 6px; background: #fff; color: #64758a; }
.page-button { font-size: 17px; }
.page-button:disabled { color: #c4ccd6; cursor: default; }
.page-indicator { border-color: var(--blue); color: var(--blue); background: #f2f7ff; font-size: 11px; }
.empty-state { padding: 40px 15px; color: #8996a6; text-align: center; }
.empty-state > span { display: block; margin-bottom: 8px; color: #aab6c4; font-size: 25px; }
.empty-state strong { color: #43556a; font-size: 13px; }
.empty-state p { margin: 5px 0 0; font-size: 11px; }
.footer-note { display: flex; justify-content: space-between; margin-top: 17px; color: #96a1ae; font-size: 10px; }
.footer-separator { padding: 0 5px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.modal-backdrop { position: fixed; z-index: 5; inset: 0; display: grid; place-items: center; padding: 18px; background: #0b1c30a8; }
.modal-backdrop[hidden] { display: none; }
.editor-modal { display: flex; flex-direction: column; width: min(920px, 100%); max-height: min(90vh, 920px); overflow: hidden; border-radius: 13px; background: #fff; box-shadow: 0 22px 80px #06142650; }
.share-modal { display: flex; flex-direction: column; width: min(610px, 100%); max-height: min(90vh, 820px); overflow: hidden; border-radius: 13px; background: #fff; box-shadow: 0 22px 80px #06142650; }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; padding: 21px 25px 16px; border-bottom: 1px solid #edf0f4; }
.modal-header h2 { margin: 0 0 5px; font-size: 20px; }
.modal-header p:last-child { margin: 0; color: #8592a2; font-size: 11px; }
.icon-button { width: 30px; height: 30px; border: 0; border-radius: 6px; background: #f4f6f9; color: #617186; font-size: 21px; line-height: 1; }
#record-form { display: flex; flex-direction: column; min-height: 0; }
.editor-fields { overflow-y: auto; padding: 2px 25px 20px; }
.field-group { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 14px; padding: 17px 0 20px; border-bottom: 1px solid #eef1f5; }
.quick-entry-group { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-top: 15px; }
.field-group h3 { grid-column: 1/-1; margin: 0; color: #28405c; font-size: 12px; }
.field-control { min-width: 0; }
.preset-control { grid-column: 1/-1; }
.field-control label { display: block; margin-bottom: 5px; color: #65768a; font-size: 10px; font-weight: 600; }
.field-control input, .field-control textarea, .field-control select { width: 100%; min-height: 35px; padding: 8px 9px; border: 1px solid #e1e7ee; border-radius: 6px; outline: 0; color: #2d4057; background: #fff; font-size: 11px; }
.field-control input:disabled { background: #f5f7fa; color: #9aa5b2; cursor: not-allowed; }
.field-control textarea { min-height: 62px; resize: vertical; }
.field-control input:focus, .field-control textarea:focus, .field-control select:focus { border-color: #6e9be8; box-shadow: 0 0 0 3px #2265d812; }
.choice-picker { display: flex; flex-wrap: wrap; gap: 7px; }
.choice-option { display: inline-flex; align-items: center; gap: 6px; min-height: 31px; padding: 5px 9px; border: 1px solid #e2e8f0; border-radius: 6px; color: #4c6078; background: #fff; cursor: pointer; font-size: 10px; font-weight: 500; }
.choice-option.selected { border-color: #8db2f1; color: #225ab1; background: #f0f6ff; }
.choice-option input { width: 13px; min-height: 13px; height: 13px; margin: 0; padding: 0; accent-color: var(--blue); }
.other-value { flex: 1 1 190px; width: auto !important; min-width: 170px; min-height: 31px !important; }
.additional-details { margin-top: 10px; border: 1px solid #e8edf3; border-radius: 8px; }
.additional-details summary { padding: 11px 13px; color: #465c75; cursor: pointer; font-size: 11px; font-weight: 650; list-style-position: inside; }
.additional-details[open] { padding: 0 12px; }
.additional-details[open] summary { margin: 0 -12px; border-bottom: 1px solid #edf0f4; }
.additional-details .field-group { border-bottom: 0; }
.share-content { overflow-y: auto; padding: 18px 25px 20px; }
.public-access-warning { padding: 12px 14px; border: 1px solid #f2d69b; border-radius: 8px; background: #fff8e8; color: #77551d; }
.public-access-warning strong { font-size: 12px; }
.public-access-warning p { margin: 5px 0 0; font-size: 11px; line-height: 1.55; }
.share-photo-warning { margin: 12px 0 0; color: #8b681f; font-size: 10px; line-height: 1.5; }
.share-field { display: block; margin-top: 15px; }
.share-field > span:first-child { display: block; margin-bottom: 6px; color: #65768a; font-size: 10px; font-weight: 650; }
.share-field input { width: 100%; height: 37px; padding: 8px 10px; border: 1px solid #e1e7ee; border-radius: 6px; outline: 0; color: #2d4057; background: #fff; font-size: 11px; }
.share-field input:focus { border-color: #6e9be8; box-shadow: 0 0 0 3px #2265d812; }
.public-consent { display: flex; align-items: flex-start; gap: 8px; margin-top: 15px; color: #5f7187; font-size: 10px; line-height: 1.5; }
.public-consent input { margin: 1px 0 0; accent-color: var(--blue); }
.share-error { margin-top: 12px; color: #bd3939; font-size: 11px; line-height: 1.5; overflow-wrap: anywhere; }
.share-success { margin-top: 16px; padding-top: 12px; border-top: 1px solid #edf0f4; }
.share-success p { margin: 8px 0 0; color: #8b681f; font-size: 10px; line-height: 1.5; }
.share-link-row { display: flex; align-items: center; gap: 8px; }
.share-link-row input { min-width: 0; flex: 1; }
.share-link-row .button { flex: 0 0 auto; }
.modal-footer { display: flex; align-items: center; justify-content: space-between; padding: 13px 25px; border-top: 1px solid #edf0f4; color: #99a4b1; font-size: 10px; }
.modal-footer > div { display: flex; gap: 8px; }
.modal-footer .button-quiet { color: #5e6d80; background: #fff; border-color: #e0e6ed; }
.share-guide-note { color: #7b899a; }
.button:disabled { cursor: wait; opacity: .65; }
.photo-upload-control { grid-column: 1/-1; }
.photo-upload-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.photo-upload-note { color: #8996a6; font-size: 10px; }
.photo-file-list { display: grid; gap: 8px; margin-top: 11px; }
.photo-file-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 11px; border: 1px solid #e5eaf0; border-radius: 7px; background: #fbfcfe; }
.photo-file-info { min-width: 0; }
.photo-file-name { overflow: hidden; color: #314761; font-size: 11px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.photo-file-path { margin-top: 3px; overflow: hidden; color: #93a0af; font-family: Consolas, monospace; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.photo-file-actions { display: flex; align-items: center; flex: 0 0 auto; gap: 5px; }
.photo-file-actions button { padding: 5px 7px; border: 0; border-radius: 5px; color: #336bb7; background: #edf4ff; font-size: 10px; }
.photo-file-actions button.remove-photo { color: #b44242; background: #fff0f0; }
.photo-preview-modal { display: flex; flex-direction: column; width: min(900px, 100%); max-height: min(90vh, 900px); overflow: hidden; border-radius: 13px; background: #fff; box-shadow: 0 22px 80px #06142650; }
.photo-preview-content { display: grid; place-items: center; min-height: 160px; overflow: auto; padding: 14px; background: #f3f6fa; }
.photo-preview-content img { display: block; max-width: 100%; max-height: 64vh; object-fit: contain; }
.photo-preview-modal .modal-header p:last-child { overflow-wrap: anywhere; }
.photo-preview-modal .modal-footer > div { display: flex; gap: 8px; }
.form-error { margin: 0 25px 8px; color: #bd3939; font-size: 11px; }
.toast { position: fixed; z-index: 10; right: 24px; bottom: 22px; max-width: min(420px, calc(100vw - 32px)); padding: 11px 15px; border-radius: 8px; color: #fff; background: #183654; box-shadow: 0 8px 30px #10243a30; opacity: 0; pointer-events: none; transform: translateY(8px); transition: .18s; font-size: 12px; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.error { background: #a53e3e; }
.print-report { display: none; }

@media (max-width: 1000px) {
  .topbar { padding: 0 3%; }
  .main-content { padding-right: 3%; padding-left: 3%; }
  .panel-heading { align-items: flex-start; flex-direction: column; }
  .toolbar { width: 100%; }
  .search-box { flex: 1; }
  .select-wrap select { max-width: none; }
  .local-badge { display: none; }
}
@media (max-width: 640px) {
  .topbar { height: auto; min-height: 65px; padding: 12px 16px; flex-wrap: wrap; }
  .topbar-right { width: 100%; gap: 7px; }
  .topbar-right .button { flex: 1; padding: 0 8px; font-size: 11px; }
  .main-content { padding: 25px 13px 20px; }
  .welcome-row { align-items: flex-start; flex-direction: column; gap: 12px; }
  .welcome-row h1 { font-size: 24px; }
  .summary-grid { gap: 8px; }
  .summary-card { min-height: 90px; flex-wrap: wrap; gap: 8px; padding: 12px; }
  .summary-icon { width: 32px; height: 32px; font-size: 16px; }
  .summary-label { font-size: 9px; }
  .summary-card strong { font-size: 20px; }
  .summary-caption { width: 100%; margin: -5px 0 0 40px; padding: 0; font-size: 9px; }
  .panel-heading { padding: 15px 13px; }
  .toolbar { flex-wrap: wrap; }
  .search-box { flex-basis: 100%; }
  .select-wrap { flex: 1; }
  .select-wrap select { width: 100%; }
  .table-wrap table { min-width: 1020px; }
  .footer-note { flex-direction: column; gap: 5px; }
  .field-group, .quick-entry-group { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal-backdrop { padding: 8px; }
  .editor-modal { max-height: 96vh; }
  .modal-header { padding: 18px 16px 13px; }
  .editor-fields { padding: 0 16px 15px; }
  .share-content { padding: 14px 16px 16px; }
  .modal-footer { padding: 11px 15px; }
  .share-modal .modal-footer { align-items: flex-start; gap: 10px; }
  .share-modal .modal-footer > div { flex-wrap: wrap; justify-content: flex-end; }
  .share-link-row { align-items: stretch; flex-direction: column; }
  .photo-preview-modal .modal-footer { gap: 10px; }
  .photo-preview-modal .modal-footer > div { flex-wrap: wrap; justify-content: flex-end; }
}

@media print {
  @page { size: landscape; margin: 12mm; }
  body { background: #fff; color: #17283c; }
  .app-shell, .modal-backdrop, .toast { display: none !important; }
  .print-report { display: block; }
  .print-heading { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2px solid #183654; padding-bottom: 9px; }
  .print-heading p { margin: 0 0 5px; color: #537092; font-size: 8pt; letter-spacing: 1.2px; }
  .print-heading h1 { margin: 0; font-size: 19pt; }
  .print-heading > span { color: #637388; font-size: 9pt; }
  .print-filter-note { margin: 9px 0; color: #66768a; font-size: 8pt; }
  .print-report table { width: 100%; font-size: 7.5pt; }
  .print-report th { height: auto; padding: 6px 5px; border-bottom: 1px solid #8090a3; color: #334a64; font-size: 7pt; }
  .print-report td { height: auto; padding: 5px; border-bottom: 1px solid #e2e6eb; color: #33465d; font-size: 7.5pt; white-space: normal; overflow-wrap: anywhere; }
  .print-report th:nth-child(6), .print-report td:nth-child(6) { min-width: 190px; }
  .print-total { margin-top: 9px; color: #51657d; font-size: 8pt; text-align: right; }
  thead { display: table-header-group; }
  tr { break-inside: avoid; }
}
