:root {
  --main: #e0704a;
  --main-dark: #c95c38;
  --accent: #f2a33a;
  --bg: #fbf5ee;
  --text: #3b2f2a;
  --sub: #8a7a72;
  --card: #ffffff;
  --line: #eadfd3;
  --danger: #c0392b;
  --tab-h: 62px;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Noto Sans JP', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, .brand, .tile-label, .tab span { font-family: 'Zen Maru Gothic', 'Noto Sans JP', sans-serif; }

#app { max-width: 520px; margin: 0 auto; min-height: 100dvh; }

.loading { text-align: center; padding: 40vh 0 0; color: var(--sub); }

/* ---- 上の帯 ---- */
.top {
  position: sticky; top: 0; z-index: 5;
  background: var(--main); color: #fff;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
  display: flex; align-items: center; gap: 8px;
}
.top h1 { font-size: 18px; margin: 0; flex: 1; }
.top .back {
  background: none; border: 0; color: #fff; font-size: 22px; line-height: 1;
  padding: 4px 10px 4px 0; cursor: pointer;
}

main { padding: 16px 16px calc(var(--tab-h) + env(safe-area-inset-bottom) + 24px); }

/* ---- 下のタブ（どの画面でも同じ） ---- */
.tabs {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 520px; z-index: 10;
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  position: relative; height: var(--tab-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--sub); text-decoration: none; font-size: 11px;
}
.tab .ico { font-size: 22px; line-height: 1; filter: grayscale(1) opacity(.6); }
.tab.on { color: var(--main); font-weight: 700; }
.tab.on .ico { filter: none; }
.badge {
  position: absolute; top: 6px; left: calc(50% + 6px);
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

/* ---- 部品 ---- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px; margin-bottom: 12px;
}
.card h2 { font-size: 16px; margin: 0 0 8px; }
.muted { color: var(--sub); font-size: 13px; }
.hello { margin: 4px 0 16px; }
.hello strong { font-family: 'Zen Maru Gothic', sans-serif; font-size: 20px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip {
  font-size: 12px; padding: 2px 10px; border-radius: 999px;
  background: #fdebd9; color: var(--main-dark); white-space: nowrap;
}
.chip.gray { background: #eee8e2; color: var(--sub); }
.chip.fc { background: #fff1d6; color: #a86a0a; }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tile {
  position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 18px 12px; min-height: 108px; text-align: center; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  font: inherit; color: inherit;
}
.tile:active { background: #fff7ef; }
.tile-ico { font-size: 32px; line-height: 1; }
.tile-label { font-weight: 700; font-size: 15px; }
.tile .soon {
  position: absolute; top: 8px; right: 8px; font-size: 10px;
  background: #eee8e2; color: var(--sub); padding: 1px 8px; border-radius: 999px;
}

label { display: block; font-size: 13px; font-weight: 700; margin: 14px 0 4px; }
input[type=text], input[type=password], input[type=email], select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--text);
  padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
.hint { font-size: 12px; color: var(--sub); margin: 4px 0 0; }

.check { display: flex; align-items: center; gap: 10px; font-weight: 400; font-size: 15px; margin: 8px 0; }
.check input { width: 22px; height: 22px; accent-color: var(--main); flex: none; }
.checks { border: 1px solid var(--line); border-radius: 12px; padding: 4px 12px; max-height: 220px; overflow-y: auto; background: #fff; }

.btn {
  display: block; width: 100%; margin-top: 18px; padding: 14px;
  font: inherit; font-weight: 700; font-size: 16px; font-family: 'Zen Maru Gothic', sans-serif;
  color: #fff; background: var(--main); border: 0; border-radius: 999px; cursor: pointer;
}
.btn:active { background: var(--main-dark); }
.btn:disabled { opacity: .5; }
.btn.sub { background: #fff; color: var(--main); border: 1.5px solid var(--main); }
.btn.plain { background: none; color: var(--sub); font-weight: 400; margin-top: 8px; }
.btn.small { display: inline-block; width: auto; margin: 0; padding: 6px 16px; font-size: 13px; }

.error { color: var(--danger); font-size: 14px; margin: 12px 0 0; min-height: 1em; }

.list { list-style: none; margin: 0; padding: 0; }
.row {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; margin-bottom: 8px; display: flex; align-items: center; gap: 10px;
  width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
}
.row .grow { flex: 1; min-width: 0; }
.row .name { font-weight: 700; }
.row .arrow { color: var(--sub); }
.row.off { opacity: .55; }

.notice { display: block; }
.notice.unread { border-left: 5px solid var(--main); }
.notice .when { font-size: 12px; color: var(--sub); }
.notice .ttl { font-weight: 700; margin: 2px 0; }
.notice .txt { font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }

.bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 8px; }

.empty { text-align: center; color: var(--sub); padding: 40px 0; }

/* ---- ログイン ---- */
.login { padding: 14vh 24px 40px; }
.login .logo {
  width: 84px; height: 84px; border-radius: 22px; display: block; margin: 0 auto 12px;
}
.brand { text-align: center; font-size: 26px; font-weight: 700; color: var(--main); letter-spacing: .08em; margin: 0; }
.login .lead { text-align: center; color: var(--sub); font-size: 14px; margin: 4px 0 20px; }

/* ---- 下から出る入力シート ---- */
dialog {
  border: 0; padding: 0; width: 100%; max-width: 520px; max-height: 92dvh;
  margin: auto auto 0; border-radius: 20px 20px 0 0; color: var(--text); background: var(--bg);
}
dialog::backdrop { background: rgba(59, 47, 42, .45); }
.sheet { padding: 20px 20px calc(env(safe-area-inset-bottom) + 24px); }
.sheet h2 { margin: 0; font-size: 18px; }

#toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 16px);
  transform: translateX(-50%); z-index: 100;
  background: var(--text); color: #fff; font-size: 14px;
  padding: 10px 18px; border-radius: 999px; max-width: 90vw;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
#toast.show { opacity: .95; }

/* ---------- 日報 ---------- */
.seg { display: flex; background: #f1e7dc; border-radius: 12px; padding: 4px; margin-bottom: 12px; }
.seg button { flex: 1; border: 0; background: none; padding: 9px 0; border-radius: 9px; font: inherit; font-size: 14px; color: var(--sub); }
.seg button.on { background: #fff; color: var(--main); font-weight: 700; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.daybar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.daybar > button { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: #fff; font-size: 24px; color: var(--main); }
.daybar > button:disabled { opacity: .35; }
.daybar .day { flex: 1; position: relative; margin: 0; text-align: center; font-family: 'Zen Maru Gothic', sans-serif; font-weight: 700; font-size: 17px; padding: 10px 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.daybar .day input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; margin: 0; }
.mybox { display: flex; align-items: center; gap: 10px; border-left: 5px solid var(--accent); }
.sec { font-size: 15px; margin: 20px 0 8px; }
.report.star { border: 1.5px solid var(--accent); }
.rhead { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 10px; }
.rhead .grow { flex: 1; min-width: 0; }
.nums { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 6px; }
.nums.two { grid-template-columns: repeat(2, 1fr); }
.nums > div { background: var(--bg); border-radius: 10px; padding: 6px 4px; text-align: center; }
.nums span { display: block; font-size: 11px; color: var(--sub); }
.nums b { font-size: 16px; }
.nums.two b { font-size: 14px; }
.rtext { margin: 10px 0 0; }
.rtext dt { font-size: 12px; color: var(--sub); margin-top: 8px; }
.rtext dd { margin: 2px 0 0; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.marks { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.mark { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 12px; font: inherit; font-size: 13px; color: var(--text); min-height: 38px; }
.mark.on { background: #fdebe3; border-color: var(--main); color: var(--main-dark); font-weight: 700; }
.numrow { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.numrow:last-of-type { border-bottom: 0; }
.numrow .grow { flex: 1; min-width: 0; }
.numrow input { width: 58px; height: 44px; margin: 0; padding: 0; text-align: center; font-size: 18px; font-weight: 700; }
.numrow .step { width: 44px; height: 44px; flex: none; border-radius: 50%; border: 1.5px solid var(--main); background: #fff; color: var(--main); font-size: 22px; line-height: 1; }
.numrow .step:active { background: #fdebe3; }

/* ---------- サブスク ---------- */
.nums.three { grid-template-columns: repeat(3, 1fr); }
.nums.three b { font-size: 15px; }
.todo { border-left: 5px solid var(--accent); }
.sq { font-weight: 700; margin: 4px 0 8px; display: inline-block; }
.log { font-size: 13px; padding: 10px 0; border-bottom: 1px dashed var(--line); line-height: 1.6; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 8px 4px; border-bottom: 1px solid var(--line); text-align: right; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl th { font-size: 11px; color: var(--sub); font-weight: 500; }
.tbl .sum td { font-weight: 700; border-top: 2px solid var(--text); }

main > .nums > div { background: #fff; padding: 10px 4px; }
main > .nums b { font-size: 20px; }

/* 日報の絞り込み・並び順 */
.filters { display: flex; gap: 8px; margin: 0 0 10px; }
.filters select { flex: 1; margin: 0; padding: 10px; font-size: 14px; }
.seg button { white-space: nowrap; }

/* ホームのアラート */
.alert { display: block; width: 100%; text-align: left; font: inherit; color: var(--text); border: 1.5px solid var(--danger); background: #fdeeee; margin-bottom: 10px; cursor: pointer; }
/* ホームのお知らせの枠は、種類で色を分ける：レジ＝赤（そのまま）／サブスク＝青／宿題（出すもの）＝黄色／確認（本部・上長向け）＝グレー。
   色だけに頼らないよう、左上に種類の名前も出す（data-cat） */
.alert.subs { border-color: #3d7fd6; background: #eaf2fd; }
.alert.todo { border-color: #e0a400; background: #fff6da; }
.alert.check { border-color: #a8a29e; background: #f4f1ee; }
.alert[data-cat]::before { content: attr(data-cat); display: inline-block; font-size: 11px; font-weight: 700; line-height: 1; color: #fff; background: var(--danger); border-radius: 999px; padding: 4px 9px; margin: 0 8px 6px 0; vertical-align: middle; }
.alert.subs[data-cat]::before { background: #3d7fd6; }
.alert.todo[data-cat]::before { background: #c98f00; }
.alert.check[data-cat]::before { background: #857f7a; }

/* ----- シフト ----- */
.sc-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 2px; background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.sc-wd { background: #fff7ef; text-align: center; font-size: 11px; padding: 4px 0; color: var(--sub); }
.sc-wd.sun, .sc-day.sun .sc-num { color: #d0453a; }
.sc-wd.sat, .sc-day.sat .sc-num { color: #3f73c9; }
.sc-cal > div:not(.sc-wd) { background: #fff; }
.sc-day { background: #fff; border: 0; padding: 2px 1px 4px; min-height: 76px; display: flex; flex-direction: column; gap: 1px; align-items: stretch; font: inherit; text-align: left; min-width: 0; cursor: pointer; }
.sc-day.today .sc-num { background: var(--main); color: #fff; border-radius: 999px; }
.sc-day.lack { box-shadow: inset 0 0 0 2px #e25b4f; }
.sc-num { font-size: 12px; align-self: center; min-width: 20px; text-align: center; line-height: 20px; }
.sc-bar, .sc-ev { display: block; font-size: 9.5px; line-height: 1.35; padding: 0 2px; border-radius: 3px; color: #fff; white-space: nowrap; overflow: hidden; }
.sc-bar { color: #3b2f2a; font-weight: 500; }
.sc-ev { background: #6b5d55; color: #fff; }
.sc-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; display: inline-block; margin-right: 6px; }
.sc-person { border-top: 1px solid var(--line); padding: 10px 0; }
.sc-pname { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.sc-pname .muted { font-size: 12px; margin-left: 4px; }
.sc-kinds { display: flex; flex-wrap: wrap; gap: 6px; }
.sc-kinds .mark { padding: 6px 10px; min-height: 34px; }
.sc-more { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.sc-more[hidden] { display: none; }
.sc-more input[type=time], .sc-time input { width: auto; flex: none; }
.sc-more input[type=text] { flex: 1 1 100%; }
.sc-time { display: flex; align-items: center; gap: 8px; }
.sc-add { margin: 8px 0; }
.sc-add summary { color: var(--main); font-weight: 700; padding: 8px 0; cursor: pointer; }
.sc-bar.absent { opacity: .45; text-decoration: line-through; }
.sc-wish { display: block; font-size: 9.5px; line-height: 1.3; padding: 0 2px; border-radius: 3px; border: 1px dashed #b9aca2; color: #3b2f2a; background: #fff; white-space: nowrap; overflow: hidden; }
.sc-day:disabled { opacity: .55; }
.sc-time-s { display: block; font-size: 8.5px; line-height: 1.2; color: var(--sub); text-align: center; white-space: nowrap; overflow: hidden; }
.sc-plan { background: #fff6dc; border: 1.5px solid #f2a33a; border-radius: 12px; padding: 10px 12px; margin-top: 10px; font-size: 13.5px; line-height: 1.6; }
.tk-fb { background: #f4f9f1; border: 1px solid #cfe5c5; border-radius: 10px; padding: 8px 10px; margin-top: 8px; font-size: 13.5px; line-height: 1.6; }
