:root {
  --bg: #f6f3ed;
  --ink: #1e2528;
  --muted: #667073;
  --line: #d8ddd8;
  --panel: #ffffff;
  --accent: #23605a;
  --accent-strong: #17433f;
  --warn: #a14e2f;
  --soft: #e9f2ef;
  --shadow: 0 16px 40px rgba(25, 42, 45, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, BlinkMacSystemFont,
    sans-serif;
  -webkit-tap-highlight-color: rgba(35, 96, 90, 0.16);
}

button,
input,
select {
  font: inherit;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 0 max(40px, env(safe-area-inset-bottom));
}

.summary-band {
  min-height: 190px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: end;
  padding: 30px;
  border-radius: 8px;
  color: #f8fbf9;
  background:
    linear-gradient(115deg, rgba(18, 63, 59, 0.96), rgba(35, 96, 90, 0.88)),
    url("data:image/svg+xml,%3Csvg width='900' height='320' viewBox='0 0 900 320' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 238C130 174 244 271 368 208C492 145 584 31 718 76C802 104 855 171 900 150V320H0Z' fill='%23d7eee6' fill-opacity='.22'/%3E%3Cpath d='M0 91C94 132 158 42 255 72C352 102 405 174 513 136C621 98 681 20 775 38C832 49 867 78 900 65' fill='none' stroke='%23ffffff' stroke-opacity='.16' stroke-width='18'/%3E%3C/svg%3E");
  background-size: cover;
  box-shadow: var(--shadow);
}

.eyebrow,
.cycle-text,
.panel-heading p,
.total-label,
.total-panel span,
.rate-card span,
dt {
  color: inherit;
  opacity: 0.75;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 13px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 12px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 1.02;
  letter-spacing: 0;
}

.cycle-text {
  margin-bottom: 0;
  font-size: 17px;
}

.person-text {
  margin: 8px 0 0;
  color: inherit;
  font-size: 15px;
  opacity: 0.78;
}

.total-panel {
  display: grid;
  gap: 8px;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
}

.total-panel strong {
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1;
}

.controls-band,
.login-panel,
.entry-panel,
.records-panel,
.breakdown-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-panel {
  margin-top: 18px;
  overflow: hidden;
}

.app-panel.is-hidden,
.login-panel.is-hidden,
.is-hidden {
  display: none !important;
}

.controls-band {
  display: grid;
  grid-template-columns: minmax(180px, 1.1fr) minmax(160px, 1fr) minmax(160px, 1fr) 170px auto;
  gap: 14px;
  align-items: end;
  margin-top: 18px;
  padding: 18px;
}

.person-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.person-control .primary-button {
  min-height: 42px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

input,
select {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #cbd4cf;
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  outline: none;
  font-size: 16px;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(35, 96, 90, 0.16);
}

.login-form {
  display: grid;
  grid-template-columns: 160px minmax(180px, 1fr) minmax(180px, 1fr) auto;
  gap: 14px;
  align-items: end;
  padding: 22px;
}

.form-message {
  min-height: 22px;
  margin: -8px 22px 18px;
  color: var(--warn);
  font-size: 14px;
}

.rate-card {
  min-height: 70px;
  display: grid;
  gap: 6px;
  align-content: center;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--soft);
}

.rate-card strong {
  color: var(--accent-strong);
  font-size: 24px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  margin-top: 18px;
  align-items: start;
}

.entry-panel,
.breakdown-panel {
  overflow: hidden;
}

.panel-heading {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
}

.compact-heading {
  margin: -20px -20px 16px;
  padding: 20px;
}

h2 {
  margin-bottom: 4px;
  font-size: 21px;
}

.panel-heading p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
}

.secondary-button {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid #c8d2ce;
  border-radius: 6px;
  color: var(--accent-strong);
  background: #fff;
  cursor: pointer;
}

.primary-button {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-button:hover {
  background: var(--soft);
}

.type-pill {
  display: inline-flex;
  min-width: 64px;
  justify-content: center;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--accent-strong);
  background: var(--soft);
  font-size: 12px;
  font-weight: 700;
}

.type-pill.weekend {
  color: var(--accent-strong);
  background: var(--soft);
}

.type-pill.weekday {
  color: #4e4d1f;
  background: #f0efcf;
}

.type-pill.holiday {
  color: var(--warn);
  background: #f6e3d7;
}

.entry-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 22px;
}

.check-row {
  min-height: 48px;
  display: flex;
  gap: 10px;
  align-items: center;
  align-self: end;
  padding: 11px 12px;
  border: 1px solid #cbd4cf;
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
}

.check-row input {
  width: 24px;
  height: 24px;
  min-height: 24px;
  accent-color: var(--accent);
}

.entry-preview {
  min-height: 78px;
  display: grid;
  gap: 9px;
  align-content: center;
  padding: 14px;
  border-radius: 8px;
  background: #f7f9f7;
}

.entry-preview strong {
  font-size: 28px;
  line-height: 1;
}

.entry-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.records-panel {
  margin-top: 18px;
  overflow: hidden;
}

.records-list {
  display: grid;
}

.record-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
  border-top: 1px solid #edf0ed;
}

.record-row strong,
.record-row span {
  display: block;
}

.record-row span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.empty-text {
  margin: 0;
  padding: 18px;
  color: var(--muted);
}

.breakdown-panel {
  padding: 20px;
  position: sticky;
  top: 18px;
}

.breakdown-panel h2 {
  margin-bottom: 14px;
}

dl {
  display: grid;
  gap: 12px;
  margin: 0;
}

dl div {
  display: grid;
  gap: 5px;
  padding: 14px;
  border-radius: 8px;
  background: #f7f9f7;
}

dt {
  color: var(--muted);
  font-size: 13px;
}

dd {
  margin: 0;
  font-weight: 800;
}

@media (max-width: 900px) {
  .summary-band,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .controls-band {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .login-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .person-control {
    grid-column: 1 / -1;
  }

  .breakdown-panel {
    position: static;
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 10px;
  }

  .summary-band {
    padding: 22px;
  }

  .controls-band {
    grid-template-columns: 1fr;
  }

  .login-form {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .person-control {
    grid-column: auto;
    grid-template-columns: 1fr;
  }

  .content-grid {
    gap: 14px;
  }

  .entry-form {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .entry-actions {
    grid-template-columns: 1fr;
  }

  .record-row {
    grid-template-columns: 1fr;
  }

  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .secondary-button {
    width: 100%;
  }
}
