:root {
  color-scheme: light;
  --green-900: #0b4938;
  --green-800: #0e5c46;
  --green-700: #136f52;
  --green-100: #ddf3ea;
  --green-50: #eef9f5;
  --ink: #17211e;
  --muted: #65736e;
  --line: #dfe7e3;
  --surface: #ffffff;
  --canvas: #f4f7f5;
  --danger: #b42318;
  --danger-bg: #fff1f0;
  --warning: #985c08;
  --shadow: 0 10px 30px rgba(15, 50, 39, .08);
}

* { box-sizing: border-box; }
html { background: var(--canvas); }
body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--canvas);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  background: var(--canvas);
}
.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  min-height: 68px;
  padding: max(12px, env(safe-area-inset-top)) 18px 12px;
  border-bottom: 1px solid rgba(223, 231, 227, .8);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(16px);
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: white;
  background: var(--green-700);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: -.5px;
}
.brand-copy { display: flex; flex: 1; flex-direction: column; gap: 1px; margin-left: 10px; }
.brand-copy strong { font-size: 16px; }
.brand-copy span { color: var(--muted); font-size: 11px; }
.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--green-700);
  background: white;
  font-weight: 700;
}
.manager-link { margin-left: 8px; padding: 8px 10px; border-radius: 10px; color: var(--green-700); background: var(--green-50); font-size: 12px; font-weight: 700; text-decoration: none; }
.screen { padding: 26px 18px 40px; }
.loading-screen { display: grid; min-height: 60vh; place-content: center; place-items: center; color: var(--muted); }
.spinner { width: 30px; height: 30px; border: 3px solid var(--green-100); border-top-color: var(--green-700); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.hero { padding: 18px 2px 22px; }
.hero.compact { padding-top: 26px; }
.hero h1, .welcome-row h1 { margin: 5px 0 8px; font-size: 27px; line-height: 1.25; letter-spacing: -.7px; }
.hero p { max-width: 36ch; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.eyebrow, .section-kicker { color: var(--green-700); font-size: 12px; font-weight: 700; letter-spacing: .06em; }
.card { border: 1px solid rgba(214, 225, 220, .95); border-radius: 19px; background: var(--surface); box-shadow: var(--shadow); }
.form-card { padding: 20px; }
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 17px; }
.field > span { font-size: 13px; font-weight: 650; }
input, select {
  width: 100%;
  height: 48px;
  border: 1px solid #ccd8d3;
  border-radius: 12px;
  outline: none;
  color: var(--ink);
  background: #fbfcfc;
  padding: 0 13px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input:focus, select:focus { border-color: var(--green-700); background: white; box-shadow: 0 0 0 3px rgba(19, 111, 82, .11); }
.primary-button, .secondary-button, .text-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 49px;
  border-radius: 13px;
  border: 0;
  cursor: pointer;
  font-weight: 700;
}
.primary-button { color: white; background: var(--green-700); box-shadow: 0 8px 18px rgba(19, 111, 82, .19); }
.primary-button:active { background: var(--green-800); transform: translateY(1px); }
.primary-button:disabled { opacity: .6; cursor: wait; }
.secondary-button { border: 1px solid var(--line); color: var(--ink); background: white; box-shadow: none; }
.text-button { color: var(--muted); background: transparent; font-weight: 600; box-shadow: none; }
.privacy-note { margin: 12px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; text-align: center; }
.message { margin: 0 0 14px; padding: 11px 12px; border-radius: 10px; font-size: 13px; line-height: 1.5; }
.message.error { color: var(--danger); background: var(--danger-bg); }

.identity-card { display: flex; align-items: center; gap: 13px; padding: 18px; }
.avatar { display: grid; flex: 0 0 auto; width: 48px; height: 48px; place-items: center; border-radius: 15px; color: white; background: linear-gradient(145deg, var(--green-700), var(--green-900)); font-size: 17px; font-weight: 800; }
.identity-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 4px; }
.identity-copy strong { font-size: 19px; }
.identity-copy span { overflow: hidden; color: var(--muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.status-pill, .edit-state { padding: 5px 8px; border-radius: 999px; color: var(--green-700); background: var(--green-50); font-size: 11px; font-weight: 700; white-space: nowrap; }
.button-stack { display: grid; gap: 6px; margin-top: 20px; }

.report-screen { padding-top: 22px; }
.welcome-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.welcome-row h1 { margin-top: 4px; font-size: 24px; }
.completion-ring { display: grid; flex: 0 0 auto; width: 66px; height: 66px; place-content: center; border: 5px solid var(--green-100); border-radius: 50%; text-align: center; }
.completion-ring strong { font-size: 15px; }
.completion-ring span { margin-top: 1px; color: var(--muted); font-size: 9px; }
.cutoff-note { display: flex; gap: 9px; margin: 12px 0 18px; padding: 11px 12px; border-radius: 12px; color: #4e645d; background: var(--green-50); font-size: 12px; line-height: 1.5; }
.cutoff-note > span:first-child { color: var(--green-700); font-size: 17px; }
.slot-card { padding: 17px 0 16px; overflow: hidden; }
.section-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 16px 12px; }
.section-heading.plain { padding: 0 0 12px; }
.section-heading h2 { margin: 3px 0 0; font-size: 17px; }
.slot-scroller { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 4px; scrollbar-width: none; }
.slot-scroller::-webkit-scrollbar { display: none; }
.slot-button { position: relative; flex: 0 0 auto; min-width: 68px; height: 43px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; color: #4e5e59; background: white; font-size: 13px; font-weight: 700; }
.slot-button.active { border-color: var(--green-700); color: white; background: var(--green-700); }
.slot-button.done::after { position: absolute; top: -4px; right: -3px; width: 15px; height: 15px; border: 2px solid white; border-radius: 50%; color: white; background: #2a9d69; content: "✓"; font-size: 9px; line-height: 15px; }
.slot-button.active.done::after { background: var(--green-900); }
.metric-section { margin-top: 24px; }
.metric-grid, .result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.metric-field { display: block; margin: 0; padding: 12px 12px 10px; border: 1px solid var(--line); border-radius: 15px; background: white; }
.metric-field > span { display: block; min-height: 18px; margin-bottom: 5px; color: #4e5e59; font-size: 12px; font-weight: 600; }
.metric-field input { height: 38px; padding: 0; border: 0; border-radius: 0; color: var(--ink); background: transparent; box-shadow: none; font-size: 23px; font-weight: 750; }
.metric-field input:focus { box-shadow: none; }
.result-section { margin-bottom: 18px; }
.result-field { border-color: #c4dcd3; background: linear-gradient(180deg, white, #f8fcfa); }
.result-field.amount { grid-column: auto; }
.input-unit { display: flex; align-items: center; }
.input-unit b { margin-right: 5px; color: var(--green-700); font-size: 18px; }
.input-unit i { color: var(--muted); font-size: 12px; font-style: normal; }
.sticky-submit { position: sticky; z-index: 10; bottom: max(14px, env(safe-area-inset-bottom)); margin-top: 8px; }
.totals-card { margin-top: 23px; padding: 17px 16px; }
.daily-card { margin-top: 14px; padding: 17px 16px; }
.daily-card p { margin: 0 0 14px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.totals-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.totals-grid div { display: flex; flex-direction: column; padding: 10px; border-radius: 12px; background: var(--canvas); }
.totals-grid span { color: var(--muted); font-size: 11px; }
.totals-grid strong { margin-top: 4px; font-size: 17px; }

.toast { position: fixed; z-index: 50; left: 50%; bottom: max(25px, env(safe-area-inset-bottom)); width: max-content; max-width: calc(100% - 40px); transform: translateX(-50%); padding: 11px 16px; border-radius: 999px; color: white; background: rgba(18, 32, 27, .93); box-shadow: var(--shadow); font-size: 13px; }
.dialog-backdrop { position: fixed; z-index: 60; inset: 0; display: grid; padding: 20px; place-items: center; background: rgba(9, 25, 19, .52); backdrop-filter: blur(4px); }
.dialog { width: min(100%, 420px); padding: 22px; text-align: center; }
.dialog h2 { margin: 10px 0 8px; font-size: 20px; }
.warning-icon { display: grid; width: 42px; height: 42px; margin: 0 auto; place-items: center; border-radius: 50%; color: white; background: #d88716; font-size: 21px; font-weight: 800; }
.warning-list { display: grid; gap: 8px; margin: 14px 0 19px; color: #665338; font-size: 13px; line-height: 1.55; text-align: left; }
.warning-list p { margin: 0; padding: 10px 11px; border-radius: 10px; background: #fff8e8; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1.25fr; gap: 9px; }
.daily-dialog { max-height: min(86vh, 720px); overflow-y: auto; text-align: left; }
.daily-dialog h2 { text-align: center; }
.daily-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.daily-summary div { display: flex; flex-direction: column; padding: 10px; border-radius: 10px; background: var(--green-50); }
.daily-summary span { color: var(--muted); font-size: 10px; }
.daily-summary strong { margin-top: 3px; font-size: 15px; }
.exception-switch { margin: 13px 0; padding: 11px; border-radius: 10px; background: var(--canvas); font-size: 13px; }
.exception-switch label { display: flex; align-items: center; gap: 8px; }
.exception-switch input { width: 18px; height: 18px; }
.exception-form { display: grid; gap: 8px; margin-bottom: 12px; }
.exception-form input, .exception-form select { height: 42px; }
.exception-list { display: grid; gap: 7px; margin-bottom: 13px; }
.exception-item { position: relative; padding: 10px 34px 10px 11px; border: 1px solid var(--line); border-radius: 10px; font-size: 12px; }
.exception-item strong, .exception-item span { display: block; }
.exception-item span { margin-top: 3px; color: var(--muted); }
.exception-item button { position: absolute; top: 7px; right: 7px; width: 24px; height: 24px; border: 0; border-radius: 50%; color: var(--danger); background: var(--danger-bg); }

@media (min-width: 521px) {
  body { padding: 24px 0; }
  .app-shell { min-height: calc(100vh - 48px); border: 1px solid var(--line); border-radius: 26px; overflow: clip; box-shadow: 0 25px 70px rgba(10, 50, 37, .12); }
  .topbar { top: 24px; }
}
@media (max-width: 360px) {
  .screen { padding-right: 14px; padding-left: 14px; }
  .metric-grid { gap: 7px; }
  .metric-field { padding: 10px; }
  .metric-field > span { font-size: 11px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; } }
