:root {
  color-scheme: light;
  font: 100%/1.5 system-ui, -apple-system, sans-serif;
  --ink: #102927; --muted: #536765; --line: #d8e4e0;
  --green: #08775d; --green-dark: #065946; --wash: #e7f5ef; --bg: #f0f5f3;
}
* { box-sizing: border-box }
body { margin: 0; background: var(--bg); color: var(--ink); overflow-wrap: anywhere }
button, input, textarea, select { font: inherit }
button { cursor: pointer }
button:disabled { cursor: default; opacity: .56 }
:focus-visible { outline: 3px solid #36a58a; outline-offset: 2px }
a { color: var(--green-dark) }
h1, h2, h3, p { margin: 0 }
h1 { font-size: clamp(1.9rem, 5vw, 3rem); letter-spacing: -.055em; line-height: 1.12 }
h2 { font-size: 1.25rem; letter-spacing: -.02em }
h3 { font-size: 1.05rem }
small, .muted { color: var(--muted) }
small { font-size: .87rem }
strong { font-weight: 670 }
header { background: #0d2424; color: #e8f6f1; padding: 1rem clamp(1rem,4vw,3rem); min-height: 72px }
.brand { align-items: center; display: flex; gap: .68rem; font-size: 1rem; font-weight: 750 }
.brand img { width: 38px; height: 38px; border-radius: 10px }
.top, .sectionhead, .actions { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap }
.actions { justify-content: flex-start }
.top .muted { color: #bad5cc }
.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100dvh - 72px) }
nav { background: #e7efec; padding: 2rem .8rem; border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: stretch; gap: .42rem }
nav button { text-align: left; background: transparent; border: 0; color: #31504d; padding: .7rem .95rem; border-radius: .62rem; font-weight: 620; white-space: nowrap }
nav button[aria-current] { background: #cfe9df; color: #093d32; box-shadow: inset 3px 0 #14856c }
main { padding: clamp(1rem, 4vw, 3rem); max-width: 1420px; width: 100%; margin: 0 auto }
.login { min-height: 100dvh; display: grid; place-items: center; background: #e2efeb; max-width: none }
.login .card { width: min(100%, 440px); box-shadow: 0 20px 55px #10292713 }
.login .brand { margin-bottom: 1.35rem }
.hero { background: #153b37; color: #f4fbf8; padding: clamp(1.3rem,4vw,2.6rem); border-radius: 1.05rem; margin-bottom: 1.3rem }
.hero p { color: #d2e9df; margin-top: .5rem }
.hero .button { background: #bbf2d9; color: #12382f; border-color: transparent }
.stats { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: .85rem; margin-bottom: 1.3rem }
.stats .card { display: grid; gap: .3rem }
.stats strong { font-size: 2rem; line-height: 1; letter-spacing: -.05em }
.card { background: #fff; border: 1px solid var(--line); border-radius: .95rem; padding: 1rem clamp(.9rem,2vw,1.25rem); min-width: 0 }
.sectionhead { margin-bottom: 1rem }
.stack { display: grid; gap: 1rem }
.table-scroll { overflow-x: auto }
table { width: 100%; border-collapse: collapse; text-align: left }
th, td { padding: .73rem .55rem; border-bottom: 1px solid var(--line); vertical-align: middle }
thead th { color: var(--muted); font-weight: 650; font-size: .87rem }
tr:last-child td { border-bottom: 0 }
.wide { min-width: 620px }
.button { min-height: 42px; padding: .51rem .88rem; border-radius: .6rem; border: 1px solid var(--line); background: #fff; color: var(--ink); font-weight: 650 }
.button:hover { border-color: #72a99b }
.primary { color: #fff; background: var(--green); border-color: var(--green) }
.primary:hover { background: var(--green-dark) }
.button.slim { min-height: 36px; padding: .28rem .65rem; white-space: nowrap }
.tag { display: inline-block; padding: .2rem .53rem; border-radius: .4rem; background: var(--wash); color: #105c49; font-size: .85rem; font-weight: 635 }
.tag.warn, .warnbox { background: #fff1d7; color: #744812 }
.tag.closed { color: #46605a; background: #e9efed }
.warnbox { padding: .75rem .9rem; border-radius: .6rem }
.form { display: grid; gap: .9rem; margin-top: .8rem }
.fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .85rem }
label { display: grid; gap: .25rem; min-width: 0; font-size: .91rem; color: #31504d; font-weight: 620 }
.full { grid-column: 1 / -1 }
input, textarea, select { width: 100%; min-width: 0; border: 1px solid #a9c3bb; border-radius: .57rem; padding: .63rem .7rem; background: #fbfdfc; color: var(--ink) }
input[type=file] { background: #fff }
input[type=checkbox] { width: auto }
textarea { min-height: 4.8rem; resize: vertical }
dialog { width: min(calc(100vw - 1.5rem), 710px); max-height: 89dvh; padding: 1.25rem; border: 1px solid var(--line); border-radius: 1rem; color: var(--ink); box-shadow: 0 24px 70px #112f2b42 }
dialog::backdrop { background: #0e24249c }
#notice { position: fixed; bottom: 1rem; right: 1rem; z-index: 20; max-width: min(440px, calc(100% - 2rem)) }
#notice p { border-radius: .65rem; padding: .7rem 1rem; background: #123b33; color: #fff; box-shadow: 0 7px 25px #142d292e }
.error { color: #8c281b; font-weight: 650; min-height: 1.4em }
.meta { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .55rem; margin-bottom: .8rem }
.meta p { display: grid }
.pre { white-space: pre-wrap }
.line-item { display: grid; grid-template-columns: 2fr 1.4fr 90px auto; align-items: end; gap: .55rem; padding: .45rem 0 }
.signature { width: 100%; height: 150px; border: 1px dashed #6d9f91; border-radius: .6rem; touch-action: none; display: block; background: #fff }
.photos { display: grid; grid-template-columns: repeat(auto-fit,minmax(125px,1fr)); gap: .6rem }
.photos figure { margin: 0; display: grid; gap: .35rem }
.photos img { width: 100%; aspect-ratio: 4/3; object-fit: contain; background: var(--bg); border-radius: .5rem }
.search { max-width: 24rem }
hr { border: 0; border-top: 1px solid var(--line); margin: .5rem 0 }
ul { margin: .3rem 0; padding-left: 1.35rem }
[hidden] { display: none !important }
@media (max-width: 760px) {
  .layout { display: block }
  nav { position: sticky; top: 0; z-index: 5; flex-direction: row; overflow: auto; padding: .5rem; border: 0; border-bottom: 1px solid var(--line) }
  nav button { padding: .55rem .65rem }
  nav button[aria-current] { box-shadow: inset 0 -3px #14856c }
  .stats { gap: .4rem }
  .stats .card { padding: .7rem .55rem }
  .stats small { font-size: .8rem }
  .fields, .meta { grid-template-columns: minmax(0,1fr) }
  .line-item { grid-template-columns: 1fr 1fr }
  .line-item label:first-child { grid-column: 1 / -1 }
  .top .button { font-size: .87rem }
}
