.history-future-sep {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 18px 0 0 0;
  padding: 0;
  border-top: 2px dashed var(--accent);
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  background: transparent;
}

.history-future-sep span {
  background: var(--surface);
  padding: 0 16px;
  position: relative;
  top: -0.7em;
}

:root {
  --bg: #f4efe6;
  --surface: rgba(255, 252, 247, 0.92);
  --surface-strong: #fffdfa;
  --border: rgba(105, 84, 57, 0.18);
  --border-strong: rgba(105, 84, 57, 0.3);
  --text: #261d16;
  --text-muted: #7a6a5b;
  --accent: #1f6a52;
  --accent-strong: #154d3d;
  --accent-soft: #ddede7;
  --accent-soft-2: #c6e1d7;
  --warn: #c1781f;
  --danger: #bb4337;
  --shadow: 0 10px 24px rgba(71, 53, 35, 0.08);
  --radius-lg: 28px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --mono: "JetBrains Mono", "Consolas", monospace;
  --sans: "BIZ UDPGothic", "Hiragino Sans", "Noto Sans JP", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

button,
input,
select {
  font: inherit;
}

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  backdrop-filter: blur(16px);
  background: rgba(38, 29, 22, 0.88);
  color: #fff7ef;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-right.is-hidden {
  display: none;
}

.header-title {
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: 0.03em;
}

.file-badge {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-family: var(--mono);
  color: rgba(255, 247, 239, 0.82);
  background: rgba(255, 255, 255, 0.04);
}

.sep {
  width: 1px;
  height: 22px;
  background: rgba(255, 255, 255, 0.14);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-hdr {
  color: rgba(255, 247, 239, 0.92);
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
}

.btn-hdr:hover {
  background: rgba(255, 255, 255, 0.14);
}

.btn-icon {
  padding-inline: 14px;
  color: rgba(255, 247, 239, 0.92);
  background: rgba(255, 255, 255, 0.07);
}

.btn-primary {
  color: #fdfaf5;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  box-shadow: 0 3px 8px rgba(38, 29, 22, 0.22);
}

.btn-primary:hover {
  filter: brightness(1.05);
}

.btn-secondary {
  color: var(--text);
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.7);
}

.btn-secondary:hover {
  border-color: var(--border-strong);
  background: #fff;
}

.btn-big {
  min-width: 148px;
}

.btn-row {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: transparent;
}

.btn-row-edit {
  color: var(--accent);
  border-color: rgba(31, 106, 82, 0.15);
}

.btn-row-del {
  color: var(--danger);
  border-color: rgba(187, 67, 55, 0.15);
}

.no-file-screen,
.main {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.no-file-screen {
  padding: 40px 0 52px;
}

.empty-hero,
.hero-card,
.card,
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.empty-hero {
  padding: 42px;
  text-align: left;
}

.empty-hero h2 {
  margin-top: 10px;
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.15;
}

.empty-hero p:last-of-type {
  max-width: 720px;
  margin-top: 14px;
  color: var(--text-muted);
  font-size: 15px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.restore-inline {
  margin-top: 18px;
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 12px;
}

.main {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 28px 0 48px;
}

.hero-card {
  padding: 28px;
  overflow: hidden;
  position: relative;
}

.hero-copy {
  max-width: 640px;
  margin-bottom: 24px;
}

.hero-copy h2 {
  margin-top: 10px;
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.2;
}

.hero-copy p:last-child {
  margin-top: 10px;
  color: var(--text-muted);
}

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

.sum-item {
  padding: 20px;
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  border: 1px solid rgba(105, 84, 57, 0.08);
}

.sum-label {
  font-size: 12px;
  color: var(--text-muted);
}

.sum-val {
  margin-top: 10px;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1;
  font-weight: 700;
  color: var(--accent);
  font-family: var(--mono);
}

.sum-val.is-warn {
  color: var(--warn);
}

.sum-val.is-danger {
  color: var(--danger);
}

.sum-unit {
  margin-left: 4px;
  font-size: 13px;
  color: var(--text-muted);
  font-family: var(--sans);
}

.gauge-panel {
  margin-top: 20px;
  padding: 18px 20px 20px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(105, 84, 57, 0.08);
}

.section-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.section-title {
  font-weight: 700;
}

.section-note {
  font-size: 12px;
  color: var(--text-muted);
}

.gauge-wrap {
  overflow: hidden;
  border-radius: 999px;
}

.gauge-bar {
  display: flex;
  min-height: 32px;
  background: #ece4d8;
}

.gauge-taken,
.gauge-rest {
  display: flex;
  align-items: center;
  min-width: 0;
}

.gauge-taken {
  justify-content: flex-end;
  background: linear-gradient(90deg, var(--accent) 0%, #2e8668 100%);
  transition: width 0.35s ease;
}

.gauge-taken.is-warn {
  background: linear-gradient(90deg, var(--warn) 0%, #d98e2b 100%);
}

.gauge-taken.is-danger {
  background: linear-gradient(90deg, var(--danger) 0%, #d55e52 100%);
}

.gauge-rest {
  flex: 1;
}

.gauge-lbl {
  padding: 0 12px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gauge-taken .gauge-lbl {
  color: rgba(255, 255, 255, 0.96);
  font-family: var(--mono);
}

.gauge-lbl-rest {
  color: var(--text-muted);
}

.card {
  overflow: hidden;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px 16px;
  border-bottom: 1px solid rgba(105, 84, 57, 0.1);
}

.card-kicker {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.card-title {
  display: inline-block;
  margin-top: 4px;
  font-size: 20px;
  font-weight: 700;
}

.card-body {
  padding: 22px 24px 24px;
}

.edit-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid rgba(31, 106, 82, 0.18);
  border-radius: 16px;
  background: rgba(31, 106, 82, 0.08);
}

.edit-banner strong {
  display: block;
  margin-bottom: 2px;
  font-size: 14px;
}

.edit-banner span {
  font-size: 12px;
  color: var(--text-muted);
}

.card.is-editing {
  border-color: rgba(31, 106, 82, 0.35);
  box-shadow: 0 24px 52px rgba(31, 106, 82, 0.14);
}

.hint,
.table-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.month-chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(42px, 1fr));
  gap: 10px;
  align-items: end;
  min-height: 170px;
  padding-top: 18px;
}

.mc-col {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: end;
  min-height: 140px;
}

.mc-bar {
  width: 100%;
  min-height: 6px;
  border-radius: 14px 14px 6px 6px;
  background: #e8dfd2;
}

.mc-bar.mc-data {
  background: linear-gradient(180deg, var(--accent-soft-2) 0%, #8cbca7 100%);
}

.mc-bar.mc-current {
  background: linear-gradient(180deg, #f1c680 0%, var(--warn) 100%);
}

.mc-val {
  position: absolute;
  top: 0;
  transform: translateY(-10px);
  font-size: 10px;
  font-family: var(--mono);
  color: var(--accent);
}

.mc-val.mc-current,
.mc-month.mc-current {
  color: var(--warn);
}

.mc-month {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.mc-empty {
  grid-column: 1 / -1;
  padding: 40px 0;
  text-align: center;
  color: var(--text-muted);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

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

.fg {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fg label {
  font-size: 12px;
  color: var(--text-muted);
}

.fg input,
.fg select,
.fg textarea {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid rgba(105, 84, 57, 0.16);
  background: rgba(255, 255, 255, 0.82);
  color: var(--text);
}

.fg input:focus,
.fg select:focus,
.fg textarea:focus {
  outline: none;
  border-color: rgba(31, 106, 82, 0.55);
  box-shadow: 0 0 0 4px rgba(31, 106, 82, 0.08);
}

.fg input:disabled {
  background: rgba(237, 230, 220, 0.75);
  color: rgba(38, 29, 22, 0.45);
}

.fg textarea {
  min-height: 92px;
  padding-block: 12px;
  resize: vertical;
}

.fg-submit {
  justify-content: end;
}

.fg-note {
  margin-top: 14px;
}

.form-err {
  min-height: 22px;
  margin-top: 10px;
  color: var(--danger);
  font-size: 13px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.check-row input {
  width: 18px;
  height: 18px;
}

.history-wrap {
  padding: 0 18px 16px;
  --history-cols: minmax(9.5rem, 2.2fr) minmax(4.5rem, 1fr) minmax(5.5rem, 1fr) minmax(6.5rem, 1.2fr) minmax(9rem, 1.5fr);
}

.history-head,
.history-main {
  display: grid;
  grid-template-columns: var(--history-cols);
  align-items: center;
  column-gap: 18px;
}

.history-head {
  padding: 14px 6px 12px;
  border-bottom: 1px solid rgba(105, 84, 57, 0.1);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
}

.history-head>span:nth-child(1) {
  justify-self: start;
  text-align: left;
}

.history-head>span:nth-child(2) {
  justify-self: center;
  text-align: center;
}

.history-head>span:nth-child(3) {
  justify-self: center;
  text-align: center;
}

.history-head>span:nth-child(4) {
  justify-self: center;
  text-align: center;
}

.history-head>span:nth-child(5) {
  justify-self: end;
  text-align: right;
  padding-right: 10px;
}

.history-list {
  display: flex;
  flex-direction: column;
}

.history-row {
  padding: 14px 6px 12px;
  border-bottom: 1px solid rgba(105, 84, 57, 0.08);
}

.history-row:last-child {
  border-bottom: none;
}

.history-row:hover {
  background: rgba(31, 106, 82, 0.04);
}

.history-row.is-editing-row {
  background: rgba(31, 106, 82, 0.08);
}

.mono,
.num {
  font-family: var(--mono);
}

.table-cell-date {
  display: flex;
  align-items: center;
}

.table-cell-date>span,
.table-cell-date>small {
  white-space: nowrap;
}

.history-cell {
  min-width: 0;
}

.history-date {
  justify-self: start;
  text-align: left;
}

.history-type {
  justify-self: center;
  text-align: center;
}

.history-label {
  display: none;
}

.history-hours {
  justify-self: center;
  text-align: center;
}

.history-time-range {
  justify-self: center;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

.history-actions {
  display: inline-flex;
  justify-self: end;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.history-note-row {
  margin-top: 4px;
  padding-left: 0;
}

.history-note-label {
  display: inline-block;
  margin-right: 8px;
  color: var(--text-muted);
  font-size: 11px;
}

.history-note-text {
  display: inline;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

.note-indicator {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.note-indicator-inline {
  justify-self: start;
}

.note-trigger {
  border: 1px solid rgba(31, 106, 82, 0.12);
  border-radius: 999px;
  background: rgba(31, 106, 82, 0.06);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  cursor: help;
}

.note-tooltip {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 5;
  display: none;
  width: min(260px, 48vw);
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(38, 29, 22, 0.94);
  color: #fff7ef;
  font-size: 12px;
  line-height: 1.5;
  box-shadow: 0 12px 30px rgba(38, 29, 22, 0.22);
  white-space: normal;
}

.note-tooltip-right {
  left: auto;
  right: 0;
}

.note-indicator:hover .note-tooltip,
.note-indicator:focus-within .note-tooltip {
  display: block;
}

.history-row:last-child .note-tooltip,
.history-row:nth-last-child(2) .note-tooltip {
  top: auto;
  bottom: calc(100% + 8px);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-full {
  color: var(--accent);
  background: var(--accent-soft);
}

.badge-partial {
  color: #6b4d14;
  background: #f6e3c0;
}

.empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 30;
  justify-content: center;
  align-items: center;
  padding: 20px;
  background: rgba(29, 20, 14, 0.42);
  backdrop-filter: blur(8px);
}

.modal-overlay.open {
  display: flex;
}

.modal {
  width: min(480px, 100%);
}

.modal-head,
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 20px 24px;
}

.modal-head {
  border-bottom: 1px solid rgba(105, 84, 57, 0.1);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
}

.modal-footer {
  justify-content: flex-end;
  border-top: 1px solid rgba(105, 84, 57, 0.1);
}

.modal-title {
  font-size: 20px;
  font-weight: 700;
}

.modal-close {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
}

@media (max-width: 980px) {
  .summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .fg-submit {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .header {
    flex-direction: column;
    align-items: stretch;
    padding: 14px 16px;
  }

  .header-left,
  .header-right {
    flex-wrap: wrap;
  }

  .file-badge {
    max-width: 100%;
  }

  .no-file-screen,
  .main {
    width: min(100%, calc(100% - 24px));
  }

  .empty-hero,
  .hero-card,
  .card {
    border-radius: 22px;
  }

  .empty-hero,
  .hero-card,
  .card-body,
  .modal-body {
    padding: 16px;
  }

  .card-head,
  .modal-head,
  .modal-footer {
    padding: 16px;
  }

  .form-grid,
  .form-grid-compact {
    grid-template-columns: 1fr;
  }

  .section-meta {
    flex-direction: column;
    align-items: flex-start;
  }

  .edit-banner {
    flex-direction: column;
    align-items: stretch;
  }

  .history-wrap {
    padding: 0 12px 12px;
    --history-cols: minmax(8rem, 2fr) minmax(4rem, 0.9fr) minmax(4.8rem, 1fr) minmax(5.6rem, 1.1fr) minmax(8rem, 1.35fr);
  }

  .history-head,
  .history-main {
    column-gap: 14px;
  }

  .history-row {
    padding-inline: 2px;
  }

  .history-head,
  .history-main {
    grid-template-columns: var(--history-cols);
  }

  .badge {
    min-height: 24px;
    padding: 0 8px;
    font-size: 11px;
  }

  .btn-row {
    min-height: 30px;
    padding: 0 8px;
    font-size: 12px;
  }

  .note-trigger {
    padding: 2px 7px;
    font-size: 10px;
  }

  .history-actions {
    gap: 6px;
  }
}

@media (max-width: 620px) {

  .summary,
  .form-grid,
  .form-grid-compact {
    grid-template-columns: 1fr;
  }

  .sum-item {
    min-height: 112px;
  }

  .history-head {
    display: none;
  }

  .history-row {
    padding: 14px 12px;
    margin-top: 4px;
    border: 1px solid rgba(105, 84, 57, 0.08);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
  }

  .history-main {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "date"
      "type"
      "time"
      "hours"
      "actions";
    row-gap: 10px;
    align-items: start;
  }

  .history-date {
    grid-area: date;
  }

  .history-type {
    grid-area: type;
  }

  .history-time-range {
    grid-area: time;
  }

  .history-hours {
    grid-area: hours;
    text-align: left;
  }

  .history-actions {
    grid-area: actions;
    justify-self: start;
  }

  .history-label {
    display: block;
    width: 4.75rem;
    margin-bottom: 0;
    margin-right: 0;
    color: var(--text-muted);
    font-size: 11px;
    font-family: var(--sans);
    text-align: left;
  }

  .history-date,
  .history-type,
  .history-time-range,
  .history-hours {
    display: grid;
    grid-template-columns: 4.75rem minmax(0, 1fr);
    align-items: baseline;
    column-gap: 8px;
    justify-self: stretch;
  }

  .history-time-range {
    justify-self: stretch;
    text-align: left;
    font-size: 13px;
  }

  .history-date .table-cell-date,
  .history-type .badge,
  .history-time-range>span:last-child,
  .history-hours>span:last-child {
    justify-self: start;
  }

  .history-hours {
    text-align: left;
  }

  .history-note-row {
    margin-top: 4px;
    padding-top: 4px;
    border-top: 1px solid rgba(105, 84, 57, 0.08);
  }

  .history-actions {
    gap: 6px;
    align-self: start;
    justify-self: end;
  }
}