/* 猪野組 日報アプリ — 配色は備品管理・inogumi.pages.dev と同じロゴ実測値 */
:root {
  --red: #EB072A;
  --red-dark: #C00622;
  --dark: #4F4F4F;
  --gray: #CACACA;
  --safety-yellow: #F5C400;
  --bg-soft: #F7F6F2;
  --text: #3A3A3A;
  --white: #FFFFFF;
  --done: #2E7D32;
  --warn-bg: #FFF6D9;
  --warn-fg: #8A6D00;
  --danger-bg: #FDE7E9;
  --danger-fg: #C62828;
  --holiday-bg: #E3F0FA;
  --holiday-fg: #1D5A99;
  --line: #E3E0D8;
  --radius: 12px;
  --shadow: 0 1px 4px rgba(0,0,0,.08);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  background: var(--bg-soft);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }

/* ---------- ヘッダー ---------- */
header.app-header {
  position: sticky; top: 0; z-index: 20;
  background: var(--white);
  border-bottom: 3px solid var(--red);
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
}
.app-title { font-size: 17px; font-weight: 700; color: var(--dark); display: flex; align-items: center; gap: 7px; }
.app-title .logo-mark {
  background: var(--red); color: #fff; border-radius: 6px;
  width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 15px;
}
.header-spacer { flex: 1; }
.person-badge {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 12px; font-size: 13px; color: var(--dark); white-space: nowrap;
}

/* ---------- ナビ（スマホ＝下固定／PC＝ヘッダー下） ---------- */
nav.app-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  background: var(--white); border-top: 1px solid var(--line);
  display: flex;
  padding-bottom: env(safe-area-inset-bottom);
}
nav.app-nav button {
  flex: 1; border: none; background: none; cursor: pointer;
  padding: 7px 2px 6px; font-size: 11px; color: #888;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  position: relative;
}
nav.app-nav button .nav-icon { font-size: 20px; line-height: 1; }
nav.app-nav button.active { color: var(--red); font-weight: 700; }
.nav-badge {
  position: absolute; top: 2px; right: calc(50% - 22px);
  background: var(--red); color: #fff; border-radius: 999px;
  font-size: 10px; font-weight: 700; min-width: 16px; height: 16px;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 4px;
}

main.app-main { padding: 14px 14px 84px; max-width: 860px; margin: 0 auto; }

@media (min-width: 820px) {
  nav.app-nav {
    position: sticky; top: 59px; bottom: auto;
    border-top: none; border-bottom: 1px solid var(--line);
    justify-content: center; gap: 6px; padding: 4px 0;
  }
  nav.app-nav button { flex: 0 0 auto; flex-direction: row; font-size: 14px; padding: 9px 18px; gap: 7px; border-radius: 8px; }
  nav.app-nav button.active { background: #FCEBEE; }
  .nav-badge { position: static; margin-left: 4px; }
  main.app-main { padding-bottom: 40px; }
}

/* ---------- 汎用 ---------- */
.card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px;
}
.view-title { font-size: 18px; font-weight: 700; color: var(--dark); margin: 4px 0 12px; }
.muted { color: #888; font-size: 13px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 10px; cursor: pointer;
  font-size: 15px; font-weight: 700; padding: 12px 18px;
  min-height: 44px;
}
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:active { background: var(--red-dark); }
.btn-outline { background: var(--white); color: var(--dark); border: 1.5px solid var(--gray); }
.btn-small { padding: 7px 12px; min-height: 36px; font-size: 13px; border-radius: 8px; }
.btn-danger-text { background: none; border: none; color: var(--danger-fg); font-size: 13px; cursor: pointer; text-decoration: underline; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; }
.empty-note { text-align: center; color: #999; padding: 40px 10px; font-size: 14px; }

/* ---------- ログイン ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { width: 100%; max-width: 380px; text-align: center; }
.login-logo {
  width: 64px; height: 64px; border-radius: 16px; background: var(--red); color: #fff;
  font-size: 34px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 12px;
}
.login-box h1 { font-size: 21px; color: var(--dark); margin: 0 0 4px; }
.login-box .sub { color: #888; font-size: 13px; margin-bottom: 22px; }
.login-box .btn { margin-bottom: 14px; }
.setup-note {
  background: var(--warn-bg); color: var(--warn-fg); font-size: 13px;
  border-radius: 8px; padding: 8px 12px; text-align: left; margin: 0 0 12px;
}

/* ---------- フォーム ---------- */
.field { margin-bottom: 14px; text-align: left; }
.field label { display: block; font-size: 13px; font-weight: 700; color: var(--dark); margin-bottom: 5px; }
.field label .req { color: var(--red); font-size: 11px; margin-left: 5px; }
.field input, .field select, .field textarea {
  width: 100%; border: 1.5px solid var(--gray); border-radius: 10px;
  padding: 11px 12px; font-size: 16px; background: var(--white); color: var(--text);
  font-family: inherit;
}
.field textarea { min-height: 110px; resize: vertical; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--red); }

/* ---------- 出勤区分チップ ---------- */
.att-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.att-chips button {
  border: 1.5px solid var(--gray); background: var(--white); color: var(--dark);
  border-radius: 999px; padding: 8px 15px; font-size: 14px; cursor: pointer; min-height: 40px;
}
.att-chips button.on { border-color: var(--red); background: #FCEBEE; color: var(--red); font-weight: 700; }

/* ---------- 日付・月ナビ ---------- */
.date-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.date-nav input[type="date"] {
  flex: 1; border: 1.5px solid var(--gray); border-radius: 10px;
  padding: 9px 10px; font-size: 16px; background: var(--white); font-family: inherit; min-width: 0;
}
.date-nav .nav-arrow {
  border: 1px solid var(--line); background: var(--white); border-radius: 8px;
  width: 42px; height: 42px; font-size: 16px; cursor: pointer; flex-shrink: 0;
}
.month-label { flex: 1; text-align: center; font-size: 16px; font-weight: 700; color: var(--dark); }

/* ---------- 日報表示 ---------- */
.report-sec { margin-bottom: 12px; }
.report-sec h4 { margin: 0 0 3px; font-size: 12px; color: #888; font-weight: 700; }
.report-sec p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; }
.report-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.report-head .rh-date { font-size: 16px; font-weight: 700; color: var(--dark); }
.report-head .rh-name { font-size: 14px; color: var(--dark); }
.badge {
  font-size: 12px; border-radius: 6px; padding: 2px 8px;
  background: var(--bg-soft); border: 1px solid var(--line); color: #666; white-space: nowrap;
}
.badge.att-work { background: #EAF4EB; border-color: #C4E0C7; color: var(--done); }
.badge.att-off { background: var(--holiday-bg); border-color: #C9DCF0; color: var(--holiday-fg); }
.badge.att-absent { background: var(--danger-bg); border-color: #F2BFC4; color: var(--danger-fg); }
.badge.att-none { background: #F1F1F1; border-color: #DDD; color: #999; }
.badge.cmt { background: #FFF3E0; border-color: #F2CFA8; color: #E65100; }
.updated-line { font-size: 11px; color: #AAA; margin-top: 6px; }

/* ---------- 未読お知らせ ---------- */
.unread-card {
  background: var(--warn-bg); border: 1px solid #EAD98F; border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 12px; cursor: pointer;
  font-size: 14px; color: var(--warn-fg); font-weight: 700;
}

/* ---------- カレンダー ---------- */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-dow { text-align: center; font-size: 11px; color: #888; font-weight: 700; padding: 2px 0; }
.cal-dow.sun { color: var(--danger-fg); }
.cal-dow.sat { color: var(--holiday-fg); }
.cal-cell {
  border: 1px solid var(--line); border-radius: 8px; background: var(--white);
  min-height: 52px; padding: 3px 4px; font-size: 12px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  position: relative;
}
.cal-cell.blank { border: none; background: none; cursor: default; }
.cal-cell .d { font-size: 12px; color: var(--dark); }
.cal-cell.today { border: 2px solid var(--red); }
.cal-cell .mark { font-size: 10px; border-radius: 5px; padding: 0 4px; line-height: 1.6; white-space: nowrap; max-width: 100%; overflow: hidden; }
.cal-cell .mark.att-work { background: #EAF4EB; color: var(--done); }
.cal-cell .mark.att-off { background: var(--holiday-bg); color: var(--holiday-fg); }
.cal-cell .mark.att-absent { background: var(--danger-bg); color: var(--danger-fg); }
.cal-cell .cdot {
  position: absolute; top: 2px; right: 3px;
  width: 8px; height: 8px; border-radius: 50%; background: #E65100;
}
.cal-legend { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; font-size: 11px; color: #888; }

/* ---------- 検索 ---------- */
.search-bar { display: flex; gap: 8px; margin-bottom: 10px; }
.search-bar input {
  flex: 1; border: 1.5px solid var(--gray); border-radius: 999px;
  padding: 11px 18px; font-size: 16px; background: var(--white); min-width: 0;
}
.search-bar input:focus { outline: none; border-color: var(--red); }
.filter-row { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.filter-row select {
  flex: 1; min-width: 120px; border: 1.5px solid var(--line); border-radius: 8px;
  padding: 8px 6px; font-size: 14px; background: var(--white); color: var(--dark);
}

/* ---------- 一覧カード（検索結果・チーム） ---------- */
.item-card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 10px; cursor: pointer;
}
.item-card:active { background: #FAF8F4; }
.item-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.item-head .t { font-size: 15px; font-weight: 700; color: var(--dark); }
.item-head .r { font-size: 12px; color: #999; }
.item-body { font-size: 13px; color: #666; margin-top: 4px; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- コメント ---------- */
.comment-list { margin: 10px 0 0; }
.comment-item {
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 12px; margin-bottom: 8px;
}
.comment-item.mine { background: #FCEBEE; border-color: #F2BFC4; }
.comment-item .c-head { font-size: 12px; font-weight: 700; color: var(--dark); }
.comment-item .c-head .c-time { font-weight: 400; color: #AAA; font-size: 11px; margin-left: 6px; }
.comment-item .c-body { font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-form { display: flex; gap: 8px; margin-top: 10px; align-items: flex-end; }
.comment-form textarea {
  flex: 1; border: 1.5px solid var(--gray); border-radius: 10px;
  padding: 9px 11px; font-size: 15px; min-height: 44px; max-height: 140px; resize: vertical; font-family: inherit;
}
.comment-form textarea:focus { outline: none; border-color: var(--red); }

/* ---------- 設定・名簿 ---------- */
.master-list { list-style: none; margin: 6px 0; padding: 0; }
.master-list li {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 2px; border-bottom: 1px solid var(--line); font-size: 14px; flex-wrap: wrap;
}
.master-list li span.m-name { flex: 1; overflow-wrap: anywhere; min-width: 8em; }
.add-row { display: flex; gap: 8px; margin-top: 10px; }
.add-row input { flex: 1; border: 1.5px solid var(--gray); border-radius: 8px; padding: 9px 10px; font-size: 15px; min-width: 0; }

/* ---------- モーダル ---------- */
#modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 40;
  display: flex; align-items: flex-end; justify-content: center;
}
#modal-box {
  background: var(--white); width: 100%; max-width: 560px;
  border-radius: 16px 16px 0 0; padding: 18px 16px 24px;
  max-height: 88vh; overflow-y: auto;
}
@media (min-width: 820px) {
  #modal-overlay { align-items: center; }
  #modal-box { border-radius: 16px; }
}
#modal-box h3 { margin: 0 0 14px; font-size: 17px; color: var(--dark); }
.modal-btns { display: flex; gap: 10px; margin-top: 14px; }
.modal-btns .btn { flex: 1; }

/* ---------- トースト ---------- */
#toast {
  position: fixed; left: 50%; bottom: 86px; transform: translateX(-50%);
  background: var(--dark); color: #fff; font-size: 14px;
  padding: 10px 20px; border-radius: 999px; z-index: 60;
  opacity: 0; transition: opacity .25s; pointer-events: none;
  max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1; }
@media (min-width: 820px) { #toast { bottom: 40px; } }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
