:root {
  color-scheme: light;
  --ink: #1d2924;
  --muted: #78817b;
  --green: #2e5a43;
  --green-dark: #234634;
  --green-soft: #e8eee8;
  --paper: #f5f7f3;
  --line: #e7eae5;
  --white: #fff;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
button, input { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.topbar {
  height: 82px; padding: 0 max(6.5vw, calc((100vw - 1180px) / 2));
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(255,255,255,.82); border-bottom: 1px solid #e9ece7;
}
.wordmark { display: inline-flex; gap: 11px; align-items: center; color: var(--ink); font: 800 17px ui-sans-serif,system-ui,sans-serif; text-decoration: none; letter-spacing: -.5px; }
.wordmark small { display: block; margin-top: 2px; font: 600 8px ui-sans-serif,system-ui,sans-serif; letter-spacing: 1.65px; color: #78817b; }
.brand-mark { width: 49px; height: 49px; display: grid; place-items: center; border-radius: 50%; color: #f7f8f2; background: var(--green); font: 500 26px Georgia,serif; }
.brand-mark.small { width: 37px; height: 37px; font-size: 19px; }
.topbar-actions { display: flex; align-items: center; gap: 25px; }
.live-status { display: flex; align-items: center; gap: 8px; color: #64716a; font-size: 12px; }
.live-status span { width: 7px; height: 7px; border-radius: 50%; background: #75a278; box-shadow: 0 0 0 3px #e6efe4; }
.button { border: 0; border-radius: 7px; min-height: 45px; padding: 0 18px; font-size: 13px; font-weight: 600; transition: background .18s, transform .18s; }
.button:hover { transform: translateY(-1px); }
.button-primary { background: var(--green); color: #fff; }
.button-primary:hover { background: var(--green-dark); }
.button-primary span { padding-left: 14px; font-size: 16px; }
.button-quiet { min-height: 37px; padding: 0 4px; background: transparent; color: #5e6b63; }
.button-quiet span { padding-left: 7px; }
.full-width { width: 100%; }

.page-content { max-width: 1180px; padding: 0 0 40px; margin: auto; }
.intro { min-height: 236px; display: flex; justify-content: space-between; align-items: center; padding: 36px 0 30px; }
.eyebrow { margin: 0 0 12px; color: #76827a; font-size: 9px; font-weight: 700; letter-spacing: 1.65px; }
.eyebrow-rule { display: inline-block; vertical-align: 3px; width: 19px; height: 1px; margin-right: 7px; background: #9bab9c; }
h1, h2, p { margin-top: 0; }
.intro h1, .login-card h1 { margin: 0; font: 600 43px/1.12 ui-sans-serif,system-ui,sans-serif; letter-spacing: -2px; }
.intro h1 em { color: var(--green); font-style: normal; }
.intro-copy { max-width: 440px; margin: 12px 0 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.intro-aside { align-self: flex-end; display: flex; gap: 12px; align-items: center; margin: 0 2px 18px 0; color: #748078; font: 12px/1.55 ui-sans-serif,system-ui,sans-serif; }
.intro-aside strong { color: var(--green); font-weight: 700; }
.sun-icon { color: #a7aa82; font-size: 27px; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 16px; }
.metric-card { min-height: 144px; padding: 20px 22px 18px; border: 1px solid #e8ebe6; border-radius: 9px; background: #fff; }
.metric-primary { background: var(--green); border-color: var(--green); color: white; }
.metric-topline { display: flex; justify-content: space-between; align-items: center; font-size: 9px; font-weight: 700; letter-spacing: 1.4px; color: #768078; }
.metric-primary .metric-topline { color: #c5d3c8; }
.metric-icon { font: 19px Georgia,serif; color: #c7d7c9; }
.muted-icon { color: #a3b3a5; }
.metric-value { display: flex; align-items: baseline; gap: 8px; margin-top: 15px; }
.metric-value strong { font: 600 34px/1 ui-sans-serif,system-ui,sans-serif; letter-spacing: -1.6px; }
.metric-value span { color: #7d8880; font-size: 12px; }
.metric-primary .metric-value span { color: #c5d3c8; }
.metric-card p { margin: 8px 0 0; color: #87918a; font-size: 11px; }
.metric-primary p { color: #c5d3c8; }

.chart-card, .readings-card, .new-reading-card { border: 1px solid #e8ebe6; border-radius: 9px; background: white; }
.chart-card { padding: 24px 24px 16px; margin-bottom: 16px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; }
.section-heading .eyebrow { margin-bottom: 5px; }
.section-heading h2, .new-reading-card h2 { margin: 0; font: 600 19px ui-sans-serif,system-ui,sans-serif; letter-spacing: -.55px; }
.chart-switch { display: flex; gap: 3px; padding: 3px; border-radius: 7px; background: #f2f4f0; }
.chart-tab { padding: 7px 11px; border: 0; border-radius: 5px; color: #748078; background: transparent; font-size: 10px; }
.chart-tab.selected { color: var(--green); background: white; box-shadow: 0 1px 3px #2235221c; font-weight: 600; }
.chart-wrap { height: 265px; width: 100%; margin-top: 14px; }
#chart { display: block; width: 100%; height: 100%; overflow: visible; }
.grid-line { stroke: #edf0ec; stroke-width: 1; }
.axis-label { fill: #909a92; font: 10px ui-sans-serif,system-ui,sans-serif; }
.line-area { fill: url(#areaFill); }
.chart-line { fill: none; stroke: #527a5d; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.chart-dot { fill: white; stroke: #527a5d; stroke-width: 2; }
.chart-bar { fill: #66836a; rx: 3; }
.chart-legend { display: flex; align-items: center; gap: 8px; padding-top: 11px; color: #818c84; font-size: 10px; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; background: #66836a; }
.estimate-note { margin-left: auto; color: #927947; font-size: 10px; }
.lower-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(305px, .85fr); gap: 16px; align-items: start; }
.readings-card { min-width: 0; padding: 23px 24px; }
.readings-heading { margin-bottom: 18px; }
.readings-card > .form-message { margin: -10px 0 12px; }
.count-pill { padding: 5px 10px; border-radius: 20px; background: #eff3ee; color: #627568; font-size: 10px; }
.table-scroll { overflow: auto; max-height: 430px; }
table { width: 100%; border-collapse: collapse; text-align: left; white-space: nowrap; }
th { padding: 0 12px 11px; color: #89938c; font-size: 9px; font-weight: 600; }
th:first-child, td:first-child { padding-left: 0; }
td { padding: 12px; border-top: 1px solid #eff1ed; color: #4b5850; font-size: 11px; }
td:nth-child(2) { color: var(--ink); font-weight: 600; }
td:last-child { color: #627568; text-align: right; }
th:last-child { text-align: right; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.delete-reading { border: 0; border-radius: 5px; padding: 6px 9px; color: #9c4a3e; background: #fbf1ef; font-size: 10px; }
.delete-reading:hover { background: #f5e1dd; }
.delete-reading:disabled { opacity: .55; cursor: wait; }
.new-reading-card { padding: 22px; background: #f0f3ed; border-color: #e8ece5; }
.form-heading-icon { display: grid; width: 32px; height: 32px; place-items: center; margin-bottom: 18px; border-radius: 50%; color: var(--green); background: #dfe9df; font-size: 19px; }
.new-reading-card .eyebrow { margin-bottom: 7px; }
.new-reading-card h2 { font-size: 20px; }
.form-intro { margin: 8px 0 17px; color: #78827b; font-size: 11px; line-height: 1.55; }
.photo-reader { margin: 0 0 16px; padding: 12px; border: 1px solid #dfe5dc; border-radius: 6px; background: #f8faf7; }
.photo-reader label { margin: 0 0 8px; }
.photo-reader input[type="file"] { height: auto; min-height: 38px; padding: 7px; background: white; font-size: 10px; }
.photo-reader input[type="file"]::file-selector-button { margin-right: 8px; padding: 6px 9px; border: 0; border-radius: 4px; background: #e8eee8; color: var(--green); font: inherit; }
.photo-status { margin: 8px 0 0; color: #68756c; font-size: 10px; line-height: 1.5; }
.photo-status.error { color: #a34539; }
.photo-status.success { color: #466c4b; }
.photo-stage { position: relative; width: fit-content; max-width: 100%; margin: 10px auto 0; }
.photo-preview { display: block; max-width: 100%; max-height: 320px; border-radius: 4px; object-fit: contain; }
.photo-selection { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.photo-selection.selecting { cursor: crosshair; }
.photo-ai-controls { margin-top: 9px; }
.photo-ai-controls .photo-privacy { margin: 0 0 6px; }
.photo-action { min-height: 34px; padding: 0 4px; font-size: 10px; }
.photo-ai-controls .button-primary { min-height: 38px; margin-top: 3px; font-size: 11px; }
.photo-ai-controls .button-primary:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.photo-privacy { margin: 7px 0 0; color: #879188; font-size: 9px; line-height: 1.45; }
label { display: block; margin: 12px 0 6px; color: #536057; font-size: 10px; font-weight: 600; }
label span { float: right; color: #97a098; font-weight: 400; }
input { width: 100%; height: 41px; padding: 0 11px; border: 1px solid #dfe5dc; border-radius: 5px; outline: none; color: var(--ink); background: white; font-size: 12px; }
input:focus { border-color: #78977b; box-shadow: 0 0 0 3px #78977b20; }
input::placeholder { color: #aab1ab; }
.new-reading-card .button { margin-top: 16px; }
.form-message, .form-error { min-height: 16px; margin: 9px 0 0; color: #a34539; font-size: 11px; line-height: 1.45; }
.form-message.success { color: #466c4b; }
.validation-note { margin: 7px 0 0; color: #879188; font-size: 9px; line-height: 1.55; }
.validation-note span { padding-right: 3px; color: #8d9f85; }
footer { display: flex; justify-content: space-between; padding: 27px 2px 0; color: #8b958d; font-size: 8px; letter-spacing: 1.1px; }
footer span { letter-spacing: 0; font-size: 9px; }

.login-view { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(ellipse at 50% 35%, #e9eee6 0%, #f5f7f3 60%); }
.login-card { width: min(100%, 410px); padding: 39px; border: 1px solid #e8ebe6; border-radius: 12px; background: white; box-shadow: 0 14px 50px #28442e0b; }
.login-card .brand-mark { margin-bottom: 25px; }
.login-card .eyebrow { margin-bottom: 14px; }
.login-card h1 { font-size: 35px; letter-spacing: -1.6px; }
.login-card > .muted { margin: 12px 0 23px; color: var(--muted); font-size: 12px; }
.login-card label { margin-bottom: 7px; }
.login-card input { height: 46px; }
.login-card .button { margin-top: 13px; }
.login-footnote { margin: 20px 0 0; color: #929b94; text-align: center; font-size: 10px; }
.lock-icon { padding-right: 5px; color: #89a18c; font-size: 8px; }
.loading-view { min-height: 100vh; display: flex; align-items: center; justify-content: center; gap: 11px; color: #748078; font-size: 12px; }
.loader { width: 17px; height: 17px; border: 2px solid #dce5dc; border-top-color: #527a5d; border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 1230px) { .page-content { margin: 0 6.5vw; } }
@media (max-width: 760px) {
  .topbar { height: 68px; padding: 0 20px; }
  .topbar-actions { gap: 12px; }
  .live-status { font-size: 0; gap: 0; }
  .live-status span { width: 8px; height: 8px; }
  .page-content { margin: 0 20px; }
  .intro { min-height: auto; padding: 39px 0 25px; }
  .intro h1 { font-size: 37px; }
  .intro-aside { display: none; }
  .metrics { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric-card { min-height: 127px; padding: 16px; }
  .metric-card:first-child { grid-column: span 2; min-height: 132px; }
  .metric-value strong { font-size: 29px; }
  .chart-card { padding: 19px 15px 13px; }
  .chart-heading { align-items: flex-start; gap: 8px; }
  .chart-tab { padding: 7px 8px; font-size: 9px; }
  .chart-wrap { height: 220px; margin-top: 20px; }
  .lower-grid { grid-template-columns: 1fr; }
  .readings-card { padding: 19px 15px; }
  .new-reading-card { padding: 20px; }
  footer { gap: 15px; font-size: 7px; }
  footer span { text-align: right; }
}
@media (max-width: 390px) {
  .page-content { margin: 0 14px; }
  .topbar { padding: 0 14px; }
  .chart-heading { display: block; }
  .chart-switch { width: fit-content; margin-top: 12px; }
  .metric-value { gap: 5px; }
  .metric-value strong { font-size: 25px; }
}
