:root {
    color-scheme: light;
    font: 16px/1.5 "Instrument Sans", "Segoe UI", sans-serif;
    --forest: #123b32;
    --muted: #52635d;
    --line: #d6dfda;
    --paper: #f3f6f3;
    --accent: #e9ed9e;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: #152d25; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #357b65; outline-offset: 3px; }
h1, h2, h3, p, dl { margin: 0; }
h1, h2, h3 { line-height: 1.18; }
h2 { font-size: 1.35rem; }
.muted { color: var(--muted); }
.eyebrow { font-size: .75rem; font-weight: 750; letter-spacing: .13em; text-transform: uppercase; }
.back-link { display: inline-flex; align-items: center; min-height: 44px; font-size: .9rem; font-weight: 700; text-underline-offset: 4px; }

.login-shell { min-height: 100svh; display: grid; grid-template-columns: 1fr 1fr; }
.login-cover {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 60px;
    min-width: 0;
    padding: clamp(26px, 6vw, 90px);
    background: linear-gradient(145deg, #0d2b24bd, #092c22f5), url("../terra-mechanical-palm-oil.jpg") center / cover;
    color: #fff;
}
.cover-brand { align-self: flex-start; }
.cover-brand img { display: block; width: min(275px, 65vw); height: auto; filter: brightness(0) invert(1); }
.cover-copy { max-width: 510px; }
.cover-copy .eyebrow, .cover-copy h1 span { color: var(--accent); }
.cover-copy h1 { margin: 8px 0 13px; font-size: clamp(3.1rem, 7vw, 6.8rem); letter-spacing: -.075em; }
.cover-copy > p:last-child { max-width: 360px; color: #e3ede6; }
.login-panel { display: grid; place-items: center; background: #fff; padding: clamp(22px, 5vw, 75px); }
.login-content { width: min(100%, 440px); }
.login-content h2 { margin: 13px 0 7px; font-size: clamp(1.75rem, 3vw, 2.5rem); letter-spacing: -.045em; }
.login-content form { margin-top: 25px; display: grid; gap: 8px; }
.login-content input { margin-bottom: 9px; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 88px; }
.password-wrap button { position: absolute; top: 4px; right: 4px; min-height: 41px; padding: 0 12px; border: 0; background: transparent; color: var(--forest); font-size: .88rem; font-weight: 700; }

label { font-weight: 650; font-size: .92rem; }
input:not([type="radio"]), select, textarea {
    display: block;
    width: 100%;
    min-height: 49px;
    border: 1px solid #adbeb5;
    border-radius: 9px;
    background: #fff;
    color: #152d25;
    padding: 10px 12px;
    font-size: 1rem;
    font-weight: 400;
}
textarea { resize: vertical; }
.primary { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 53px; padding: 10px 16px; border: 0; border-radius: 9px; background: var(--forest); color: white; font-weight: 700; text-align: left; }
.primary:hover { background: #205846; }
.primary span { color: var(--accent); }
.login-content .primary { margin-top: 7px; }
.ehs-install { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 8px 10px; align-items: center; margin-top: 16px; padding: 10px; border: 1px solid #c8dcde; border-radius: 11px; background: #f1f8f7; }
.ehs-install img { border-radius: 8px; }
.ehs-install strong { display: block; color: #07545b; font-size: .87rem; line-height: 1.25; }
.ehs-install p { color: var(--muted); font-size: .79rem; }
.ehs-install button { min-height: 44px; padding: 0 11px; border: 1px solid #9ebabc; border-radius: 7px; background: #fff; color: #07545b; font-size: .82rem; font-weight: 700; }
.ehs-install button:hover { background: #e4f2f2; }
.ehs-install [data-install-help] { grid-column: 2 / -1; }
.error-box, .success-box { margin-top: 14px; padding: 12px 16px; border-radius: 9px; }
.error-box { background: #fff0ec; color: #842b20; }
.error-box ul { margin: 6px 0 0; padding-left: 20px; }
.success-box { background: #e1f3e8; color: #1d5a33; }

.ehs-app { --forest: #07545b; --app-gold: #f4b52c; background: #f2f6f7; }
.app-header { position: sticky; z-index: 5; top: 0; padding-top: env(safe-area-inset-top); border-bottom: 3px solid var(--app-gold); background: var(--forest); color: #fff; }
.app-header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 65px; width: min(100% - 32px, 890px); margin: auto; }
.app-header a { font-weight: 800; text-decoration: none; }
.app-header button { min-height: 44px; padding: 0 13px; border: 1px solid #a3b9b1; border-radius: 8px; background: transparent; color: inherit; font-size: .82rem; font-weight: 650; }
.app-brand { display: flex; align-items: center; gap: 9px; line-height: 1.15; }
.app-brand img { border-radius: 9px; }
.app-brand small { display: block; margin-top: 4px; color: #d3e8e8; font-size: .68rem; font-weight: 500; }
.workspace { width: min(100% - 32px, 890px); margin: 24px auto 0; padding-bottom: calc(98px + env(safe-area-inset-bottom)); overflow-wrap: anywhere; }
.workspace-heading { margin: 0 0 20px; }
.workspace-heading h1 { margin-bottom: 6px; font-size: clamp(1.7rem, 4vw, 2.4rem); letter-spacing: -.045em; }
.workspace-heading p { font-size: .91rem; }
.app-dock { position: fixed; z-index: 6; inset: auto 0 0; padding: 5px 8px calc(5px + env(safe-area-inset-bottom)); border-top: 1px solid #d7e3e5; background: #fff; box-shadow: 0 -8px 30px #063d4410; }
.app-dock-inner { display: flex; max-width: 560px; margin: auto; gap: 4px; }
.app-dock a { display: flex; flex: 1 1 0; min-width: 0; min-height: 52px; align-items: center; justify-content: center; flex-direction: column; gap: 4px; border-radius: 9px; color: #455e61; font-size: .69rem; font-weight: 700; text-align: center; text-decoration: none; }
.app-dock a span { font-size: 1.25rem; line-height: 1; }
.app-dock a[aria-current] { background: #e4f2f2; color: #07545b; }
.home-hero { position: relative; isolation: isolate; overflow: hidden; padding: clamp(20px, 4vw, 36px); border-radius: 14px; background: linear-gradient(120deg, #084950, #0b676b); color: #fff; }
.home-hero::after { position: absolute; z-index: -1; right: -55px; bottom: -125px; width: 220px; height: 220px; border: 28px solid #ffffff12; border-radius: 50%; box-shadow: 0 0 0 23px #ffffff0d; content: ""; }
.home-hero .eyebrow { color: #f8cc6a; }
.home-hero h1 { margin: 7px 0; max-width: 650px; font-size: clamp(1.65rem, 5vw, 2.7rem); letter-spacing: -.045em; }
.home-hero > p:last-child { max-width: 430px; color: #d9eeee; font-size: .9rem; }
.home-section, .recent-reports, .guide-checklist { margin-top: 20px; }
.home-section h2, .section-heading h2 { font-size: 1.08rem; }
.menu-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: 9px; margin-top: 10px; }
.menu-tile { display: flex; flex-direction: column; align-items: flex-start; padding: clamp(9px, 2vw, 16px); border: 1px solid #d5e3e5; border-radius: 12px; background: #fff; text-decoration: none; }
.menu-tile:hover { border-color: #83aeb1; background: #fafdfe; }
.menu-tile strong { margin-top: 8px; font-size: .85rem; line-height: 1.2; }
.menu-tile small { margin-top: 4px; color: var(--muted); font-size: .73rem; line-height: 1.35; }
.menu-icon { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 9px; font-size: 1.25rem; font-weight: 700; line-height: 1; }
.menu-icon.new { background: #e3f1f0; color: #07545b; }
.menu-icon.history-icon { background: #e7effc; color: #234e8e; }
.menu-icon.guide-icon { background: #fff1d8; color: #785409; }
.section-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.section-heading a { flex: none; color: var(--forest); font-size: .76rem; font-weight: 700; text-underline-offset: 3px; }
.empty-state { padding: 14px 0; color: var(--muted); font-size: .9rem; }
.check-group { margin-top: 10px; border: 1px solid #d4e4e6; border-radius: 9px; background: #f5fafa; }
.check-group summary { padding: 11px; cursor: pointer; font-size: .9rem; font-weight: 700; }
.check-group small { margin-left: 5px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.check-group-body { padding: 2px 9px 0; }
.check-group .check-item { background: white; }
.guide-statuses div + div { margin-top: 10px; }
.guide-statuses dd { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }
.guide-checklist ul { margin: 0 12px 12px; padding-left: 20px; font-size: .9rem; }
.ehs-app .workspace :is(input, select, textarea, summary) { scroll-margin-block: 85px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; flex-wrap: wrap; gap: 8px 18px; margin: 18px 0 24px; }
.page-heading h1 { margin: 5px 0; font-size: clamp(2rem, 5vw, 3.25rem); letter-spacing: -.05em; }
.inspection-form { display: grid; gap: 15px; }
.card { padding: clamp(15px, 3vw, 26px); border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.card h2 { margin-bottom: 11px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
[data-project-search] { margin-bottom: 12px; }
.form-grid :is(input, select, textarea), .check-observation textarea, .general-notes textarea { margin-top: 5px; }
.reference { margin-top: 10px; font-size: .84rem; color: var(--muted); }
.reference a { text-underline-offset: 3px; }
.check-category { margin: 24px 0 12px; padding: 10px; border-radius: 7px; background: #eaf2eb; font-size: 1rem; }
.check-item { min-width: 0; margin: 0 0 13px; padding: 10px 12px 13px; border: 1px solid var(--line); border-radius: 9px; }
.check-item legend { padding: 0 5px; font-size: .93rem; font-weight: 650; }
.status-options { display: flex; flex-wrap: wrap; gap: 5px; }
.status-options label { display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 8px; border: 1px solid var(--line); border-radius: 7px; cursor: pointer; }
.status-options label:has(:checked) { background: #e3f2e7; border-color: #50816a; }
.status-options input { margin: 0; accent-color: var(--forest); }
.check-observation, .general-notes { display: block; margin-top: 12px; }
.finding-fields { margin-top: 12px; }
.inspection-actions { display: flex; justify-content: flex-end; padding: 10px 0 0; }
.save-button { width: min(100%, 290px); justify-content: center; box-shadow: 0 5px 15px #07545b20; }
.photo-input { margin-top: 12px; }
.photo-input::file-selector-button { margin-right: 10px; padding: 6px 9px; border: 0; border-radius: 5px; background: #e4f2f2; color: #07545b; cursor: pointer; }
.photo-gallery { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.photo-gallery a { display: block; border-radius: 9px; overflow: hidden; }
.photo-gallery img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: #eff5f5; }
.history { margin-top: 20px; }
.history-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; min-height: 60px; border-bottom: 1px solid var(--line); text-decoration: none; }
.history-row:hover strong { text-decoration: underline; }
.history-row small, .history-row time { color: var(--muted); }
.history-row small { display: block; }
.history-row time { flex: none; font-size: .85rem; }
.history-pagination { display: flex; flex-wrap: wrap; gap: 18px; padding-top: 12px; }
.report .card + .card { margin-top: 15px; }
.report dt { color: var(--muted); font-size: .85rem; }
.report dd { margin: 2px 0 0; white-space: pre-wrap; }
.result-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.result-item dl { margin-top: 9px; }
.result-status { display: inline-block; margin-top: 6px; padding: 3px 8px; border-radius: 5px; background: #e8ecea; font-size: .82rem; font-weight: 700; }
.result-status.pass { background: #dff0e4; color: #195b39; }
.result-status.finding { background: #fff0ec; color: #842b20; }
.result-note { margin-top: 8px; white-space: pre-wrap; }

@media (max-width: 720px) {
    .login-shell { display: block; background: #fff; }
    .login-cover { gap: 30px; padding: 23px 22px 28px; }
    .cover-brand img { width: min(230px, 65vw); }
    .cover-copy h1 { font-size: clamp(3rem, 12vw, 4.8rem); }
    .login-panel { display: block; padding: 15px 22px 35px; }
    .login-content { margin: auto; }
    .workspace { margin-top: 20px; }
}
@media (max-width: 500px) {
    .form-grid { grid-template-columns: 1fr; }
    .history-row time { font-size: .78rem; }
    .save-button { width: 100%; }
}
