:root {
  --ink: #14211d;
  --muted: #66736d;
  --paper: #f5f4ef;
  --surface: #ffffff;
  --line: #dfe4df;
  --green: #153f36;
  --green-2: #1f6a55;
  --mint: #d9ebe3;
  --orange: #de7c37;
  --shadow: 0 18px 50px rgba(18, 43, 35, .09);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--paper); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

.login-shell { min-height: 100vh; min-height: 100svh; display: grid; place-items: safe center; padding: max(20px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(20px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); background: radial-gradient(circle at top left, #e8f0ea 0, transparent 40%), linear-gradient(135deg, #f8f7f2, #edf1ed); }
.login-card { width: min(540px, 100%); padding: clamp(24px, 4vw, 40px); border: 1px solid rgba(21,63,54,.12); border-radius: 26px; background: rgba(255,255,255,.94); box-shadow: var(--shadow); }
.login-card .lead { margin: 22px 0; }
.login-card .stack { gap: 18px; }
.login-card label, .login-password-group > label { font-size: 14px; }
.login-card input { min-height: 50px; font-size: 16px; }
.login-card .button.primary { min-height: 50px; font-size: 16px; }
.login-password-group { display: grid; gap: 7px; }
.login-password-field { position: relative; }
.login-password-field input { padding-right: 98px; }
.password-toggle { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); min-width: 76px; min-height: 42px; border: 0; border-radius: 9px; background: transparent; color: var(--green-2); font-size: 14px; font-weight: 750; }
.password-toggle:hover { background: #e8f2ee; }
.brand-lockup { display: flex; gap: 15px; align-items: center; }
.brand-lockup.compact { gap: 10px; }
.brand-logo { width: 172px; height: auto; object-fit: contain; display: block; }
.compact .brand-logo { width: 118px; }
.eyebrow { margin: 0 0 4px; color: var(--green-2); font-size: 11px; font-weight: 800; letter-spacing: .13em; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(26px, 5vw, 38px); letter-spacing: -.035em; }
h2 { margin-bottom: 6px; font-size: 27px; letter-spacing: -.025em; }
.lead { color: var(--muted); line-height: 1.6; margin: 24px 0; }
.stack { display: grid; gap: 16px; }
label { display: grid; gap: 7px; color: #3d4944; font-size: 13px; font-weight: 650; }
input, select, textarea { width: 100%; border: 1px solid #cad2cd; border-radius: 11px; background: #fff; color: var(--ink); padding: 11px 12px; outline: none; transition: .18s border-color, .18s box-shadow; }
input:focus, select:focus, textarea:focus { border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(31,106,85,.12); }
textarea { resize: vertical; }
.button { border: 0; border-radius: 11px; padding: 11px 15px; font-weight: 750; color: var(--ink); background: #e8ece9; }
.button.primary { color: white; background: var(--green-2); }
.button.primary:hover { background: var(--green); }
.button.ghost { background: transparent; border: 1px solid var(--line); }
.button.correction { color: white; background: #9a651e; }
.button.danger { color: white; background: #a23d32; }
.button.full { width: 100%; margin: 18px 0 24px; }
.button.compact-action { margin: 10px 0 0; }
.button.small { padding: 9px 12px; font-size: 13px; }
.fine-print { color: var(--muted); font-size: 12px; margin: 18px 0 0; text-align: center; }

.app-shell { min-height: 100vh; }
.topbar { height: 68px; padding: 0 22px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.93); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(12px); }
.top-actions { display: flex; align-items: center; gap: 12px; min-width: 0; }
.user-email { color: var(--muted); font-size: 13px; }
.role-pill { background: #e8f2ee; color: #175f50; border-radius: 999px; padding: 7px 10px; font-size: 12px; font-weight: 800; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 999px; background: #edf5f1; color: var(--green-2); font-size: 12px; font-weight: 750; }
.status-pill.offline { color: #97501f; background: #fff0e5; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #2f9e6f; }
.offline .status-dot { background: var(--orange); }
.layout { display: grid; grid-template-columns: 290px minmax(0,1fr); min-height: calc(100vh - 68px); }
.sidebar { padding: 24px 18px; border-right: 1px solid var(--line); background: #fafaf7; }
.sidebar-extra > summary { display: none; }
.section-label { margin: 0 0 8px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }
.sidebar-title { display: flex; justify-content: space-between; align-items: center; }
.sync-note { margin: -3px 0 10px; color: var(--muted); font-size: 10px; }
.icon-button.refreshing { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.monthly-tools { padding: 16px 0 20px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.monthly-tools input { margin-bottom: 2px; }
.period-label { margin-top: 20px; }
.date-label { margin-top: 8px; font-size: 11px; }
.icon-button { width: 32px; height: 32px; border: 0; border-radius: 9px; background: transparent; font-size: 20px; }
.reports-list { display: grid; gap: 8px; }
.report-item { width: 100%; text-align: left; border: 1px solid transparent; border-radius: 12px; padding: 12px; color: var(--ink); background: transparent; }
.report-item:hover, .report-item.active { border-color: #cbd9d1; background: white; }
.report-item strong { display: block; margin-bottom: 4px; }
.report-item span { color: var(--muted); font-size: 12px; }
.content { min-width: 0; padding: 32px; }
.empty-state { min-height: 65vh; display: grid; place-items: center; align-content: center; text-align: center; color: var(--muted); }
.empty-state h2 { color: var(--ink); }
.empty-icon { width: 72px; height: 72px; display: grid; place-items: center; margin-bottom: 16px; border-radius: 22px; color: var(--green-2); background: var(--mint); font-size: 34px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 20px; }
.tag { padding: 7px 10px; border-radius: 999px; color: #85501e; background: #fff0d9; font-size: 12px; font-weight: 750; }
.panel { padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 5px 18px rgba(20,33,29,.03); }
.form-grid { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 14px; }
.form-grid .date-time-field { min-width: 0; grid-template-columns: minmax(0,1fr); }
.form-grid .date-time-control { display: flex; align-items: center; width: 100%; min-width: 0; max-width: 100%; padding: 0 12px; border: 1px solid #cad2cd; border-radius: 11px; background: #fff; }
.form-grid .date-time-control:focus-within { border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(31,106,85,.12); }
.form-grid .date-time-control input { display: block; width: 100%; min-width: 0; max-width: 100%; min-height: 43px; border: 0; padding: 0; background: transparent; box-shadow: none; }
.form-grid .date-time-control input:focus { box-shadow: none; }
.wide { grid-column: 1 / -1; }
.form-actions { display: flex; align-items: center; gap: 14px; }
.check-field { display: flex; align-items: center; align-self: end; gap: 9px; min-height: 43px; }
.check-field input { width: 18px; height: 18px; }
.autosave-note { color: var(--muted); font-size: 12px; }
.detail-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; margin-top: 18px; }
.detail-card { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.detail-card h3 { margin: 0 0 4px; font-size: 17px; }
.detail-card > p { color: var(--muted); font-size: 12px; margin-bottom: 15px; }
.mini-form { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.mini-form .span-2 { grid-column: 1 / -1; }
.mini-form label { min-width: 0; font-size: 12px; }
.mini-form input, .mini-form select, .mini-form textarea { padding: 9px 10px; }
.mini-form button { justify-self: start; }
.detail-list { display: grid; gap: 8px; margin: 0 0 14px; }
.detail-row { display: flex; justify-content: space-between; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #fafbf9; }
.detail-row-text { min-width: 0; font-size: 12px; line-height: 1.45; }
.detail-row-text strong { display: block; font-size: 13px; }
.detail-row-text span { color: var(--muted); }
.edit-row { flex: 0 0 auto; align-self: center; }
.correction-row { min-width: 0; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; padding: 12px; border: 1px solid #cfb784; border-radius: 12px; background: #fffaf0; }
.correction-row .span-2 { grid-column: 1 / -1; }
.correction-row.marked-for-removal { opacity: .55; background: #fbe5e2; border-color: #c66b61; }
.remove-row { justify-self: end; }
.correction-actions { position: sticky; bottom: 12px; z-index: 10; display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; padding: 14px; border: 1px solid #cfb784; border-radius: 14px; background: rgba(255,250,240,.96); box-shadow: var(--shadow); }
.correction-matches { display: grid; gap: 8px; padding: 12px; border: 1px solid #e0c07f; border-radius: 12px; background: #fff8e9; }
.correction-matches > p { margin: 0 0 3px; color: #745a29; font-size: 12px; }
.detail-card.span-all { grid-column: 1 / -1; }
.correction-match { width: 100%; text-align: left; border: 1px solid #dbc58f; border-radius: 10px; padding: 10px 12px; background: white; color: var(--ink); }
.correction-match strong, .correction-match span { display: block; overflow-wrap: anywhere; }
.correction-match span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.locked-note { padding: 10px; margin: 0 0 12px; border-radius: 10px; background: #f5f1e8; color: #745a29; font-size: 12px; }
.modal { width: min(520px, calc(100vw - 32px)); border: 0; border-radius: 18px; padding: 24px; box-shadow: var(--shadow); }
.modal::backdrop { background: rgba(13, 28, 23, .48); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.fine-print.left { text-align: left; margin: 0; }
.print-report { display: none; }
.report-sheet { color: #111; background: white; font-family: Arial, sans-serif; }
.report-sheet-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; border-bottom: 2px solid #153f36; padding-bottom: 14px; margin-bottom: 20px; }
.report-sheet-logo { width: 190px; height: auto; }
.report-sheet h1 { font-size: 24px; margin: 0 0 6px; }
.report-sheet h2 { margin-top: 26px; font-size: 18px; border-bottom: 1px solid #aaa; padding-bottom: 5px; }
.report-sheet table { width: 100%; border-collapse: collapse; margin: 10px 0 20px; font-size: 11px; }
.report-sheet th, .report-sheet td { border: 1px solid #bbb; padding: 6px; text-align: left; vertical-align: top; }
.report-sheet th { background: #edf4f1; }
.report-sheet .summary-cards { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.report-sheet .summary-card { border: 1px solid #bbb; padding: 10px; border-radius: 8px; }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 50; max-width: min(390px, calc(100vw - 40px)); padding: 13px 16px; border-radius: 12px; color: white; background: var(--green); box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .22s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #a23d32; }

@media (max-width: 1100px) {
  .topbar { position: static; min-height: 68px; height: auto; padding: 12px 20px; flex-wrap: wrap; }
  .layout { display: block; min-height: 0; }
  .sidebar { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); align-items: end; gap: 10px 14px; padding: 16px 20px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar > .section-label { grid-column: 1 / -1; margin: 0; }
  .sidebar > #site-select { grid-column: 1 / -1; }
  .sidebar > .button { width: 100%; min-height: 46px; margin: 0; }
  .sidebar-extra { grid-column: 1 / -1; min-width: 0; }
  .sidebar-extra > summary { display: block; list-style: none; padding: 12px 14px; border: 1px solid var(--line); border-radius: 11px; background: white; color: var(--green); font-size: 14px; font-weight: 750; cursor: pointer; }
  .sidebar-extra > summary::-webkit-details-marker { display: none; }
  .sidebar-extra > summary::after { content: "⌄"; float: right; font-size: 18px; line-height: 16px; }
  .sidebar-extra[open] > summary::after { transform: rotate(180deg); }
  .monthly-tools { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: end; gap: 10px 14px; padding: 16px 0; margin: 0; }
  .monthly-tools > .section-label { grid-column: 1 / -1; margin: 0; }
  .monthly-tools .period-label { margin-top: 10px; }
  .monthly-tools .date-label { margin-top: 0; }
  .monthly-tools .button { margin: 0; min-height: 44px; }
  .content { padding: 22px 20px 40px; }
  .form-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .detail-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .mini-form { grid-template-columns: 1fr; }
  .mini-form .span-2 { grid-column: auto; }
  .correction-row { grid-template-columns: 1fr; }
  .correction-row .span-2 { grid-column: auto; }
}
@media (max-width: 700px) {
  .topbar { gap: 9px; padding: 10px 14px; }
  .topbar .brand-lockup { min-width: 0; }
  .compact .brand-logo { width: 88px; }
  .top-actions { flex-wrap: wrap; justify-content: flex-end; gap: 6px; margin-left: auto; }
  .top-actions .user-email, .top-actions .role-pill { display: none; }
  .top-actions .button { min-height: 42px; padding: 8px 11px; }
  .sidebar { grid-template-columns: repeat(2,minmax(0,1fr)); padding: 14px; gap: 9px; }
  #new-report-button { grid-column: 1 / -1; }
  .sidebar > #site-select { min-height: 46px; }
  .content { padding: 18px 12px 32px; }
  .page-heading { gap: 8px; align-items: center; }
  .page-heading h2 { font-size: clamp(21px, 6vw, 27px); }
  .page-heading .tag { flex-shrink: 0; font-size: 11px; }
  .panel, .detail-card { padding: 14px; border-radius: 14px; }
  .form-grid, .detail-grid, .mini-form, .correction-row { grid-template-columns: 1fr; }
  .wide, .mini-form .span-2, .correction-row .span-2 { grid-column: auto; }
  .form-actions { align-items: stretch; flex-direction: column; }
  .form-actions .button, .mini-form .button { width: 100%; min-height: 46px; }
  .check-field { align-self: start; }
  .monthly-tools { grid-template-columns: 1fr; }
  .monthly-tools > .section-label { grid-column: auto; }
  .reports-list { display: flex; overflow-x: auto; }
  .report-item { min-width: 180px; }
  .correction-actions { position: static; display: grid; grid-template-columns: 1fr; gap: 8px; padding: 10px; }
  .correction-actions .button { min-height: 46px; }
  .modal { width: calc(100vw - 24px); max-height: calc(100dvh - 24px); overflow-y: auto; padding: 18px; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .button { min-height: 46px; }
  .login-shell { padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left)); }
  .login-card { padding: 24px 20px; border-radius: 20px; }
  .login-card .brand-lockup { gap: 12px; align-items: center; }
  .login-card .brand-logo { width: clamp(100px, 28vw, 150px); flex: none; }
  .login-card h1 { font-size: clamp(25px, 6vw, 34px); line-height: 1.12; }
  .login-card .eyebrow { font-size: 10px; }
  .login-card .lead { margin: 18px 0; font-size: 14px; line-height: 1.5; }
  .login-card .stack { gap: 15px; }
  .login-card .fine-print { line-height: 1.4; }
  input, select, textarea { min-width: 0; font-size: 16px; }
  .button { min-height: 44px; }
  .toast { right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); left: 12px; max-width: none; }
}
@media (max-width: 380px) {
  .sidebar > #new-site-button, .sidebar > #correction-button { font-size: 12px; padding-inline: 6px; }
  .compact .brand-logo { width: 72px; }
  .topbar .eyebrow { font-size: 9px; }
}

@media print {
  @page { size: A4 landscape; margin: 12mm; }
  body > *:not(#monthly-report-view) { display: none !important; }
  #monthly-report-view { display: block !important; }
  .report-sheet { display: block; }
  .no-print { display: none !important; }
  .report-sheet table { break-inside: auto; }
  .report-sheet tr { break-inside: avoid; }
  .report-sheet h2 { break-after: avoid; }
}
