/* 共通トークン・部品（フォーム／管理コンソール共通） */
:root {
  --font: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --c-text: #2b2723;
  --c-muted: #6e675f;
  --c-border: #e4ded4;
  --c-bg: #f8f5ef;
  --c-surface: #ffffff;
  --c-accent: #c2532a;
  --c-accent-dark: #a3441f;
  --c-accent-soft: #fbeee7;
  --c-ok: #2f7d5a;
  --c-ok-soft: #e6f3ec;
  --c-err: #c0392b;
  --c-err-soft: #fdecea;
  --c-warn-soft: #fff6dc;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 4px 14px rgba(0, 0, 0, .06);
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--c-text); background: var(--c-bg); line-height: 1.6; font-size: 16px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.35; font-weight: 700; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ボタン */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent; font-weight: 600; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, opacity .15s; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--c-accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--c-accent-dark); }
.btn-secondary { background: var(--c-surface); color: var(--c-text); border-color: var(--c-border); }
.btn-secondary:hover:not(:disabled) { background: #f2eee7; }
.btn-ghost { background: transparent; color: var(--c-accent); }
.btn-ghost:hover:not(:disabled) { background: var(--c-accent-soft); }
.btn-danger { background: var(--c-surface); color: var(--c-err); border-color: var(--c-border); }
.btn-danger:hover:not(:disabled) { background: var(--c-err-soft); }
.btn-block { width: 100%; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 14px; border-radius: 8px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--c-accent); text-decoration: underline; font-weight: 600; }
.linkbtn.danger { color: var(--c-err); }

/* 入力 */
.field { margin-bottom: 16px; }
.label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--c-text); }
.req { display: inline-block; font-size: 11px; font-weight: 600; line-height: 1.4; color: #fff; background: var(--c-accent); border-radius: 4px; padding: 1px 6px; margin-left: 6px; vertical-align: 2px; }
.input, .select, .textarea { width: 100%; min-height: 46px; padding: 10px 12px; border: 1px solid var(--c-border); border-radius: 10px; background: var(--c-surface); font-size: 16px; }
.textarea { min-height: 80px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: 2px solid var(--c-accent); outline-offset: 1px; border-color: var(--c-accent); }
.input:disabled, .select:disabled { background: #f3f0ea; color: var(--c-muted); }
.select { appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%236e675f' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input.is-error, .select.is-error { border-color: var(--c-err); background: #fffafa; }
.help { font-size: 14px; color: var(--c-muted); }
.hint { font-size: 13px; color: var(--c-muted); }
.error { color: var(--c-err); font-size: 13px; margin-top: 6px; font-weight: 600; }
.chip { display: inline-block; font-size: 11px; font-weight: 600; line-height: 1.6; padding: 1px 8px; border-radius: 999px; background: #efeae2; color: var(--c-muted); vertical-align: middle; white-space: nowrap; }
.card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 16px; }
.mono { font-family: var(--mono); font-size: 13px; }

/* スイッチ */
.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; position: relative; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .sw { width: 40px; height: 24px; border-radius: 999px; background: #cfc9bf; position: relative; transition: background .15s; flex: none; }
.switch .sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.switch input:checked + .sw { background: var(--c-ok); }
.switch input:checked + .sw::after { transform: translateX(16px); }
.switch input:focus-visible + .sw { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.switch .sw-label { font-size: 13px; color: var(--c-muted); min-width: 3em; }

/* モーダル */
.modal-backdrop { position: fixed; inset: 0; background: rgba(20, 16, 12, .45); z-index: 50; }
.modal-panel { position: fixed; z-index: 51; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(660px, calc(100vw - 32px)); max-height: calc(100vh - 48px); overflow: auto; background: var(--c-surface); border-radius: 14px; padding: 24px 28px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
.modal-panel h2 { font-size: 18px; margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* トースト */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #2b2723; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 60; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
