:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-soft: #eef2ef;
  --ink: #17211d;
  --muted: #68736d;
  --line: #dce2de;
  --blue: #246b9b;
  --blue-soft: #e3eef5;
  --green: #247a5b;
  --green-soft: #e4f2eb;
  --amber: #9a6a16;
  --amber-soft: #f5ecd8;
  --red: #b54842;
  --red-soft: #f7e4e2;
  --shadow: 0 14px 40px rgba(23, 33, 29, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(36, 107, 155, 0.22);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px clamp(16px, 4vw, 44px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar h1,
.panel h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(22px, 3vw, 34px);
}

.topbar-actions,
.panel-actions,
.date-controls,
.segmented {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button,
.text-button,
.view-tab {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  font-size: 22px;
  line-height: 1;
}

.icon-button:hover,
.text-button:hover,
.view-tab:hover {
  border-color: #aeb8b1;
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.danger {
  color: var(--red);
}

.workspace {
  width: min(1180px, calc(100% - 28px));
  margin: 20px auto 48px;
}

.control-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.period-center {
  min-width: min(370px, 54vw);
}

#periodControls .date-controls {
  width: 100%;
  justify-content: center;
}

#periodControls .period-center {
  display: grid;
  justify-items: center;
}

.period-center input,
.period-center select {
  width: 180px;
  max-width: 100%;
  text-align: center;
}

.period-center select {
  text-align-last: center;
}

.period-picker-button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 20px;
  align-items: center;
  gap: 8px;
  width: 260px;
  max-width: 100%;
  height: 44px;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}

#periodPickerValue {
  min-width: 0;
  overflow: hidden;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.period-picker-current {
  width: 100%;
  margin-top: 12px;
}

.period-picker-button:hover {
  border-color: #aeb8b1;
  background: var(--surface-soft);
}

.period-picker-button:focus-visible {
  border-color: var(--blue);
  outline: 3px solid rgba(36, 107, 155, 0.14);
}

.period-center input::-webkit-date-and-time-value,
.period-center input::-webkit-datetime-edit {
  display: block;
  text-align: center;
}

.week-picker-control {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 20px;
  align-items: center;
  gap: 8px;
  width: 260px;
  max-width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--ink);
  text-align: center;
}

.week-picker-control[hidden] {
  display: none;
}

.week-picker-control:focus-within {
  border-color: var(--blue);
  outline: 3px solid rgba(36, 107, 155, 0.14);
}

.week-picker-control input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  min-height: 0;
  opacity: 0;
  cursor: pointer;
}

.calendar-mark {
  position: relative;
  width: 17px;
  height: 16px;
  border: 2px solid var(--muted);
  border-radius: 3px;
}

.calendar-mark::before {
  content: "";
  position: absolute;
  top: 3px;
  right: -2px;
  left: -2px;
  border-top: 2px solid var(--muted);
}

.period-center p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #fbfcfb;
  color: var(--ink);
}

.plan-period-host .control-strip {
  box-shadow: none;
  background: var(--surface-soft);
}

input:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(36, 107, 155, 0.14);
}

input:disabled {
  background: var(--surface-soft);
  color: var(--muted);
  cursor: not-allowed;
}

.segmented {
  padding: 4px;
  background: var(--surface-soft);
  border-radius: 8px;
}

.view-tab {
  min-width: 48px;
  min-height: 38px;
  border-radius: 7px;
  font-weight: 700;
}

.view-tab.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #ffffff;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric-tile {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric-tile span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.metric-tile strong {
  display: block;
  margin-top: 8px;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.1;
}

.accent-blue {
  border-top: 4px solid var(--blue);
}

.accent-green {
  border-top: 4px solid var(--green);
}

.accent-amber {
  border-top: 4px solid var(--amber);
}

.accent-red {
  border-top: 4px solid var(--red);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.8fr);
  gap: 16px;
  margin-bottom: 16px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.input-panel,
.plan-panel,
.report-panel {
  padding: 18px;
}

.input-panel {
  margin-bottom: 16px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel h2 {
  font-size: 20px;
}

.text-button {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 700;
}

.text-button.primary {
  background: var(--green);
  border-color: var(--green);
  color: #ffffff;
}

.text-button.muted {
  color: var(--muted);
}

.text-button.danger {
  background: var(--red-soft);
}

.service-picker-block,
.work-session-field {
  margin-bottom: 16px;
}

.field-section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.field-section-heading strong,
.field-section-heading span {
  display: block;
}

.field-section-heading strong {
  font-size: 14px;
}

.field-section-heading span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.service-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 10px;
}

.service-card {
  position: relative;
  min-width: 0;
}

.service-select {
  width: 100%;
  height: 100%;
  min-height: 76px;
  padding: 13px 46px 13px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  color: var(--ink);
  text-align: left;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.service-select:hover {
  border-color: #aeb8b1;
  transform: translateY(-1px);
}

.service-select.has-value {
  border-color: rgba(36, 122, 91, 0.48);
  background: var(--green-soft);
}

.provider-edit-button {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(42, 111, 151, 0.22);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--blue);
  font-size: 17px;
  font-weight: 900;
  cursor: pointer;
}

.provider-edit-button:hover {
  border-color: rgba(42, 111, 151, 0.5);
  background: var(--blue-soft);
}

.service-name {
  display: inline-block;
  margin-bottom: 9px;
  font-weight: 800;
}

.service-icon,
.summary-service-icon {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-right: 8px;
  border-radius: 9px;
  background: var(--ink);
  color: white;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
  vertical-align: middle;
}

.add-provider-button {
  width: 100%;
  min-height: 44px;
  margin-top: 10px;
  border: 1px dashed rgba(42, 111, 151, 0.38);
  border-radius: 12px;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 800;
  cursor: pointer;
}

.provider-fields {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
}

.provider-fields input {
  width: 100%;
}

.odometer-hint {
  display: block;
  margin-top: 6px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.45;
}

.odometer-hint.error {
  color: var(--red);
}

.service-values {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.service-values strong:last-child {
  color: var(--ink);
}

.work-session-list {
  display: grid;
  gap: 8px;
}

.work-session-row {
  display: grid;
  grid-template-columns: auto minmax(130px, 1fr) minmax(130px, 1fr) 40px;
  gap: 10px;
  align-items: end;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.session-number {
  align-self: center;
  min-width: 68px;
  font-size: 13px;
}

.session-time-field {
  min-width: 0;
}

.session-time-field input[type="time"] {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  font-size: 16px;
}

.session-remove,
.dialog-close {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--red);
  font-size: 22px;
  line-height: 1;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.memo-field {
  grid-column: span 3;
}

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

.daily-calc {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.daily-calc div,
.plan-list div,
.summary-tile,
.service-summary,
.day-line,
.month-line {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.daily-calc div {
  padding: 12px;
}

.daily-calc span,
.summary-tile span,
.service-summary span,
.day-line span,
.month-line span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.daily-calc strong,
.summary-tile strong,
.service-summary strong,
.day-line strong,
.month-line strong {
  display: block;
  margin-top: 5px;
}

.target-input {
  margin-bottom: 16px;
}

.progress-block {
  margin-bottom: 12px;
}

.progress-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.progress-track {
  height: 12px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: var(--green);
  transition: width 0.2s ease;
}

.plan-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.plan-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
}

.plan-list dt {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.plan-list dd {
  margin: 0;
  font-weight: 800;
  text-align: right;
}

.report-view {
  display: none;
}

.report-view.active {
  display: block;
}

.time-analysis-panel {
  margin: 14px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.time-analysis-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.time-analysis-heading h3,
.time-analysis-heading p,
.time-analysis-note,
.time-analysis-insight {
  margin: 0;
}

.time-analysis-heading h3 {
  font-size: 17px;
}

.time-analysis-heading > div > p,
.time-analysis-note {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.time-analysis-insight {
  flex: 0 0 auto;
  padding: 8px 11px;
  border-radius: 10px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

.time-analysis-list {
  display: grid;
  gap: 9px;
}

.time-analysis-row {
  display: grid;
  grid-template-columns: 112px minmax(80px, 0.7fr) minmax(390px, 2.3fr);
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.time-band-label strong,
.time-band-label span {
  display: block;
}

.time-band-label strong {
  font-size: 14px;
}

.time-band-label span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.time-band-label .time-analysis-sample-note {
  display: inline-block;
  margin-top: 7px;
  padding: 3px 6px;
  border-radius: 999px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 10px;
  font-weight: 800;
}

.time-analysis-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(22, 116, 87, 0.11);
}

.time-analysis-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.time-analysis-row dl {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.time-analysis-row dl div {
  min-width: 0;
}

.time-analysis-row dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.time-analysis-row dd {
  margin: 4px 0 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.time-analysis-row .time-analysis-hourly {
  color: var(--green);
}

.time-analysis-note {
  margin-top: 12px;
}

.time-analysis-empty .empty-state {
  padding: 14px;
}

.summary-grid,
.service-summary-grid,
.day-list,
.month-list {
  display: grid;
  gap: 10px;
}

.summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 14px;
}

.summary-tile,
.service-summary {
  padding: 13px;
}

.service-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 58px;
}

.service-summary > .service-summary-provider {
  display: flex;
  align-items: center;
  min-width: 0;
  margin: 0;
}

.service-summary .service-summary-name {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.service-summary > strong {
  margin: 0;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.service-summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 14px;
}

.day-line,
.month-line {
  display: grid;
  grid-template-columns: 1.1fr repeat(4, minmax(90px, 1fr));
  gap: 10px;
  align-items: center;
  padding: 12px;
}

.empty-state {
  margin: 0;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcfb;
}

.service-dialog {
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(23, 33, 29, 0.25);
}

.service-dialog::backdrop {
  background: rgba(23, 33, 29, 0.48);
  backdrop-filter: blur(2px);
}

.period-picker-dialog {
  width: min(460px, calc(100vw - 24px));
}

.period-picker-navigation {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.period-picker-navigation strong {
  text-align: center;
}

.period-picker-options {
  min-height: 270px;
}

.period-calendar-weekdays,
.period-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 5px;
}

.period-calendar-weekdays {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.period-option,
.period-day-spacer {
  min-width: 0;
  min-height: 42px;
}

.period-option {
  display: grid;
  place-items: center;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.period-option:hover,
.period-option:focus-visible {
  border-color: rgba(22, 116, 87, 0.45);
  background: var(--green-soft);
}

.period-option.is-selected {
  border-color: var(--green);
  background: var(--green);
  color: #ffffff;
}

.period-week-list {
  display: grid;
  gap: 8px;
}

.period-week-option {
  grid-template-columns: minmax(0, 1fr) auto;
  justify-items: start;
  min-height: 48px;
  padding: 10px 13px;
  text-align: left;
}

.period-week-option small {
  color: var(--muted);
  font-size: 11px;
}

.period-week-option.is-selected small {
  color: rgba(255, 255, 255, 0.82);
}

.period-month-grid,
.period-year-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.period-month-grid .period-option,
.period-year-grid .period-option {
  min-height: 52px;
}

.period-picker-hint {
  margin: 14px 0 0;
  text-align: center;
}

.dialog-card {
  padding: 20px;
}

.dialog-heading,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-heading {
  margin-bottom: 18px;
}

.dialog-heading h2 {
  margin: 0;
  font-size: 20px;
}

.dialog-fields {
  display: grid;
  gap: 14px;
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: 20px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: calc(100% - 36px);
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #ffffff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

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

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

  .field-grid,
  .daily-calc,
  .service-summary-grid {
    grid-template-columns: 1fr;
  }

  .memo-field {
    grid-column: auto;
  }

  .day-line,
  .month-line {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .time-analysis-row {
    grid-template-columns: 112px minmax(0, 1fr);
  }

  .time-analysis-row dl {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .topbar,
  .control-strip,
  .panel-heading,
  .field-section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .panel-actions,
  .date-controls,
  .segmented {
    width: 100%;
  }

  .date-controls {
    justify-content: space-between;
  }

  .period-center {
    min-width: 0;
    flex: 1;
  }

  #periodControls .period-picker-button {
    width: 100%;
    min-width: 0;
  }

  .period-center input,
  .period-center select,
  .week-picker-control {
    width: 100%;
  }

  .segmented {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .service-picker {
    grid-template-columns: 1fr;
  }

  .work-session-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 40px;
  }

  .session-number {
    grid-column: 1 / -1;
  }

  .panel-actions {
    flex-wrap: wrap;
  }

  .panel-actions .text-button {
    flex: 1;
  }

  .day-line,
  .month-line {
    grid-template-columns: 1fr;
  }

  .time-analysis-heading {
    flex-direction: column;
    gap: 10px;
  }

  .time-analysis-insight {
    width: 100%;
  }

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

  .time-analysis-row dl {
    grid-column: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 480px) {
  .work-session-row {
    grid-template-columns: minmax(0, 1fr) 40px;
  }

  .work-session-row .session-number {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
  }

  .work-session-row .session-remove {
    grid-column: 2;
    grid-row: 1;
  }

  .work-session-row .session-time-field {
    grid-column: 1 / -1;
  }
}


@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* Modern multi-screen layout */
:root {
  --bg: #f2f5f3;
  --surface: #ffffff;
  --surface-soft: #edf3ef;
  --ink: #14231c;
  --muted: #66756d;
  --line: #d8e2dc;
  --green: #167457;
  --green-soft: #e2f2eb;
  --blue: #276c93;
  --blue-soft: #e5f0f6;
  --amber: #a66a0a;
  --amber-soft: #fff2d6;
  --red: #bd443f;
  --red-soft: #fbe8e6;
  --shadow: 0 12px 34px rgba(20, 35, 28, 0.07);
  --shadow-strong: 0 20px 50px rgba(20, 35, 28, 0.12);
}

[hidden] {
  display: none !important;
}

body {
  background:
    radial-gradient(circle at 12% 0%, rgba(22, 116, 87, 0.08), transparent 28rem),
    var(--bg);
}

.topbar {
  padding: 24px max(20px, calc((100vw - 1180px) / 2));
  border-bottom: 0;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(14px);
}

.brand-copy,
.section-copy,
.screen-heading-panel p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.header-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(22, 116, 87, 0.12);
}

.screen-nav {
  position: relative;
  top: auto;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  width: min(720px, calc(100% - 28px));
  margin: 0 auto;
  padding: 6px;
  border: 1px solid rgba(216, 226, 220, 0.88);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

/* Tax estimate */
.tax-screen {
  display: grid;
  gap: 14px;
}

.tax-heading-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.tax-year-control {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.tax-year-control select {
  min-width: 116px;
}

.tax-notice {
  padding: 14px 18px;
  border: 1px solid color-mix(in srgb, var(--amber) 32%, var(--line));
  border-radius: 15px;
  background: var(--amber-soft);
  color: var(--ink);
}

.tax-notice strong,
.tax-notice p {
  display: block;
}

.tax-notice p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.tax-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.tax-overview-grid article {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.tax-overview-grid span,
.tax-overview-grid strong {
  display: block;
}

.tax-overview-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tax-overview-grid strong {
  margin-top: 7px;
  font-size: clamp(20px, 4vw, 28px);
}

.tax-overview-profit {
  background: linear-gradient(145deg, var(--green-soft), var(--surface)) !important;
}

.tax-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(300px, 0.88fr);
  gap: 14px;
  align-items: start;
}

.tax-input-panel,
.tax-result-panel,
.tax-schedule-panel,
.tax-consumption-panel {
  padding: clamp(18px, 3vw, 26px);
}

.tax-input-panel .panel-heading p,
.tax-result-panel .panel-heading p,
.tax-schedule-panel .panel-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.tax-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 14px;
  margin-top: 18px;
}

.tax-field-grid > label {
  display: grid;
  align-content: start;
  gap: 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.tax-field-grid > label small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
}

.money-input {
  display: flex;
  align-items: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.money-input:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 14%, transparent);
}

.money-input > span {
  padding-left: 13px;
  color: var(--muted);
  font-weight: 800;
}

.money-input input {
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none !important;
}

.tax-switches {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

.tax-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
}

.tax-switch-row span,
.tax-switch-row strong,
.tax-switch-row small {
  display: block;
}

.tax-switch-row strong {
  font-size: 13px;
}

.tax-switch-row small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
}

.tax-switch-row input {
  flex: 0 0 auto;
  width: 22px;
  min-height: 22px;
  accent-color: var(--blue);
}

.tax-result-panel {
  position: sticky;
  top: 14px;
}

.tax-total-card {
  margin-top: 16px;
  padding: 20px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--blue), var(--violet, var(--green)));
  color: #ffffff;
  box-shadow: 0 14px 30px color-mix(in srgb, var(--blue) 22%, transparent);
}

.tax-total-card span,
.tax-total-card strong,
.tax-total-card small {
  display: block;
}

.tax-total-card span {
  font-size: 12px;
  font-weight: 800;
  opacity: 0.82;
}

.tax-total-card strong {
  margin-top: 7px;
  font-size: clamp(28px, 5vw, 40px);
  letter-spacing: -0.03em;
}

.tax-total-card small {
  margin-top: 7px;
  font-weight: 700;
  opacity: 0.88;
}

.tax-filing-status {
  margin: 12px 0 0;
  padding: 11px 13px;
  border-radius: 11px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.55;
}

.tax-filing-status.needs-filing {
  background: var(--amber-soft);
  color: var(--amber);
}

.tax-result-list {
  display: grid;
  gap: 0;
  margin: 16px 0 0;
}

.tax-result-list > div,
.tax-calculation-details dl > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 2px;
  border-bottom: 1px solid var(--line);
}

.tax-result-list dt,
.tax-calculation-details dt {
  color: var(--muted);
  font-size: 12px;
}

.tax-result-list dd,
.tax-calculation-details dd {
  margin: 0;
  font-weight: 800;
}

.tax-result-emphasis {
  margin-top: 5px;
  padding: 13px 10px !important;
  border: 0 !important;
  border-radius: 11px;
  background: var(--blue-soft);
}

.tax-result-emphasis dd {
  color: var(--blue);
  font-size: 19px;
}

.tax-refund-message {
  margin: 12px 0 0;
  padding: 11px 13px;
  border-radius: 11px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

.tax-calculation-details {
  margin-top: 14px;
}

.tax-calculation-details summary {
  cursor: pointer;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.tax-calculation-details dl {
  margin: 8px 0 0;
}

.tax-schedule {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.tax-schedule li {
  display: flex;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.tax-schedule li > span {
  flex: 0 0 auto;
  align-self: flex-start;
  padding: 5px 8px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 10px;
  font-weight: 900;
}

.tax-schedule strong,
.tax-schedule p {
  display: block;
}

.tax-schedule strong {
  font-size: 13px;
}

.tax-schedule p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.tax-consumption-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.55fr);
  gap: 18px;
}

.tax-consumption-panel h2 {
  font-size: 18px;
}

.tax-consumption-panel p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.tax-consumption-panel p strong {
  color: var(--ink);
}

.tax-source-note {
  align-self: center;
  padding-left: 18px;
  border-left: 1px solid var(--line);
}

.tax-source-note a {
  color: var(--blue);
  font-weight: 800;
}

@media (max-width: 820px) {
  .tax-layout,
  .tax-consumption-panel {
    grid-template-columns: 1fr;
  }

  .tax-result-panel {
    position: static;
  }

  .tax-source-note {
    padding: 14px 0 0;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 620px) {
  .screen-tab {
    padding-right: 2px;
    padding-left: 2px;
    font-size: 10px;
  }

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

  .tax-year-control {
    justify-content: space-between;
  }

  .tax-overview-grid {
    grid-template-columns: 1fr;
  }

  .tax-overview-grid article {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px;
  }

  .tax-overview-grid strong {
    margin-top: 0;
    font-size: 20px;
  }

  .tax-field-grid,
  .tax-schedule {
    grid-template-columns: 1fr;
  }

  .tax-input-panel,
  .tax-result-panel,
  .tax-schedule-panel,
  .tax-consumption-panel {
    padding: 15px;
  }
}

.screen-tab {
  min-height: 48px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.screen-tab.active {
  background: var(--ink);
  color: #ffffff;
  box-shadow: 0 6px 18px rgba(20, 35, 28, 0.16);
}

.screen-tab-icon {
  margin-right: 5px;
}

.workspace {
  margin-top: 16px;
}

.control-strip,
.panel,
.screen-heading-panel {
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.control-strip {
  position: relative;
  z-index: 2;
  padding: 14px;
}

.today-button {
  white-space: nowrap;
}

.app-screen {
  animation: screen-in 0.2s ease both;
}

@keyframes screen-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.input-panel,
.plan-panel,
.report-panel,
.data-management {
  padding: clamp(18px, 3vw, 28px);
}

.input-panel {
  margin-bottom: 0;
}

.input-heading {
  margin-bottom: 14px;
}

.record-action-dock {
  position: static;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 22px -8px 0;
  padding: 10px;
  border: 1px solid rgba(216, 226, 220, 0.9);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 8px 26px rgba(20, 35, 28, 0.1);
  backdrop-filter: blur(12px);
}

.record-action-buttons {
  display: flex;
  gap: 8px;
}

.save-button {
  min-width: 180px;
}

.save-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.save-status::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.save-status.saved { color: var(--green); }
.save-status.dirty { color: var(--amber); }
.save-status.saving { color: var(--blue); }
.save-status.error { color: var(--red); }

.daily-calc {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin: 0 0 22px;
}

.daily-calc div {
  min-width: 0;
  border: 0;
  background: var(--surface-soft);
}

.daily-calc strong {
  font-size: 18px;
}

.input-section {
  margin: 0;
  padding: 22px 0;
  border-top: 1px solid var(--line);
}

.field-section-heading {
  align-items: center;
  margin-bottom: 14px;
}

.section-step {
  float: left;
  display: inline-grid !important;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--ink);
  color: #ffffff !important;
  font-size: 12px !important;
  line-height: 1;
}

.field-section-heading strong {
  min-height: 24px;
  font-size: 16px;
  line-height: 24px;
}

.field-section-heading div > span:last-child:not(.section-step) {
  clear: both;
  padding-top: 2px;
}

.service-select,
.work-session-row,
.expense-total-row,
.expense-item,
.advanced-inputs {
  border-radius: 14px;
}

.service-select {
  min-height: 88px;
  padding: 15px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.service-select.has-value {
  border-color: rgba(22, 116, 87, 0.38);
  background: linear-gradient(145deg, var(--green-soft), #f5fbf8);
}

.work-session-row {
  padding: 14px;
}

.expense-add-button {
  border: 1px solid rgba(22, 116, 87, 0.28);
  background: var(--green-soft);
  color: var(--green);
  font-weight: 800;
}

.expense-total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
  padding: 12px 14px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.expense-total-row strong {
  color: var(--ink);
  font-size: 18px;
}

.expense-list {
  display: grid;
  gap: 8px;
}

.expense-empty {
  margin: 0;
  padding: 15px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  color: var(--muted);
  background: #fbfcfb;
  font-size: 13px;
  text-align: center;
}

.expense-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto 16px;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 64px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  text-align: left;
}

.expense-item:hover {
  border-color: rgba(22, 116, 87, 0.38);
  background: #fbfdfc;
}

.expense-kind {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 900;
}

.expense-kind.gas {
  background: var(--blue-soft);
  color: var(--blue);
}

.expense-kind.other {
  background: var(--amber-soft);
  color: var(--amber);
}

.expense-item-copy {
  min-width: 0;
}

.expense-item-copy strong,
.expense-item-copy small {
  display: block;
}

.expense-item-copy small {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.expense-item-amount {
  white-space: nowrap;
}

.expense-item-arrow {
  color: var(--muted);
  font-size: 22px;
}

.compact-fields {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.compact-fields .memo-field {
  grid-column: auto;
}

.advanced-inputs {
  margin-top: 12px;
  border: 1px solid var(--line);
  background: #fbfcfb;
}

.advanced-inputs summary,
.data-management summary {
  padding: 14px 16px;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.advanced-field-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 0 14px 14px;
}

.imported-hours-note {
  margin: -4px 14px 14px;
  color: var(--amber);
  font-size: 0.82rem;
  line-height: 1.55;
}

.source-data-summary {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 12px;
  padding: 11px 13px;
  border: 1px solid rgba(42, 111, 151, 0.16);
  border-radius: 12px;
  background: var(--blue-soft);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.source-data-summary strong {
  flex: 0 0 auto;
  color: var(--blue);
}

.chart-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 14px;
  margin: 16px 0;
}

.chart-panel {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.chart-panel h3 {
  margin: 0 0 14px;
  font-size: 15px;
}

.chart-note {
  margin: -7px 0 12px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: -6px 0 12px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.legend-current {
  background: var(--blue);
}

.legend-previous {
  background: #a9b5c1;
}

.chart-scroll {
  overflow-x: auto;
  padding-bottom: 4px;
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(12, minmax(44px, 1fr));
  gap: 7px;
  min-width: 620px;
  height: 210px;
}

.bar-chart--days {
  grid-template-columns: repeat(31, minmax(44px, 1fr));
  min-width: 1440px;
}

.bar-chart--weeks {
  grid-template-columns: repeat(53, minmax(70px, 1fr));
  min-width: 4020px;
}

.bar-chart--years {
  grid-template-columns: repeat(8, minmax(58px, 1fr));
  min-width: 500px;
}

.comparison-chart {
  grid-template-columns: repeat(12, minmax(52px, 1fr));
  min-width: 720px;
}

.bar-item {
  display: grid;
  grid-template-rows: 22px 1fr 22px;
  gap: 5px;
  min-width: 0;
  text-align: center;
}

.bar-item-button {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.bar-item-button:hover .bar-fill {
  filter: brightness(0.94) saturate(1.12);
}

.bar-item-button:focus-visible {
  outline: none;
}

.bar-item-button:focus-visible .bar-track {
  outline: 3px solid rgba(42, 111, 151, 0.28);
  outline-offset: 2px;
}

.bar-value {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  border-radius: 8px 8px 4px 4px;
  background: var(--surface-soft);
}

.bar-fill {
  width: 100%;
  min-height: 0;
  border-radius: 8px 8px 3px 3px;
  background: linear-gradient(180deg, var(--blue), var(--green));
}

.bar-item.is-selected .bar-track {
  outline: 3px solid rgba(42, 111, 151, 0.24);
  outline-offset: 2px;
}

.bar-item.is-selected strong {
  color: var(--blue);
}

.comparison-track {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  overflow: hidden;
  padding: 0 3px;
  border-radius: 8px 8px 4px 4px;
  background: var(--surface-soft);
}

.comparison-track .bar-fill {
  flex: 1 1 50%;
  width: auto;
}

.comparison-current {
  background: linear-gradient(180deg, var(--blue), var(--green));
}

.comparison-previous {
  background: #a9b5c1;
}

.bar-item strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.screen-heading-panel h2 {
  margin: 0;
}

.plan-panel {
  width: min(720px, 100%);
  margin: 0 auto 16px;
}

.plan-panel .target-input input {
  min-height: 54px;
  font-size: 22px;
  font-weight: 800;
}

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

.plan-list div {
  min-height: 62px;
  align-items: center;
  border: 0;
  background: var(--surface-soft);
}

.data-management {
  width: min(720px, 100%);
  margin: 0 auto;
}

.data-management > p {
  margin: 0 16px 14px;
  color: var(--muted);
  font-size: 13px;
}

.data-management-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 16px;
}

.file-text-button {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.file-text-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.expense-type-fieldset {
  min-width: 0;
  margin: 0 0 16px;
  padding: 0;
  border: 0;
}

.expense-type-fieldset legend {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.expense-type-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.expense-type-option {
  position: relative;
  display: block;
  cursor: pointer;
}

.expense-type-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.expense-type-option span {
  display: grid;
  place-items: center;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfb;
  color: var(--muted);
  font-weight: 800;
}

.expense-type-option input:checked + span {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green);
  box-shadow: inset 0 0 0 1px var(--green);
}

.expense-type-option input:focus-visible + span {
  outline: 3px solid rgba(36, 107, 155, 0.22);
  outline-offset: 2px;
}

.field-note {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.expense-dialog-actions {
  flex-wrap: wrap;
}

.dialog-action-spacer {
  flex: 1;
}

.expense-report-block {
  margin-top: 14px;
}

.expense-report-block h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.expense-report-list {
  display: grid;
  gap: 7px;
}

.expense-report-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 13px;
  border-radius: 10px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 13px;
}

.expense-report-item strong {
  color: var(--ink);
  white-space: nowrap;
}

@media (max-width: 900px) {
  .daily-calc {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .plan-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  body {
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }

  .topbar {
    padding: 16px;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .brand-copy,
  .header-status {
    display: none;
  }

  .screen-nav {
    position: fixed;
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 50;
    width: 100%;
    margin: 0;
    padding: 7px 10px calc(7px + env(safe-area-inset-bottom));
    border-width: 1px 0 0;
    border-radius: 0;
    box-shadow: 0 -10px 30px rgba(20, 35, 28, 0.12);
  }

  .screen-tab {
    min-height: 54px;
    font-size: 12px;
  }

  .screen-tab-icon {
    display: block;
    margin: 0 0 2px;
    font-size: 17px;
  }

  .workspace {
    width: min(100% - 20px, 1180px);
    margin-top: 10px;
  }

  .control-strip {
    gap: 10px;
    padding: 10px;
  }

  .today-button {
    width: 100%;
  }

  .input-panel,
  .plan-panel,
  .report-panel,
  .data-management {
    padding: 15px;
  }

  .record-action-dock {
    align-items: stretch;
    margin: 20px -6px 0;
    padding: 8px;
  }

  .save-status {
    align-self: center;
  }

  .record-action-buttons {
    flex: 1;
    justify-content: flex-end;
  }

  .record-action-buttons .text-button {
    flex: 0 1 auto;
  }

  .record-action-buttons .danger {
    flex: 0 0 auto;
    padding-inline: 10px;
    white-space: nowrap;
  }

  .save-button {
    min-width: 0;
    padding-inline: 10px;
    font-size: 13px;
  }

  .daily-calc,
  .metrics-grid,
  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .daily-calc div {
    padding: 11px;
  }

  .service-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .service-select {
    min-height: 90px;
    padding: 10px 42px 10px 10px;
  }

  .provider-edit-button {
    top: 5px;
    right: 5px;
    width: 38px;
    height: 38px;
  }

  .service-name {
    font-size: 13px;
  }

  .service-values {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .provider-fields {
    grid-template-columns: 74px 1fr;
  }

  .chart-grid {
    grid-template-columns: 1fr;
  }

  .chart-panel {
    padding: 14px 10px;
  }

  .field-section-heading {
    align-items: stretch;
  }

  .field-section-heading > .text-button {
    width: 100%;
  }

  .compact-fields,
  .advanced-field-grid {
    grid-template-columns: 1fr;
  }

  .expense-item {
    grid-template-columns: 36px minmax(0, 1fr) auto 12px;
    gap: 8px;
  }

  .expense-item-amount {
    font-size: 13px;
  }

  .screen-heading-panel {
    align-items: stretch;
    flex-direction: column;
    padding: 15px;
  }

  .screen-heading-panel .segmented {
    width: 100%;
  }

  input {
    min-height: 46px;
    font-size: 16px;
  }

  .service-dialog {
    width: 100%;
    max-width: none;
    max-height: 88dvh;
    margin: auto 0 0;
    border-radius: 20px 20px 0 0;
  }

  .dialog-card {
    padding: 20px 16px calc(18px + env(safe-area-inset-bottom));
  }

  .dialog-actions .text-button {
    min-height: 44px;
  }

  .toast {
    right: 10px;
    bottom: calc(82px + env(safe-area-inset-bottom));
    left: 10px;
    max-width: none;
    text-align: center;
  }
}

.settings-panel,
.local-data-panel {
  width: min(760px, 100%);
  margin: 0 auto 16px;
  padding: clamp(18px, 3vw, 28px);
}

.settings-section + .settings-section {
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.settings-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.settings-section-heading h3,
.local-data-panel h2 {
  margin: 0;
}

.settings-section-heading p,
.local-data-panel > p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.settings-list {
  display: grid;
  gap: 8px;
}

.settings-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  min-height: 64px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.settings-item-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--ink);
  color: #ffffff;
  font-size: 13px;
  font-weight: 900;
}

.settings-item-icon.vehicle-icon {
  background: var(--surface);
  color: var(--ink);
  font-size: 21px;
}

.settings-item-copy {
  min-width: 0;
}

.settings-item-copy strong,
.settings-item-copy span {
  display: block;
}

.settings-item-copy span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.visibility-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.visibility-toggle input {
  width: 20px;
  min-height: 20px;
  accent-color: var(--blue);
}

.settings-edit-button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #cfd9de;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
}

.settings-empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 18px;
  border: 1px dashed #cfd9de;
  border-radius: 14px;
  color: var(--muted);
  text-align: center;
}

.local-data-panel h2 {
  font-size: 20px;
}

.local-data-panel .data-management-actions {
  margin-top: 16px;
}

@media (max-width: 620px) {
  .settings-panel,
  .local-data-panel {
    padding: 15px;
  }

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

  .settings-section-heading .text-button {
    width: 100%;
  }

  .settings-item {
    grid-template-columns: 38px minmax(0, 1fr) auto;
  }

  .visibility-toggle {
    grid-column: 2;
  }

  .settings-edit-button {
    grid-column: 3;
    grid-row: 1 / span 2;
  }
}
