:root {
  --accent:   #D85D90;
  --accent-l: #fce8f2;
  --base:     #F5F5F7;
  --text:     #2B3050;
  --text-mid: #6B7090;
  --text-lt:  #A8ADCA;
  --white:    #FFFFFF;
  --border:   #E3E3EC;
  --gold:     #8CBCA3;
  --purple:   #6168A2;
  --shadow:       0 2px 10px rgba(43,48,80,0.07);
  --shadow-hover: 0 6px 18px rgba(43,48,80,0.13);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'DM Sans','Noto Sans JP',-apple-system,sans-serif;
  background: var(--base); color: var(--text); min-height: 100vh;
}

/* ── ログイン ── */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: #1B2140;
}
.login-box {
  background: var(--white); border-radius: 16px;
  padding: 40px 36px; width: 340px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2); text-align: center;
}
.login-title {
  font-size: 32px; color: var(--text); margin-bottom: 4px;
}
.login-sub {
  font-size: 11px; letter-spacing: 3px; color: var(--text-lt);
  margin-bottom: 28px; font-weight: 600;
}
.login-input {
  width: 100%; border: 1.5px solid var(--border); border-radius: 8px;
  padding: 11px 14px; font-size: 14px; font-family: inherit;
  margin-bottom: 12px; outline: none; transition: border-color .2s;
}
.login-input:focus { border-color: var(--accent); }
.login-btn {
  width: 100%; background: var(--accent); color: white;
  border: none; border-radius: 8px; padding: 12px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  margin-top: 4px;
}
.login-error { color: var(--accent); font-size: 12px; margin-top: 10px; min-height: 16px; }

/* ── ヘッダー ── */
.header {
  background: #1B2140; color: var(--white);
  padding: 0 24px; height: 62px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 200;
  box-shadow: 0 2px 10px rgba(43,48,80,0.2);
}
.app-name { font-size: 15px; font-weight: 600; letter-spacing: 2px; display: flex; align-items: center; gap: 10px; }
.app-name-bar { width: 3px; height: 20px; background: var(--accent); border-radius: 2px; }
.app-name-en { font-family: 'Fraunces',serif; font-style: italic; font-weight: 400; font-size: 22px; letter-spacing: 0; }
.app-name-sub { font-size: 10px; font-weight: 400; letter-spacing: 2px; opacity: .6; margin-left: 2px; }
.today-info { font-size: 11px; font-weight: 300; opacity: .8; text-align: right; line-height: 1.7; letter-spacing: .5px; cursor: pointer; }
.user-menu { position: absolute; top: 62px; right: 16px; background: var(--white); border-radius: 10px; box-shadow: var(--shadow-hover); overflow: hidden; z-index: 300; min-width: 140px; }
.user-menu-item { padding: 12px 18px; font-size: 13px; cursor: pointer; transition: background .15s; }
.user-menu-item:hover { background: var(--base); }
.user-menu-item.danger { color: var(--accent); }

/* ── タブ ── */
.tab-bar { background: var(--white); display: flex; border-bottom: 1px solid var(--border); position: sticky; top: 62px; z-index: 100; }
.tab { flex: 1; padding: 13px 0; text-align: center; font-size: 12px; border: none; background: none; cursor: pointer; color: var(--text-lt); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; letter-spacing: .5px; transition: color .2s; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── フィルタ ── */
.filter-bar { background: var(--white); padding: 10px 20px; display: flex; gap: 8px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.chip { padding: 5px 16px; border-radius: 20px; border: 1.5px solid var(--border); font-size: 12px; cursor: pointer; background: var(--white); white-space: nowrap; font-weight: 500; color: var(--text-mid); transition: all .2s; }
.chip.active { background: var(--accent); color: var(--white); border-color: var(--accent); }

/* ── スクリーン ── */
.screen { display: none; }
.screen.active { display: block; }
.container { max-width: 720px; margin: 0 auto; padding: 22px 20px 96px; }

/* ── セクション ── */
.section { margin-bottom: 32px; }
.sec-title { font-size: 10px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--text-mid); margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.sec-en { font-family: 'Fraunces',serif; font-style: italic; font-weight: 300; font-size: 11px; opacity: .5; letter-spacing: 0; }
.sec-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.d-red    { background: var(--accent); }
.d-gold   { background: var(--gold); }
.d-green  { background: var(--text); }
.d-purple { background: var(--purple); }
.badge { border-radius: 10px; padding: 1px 8px; font-size: 10px; font-weight: 700; }
.b-red    { background: var(--accent); color: #fff; }
.b-gold   { background: var(--gold); color: #fff; }
.b-green  { background: var(--text); color: #fff; }
.b-purple { background: var(--purple); color: #fff; }

/* ── 進捗バー ── */
.prog-wrap { margin-bottom: 14px; }
.prog-label { font-size: 11px; color: var(--text-mid); margin-bottom: 5px; }
.prog-bar { background: var(--border); border-radius: 4px; height: 4px; overflow: hidden; }
.prog-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width .4s; }

/* ── タスクカード ── */
.task-card { background: var(--white); border-radius: 12px; padding: 14px 16px; margin-bottom: 8px; display: flex; align-items: flex-start; gap: 12px; box-shadow: var(--shadow); cursor: pointer; border-left: 3px solid transparent; transition: box-shadow .2s, transform .15s; }
.task-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-1px); }
.c-today    { border-left-color: var(--accent); }
.c-week     { border-left-color: var(--gold); }
.c-month    { border-left-color: var(--text); }
.c-upcoming { border-left-color: var(--purple); }
.cb { width: 18px; height: 18px; border: 1.5px solid var(--border); border-radius: 5px; flex-shrink: 0; margin-top: 1px; display: flex; align-items: center; justify-content: center; font-size: 10px; transition: all .2s; }
.cb.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.task-body { flex: 1; min-width: 0; }
.task-name { font-size: 13px; font-weight: 500; line-height: 1.5; color: var(--text); }
.task-name.done { text-decoration: line-through; color: var(--text-lt); }
.task-tags { display: flex; gap: 5px; margin-top: 6px; flex-wrap: wrap; align-items: center; }
.tag { padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 600; letter-spacing: .3px; }
.t-sc     { background: var(--accent-l); color: var(--accent); }
.t-estate { background: #e8f5ef; color: var(--gold); }
.t-all    { background: #eeeff8; color: var(--purple); }
.t-freq   { background: #eeeff8; color: var(--purple); }
.t-date   { color: var(--text-lt); font-size: 10px; }
.task-note { font-size: 11px; color: var(--text-lt); margin-top: 3px; line-height: 1.4; }
.task-actions { display: flex; gap: 6px; margin-top: 6px; }
.btn-edit-sm { font-size: 10px; color: var(--text-mid); background: var(--base); border: none; border-radius: 4px; padding: 2px 8px; cursor: pointer; }
.btn-edit-sm:hover { background: var(--border); }

/* ── タスク管理 ── */
.list-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.list-header h2 { font-size: 15px; font-weight: 700; }
.btn-add { background: var(--accent); color: white; border: none; border-radius: 20px; padding: 8px 22px; font-size: 12px; cursor: pointer; font-weight: 600; letter-spacing: .5px; box-shadow: 0 3px 10px rgba(216,93,144,0.3); transition: box-shadow .2s, transform .15s; }
.btn-add:hover { box-shadow: 0 5px 14px rgba(216,93,144,0.4); transform: translateY(-1px); }
.btn-add-sm { background: var(--accent); color: white; border: none; border-radius: 16px; padding: 5px 14px; font-size: 11px; cursor: pointer; font-weight: 600; }
.freq-filter { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 16px; }
.fchip { padding: 5px 14px; border-radius: 16px; font-size: 11px; border: 1px solid var(--border); background: var(--white); cursor: pointer; white-space: nowrap; color: var(--text-mid); font-weight: 500; transition: all .2s; }
.fchip.active { background: var(--text); color: white; border-color: var(--text); }
.trow { background: var(--white); border-radius: 10px; padding: 12px 16px; margin-bottom: 5px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; transition: box-shadow .2s; }
.trow:hover { box-shadow: var(--shadow-hover); }
.trow-name { flex: 1; font-size: 13px; font-weight: 500; }
.trow-freq { font-size: 10px; background: #eeeff8; color: var(--purple); padding: 2px 8px; border-radius: 4px; white-space: nowrap; font-weight: 600; }
.trow-timing { font-size: 11px; color: var(--text-lt); white-space: nowrap; min-width: 80px; text-align: right; }
.trow-del { font-size: 12px; color: var(--text-lt); background: none; border: none; cursor: pointer; padding: 2px 6px; }
.trow-del:hover { color: var(--accent); }

/* ── 請求書 ── */
.month-nav-bar { background: var(--white); border-radius: 12px; padding: 16px 20px; margin-bottom: 16px; box-shadow: var(--shadow); display: flex; align-items: center; justify-content: space-between; }
.month-title { font-size: 19px; font-weight: 700; letter-spacing: 1px; }
.month-sub { font-size: 11px; color: var(--text-lt); margin-top: 3px; }
.nav-btn { background: none; border: 1px solid var(--border); border-radius: 8px; padding: 6px 14px; cursor: pointer; font-size: 13px; color: var(--text-mid); transition: all .2s; }
.nav-btn:hover { border-color: var(--accent); color: var(--accent); }
.inv-day { background: var(--white); border-radius: 12px; padding: 14px 16px; margin-bottom: 8px; box-shadow: var(--shadow); display: flex; gap: 16px; align-items: flex-start; }
.day-wrap { width: 36px; flex-shrink: 0; text-align: center; }
.day-num { font-size: 24px; font-weight: 700; color: var(--accent); line-height: 1; }
.day-lbl { font-size: 10px; color: var(--text-lt); margin-top: 2px; }
.inv-items { flex: 1; }
.inv-item { display: flex; gap: 8px; align-items: center; font-size: 12px; padding: 5px 0; border-bottom: 1px solid var(--base); }
.inv-item:last-child { border-bottom: none; }
.inv-co { flex: 1; color: var(--text); font-weight: 500; }
.inv-pur { flex: 1; color: var(--text-mid); font-size: 11px; }
.inv-bank { font-size: 10px; background: var(--accent-l); color: var(--accent); padding: 2px 8px; border-radius: 4px; white-space: nowrap; font-weight: 600; }
.inv-del { font-size: 11px; color: var(--text-lt); background: none; border: none; cursor: pointer; }
.inv-del:hover { color: var(--accent); }

/* ── メモ ── */
.memo-new { background: var(--white); border-radius: 12px; padding: 16px; margin-bottom: 20px; box-shadow: var(--shadow); }
.memo-new h3 { font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.memo-new textarea { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 13px; font-family: inherit; resize: none; height: 80px; margin-bottom: 10px; color: var(--text); background: var(--base); outline: none; transition: border-color .2s; }
.memo-new textarea:focus { border-color: var(--accent); }
.memo-select { flex: 1; border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; font-size: 12px; font-family: inherit; background: var(--base); color: var(--text-mid); outline: none; }
.memo-actions { display: flex; gap: 8px; justify-content: flex-end; }
.btn-m { border: none; border-radius: 20px; padding: 7px 18px; font-size: 12px; cursor: pointer; font-weight: 600; transition: all .2s; }
.btn-m.primary { background: var(--accent); color: white; box-shadow: 0 2px 8px rgba(216,93,144,0.3); }
.btn-m.sec { background: var(--white); color: var(--text-mid); border: 1px solid var(--border); }
.sec-sub { font-size: 10px; font-weight: 700; color: var(--text-mid); letter-spacing: 2px; text-transform: uppercase; margin-bottom: 12px; }
.memo-card { background: var(--white); border-radius: 12px; padding: 14px 16px; margin-bottom: 8px; box-shadow: var(--shadow); border-left: 3px solid var(--accent); }
.memo-card.estate { border-left-color: var(--gold); }
.memo-card.ceo { border-left-color: var(--purple); }
.memo-dt { font-size: 10px; color: var(--text-lt); margin-bottom: 5px; }
.memo-txt { font-size: 13px; color: var(--text); line-height: 1.6; }
.memo-link { font-size: 11px; color: var(--purple); margin-top: 6px; }
.memo-del { float: right; font-size: 11px; color: var(--text-lt); background: none; border: none; cursor: pointer; }
.memo-del:hover { color: var(--accent); }

/* ── 社長案件 ── */
.ceo-card { background: var(--white); border-radius: 12px; margin-bottom: 10px; box-shadow: var(--shadow); overflow: hidden; cursor: pointer; border-left: 3px solid var(--purple); transition: box-shadow .2s; }
.ceo-card:hover { box-shadow: var(--shadow-hover); }
.ceo-header { padding: 14px 16px; display: flex; align-items: center; gap: 10px; }
.ceo-title { flex: 1; font-size: 14px; font-weight: 500; }
.ceo-status { font-size: 10px; font-weight: 700; padding: 3px 10px; border-radius: 20px; white-space: nowrap; }
.st-open     { background: #eee; color: #999; }
.st-research { background: #e8f5ef; color: var(--gold); }
.st-working  { background: #eeeff8; color: var(--purple); }
.st-waiting  { background: var(--accent-l); color: var(--accent); }
.st-done     { background: #e8f5ef; color: var(--gold); }
.ceo-chevron { font-size: 12px; color: var(--text-lt); transition: transform .2s; flex-shrink: 0; }
.ceo-card.expanded .ceo-chevron { transform: rotate(180deg); }
.ceo-actions { display: flex; gap: 6px; }
.ceo-del { font-size: 11px; color: var(--text-lt); background: none; border: none; cursor: pointer; }
.ceo-del:hover { color: var(--accent); }
.ceo-timeline { padding: 4px 16px 14px; border-top: 1px solid var(--base); display: none; }
.ceo-card.expanded .ceo-timeline { display: block; }
.tl-item { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; }
.tl-date { font-size: 11px; color: var(--text-lt); white-space: nowrap; width: 76px; flex-shrink: 0; padding-top: 2px; }
.tl-mid { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; margin-top: 5px; }
.tl-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--purple); flex-shrink: 0; }
.tl-line { width: 1px; min-height: 18px; flex: 1; background: var(--border); margin-top: 3px; }
.tl-item:last-of-type .tl-line { display: none; }
.tl-text { font-size: 13px; color: var(--text); flex: 1; line-height: 1.5; }
.tl-del { font-size: 10px; color: var(--text-lt); background: none; border: none; cursor: pointer; padding: 0 4px; }
.tl-del:hover { color: var(--accent); }
.ceo-add-memo { display: flex; align-items: center; gap: 5px; padding: 8px 0 0 87px; font-size: 12px; color: var(--accent); cursor: pointer; font-weight: 600; letter-spacing: .3px; }
.ceo-status-select { font-size: 11px; border: 1px solid var(--border); border-radius: 6px; padding: 3px 8px; background: var(--base); color: var(--text-mid); cursor: pointer; }

/* ── モーダル ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(43,48,80,0.45); z-index: 500; display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 600px) { .modal-overlay { align-items: center; } }
.modal-box { background: var(--white); border-radius: 16px 16px 0 0; padding: 24px 20px 32px; width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; }
@media (min-width: 600px) { .modal-box { border-radius: 16px; } }
.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 18px; }
.modal-label { font-size: 11px; font-weight: 600; color: var(--text-mid); letter-spacing: 1px; text-transform: uppercase; display: block; margin-bottom: 5px; margin-top: 12px; }
.modal-input { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font-size: 13px; font-family: inherit; background: var(--base); color: var(--text); outline: none; transition: border-color .2s; }
.modal-input:focus { border-color: var(--accent); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.req { color: var(--accent); }

/* ── ボトムナビ ── */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; background: var(--white); border-top: 1px solid var(--border); display: flex; z-index: 200; box-shadow: 0 -2px 12px rgba(43,48,80,0.07); }
.bnav { flex: 1; padding: 9px 0; text-align: center; font-size: 10px; color: var(--text-lt); cursor: pointer; transition: color .2s; font-weight: 500; }
.bnav.active { color: var(--accent); }
.bnav-icon { font-size: 18px; display: block; margin-bottom: 2px; }

/* ── ユーティリティ ── */
.empty { text-align: center; padding: 32px; color: var(--text-lt); font-size: 13px; }
.loading { text-align: center; padding: 24px; color: var(--text-lt); font-size: 12px; }
