:root {
  color-scheme: light;
  --bg: #f5f7f6;
  --white: #fff;
  --ink: #162b28;
  --muted: #4f6560;
  --line: #dce5e1;
  --rail: #123633;
  --rail-text: #f1f8f5;
  --rail-muted: #b7d2ca;
  --mint: #c7eadb;
  --soft: #e7f2eb;
  --green: #165844;
  --green-hover: #114634;
  --focus: #086b52;
  --danger: #a42b32;
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 16px;
  font-synthesis: none;
  accent-color: var(--green);
}
* { box-sizing: border-box; }
[hidden], .symbols { display: none !important; }
body { margin: 0; min-height: 100dvh; }
::selection { color: #0c362a; background: #c7eadb; }
button, input, textarea, select { font: inherit; }
button, a, input, select, textarea, summary { -webkit-tap-highlight-color: transparent; }
button, summary { cursor: pointer; }
a { color: var(--green); text-underline-offset: .22em; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, .grid-wrap:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
svg { inline-size: 20px; block-size: 20px; stroke: currentColor; fill: none; stroke-width: 1.65; stroke-linejoin: round; stroke-linecap: round; flex-shrink: 0; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 2.45rem; line-height: 1.12; letter-spacing: -.038em; font-weight: 720; }
h2 { font-size: 1.15rem; line-height: 1.3; letter-spacing: -.02em; }
h3 { font-size: 1.05rem; }
.sr-only { position: absolute; height: 1px; width: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.button, .upload-label {
  display: inline-flex; align-items: center; justify-content: center; gap: .55rem;
  padding: .62rem .9rem; min-height: 42px; border: 1px solid transparent; border-radius: 8px;
  font-size: .9rem; font-weight: 660; line-height: 1.25; white-space: nowrap; text-decoration: none; cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}
.button svg, .upload-label svg { inline-size: 18px; block-size: 18px; }
.primary { color: #fff; background: var(--green); }
.primary:hover { background: var(--green-hover); }
.secondary, .upload-label.neutral { background: var(--white); color: var(--ink); border-color: #cddbd6; }
.secondary:hover, .upload-label.neutral:hover { background: #eef4f1; }
.button:disabled, .icon-button:disabled { opacity: .53; cursor: default; }
.text { background: none; color: var(--muted); border: none; padding-inline: 0; }
.danger { color: var(--danger); }
.danger:hover { text-decoration: underline; }
.icon-button { display: inline-grid; place-items: center; color: inherit; background: transparent; border: 0; border-radius: 7px; padding: 0; width: 40px; height: 40px; }
.icon-button:hover { background: #758b8020; }
.feedback { color: var(--muted); font-size: .9rem; line-height: 1.45; }
.feedback:empty { display: none; }
.feedback[data-error="true"] { color: var(--danger); }
.app { display: grid; grid-template-columns: 248px minmax(0,1fr); min-height: 100dvh; }
.sidebar { background: var(--rail); color: var(--rail-text); display: flex; flex-direction: column; min-width: 0; position: sticky; top: 0; height: 100dvh; padding: 26px 16px 16px; }
.brand { display: flex; gap: 12px; align-items: center; font-size: 1.02rem; font-weight: 720; line-height: 1.25; padding: 0 5px; letter-spacing: -.018em; }
.brand-mark { display: grid; place-items: center; background: var(--mint); color: #123633; width: 41px; height: 41px; border-radius: 10px; flex: 0 0 41px; }
.brand-mark svg { width: 23px; height: 23px; }
.brand small { color: var(--rail-muted); display: block; font-size: .78rem; font-weight: 450; margin-top: 4px; letter-spacing: 0; }
.sidebar nav { margin-top: 45px; }
.nav-label { color: var(--rail-muted); font-weight: 600; font-size: .78rem; padding: 0 11px; margin-bottom: 12px; }
#buildings { display: grid; gap: 5px; }
.nav-button { display: flex; align-items: center; gap: 11px; min-height: 44px; width: 100%; border: 1px solid transparent; border-radius: 8px; padding: 0 10px; font-size: .92rem; color: var(--rail-text); text-align: left; background: transparent; }
.nav-button svg { color: var(--rail-muted); width: 19px; height: 19px; }
.nav-button:hover, .nav-button[aria-current="page"] { background: #24554c; border-color: #38665b; }
.nav-button[aria-current="page"] svg { color: #d1f6e5; }
.nav-button span { margin-left: auto; font-size: .77rem; color: var(--rail-muted); font-variant-numeric: tabular-nums; }
.sidebar :focus-visible { outline-color: #c7eadb; }
.account { margin-top: auto; }
.profile { margin-top: 13px; padding: 15px 3px 4px; border-top: 1px solid #39605a; display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; border-radius: 50%; background: #285950; color: #e5f7ee; font-weight: 650; font-size: .77rem; }
.profile-text { min-width: 0; flex: 1; }
.profile strong, .profile small { display: block; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
.profile strong { font-size: .84rem; }
.profile small { font-size: .76rem; margin-top: 3px; color: var(--rail-muted); }
.topbar { background: var(--white); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; min-height: 62px; padding: 0 34px; color: var(--muted); font-size: .88rem; font-weight: 590; }
.read-only { display: inline-flex; align-items: center; gap: 7px; }
.read-only svg { width: 16px; height: 16px; }
#mobile-logout, .mobile-filters { display: none; }
.main-content { max-width: 1660px; margin: 0 auto; padding: 34px 34px 50px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 26px; }
.page-heading p, .panel-title p { color: var(--muted); margin-top: 8px; font-size: .94rem; line-height: 1.4; }
.heading-actions, .inline-actions, .form-actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.capture-strip { display: flex; align-items: center; gap: 14px; padding: 15px 17px; margin-bottom: 22px; background: var(--soft); border: 1px solid #d5e6db; border-radius: 12px; }
.capture-icon, .empty-icon { display: grid; place-items: center; width: 44px; height: 44px; background: #d2e8db; color: #175642; border-radius: 9px; flex: 0 0 44px; }
.capture-icon svg, .empty-icon svg { width: 23px; height: 23px; }
.capture-strip strong { font-size: .96rem; font-weight: 710; }
.capture-strip p { color: #37594c; font-size: .86rem; margin-top: 4px; line-height: 1.4; }
.capture-button { margin-left: auto; color: #164b3b; background: #f8fcf9; border-color: #b8d2c2; }
.capture-button:hover, .upload-label:hover { background: #dceee4; }
.panel { background: var(--white); border: 1px solid #d8e3dd; border-radius: 13px; margin: 0 0 20px; overflow: hidden; }
.table-toolbar, .panel-title { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 16px 19px; }
.table-title { display: flex; align-items: center; gap: 10px; }
.total { border-radius: 20px; background: #e8f0eb; color: #345548; padding: 4px 8px; font-variant-numeric: tabular-nums; font-size: .77rem; font-weight: 650; }
.search { display: flex; align-items: center; gap: 8px; background: #f8faf9; border: 1px solid #d4dfda; border-radius: 8px; width: min(335px, 53%); min-height: 40px; padding: 0 10px; color: #4f6560; }
.search svg { width: 17px; height: 17px; }
.search input { border: 0; background: transparent; min-width: 0; width: 100%; height: 36px; padding: 0; font-size: .86rem; outline: none; }
.search:focus-within { outline: 2px solid var(--focus); outline-offset: 1px; }
.search input:focus-visible { outline: none; }
.grid-wrap { overflow: auto; max-height: 68vh; scrollbar-color: #a9beb5 #edf3ef; scrollbar-width: thin; }
table { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; table-layout: fixed; font-size: .83rem; font-variant-numeric: tabular-nums; }
th, td { width: var(--col, 130px); min-width: var(--col, 130px); max-width: var(--col, 130px); text-align: left; border: 0; border-bottom: 1px solid #e3ebe6; padding: 0; overflow: hidden; }
th { position: sticky; z-index: 2; top: 0; background: #edf3ef; font-weight: 660; color: #36534a; padding: 12px 10px; border-top: 1px solid #e2ebe6; white-space: nowrap; }
th:first-child, td:first-child { position: sticky; left: 0; border-right: 1px solid #e1e9e4; }
th:first-child { z-index: 3; }
td:first-child { z-index: 1; font-weight: 680; }
td { background: var(--white); }
tr:nth-child(even) td { background: #f8faf8; }
td input, td select, td .cell-text { display: block; min-width: 0; width: 100%; height: 40px; min-height: 40px; margin: 0; border: 1px solid transparent; border-radius: 0; padding: 8px 9px; background: transparent; color: var(--ink); font-size: inherit; font-weight: inherit; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }
td input:hover, td select:hover { background: #e9f4ed; }
td input:focus, td select:focus, td input:focus-visible, td select:focus-visible { border-color: var(--focus); background: #f0faf4; outline: none; }
td input[data-saving="true"], td select[data-saving="true"] { border-bottom-color: #9ab8aa; }
td .cell-text { padding-top: 11px; }
td input::placeholder { color: #58716a; }
.photo-link { width: 100%; height: 40px; border: 0; background: transparent; color: #165844; display: flex; gap: 5px; align-items: center; padding: 0 9px; text-align: left; }
.photo-link:hover { background: #e9f4ed; }
.photo-link svg { width: 16px; height: 16px; }
.empty { display: grid; justify-items: center; gap: 10px; padding: 46px 16px 48px; color: var(--ink); text-align: center; }
.empty p { color: var(--muted); font-size: .89rem; line-height: 1.45; max-width: 38ch; }
.empty .button { margin-top: 4px; }
.table-footer { border-top: 1px solid var(--line); padding: 9px 18px; min-height: 47px; display: flex; align-items: center; gap: 15px; justify-content: space-between; }
.table-footer p { font-size: .82rem; color: var(--muted); }
.table-footer p[data-error="true"] { color: var(--danger); }
.pagination { display: flex; align-items: center; gap: 6px; white-space: nowrap; font-size: .82rem; }
.pagination .icon-button { width: 34px; height: 32px; }
.reverse { transform: rotate(180deg); }
#entry-form, .photo-body, #user-form { padding: 0 19px 19px; }
fieldset { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 0 0 18px; min-width: 0; }
legend { font-size: .93rem; padding: 5px 10px 5px 0; font-weight: 710; margin-bottom: 8px; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(150px,100%),1fr)); gap: 14px; }
.field-grid label, #login-form label { display: grid; align-content: start; gap: 6px; font-size: .88rem; font-weight: 620; min-width: 0; }
.field-grid input, .field-grid select, .field-grid textarea, #login-form input, .mobile-filters select, .account-edit input {
  width: 100%; min-width: 0; border: 1px solid #cbd9d2; border-radius: 8px; min-height: 43px; padding: 8px 10px; background: #fff; color: var(--ink); font-size: 1rem; font-weight: 450;
}
.field-grid textarea { resize: vertical; }
.field-grid input::placeholder { color: #536961; }
.full-field { grid-column: 1 / -1; }
.upload-label { color: #164b3b; background: #e6f3eb; border-color: #b8d2c2; }
.upload-label:has(+ input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 3px; }
#label-cta { margin: 0 0 12px; }
#label-cta[aria-busy="true"] { opacity: .65; cursor: wait; pointer-events: none; }
#ocr-status, #ocr-detail { margin: 0 0 12px; }
details summary { width: fit-content; font-size: .89rem; font-weight: 650; color: var(--green); padding: 5px 0; }
details pre { white-space: pre-wrap; overflow-wrap: anywhere; max-height: 210px; overflow: auto; padding: 8px; background: #eef4ef; font-size: .82rem; }
.other-fields { margin-top: 10px; }
.other-fields > .field-grid { margin-top: 8px; }
.field-hint { color: var(--muted); font-size: .88rem; margin-bottom: 9px; }
.photo-preview { display: flex; gap: 12px; align-items: center; margin-top: 10px; }
.photo-preview img { width: 75px; height: 62px; object-fit: cover; border-radius: 8px; }
.form-actions { padding-top: 13px; border-top: 1px solid var(--line); }
.form-actions p { flex: 0 0 100%; }
#monitor-photo { display: block; max-width: 100%; width: auto; max-height: 60vh; object-fit: contain; border-radius: 8px; margin: 0 0 13px; }
#photo-status { margin: 0 0 10px; }
#delete-row-controls { margin-top: 8px; }
#user-form .inline-actions { margin-top: 14px; }
#user-list { padding: 0 19px 12px; }
.user-row { border-top: 1px solid var(--line); padding: 12px 0; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.user-row strong { margin-right: auto; overflow-wrap: anywhere; }
.user-row small { color: var(--muted); }
.account-edit { display: flex; gap: 7px; flex-wrap: wrap; width: 100%; }
.account-edit input { flex: 1; min-width: min(180px, 100%); }
.gateway { min-height: 100dvh; padding: 50px 18px 22px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: #e9f1ed; }
.login-panel { width: min(100%, 450px); background: #fff; border: 1px solid #d1e1d8; border-radius: 15px; padding: 30px; }
.login-brand { padding: 0; margin-bottom: 30px; }
.login-brand small { color: var(--muted); }
.login-panel h1 { font-size: 1.85rem; }
.login-panel > p { color: var(--muted); margin: 8px 0 22px; font-size: .94rem; line-height: 1.4; }
#login-form { display: grid; gap: 15px; }
.login-footer { color: #37594c; display: flex; align-items: center; gap: 7px; font-size: .79rem; margin-top: 18px; text-align: center; }
.login-footer svg { width: 14px; height: 14px; }
@media (max-width: 1080px) {
  .app { grid-template-columns: 212px minmax(0,1fr); }
  .main-content { padding-inline: 22px; }
  .topbar { padding-inline: 22px; }
  h1 { font-size: 2.05rem; }
}
@media (max-width: 800px) {
  .app { display: block; }
  .sidebar { display: none; }
  .topbar { min-height: 49px; background: var(--rail); color: var(--rail-text); padding-inline: 16px; }
  .topbar :focus-visible { outline-color: var(--mint); }
  #mobile-logout { display: inline-grid; }
  .main-content { padding: 22px 15px 35px; }
  h1 { font-size: 1.9rem; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 14px; margin-bottom: 14px; }
  .page-heading p { margin-top: 5px; }
  .heading-actions { display: flex; }
  .heading-actions .primary { order: -1; }
  .mobile-filters { display: flex; gap: 9px; margin: 0 0 15px; }
  .mobile-filters select { flex: 1; }
  .capture-strip { margin-bottom: 15px; padding: 12px; display: grid; grid-template-columns: 42px minmax(0,1fr); gap: 9px 11px; }
  .capture-button { grid-column: 2; margin: 0; justify-self: start; }
  .table-toolbar { padding: 13px; flex-wrap: wrap; }
  .search { width: 100%; }
  .search input, td input, td select { font-size: 1rem; }
  td input, td select, td .cell-text, .photo-link { height: 44px; }
  .table-footer { padding-inline: 12px; }
  .panel-title, #entry-form, .photo-body, #user-form { padding-inline: 13px; }
  .field-grid { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 11px; }
  .button, .upload-label { min-height: 44px; }
  .empty { padding: 33px 13px; }
}
@media (max-width: 350px) {
  .field-grid { grid-template-columns: minmax(0,1fr); }
  .login-panel { padding: 22px; }
  .heading-actions .button { padding-inline: .62rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }
td textarea { display: block; min-width: 0; width: 100%; height: 40px; margin: 0; border: 1px solid transparent; border-radius: 0; padding: 10px 9px; background: transparent; color: var(--ink); font-size: inherit; resize: none; }
td textarea:hover { background: #e9f4ed; }
td textarea:focus { height: 75px; border-color: var(--focus); background: #f0faf4; outline: none; }
@media (max-width: 800px) { td textarea { font-size: 1rem; height: 44px; } }
.table-footer:has(p:empty):not(:has(.pagination:not([hidden]))) { display: none; }
@media (max-width: 800px) {
  #entry-panel { overflow: clip; }
  .form-actions { position: sticky; bottom: 0; z-index: 4; background: var(--white); padding: 10px 0; }
}
