/* =====================================================================
   SHUREXIA デザインガイド（design/DESIGN.md）準拠
   ===================================================================== */
:root {
  --cream: #FBF6EC; --white: #FFFFFF;
  --ink: #3B2416; --ink-sub: #5E4636;
  --honey: #F2B33D; --honey-hover: #E8A221; --honey-soft: #FCE9C2;
  --latte: #EADBC8; --line: #EADFCB; --berry: #6E1F2F;
  --alert: #E04A3F; --placeholder: #E4DED3; --muted: #8C7D70;
  --en: #B39882; --line-soft: #F0E8DA;
  --radius-l: 28px; --radius-m: 20px; --radius-s: 12px;
  --font-round: 'Zen Maru Gothic', sans-serif;
  --font-body: 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Noto Sans CJK JP', Meiryo, system-ui, sans-serif;
  --font-hand: 'Gveret Levin', var(--font-round);
  --shadow-pop: 0 18px 40px -24px rgba(59, 36, 22, .35);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--cream); color: var(--ink); font-family: var(--font-body);
  font-size: 16px; line-height: 1.8; -webkit-font-smoothing: antialiased; min-height: 100vh;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
.hidden { display: none !important; }

/* アイコン（Material Symbols Rounded） */
.ms {
  font-family: 'Material Symbols Rounded'; font-weight: normal; font-style: normal; font-size: 22px; line-height: 1;
  letter-spacing: normal; text-transform: none; display: inline-block; white-space: nowrap; direction: ltr;
  -webkit-font-feature-settings: 'liga'; font-feature-settings: 'liga'; -webkit-font-smoothing: antialiased;
  font-variation-settings: 'FILL' 0, 'wght' 500, 'GRAD' 0, 'opsz' 24; flex-shrink: 0;
}
.ms.fill { font-variation-settings: 'FILL' 1, 'wght' 500, 'GRAD' 0, 'opsz' 24; }

/* 見出し：日本語＋手書き英字、下に細線＋はちみつの短い線 */
.heading {
  display: flex; align-items: baseline; gap: 12px; position: relative;
  padding-bottom: 12px; margin-bottom: 20px;
  background: linear-gradient(var(--line-soft), var(--line-soft)) left bottom / 100% 3px no-repeat;
}
.heading::after { content: ""; position: absolute; left: 0; bottom: 0; width: 64px; height: 3px; background: var(--honey); border-radius: 2px; }
.heading h1, .heading h2 {
  font-family: var(--font-round); font-weight: 900; margin: 0; line-height: 1.5; font-size: clamp(22px, 5.6vw, 30px); word-break: break-word;
}
.en { font-family: var(--font-hand); font-weight: 400; color: var(--en); font-size: 17px; letter-spacing: .06em; line-height: 1; white-space: nowrap; }

/* ===== ボタン ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 14px 30px; border-radius: 999px;
  font-family: var(--font-round); font-weight: 700; font-size: 16px;
  border: 2px solid transparent; background: transparent;
  transition: background-color .4s ease, color .4s ease, border-color .4s ease, opacity .2s;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn .ms { font-size: 20px; }
.btn-primary { background: var(--honey); color: var(--ink); }
.btn-primary:hover:not(:disabled) { background: var(--honey-hover); }
.btn-secondary { background: var(--white); color: var(--ink); border-color: var(--ink); }
.btn-secondary:hover:not(:disabled) { background: var(--honey-soft); }
.btn-danger { background: var(--white); color: var(--alert); border-color: var(--line); }
.btn-danger:hover { border-color: var(--alert); }
.btn-block { width: 100%; }
@media (max-width: 768px) { .btn { min-height: 44px; padding: 8px 20px; font-size: 14px; } }
.icon-btn {
  border: none; background: transparent; width: 40px; height: 40px; border-radius: 50%; color: var(--ink-sub);
  display: inline-flex; align-items: center; justify-content: center; transition: background-color .4s ease;
}
.icon-btn:hover { background: var(--honey-soft); }

/* ===== ロゴ ===== */
.brand { display: flex; align-items: center; }
.brand img { height: 40px; width: auto; }
.brand-word { font-family: var(--font-round); font-weight: 900; letter-spacing: .1em; font-size: 22px; }

/* ===== ログイン ===== */
.login-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; gap: 18px; }
.login-wrap > .brand img { height: 56px; }
.login-chara { width: 150px; height: 120px; object-fit: contain; margin-bottom: -26px; position: relative; z-index: 1; }
.login-card { width: 100%; max-width: 400px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 32px 26px 26px; }
.tag {
  display: inline-block; background: var(--honey-soft); color: var(--ink); font-family: var(--font-round); font-weight: 700;
  font-size: 12px; padding: 2px 12px; border-radius: 8px; line-height: 1.7;
}
.field { margin-bottom: 16px; }
.field label { display: block; font-family: var(--font-round); font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.input, .textarea, .select {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--white);
  padding: 12px 14px; outline: none; font-size: 16px; transition: border-color .4s ease, box-shadow .4s ease;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--honey); box-shadow: 0 0 0 4px var(--honey-soft); }
.textarea { min-height: 120px; resize: vertical; line-height: 1.7; }
.select { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--ink-sub) 50%), linear-gradient(135deg, var(--ink-sub) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.hint { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.hint .ms { font-size: 16px; }
.error-msg { color: var(--alert); font-size: 13px; min-height: 20px; margin: 2px 0 10px; }
.login-note { font-size: 12px; color: var(--muted); margin: 14px 0 0; text-align: center; }

/* ===== ヘッダー ===== */
.header {
  position: sticky; top: 0; z-index: 20; background: rgba(251, 246, 236, .96);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); padding: calc(env(safe-area-inset-top) + 8px) 16px 0;
}
.header-row { display: flex; align-items: center; justify-content: space-between; max-width: 760px; margin: 0 auto; }
.me-chip {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--white);
  border-radius: 999px; padding: 4px 14px 4px 4px; font-family: var(--font-round); font-size: 14px; font-weight: 700;
  transition: background-color .4s ease;
}
.me-chip:hover { background: var(--honey-soft); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--honey-soft); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-round); font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.tabs { display: flex; gap: 4px; max-width: 760px; margin: 4px auto 0; }
.tab {
  border: none; background: transparent; padding: 10px 12px 12px; font-family: var(--font-round); font-weight: 700; font-size: 15px; color: var(--muted);
  border-bottom: 3px solid transparent; display: inline-flex; align-items: center; gap: 6px; margin-bottom: -1px; transition: color .4s ease;
}
.tab .ms { font-size: 20px; }
.tab.active { color: var(--ink); border-bottom-color: var(--honey); }
.count { background: var(--honey-soft); color: var(--ink); font-size: 12px; padding: 0 8px; border-radius: 999px; line-height: 1.7; }

/* ===== 一覧 ===== */
.main { max-width: 760px; margin: 0 auto; padding: 20px 16px 120px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0; border: 1px solid var(--line); background: var(--white); border-radius: 999px; min-height: 36px;
  padding: 4px 14px; font-family: var(--font-round); font-size: 14px; font-weight: 700; color: var(--ink-sub);
  display: inline-flex; align-items: center; gap: 6px; transition: background-color .4s ease, border-color .4s ease;
}
.chip:hover { background: var(--honey-soft); }
.chip .dot { width: 10px; height: 10px; border-radius: 50%; }
.chip .ms { font-size: 18px; }
.chip.active { background: var(--honey-soft); border-color: var(--honey); color: var(--ink); }

.card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 18px 20px; margin-bottom: 12px;
  cursor: pointer; transition: border-color .4s ease; animation: rise .5s ease both;
}
.card:hover { border-color: var(--honey); }
.card.archived { background: rgba(255, 255, 255, .6); }
.card.archived .card-title { color: var(--ink-sub); }
.card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; flex-wrap: wrap; }
.num { font-family: var(--font-hand); font-size: 17px; letter-spacing: .06em; color: var(--en); line-height: 1; }
.cat {
  font-family: var(--font-round); font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 8px;
  background: var(--honey-soft); color: var(--ink); line-height: 1.7;
}
.card-title { font-family: var(--font-round); font-size: 18px; font-weight: 900; margin: 2px 0 2px; word-break: break-word; line-height: 1.5; }
.card-body {
  color: var(--ink-sub); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  white-space: pre-wrap; word-break: break-word; line-height: 1.8;
}
.thumbs { display: flex; gap: 10px; margin-top: 12px; }
.thumbs img, .thumb-ph { width: 64px; height: 64px; object-fit: cover; border-radius: var(--radius-s); background: var(--placeholder); transition: transform .4s ease; }
.thumbs img:hover { transform: scale(1.04); }
.card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; padding-top: 12px;
  border-top: 1px dashed var(--line); font-size: 12px; color: var(--muted);
}
.card-foot .who { display: inline-flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.card-foot .who .ms { font-size: 16px; }
.check-btn {
  border: 2px solid var(--honey); background: var(--white); color: var(--ink); border-radius: 999px; min-height: 36px;
  padding: 2px 14px 2px 8px; font-family: var(--font-round); font-size: 13px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; transition: background-color .4s ease;
}
.check-btn .ms { color: var(--honey); font-size: 22px; }
.check-btn:hover { background: var(--honey-soft); }
.done-mark { color: var(--honey); display: inline-flex; align-items: center; gap: 2px; font-family: var(--font-round); font-weight: 700; font-size: 12px; }
.done-mark .ms { font-size: 20px; }

.assignee {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-sub);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 12px 2px 2px; white-space: nowrap;
}
.assignee b { color: var(--ink); font-family: var(--font-round); font-weight: 700; font-size: 13px; }
.assignee .avatar { width: 24px; height: 24px; font-size: 11px; }
.assignee.none { padding: 3px 12px; color: var(--muted); }

.empty { text-align: center; color: var(--ink-sub); padding: 40px 20px; font-family: var(--font-round); font-weight: 700; }
.empty img { width: 200px; height: 160px; object-fit: contain; margin: 0 auto 8px; }
.empty .ms { font-size: 56px; color: var(--honey); margin-bottom: 8px; }

.fab {
  position: fixed; right: 20px; bottom: calc(env(safe-area-inset-bottom) + 20px); z-index: 20;
  width: 60px; height: 60px; border-radius: 50%; border: none; background: var(--honey); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; box-shadow: var(--shadow-pop);
  transition: background-color .4s ease;
}
.fab .ms { font-size: 32px; }
.fab:hover { background: var(--honey-hover); }

/* ===== シート（ポップアップ） ===== */
.overlay {
  position: fixed; inset: 0; z-index: 50; background: rgba(59, 36, 22, .3);
  display: flex; align-items: flex-end; justify-content: center; animation: fade .25s ease;
}
@media (min-width: 640px) { .overlay { align-items: center; } }
.sheet {
  background: var(--white); width: 100%; max-width: 600px; max-height: 92vh; overflow-y: auto;
  border-radius: var(--radius-l) var(--radius-l) 0 0; padding: 8px 22px calc(env(safe-area-inset-bottom) + 24px);
  box-shadow: var(--shadow-pop); animation: up .25s ease;
}
@media (min-width: 640px) { .sheet { border-radius: var(--radius-l); } }
.sheet-handle { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 6px auto 4px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; min-height: 40px; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
@keyframes rise { from { transform: translateY(10px); opacity: 0; } }

.detail-body { white-space: pre-wrap; word-break: break-word; margin-bottom: 18px; }
.detail-meta { font-size: 13px; color: var(--muted); margin-bottom: 14px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.detail-meta span { display: inline-flex; align-items: center; gap: 4px; }
.detail-meta .ms { font-size: 18px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-bottom: 18px; }
.gallery img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-s); cursor: zoom-in; background: var(--placeholder); transition: transform .4s ease; }
.gallery img:hover { transform: scale(1.04); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 4px 0 28px; }
.actions-spacer { flex: 1; }
.round-btn {
  width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--line); background: var(--white); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; transition: background-color .4s ease, border-color .4s ease;
}
.round-btn:hover { background: var(--honey-soft); }
.round-btn .ms { font-size: 22px; }
.round-btn.danger { color: var(--alert); }
.round-btn.danger:hover { background: var(--white); border-color: var(--alert); }

.comment { display: flex; gap: 10px; margin-bottom: 12px; }
.comment-bubble { background: var(--cream); border-radius: 4px var(--radius-m) var(--radius-m) var(--radius-m); padding: 10px 14px; flex: 1; min-width: 0; }
.comment-head { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; }
.comment-head b { color: var(--ink); font-family: var(--font-round); font-weight: 700; }
.comment-text { white-space: pre-wrap; word-break: break-word; font-size: 15px; line-height: 1.7; }
.comment-del { border: none; background: none; color: var(--muted); font-size: 12px; padding: 0; }
.comment-del:hover { color: var(--alert); }
.comment-form { margin-top: 10px; }
.comment-row { display: flex; gap: 6px; align-items: flex-end; }
.comment-form .textarea { min-height: 48px; height: 48px; padding: 11px 14px; }
.comment-form .btn { padding: 8px 18px; flex-shrink: 0; min-height: 48px; }
.attach-btn { width: 48px; height: 48px; flex-shrink: 0; border: 1px solid var(--line); background: var(--white); }
.attach-btn .ms { font-size: 24px; }
.attach-btn:disabled { opacity: .4; cursor: default; }
.comment-pending { margin: 0 0 10px; }
.comment-imgs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.comment-imgs img, .comment-imgs .thumb-ph { width: 96px; height: 96px; object-fit: cover; border-radius: var(--radius-s); background: var(--placeholder); cursor: zoom-in; transition: transform .4s ease; }
.comment-imgs img:hover { transform: scale(1.04); }
.no-comment { color: var(--muted); font-size: 14px; margin-bottom: 8px; }

.upload-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.upload-item { position: relative; width: 76px; height: 76px; }
.upload-item img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-s); }
.upload-item button {
  position: absolute; top: -6px; right: -6px; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--white);
  background: var(--ink); color: var(--white); padding: 0; display: inline-flex; align-items: center; justify-content: center;
}
.upload-item button .ms { font-size: 16px; }
.upload-add {
  width: 76px; height: 76px; border-radius: var(--radius-s); border: 2px dashed var(--line); background: var(--cream); color: var(--ink-sub);
  display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 11px; gap: 2px; font-family: var(--font-round); font-weight: 700;
  transition: border-color .4s ease;
}
.upload-add:hover { border-color: var(--honey); }
.upload-add .ms { font-size: 26px; }

.lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(59, 36, 22, .88); display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .25s ease; }
.lightbox img { max-height: 90vh; border-radius: var(--radius-s); }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 96px); transform: translateX(-50%); z-index: 90;
  background: var(--ink); color: var(--white); padding: 10px 20px; border-radius: 999px; font-family: var(--font-round); font-size: 14px; font-weight: 700;
  box-shadow: var(--shadow-pop); animation: fade .25s ease; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px;
}
.toast .ms { color: var(--honey); font-size: 20px; }
.demo-banner { background: var(--honey-soft); color: var(--ink); text-align: center; font-family: var(--font-round); font-size: 12px; font-weight: 700; padding: 4px 8px; border-bottom: 1px solid var(--line); }
.spinner { text-align: center; padding: 40px; color: var(--muted); }
