/* ==========================================================
   焼鳥どん シフト・勤怠管理  main.css
   命名: BEM / ブレークポイント: 768px（PC基準 → SP調整）
   ========================================================== */

:root {
  --c-bg: #f7f3ee;
  --c-surface: #ffffff;
  --c-surface-2: #fbf8f4;
  --c-line: #e6ddd2;
  --c-text: #2b211a;
  --c-text-sub: #7a6c60;
  --c-brand: #3b2618;
  --c-accent: #c8402f;
  --c-accent-weak: #fbe9e6;
  --c-gold: #f6c453;
  --c-hall: #2f6fb3;
  --c-hall-weak: #e6f0fb;
  --c-kitchen: #c4661f;
  --c-kitchen-weak: #fdeedd;
  --c-ok: #2e8b57;
  --c-ok-weak: #e3f4ea;
  --c-warn: #b7791f;
  --c-warn-weak: #fdf3dc;
  --c-ng: #c53030;
  --c-ng-weak: #fde8e8;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(59, 38, 24, .08), 0 4px 16px rgba(59, 38, 24, .05);
  --font: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Yu Gothic', Meiryo, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font);
  font-size: .9375rem;
  line-height: 1.6;
  word-break: normal;
  overflow-wrap: anywhere;
  line-break: strict;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--c-hall); }
h1, h2, h3 { line-height: 1.35; margin: 0; }
table { border-collapse: collapse; }

/* ---------- utility ---------- */
.u-ib { display: inline-block; }
.u-nowrap { white-space: nowrap; }
.u-num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.u-sub { color: var(--c-text-sub); font-size: .8125rem; }
.u-mt { margin-top: 16px; }
.u-ok { color: var(--c-ok); }
.u-warn { color: var(--c-warn); }
.u-ng { color: var(--c-ng); }
.u-center { text-align: center; }
.u-sp-only { display: none; }
@media all and (max-width: 768px) {
  .u-sp-only { display: initial; }
  .u-pc-only { display: none; }
}

/* ---------- button ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 6px 16px;
  border: 1px solid var(--c-line);
  border-radius: 8px;
  background: var(--c-surface);
  color: var(--c-text);
  font-weight: 600;
  font-size: .875rem;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: var(--c-surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--c-brand); border-color: var(--c-brand); color: #fff; }
.btn--primary:hover { background: #563826; }
.btn--accent { background: var(--c-accent); border-color: var(--c-accent); color: #fff; }
.btn--accent:hover { background: #a93526; }
.btn--line { background: #06c755; border-color: #06c755; color: #fff; }
.btn--line:hover { background: #05a647; }
.btn--danger { color: var(--c-ng); border-color: #f0c4c4; }
.btn--sm { min-height: 30px; padding: 3px 10px; font-size: .8125rem; }
.btn--block { width: 100%; }
.btn--icon { min-width: 38px; padding: 6px; }
.btn-group { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- badge ---------- */
.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-line);
  color: var(--c-text-sub);
  font-size: .75rem;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.6;
}
.badge--trainee { background: var(--c-warn-weak); border-color: #f1d9a6; color: var(--c-warn); }
.badge--employee { background: var(--c-brand); border-color: var(--c-brand); color: var(--c-gold); }
.badge--minor { background: #efe7fb; border-color: #d8c8f2; color: #6b46c1; }
.badge--ok { background: var(--c-ok-weak); border-color: #bfe3cd; color: var(--c-ok); }
.badge--warn { background: var(--c-warn-weak); border-color: #f1d9a6; color: var(--c-warn); }
.badge--ng { background: var(--c-ng-weak); border-color: #f2c2c2; color: var(--c-ng); }
.badge--late { background: #2b2140; border-color: #2b2140; color: #f6c453; }
.badge--hall { background: var(--c-hall-weak); border-color: #c4dcf3; color: var(--c-hall); }
.badge--kitchen { background: var(--c-kitchen-weak); border-color: #f4d2b0; color: var(--c-kitchen); }

/* ---------- form ---------- */
.field { display: block; margin-bottom: 14px; }
.field__label { display: block; margin-bottom: 4px; font-size: .8125rem; font-weight: 600; color: var(--c-text-sub); }
.field__input, .field__select, .field__textarea {
  width: 100%;
  min-height: 40px;
  padding: 7px 10px;
  border: 1px solid var(--c-line);
  border-radius: 8px;
  background: #fff;
}
.field__input:focus, .field__select:focus, .field__textarea:focus, .cell-input:focus {
  outline: 2px solid rgba(47, 111, 179, .35);
  border-color: var(--c-hall);
}
.field__textarea { min-height: 72px; resize: vertical; }
.field__help { margin: 4px 0 0; font-size: .75rem; color: var(--c-text-sub); }
.field--inline { display: flex; align-items: center; gap: 8px; }
.field--inline .field__label { margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 16px; }
.form-section { margin-bottom: 20px; }
.form-section__ttl { margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--c-line); font-size: .9375rem; }
.check { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; }
.check input { width: 18px; height: 18px; accent-color: var(--c-brand); }
.cell-input {
  width: 74px;
  min-height: 34px;
  padding: 4px 6px;
  border: 1px solid var(--c-line);
  border-radius: 6px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.cell-input--wide { width: 120px; text-align: right; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: var(--c-brand); }
.login__card { width: 100%; max-width: 380px; padding: 32px 28px; border-radius: 16px; background: var(--c-surface); box-shadow: 0 12px 40px rgba(0, 0, 0, .25); }
.login__logo {
  width: 56px; height: 56px; margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 14px; background: var(--c-brand); color: var(--c-gold);
  font-size: 1.875rem; font-weight: 800;
}
.login__ttl { text-align: center; font-size: 1.25rem; }
.login__store { margin: 2px 0 24px; text-align: center; color: var(--c-text-sub); font-size: .875rem; }
.login__error { min-height: 1.5em; margin: 0 0 8px; color: var(--c-ng); font-size: .8125rem; }

/* ---------- header / nav ---------- */
.header { position: sticky; top: 0; z-index: 50; background: var(--c-brand); color: #fff; }
.header__inner { display: flex; align-items: center; gap: 16px; max-width: 1400px; margin: 0 auto; padding: 0 20px; min-height: 56px; }
.header__brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; }
.header__logo { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 8px; background: var(--c-gold); color: var(--c-brand); font-weight: 800; }
.header__name { font-size: .9375rem; }
.header__menu-btn { display: none; margin-left: auto; padding: 6px; border: 0; background: none; color: #fff; cursor: pointer; }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.nav__link { padding: 16px 10px; color: rgba(255, 255, 255, .78); text-decoration: none; font-size: .875rem; font-weight: 600; white-space: nowrap; border-bottom: 3px solid transparent; }
.nav__link:hover { color: #fff; }
.nav__link.is-active { color: #fff; border-bottom-color: var(--c-gold); }
.user-menu { position: relative; }
.user-menu__btn { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid rgba(255, 255, 255, .25); border-radius: 8px; background: none; color: #fff; cursor: pointer; white-space: nowrap; }
.user-menu__btn .badge { background: rgba(255, 255, 255, .15); border-color: transparent; color: var(--c-gold); }
.user-menu__panel { position: absolute; right: 0; top: calc(100% + 6px); min-width: 180px; padding: 6px; border-radius: 10px; background: #fff; box-shadow: var(--shadow); z-index: 60; }
.user-menu__item { display: block; width: 100%; padding: 10px 12px; border: 0; border-radius: 6px; background: none; text-align: left; color: var(--c-text); cursor: pointer; }
.user-menu__item:hover { background: var(--c-surface-2); }
@media all and (max-width: 768px) {
  .header__inner { flex-wrap: wrap; gap: 8px; padding: 0 16px; }
  .header__menu-btn { display: block; order: 2; margin-left: 0; }
  .nav { display: none; order: 3; flex-basis: 100%; flex-direction: column; padding-bottom: 8px; }
  .nav.is-open { display: flex; }
  .nav__link { padding: 10px 4px; border-bottom: 1px solid rgba(255, 255, 255, .1); }
  .nav__link.is-active { border-bottom-color: rgba(255, 255, 255, .1); color: var(--c-gold); }
  .user-menu { order: 1; margin-left: auto; }
  .user-menu__btn { padding: 4px 8px; }
  .user-menu__btn .badge { display: none; }
  .user-menu__name { max-width: 6em; overflow: hidden; text-overflow: ellipsis; }
  .header__name { font-size: .8125rem; }
}

/* ---------- layout ---------- */
.main { max-width: 1400px; margin: 0 auto; padding: 24px 20px 64px; outline: none; }
@media all and (max-width: 768px) { .main { padding: 16px 16px 48px; } }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-head__ttl { font-size: 1.375rem; }
.page-head__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.card { margin-bottom: 20px; padding: 18px 20px; border: 1px solid var(--c-line); border-radius: var(--radius); background: var(--c-surface); box-shadow: var(--shadow); }
.card__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.card__ttl { font-size: 1rem; }
@media all and (max-width: 768px) { .card { padding: 14px; } }
.notice { margin-bottom: 16px; padding: 12px 16px; border-radius: var(--radius); background: var(--c-warn-weak); border: 1px solid #f1d9a6; color: #7a5410; font-size: .875rem; }
.notice--ng { background: var(--c-ng-weak); border-color: #f2c2c2; color: #8a2020; }
.notice--info { background: var(--c-hall-weak); border-color: #c4dcf3; color: #1f4f82; }
.notice__list { margin: 6px 0 0; padding-left: 1.2em; }
.empty { padding: 28px 12px; text-align: center; color: var(--c-text-sub); }
.loading { padding: 40px; text-align: center; color: var(--c-text-sub); }

/* ---------- date nav ---------- */
.date-nav { display: flex; align-items: center; gap: 6px; }
.date-nav__input { min-height: 38px; padding: 4px 8px; border: 1px solid var(--c-line); border-radius: 8px; background: #fff; }
.date-nav__label { min-width: 11em; text-align: center; font-weight: 700; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.kpi { padding: 14px 16px; border: 1px solid var(--c-line); border-radius: var(--radius); background: var(--c-surface); box-shadow: var(--shadow); }
.kpi__label { font-size: .8125rem; color: var(--c-text-sub); font-weight: 600; }
.kpi__value { margin-top: 2px; font-size: 1.625rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.3; }
.kpi__sub { font-size: .75rem; color: var(--c-text-sub); }
@media all and (max-width: 768px) {
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi__value { font-size: 1.25rem; }
}

/* ---------- checkpoints ---------- */
.checkpoints { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 20px; }
.checkpoint { position: relative; padding: 16px; border: 1px solid var(--c-line); border-radius: var(--radius); background: var(--c-surface); box-shadow: var(--shadow); border-top: 4px solid var(--c-line); }
.checkpoint.is-ok { border-top-color: var(--c-ok); }
.checkpoint.is-warn { border-top-color: var(--c-warn); }
.checkpoint.is-ng { border-top-color: var(--c-ng); }
.checkpoint.is-future { opacity: .6; }
.checkpoint__label { display: flex; justify-content: space-between; align-items: center; font-weight: 700; }
.checkpoint__rate { margin: 6px 0 4px; font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; }
.checkpoint__rows { margin: 8px 0 0; display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: .8125rem; }
.checkpoint__rows dt { color: var(--c-text-sub); }
.checkpoint__rows dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.checkpoint__form { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.checkpoint__form .cell-input { flex: 1 1 100%; width: auto; text-align: right; }
.checkpoint__form .btn { flex: 1; }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--c-line); border-radius: 8px; background: #fff; }
.table { width: 100%; font-size: .875rem; }
.table th, .table td { padding: 9px 10px; border-bottom: 1px solid var(--c-line); text-align: left; vertical-align: middle; }
.table th { background: var(--c-surface-2); font-size: .75rem; color: var(--c-text-sub); font-weight: 700; white-space: nowrap; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fffdf9; }
.table tfoot td { background: var(--c-surface-2); font-weight: 700; }
.table__name { font-weight: 700; white-space: nowrap; }
.table__name .badge { margin-left: 4px; }
.table tr.is-approved td { background: #fbfefc; }
.table tr.is-retired td { color: var(--c-text-sub); }
.table--compact th, .table--compact td { padding: 6px 8px; }

/* ---------- skill ---------- */
.skill { display: inline-flex; gap: 2px; vertical-align: middle; }
.skill__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--c-line); }
.skill--hall .skill__dot.is-on { background: var(--c-hall); }
.skill--kitchen .skill__dot.is-on { background: var(--c-kitchen); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--c-line); }
.tabs__btn { padding: 8px 14px; border: 0; border-bottom: 3px solid transparent; background: none; font-weight: 700; color: var(--c-text-sub); cursor: pointer; white-space: nowrap; }
.tabs__btn.is-active { color: var(--c-text); border-bottom-color: var(--c-accent); }

/* ---------- shift grid ---------- */
.shift-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.shift-grid { overflow: auto; max-height: calc(100vh - 230px); border: 1px solid var(--c-line); border-radius: 8px; background: #fff; }
.shift-grid__table { font-size: .75rem; }
.shift-grid__table th, .shift-grid__table td { min-width: 62px; height: 46px; padding: 2px; border-right: 1px solid var(--c-line); border-bottom: 1px solid var(--c-line); text-align: center; }
.shift-grid__table thead th { position: sticky; top: 0; z-index: 2; height: auto; padding: 6px 2px; background: var(--c-surface-2); font-weight: 700; }
.shift-grid__table .shift-grid__staff { position: sticky; left: 0; z-index: 1; min-width: 150px; padding: 4px 8px; background: #fff; text-align: left; }
.shift-grid__table thead .shift-grid__staff { z-index: 3; background: var(--c-surface-2); }
.shift-grid__staff-name { font-weight: 700; font-size: .8125rem; white-space: nowrap; }
.shift-grid__staff-meta { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 2px; align-items: center; }
.shift-grid__day { line-height: 1.25; }
.shift-grid__day.is-sat { color: var(--c-hall); }
.shift-grid__day.is-sun, .shift-grid__day.is-holiday { color: var(--c-ng); }
.shift-grid__day-late { display: inline-block; margin-top: 2px; padding: 0 4px; border-radius: 4px; background: #2b2140; color: var(--c-gold); font-size: .625rem; }
.shift-grid__cell { cursor: pointer; }
.shift-grid__cell:hover { background: #fffaf0; }
.shift-grid__cell.is-readonly { cursor: default; }
.shift-grid__cell.is-late-col { background: #faf8fd; }
.shift-grid__sum { min-width: 70px; background: var(--c-surface-2); font-variant-numeric: tabular-nums; }
.shift-grid__foot td, .shift-grid__foot th { background: var(--c-surface-2); font-weight: 700; height: 34px; }
.shift-chip { display: block; padding: 3px 2px; border-radius: 6px; font-weight: 700; line-height: 1.25; white-space: nowrap; }
.shift-chip--hall { background: var(--c-hall-weak); color: var(--c-hall); }
.shift-chip--kitchen { background: var(--c-kitchen-weak); color: var(--c-kitchen); }
.shift-chip__time { display: block; font-weight: 600; font-size: .6875rem; }
.req-mark { font-size: 1.125rem; font-weight: 800; }
.req-mark--ok { color: var(--c-ok); }
.req-mark--ng { color: var(--c-ng); }
.req-mark--time { font-size: .6875rem; color: var(--c-ok); }
.req-mark--default { color: #c9bfb4; font-size: .6875rem; }
.cover { font-variant-numeric: tabular-nums; }
.cover.is-short { color: var(--c-ng); }
.cover.is-over { color: var(--c-warn); }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; font-size: .75rem; color: var(--c-text-sub); }
.warn-list { max-height: 180px; overflow: auto; }

/* ---------- shift export (画像用) ---------- */
.shift-export { position: fixed; left: -10000px; top: 0; width: max-content; padding: 28px 32px; background: #fff; color: #2b211a; font-family: var(--font); }
.shift-export__head { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; margin-bottom: 14px; }
.shift-export__ttl { font-size: 26px; font-weight: 800; }
.shift-export__store { font-size: 15px; color: #7a6c60; }
.shift-export table { border-collapse: collapse; font-size: 14px; }
.shift-export th, .shift-export td { border: 1px solid #d9cfc3; padding: 5px 6px; text-align: center; min-width: 58px; }
.shift-export thead th { background: #3b2618; color: #fff; font-weight: 700; line-height: 1.25; }
.shift-export thead th.is-sat { background: #2f5f99; }
.shift-export thead th.is-sun { background: #a8342a; }
.shift-export .shift-export__name { min-width: 110px; text-align: left; font-weight: 700; white-space: nowrap; background: #fbf8f4; }
.shift-export .shift-export__cell--hall { background: #e6f0fb; color: #1f4f82; font-weight: 700; }
.shift-export .shift-export__cell--kitchen { background: #fdeedd; color: #8d4512; font-weight: 700; }
.shift-export__time { display: block; font-size: 12px; font-weight: 600; white-space: nowrap; }
.shift-export__legend { margin-top: 10px; font-size: 13px; color: #7a6c60; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(30, 20, 12, .5); }
.modal__dialog { position: relative; display: flex; flex-direction: column; width: 100%; max-width: 560px; max-height: calc(100vh - 32px); border-radius: 14px; background: #fff; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal--wide .modal__dialog { max-width: 900px; }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--c-line); }
.modal__ttl { font-size: 1.0625rem; }
.modal__close { padding: 4px; border: 0; background: none; cursor: pointer; color: var(--c-text-sub); }
.modal__body { padding: 18px; overflow: auto; }
.modal__foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--c-line); }
.modal__foot:empty { display: none; }
.modal__preview { max-width: 100%; border: 1px solid var(--c-line); border-radius: 8px; }
@media all and (max-width: 768px) {
  .modal { padding: 0; align-items: flex-end; }
  .modal__dialog { max-height: 92vh; border-radius: 14px 14px 0 0; }
}

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 200; transform: translate(-50%, 20px); max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 10px; background: var(--c-brand); color: #fff; font-size: .875rem; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; white-space: pre-line; }
.toast.is-show { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: var(--c-ng); }

/* ---------- avail editor ---------- */
.avail { width: 100%; font-size: .875rem; }
.avail td { padding: 4px 6px; border-bottom: 1px solid var(--c-line); }
.avail .cell-input { width: 80px; }

/* ---------- chips list ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { padding: 4px 10px; border: 1px solid #f1d9a6; border-radius: 999px; background: var(--c-warn-weak); color: var(--c-warn); font-size: .8125rem; font-weight: 700; cursor: pointer; }

/* ---------- history bars ---------- */
.rate-bar { position: relative; display: inline-block; width: 90px; height: 8px; border-radius: 4px; background: var(--c-line); vertical-align: middle; margin-left: 6px; overflow: hidden; }
.rate-bar__fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--c-ok); }
.rate-bar__fill.is-warn { background: var(--c-warn); }
.rate-bar__fill.is-ng { background: var(--c-ng); }
.rate-bar__target { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--c-text); }
