:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  line-height: 1.55;
  color: #19352d;
  background: #f5f3e9;
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .52; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #c77b1b; outline-offset: 3px; }

.app-shell { min-height: 100dvh; display: flex; flex-direction: column; }
.site-header { color: #fffdf5; background: #21473c; }
.site-header__inner { max-width: 880px; margin: 0 auto; padding: 20px 20px 22px; display: flex; align-items: center; gap: 14px; }
.brand-mark { width: 52px; height: 52px; flex: none; display: grid; place-items: center; border-radius: 17px; color: #21473c; background: #f4d7a4; font-size: 1.55rem; font-weight: 800; }
.site-header h1 { margin: 0; font-size: clamp(1.35rem, 4vw, 1.75rem); line-height: 1.2; letter-spacing: .02em; }
.eyebrow { margin: 0 0 4px; color: #8b642b; font-size: .78rem; font-weight: 800; letter-spacing: .08em; }
.site-header .eyebrow { color: #f4d7a4; }

.container { width: min(100%, 880px); margin: 0 auto; padding: 18px 16px 48px; flex: 1; }
.source-label, .migration-status, .offline-status, .notice { margin: 0 0 10px; padding: 10px 13px; border-radius: 12px; font-size: .86rem; }
.source-label { background: #fff8e7; border: 1px solid #d7c89e; color: #634915; }
.source-label:empty { display: none; }
.migration-status { background: #fff2df; border: 1px solid #e9be7c; color: #6d3d08; }
.offline-status { background: #e7eee9; border: 1px solid #c5d5c9; }
.offline-status.is-warning { background: #fff2df; border-color: #e9be7c; color: #6d3d08; }
.notice { background: #e7eee9; border: 1px solid #c5d5c9; }
.notice.is-error { background: #fff0ed; border-color: #e7aca4; color: #872f29; }
.notice:empty { display: none; }
.reload-button { margin: 0 0 12px; }

.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; padding: 5px; margin: 14px 0 18px; border-radius: 15px; background: #e3e7dd; }
.tab { min-height: 48px; padding: 7px 4px; border: 0; border-radius: 11px; color: #34564b; background: transparent; font-size: .87rem; font-weight: 800; }
.tab.is-active { background: #fffdf8; color: #183a2e; box-shadow: 0 1px 6px #17382a20; }
.panel { padding: 22px 20px 28px; border: 1px solid #e5dfcf; border-radius: 19px; background: #fffdf8; box-shadow: 0 4px 24px #17382a0a; }
.section-heading { margin-bottom: 23px; }
.section-heading--compact { margin-bottom: 13px; }
.section-heading h2, .section-heading h3 { margin: 0 0 7px; line-height: 1.32; }
.section-heading h2 { font-size: 1.45rem; }
.section-heading h3 { font-size: 1.18rem; }
.section-heading p:last-child { margin: 0; color: #516158; font-size: .92rem; }
.subheading { margin: 24px 0 11px; font-size: 1.05rem; }

.field-block { display: grid; gap: 7px; }
.field-block label, .field-label { font-weight: 750; }
.field-block input, .field-block select, .menu-card input, .settings-card input, .settings-card select, .history-card input {
  width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid #9bab9d; border-radius: 10px; color: #17362b; background: #fff; font-size: 1rem;
}
.field-block input[type="file"] { padding: 11px; height: auto; }
.field-block input[type="checkbox"], .settings-card input[type="checkbox"] { width: 22px; min-height: 22px; height: 22px; margin: 0; accent-color: #21473c; }
.field-help { margin: 0; color: #56665d; font-size: .82rem; }
.date-block { padding: 15px; border-radius: 13px; background: #eef4ee; }
.required { margin-left: 4px; color: #a8422e; font-size: .78rem; }

.menu-list, .settings-menu-list, .history-list { display: grid; gap: 12px; }
.menu-card, .settings-card, .history-card { padding: 15px; border: 1px solid #d9dfd4; border-radius: 14px; background: #fff; }
.menu-card { display: grid; grid-template-columns: minmax(0, 1fr) 116px; align-items: center; gap: 14px; }
.menu-card h4, .settings-card h4, .history-card h3 { margin: 0 0 3px; font-size: 1rem; overflow-wrap: anywhere; }
.menu-card p, .settings-card p, .history-card p { margin: 0; }
.menu-card__detail { color: #59685e; font-size: .8rem; }
.menu-card label { display: block; margin-bottom: 4px; text-align: center; font-size: .78rem; font-weight: 750; }
.menu-card input { text-align: center; font-size: 1.15rem; font-weight: 750; }
.menu-empty { padding: 18px; background: #fff8e7; border-radius: 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.button { min-height: 48px; padding: 10px 18px; border: 1px solid transparent; border-radius: 11px; font-weight: 800; }
.button--primary { color: #fff; background: #21473c; }
.button--primary:hover:not(:disabled) { background: #2c5e4e; }
.button--quiet { color: #21473c; background: #edf3ec; border-color: #9db7a4; }
.button--danger { color: #fff; background: #8d372e; }
.button--full { display: block; width: 100%; margin-top: 18px; }

.preview-panel { margin-top: 24px; padding: 18px; border: 2px solid #7ea28a; border-radius: 16px; background: #f6faf5; }
.date-pill { display: inline-block; margin: 0 0 14px; padding: 6px 12px; border-radius: 50px; color: #204638; background: #dbeadd; font-weight: 800; }
.result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.result-card { padding: 16px; border: 1px solid #cfddd2; border-radius: 13px; background: #fff; }
.result-card h4 { margin: 0 0 10px; font-size: 1.08rem; }
.result-card dl { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; margin: 0; }
.result-card dt { color: #5a685e; font-size: .84rem; }
.result-card dd { margin: 0; text-align: right; font-weight: 750; overflow-wrap: anywhere; }
.result-card .big-number { color: #21473c; font-size: 1.35rem; line-height: 1.15; }
.preview-panel .field-help { margin-top: 13px; }

.history-card { padding: 18px; }
.history-meta { margin: 3px 0 12px !important; color: #617165; font-size: .82rem; }
.history-results { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.history-results p { padding: 11px; border-radius: 10px; background: #f1f5ed; font-size: .9rem; }
.history-results strong { display: block; color: #21473c; font-size: 1.15rem; }
.history-card .field-help { margin-top: 9px; }
.leftover-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; margin-top: 14px; }
.history-card button { margin-top: 12px; }
.history-card details { margin-top: 15px; color: #43574a; font-size: .86rem; }
.history-card summary { min-height: 44px; padding-top: 9px; cursor: pointer; font-weight: 750; }
.old-revision { padding: 9px 0; border-top: 1px solid #e5e9df; }

.conversion-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.settings-card__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; margin-top: 10px; }
.settings-card__grid .span-two { grid-column: 1 / -1; }
.settings-card .checkbox-row { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.settings-card .checkbox-row label { font-size: .88rem; }
.settings-card .field-block { min-width: 0; }
.settings-card .field-block label { font-size: .82rem; }
.settings-card .kind-fields { display: contents; }
.settings-card .kind-fields[hidden] { display: none; }
.actions--stacked { justify-content: space-between; }
.callout { padding: 16px; margin: 0 0 18px; border-left: 5px solid #c28a42; border-radius: 9px; background: #fff6e8; }
.callout h3 { margin: 0 0 5px; font-size: 1rem; }
.callout p { margin: 0; font-size: .9rem; }
.divider { margin: 28px 0; border: 0; border-top: 1px solid #d7ded2; }
.restore-preview { padding: 14px; margin-top: 15px; border: 1px solid #d6dcd0; border-radius: 12px; background: #f7faf4; font-size: .89rem; }
.restore-preview p { margin: 0 0 6px; }
.restore-preview p:last-child { margin: 0; }
.settings-event { border-color: #b7c9ad; background: #f8fbf4; }
.change-list { margin: 10px 0 0; padding-left: 1.3em; }
.change-list li { margin: 5px 0; overflow-wrap: anywhere; }
.danger-zone { margin-top: 38px; padding: 18px; border: 1px solid #d7b3a8; border-radius: 14px; background: #fff8f5; }
.danger-zone--quiet { margin-top: 30px; background: #faf8f4; }
.danger-zone h3 { margin: 0 0 6px; font-size: 1rem; }
.danger-zone p { margin: 0 0 14px; color: #5b4b43; font-size: .88rem; }
.reset-preview { margin-top: 18px; padding: 19px; border: 2px solid #a64e3e; border-radius: 15px; background: #fff8f5; }
.reset-preview h3 { margin: 0 0 7px; }
.reset-preview p { margin: 0 0 10px; }
.reset-preview ul { max-height: 45vh; overflow: auto; margin: 10px 0 18px; padding-left: 1.4em; }
.reset-preview li { margin: 7px 0; overflow-wrap: anywhere; }
.reset-actions { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; }
.reset-actions .button { flex: 1; }
.site-footer { padding: 24px 18px max(24px, env(safe-area-inset-bottom)); color: #dfeae1; background: #21473c; }
.site-footer p { max-width: 840px; margin: 0 auto; font-size: .8rem; }
.noscript { max-width: 880px; margin: 20px auto; padding: 14px; color: #872f29; }

@media (max-width: 590px) {
  .site-header__inner { padding-top: max(16px, env(safe-area-inset-top)); }
  .container { padding: 14px 12px 32px; }
  .panel { padding: 19px 14px 23px; }
  .result-grid, .conversion-grid { grid-template-columns: 1fr; }
  .menu-card { grid-template-columns: minmax(0, 1fr) 100px; gap: 10px; }
  .actions--stacked .button { width: 100%; }
  .reset-actions { flex-direction: column; }
}
@media (max-width: 380px) {
  .tab { font-size: .76rem; }
  .menu-card { grid-template-columns: minmax(0, 1fr) 86px; }
  .history-results { grid-template-columns: 1fr; }
}
