/* ============================================================
   秘書室スケジュール — Structured風のダークUI
   ADHD配慮：1行を大きく、要素を減らし、色と形の両方で区別する。
   ============================================================ */

:root {
  --bg: #000000;
  --sheet: #1A1A1C;
  --sheet-2: #232326;
  --main: #57C08C;        /* 基調の緑 */
  --main-dim: #3E9268;
  --night: #4E8FE0;
  --text: #FFFFFF;
  --sub: #8E8E93;
  --line: #2E2E31;
  --ok: #56C489;
  --warn: #E8B04B;
  --danger: #EF6B6B;
  --rail: 62px;   /* アイコン列の幅 */
  --icon: 56px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* display を指定した要素でも hidden がちゃんと効くようにする */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Hiragino Sans", "BIZ UDPGothic", "Yu Gothic UI", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; color: inherit; }

.phone {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(128px + env(safe-area-inset-bottom));
}

/* ---------- 上部 ---------- */

/* iPhoneのホーム画面から開いたとき、上のノッチ部分に食い込まないようにする */
.top { padding: calc(18px + env(safe-area-inset-top)) 20px 10px; flex: none; }

.top-date {
  background: none;
  border: 0;
  padding: 0;
  display: flex;
  align-items: baseline;
  gap: 2px;
  font-size: 29px;
  font-weight: 800;
  letter-spacing: -0.01em;
  cursor: pointer;
}
.top-date .year { color: var(--main); }
.top-date .chev { color: var(--main); font-size: 26px; margin-left: 6px; }

.week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-top: 14px;
}

.day {
  background: none;
  border: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.day-w { font-size: 13px; color: var(--sub); line-height: 1.2; }

.day-n {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 20px;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
}
.day.is-sel .day-n {
  background: #FFFFFF;
  color: #000000;
  text-decoration: none;
}
.day.is-today:not(.is-sel) .day-n { color: var(--main); }

.day-dots { display: flex; gap: 2px; height: 8px; align-items: center; }
.day-dots i { width: 7px; height: 7px; border-radius: 50%; display: block; }

/* ---------- メインカード ---------- */

.sheet {
  background: var(--sheet);
  border-radius: 26px 26px 0 0;
  flex: 1;
  padding: 0 0 20px;
  min-height: 60vh;
}

.grabber {
  width: 42px;
  height: 5px;
  border-radius: 3px;
  background: #48484C;
  margin: 9px auto 4px;
}

.view { padding: 6px 18px 0; }
.view-title { font-size: 20px; font-weight: 800; margin: 10px 0 4px; }
.view-note { font-size: 14px; color: var(--sub); margin: 0 0 16px; line-height: 1.6; }

/* ---------- エネルギー選択 ---------- */

.energy {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 0 16px;
}

.energy-label { font-size: 13px; color: var(--sub); flex: none; }

.eg {
  flex: 1;
  background: var(--sheet-2);
  border: 1.5px solid transparent;
  border-radius: 14px;
  padding: 8px 4px;
  text-align: center;
  cursor: pointer;
  line-height: 1.3;
}
.eg .eg-dots { font-size: 13px; letter-spacing: 1px; color: var(--sub); display: block; }
.eg .eg-name { font-size: 13.5px; font-weight: 700; color: var(--sub); }
.eg.is-on { border-color: var(--main); background: rgba(87, 192, 140, 0.16); }
.eg.is-on .eg-dots, .eg.is-on .eg-name { color: var(--main); }

.replan {
  flex: none;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--sheet-2);
  border: 0;
  color: var(--sub);
  font-size: 19px;
  cursor: pointer;
}
.replan:active { transform: rotate(90deg); }

/* ---------- 終日の予定 ---------- */

.allday:not(:empty) { margin: 0 0 14px; display: flex; flex-direction: column; gap: 7px; }

.ad {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--sheet-2);
  border-radius: 12px;
  padding: 9px 14px;
  cursor: pointer;
}
.ad-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--pill); flex: none; }
.ad-t { flex: 1; font-weight: 700; font-size: 15px; min-width: 0; }
.ad-c { font-size: 12px; color: var(--sub); flex: none; }

/* ---------- タイムライン ---------- */

.timeline { padding-bottom: 10px; }

.row {
  display: grid;
  grid-template-columns: 48px var(--rail) 1fr 44px;
  align-items: stretch;   /* アイコン列を行いっぱいに伸ばして線をつなぐ */
  column-gap: 6px;
}

.r-time {
  padding-top: 15px;
  text-align: right;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--sub);
  line-height: 1.45;
}
.r-time b { display: block; font-weight: 400; }
.r-time i { font-style: normal; opacity: 0.55; }

/* アイコン列＋つなぎ線 */
.r-rail { position: relative; display: flex; justify-content: center; }

.r-rail::after {
  content: "";
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 8px;
  bottom: 0;
  width: 3px;
  border-radius: 2px;
  background: var(--rail-color, var(--main));
  z-index: 0;
}
.row:last-child .r-rail::after { display: none; }

.r-icon {
  position: relative;
  z-index: 1;
  color: #fff;
  width: var(--icon);
  min-height: var(--icon);
  border-radius: 999px;
  background: var(--pill, var(--main));
  display: grid;
  place-items: center;
  align-self: stretch;
  margin: 8px 0 14px;   /* 下の14pxがつなぎ線の見えるところ */
  cursor: pointer;
}
.r-icon svg { width: 26px; height: 26px; }
.r-icon .r-emoji { font-size: 25px; line-height: 1; }

.r-body { padding: 12px 0 14px; min-width: 0; cursor: pointer; }
.r-sub { font-size: 13.5px; color: var(--sub); line-height: 1.45; }
.r-title { font-size: 19px; font-weight: 700; line-height: 1.4; word-break: break-word; }
.r-tags { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 6px; }

.tag {
  font-size: 12px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 8px;
  background: var(--sheet-2);
  color: var(--sub);
}
.tag.is-cal { color: #fff; }
/* 予定名から推測した場所。合っているか確認してほしいので点線にする。 */
.tag.is-guess { border: 1px dashed var(--warn); color: var(--warn); background: none; }
/* ＃タグ */
.tag.is-hash { background: rgba(87, 192, 140, 0.18); color: var(--main); }

.r-check {
  align-self: center;
  width: 30px; height: 30px;
  margin-top: 12px;
  border-radius: 50%;
  border: 2.5px solid var(--pill, var(--main));
  background: none;
  cursor: pointer;
  padding: 0;
}
.r-check.is-done {
  background: var(--pill, var(--main));
  position: relative;
}
.r-check.is-done::after {
  content: "";
  position: absolute;
  left: 8px; top: 5px;
  width: 7px; height: 13px;
  border: solid #000;
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}

.row.is-done .r-title { text-decoration: line-through; color: var(--sub); }
.row.is-done .r-icon { opacity: 0.45; }

/* ---------- 重なっている予定（横並び） ---------- */

.row.is-cluster .r-rail.is-plain { padding-bottom: 14px; }

.cluster {
  grid-column: 3 / span 2;   /* チェック欄まで使って幅を稼ぐ */
  padding: 10px 0 14px;
  min-width: 0;
}

.cluster-note {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--warn);
  margin-bottom: 7px;
}

.cluster-cards {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  /* 画面のふちまで使って、3件以上のときは横スクロールできると分かるようにする */
  margin-right: -18px;
  padding-right: 18px;
  scroll-snap-type: x proximity;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}
.cluster-cards::-webkit-scrollbar { height: 4px; }
.cluster-cards::-webkit-scrollbar-thumb { background: var(--line); border-radius: 2px; }

.mini {
  flex: 1 1 100px;   /* 2件なら並ぶ。3件以上は横スクロール。 */
  min-width: 100px;
  scroll-snap-align: start;
  background: var(--sheet-2);
  border-top: 4px solid var(--pill);
  border-radius: 14px;
  padding: 9px 11px 11px;
  cursor: pointer;
}

.mini-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.mini-ico {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--pill);
  color: #fff;
  display: grid; place-items: center;
  flex: none;
}
.mini-ico svg { width: 17px; height: 17px; }
.mini-ico .r-emoji { font-size: 16px; line-height: 1; }

.mini-check {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--pill);
  background: none;
  padding: 0;
  cursor: pointer;
  flex: none;
}
.mini-check.is-done { background: var(--pill); position: relative; }
.mini-check.is-done::after {
  content: "";
  position: absolute;
  left: 6px; top: 3px;
  width: 5px; height: 10px;
  border: solid #000;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.mini-time { font-size: 12px; color: var(--sub); font-variant-numeric: tabular-nums; }
.mini-title { font-size: 14.5px; font-weight: 700; line-height: 1.45; word-break: break-word; }
.mini-cal {
  display: inline-block;
  margin-top: 5px;
  padding: 1px 8px;
  border-radius: 7px;
  background: var(--pill);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
}
.mini-place { font-size: 12px; color: var(--sub); margin-top: 4px; }
.mini-place.is-guess { color: var(--warn); }

.mini.is-done { opacity: 0.5; }
.mini.is-done .mini-title { text-decoration: line-through; }

/* すきま（Zzz行） */
.row.is-gap .r-rail::after {
  top: 0;
  background: repeating-linear-gradient(
    to bottom, var(--main) 0 6px, transparent 6px 13px);
}
.row.is-gap .r-body { display: flex; gap: 9px; align-items: center; padding: 10px 0; }
.gap-z { font-size: 15px; color: var(--sub); flex: none; }
.gap-t { font-size: 15px; color: var(--sub); line-height: 1.5; }

/* 空の日 */
.blank {
  text-align: center;
  padding: 50px 20px;
  color: var(--sub);
}
.blank-e { font-size: 42px; }

/* ---------- あとで / 秘書室 / 設定 ---------- */

.item {
  display: flex;
  gap: 13px;
  align-items: center;
  background: var(--sheet-2);
  border-radius: 16px;
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
}
.item-ico {
  flex: none;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--main);
  display: grid; place-items: center;
}
.item-ico svg { width: 20px; height: 20px; }
.item-main { flex: 1; min-width: 0; }
.item-title { display: block; font-weight: 700; line-height: 1.4; }
.item-sub { display: block; font-size: 13.5px; color: var(--sub); line-height: 1.4; }
.item-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 5px; }
.item-add { flex: none; color: var(--main); font-size: 26px; line-height: 1; }

/* 秘書ルーチンの朝の要約 */
.brief {
  background: linear-gradient(180deg, rgba(87,192,140,0.16), rgba(87,192,140,0.05));
  border: 1px solid rgba(87,192,140,0.35);
  border-radius: 18px;
  padding: 15px 17px;
  margin-bottom: 16px;
}
.brief-h {
  display: flex; align-items: center; gap: 8px;
  color: var(--main);
  font-size: 13px; font-weight: 800;
  margin-bottom: 8px;
}
.brief-h svg { width: 17px; height: 17px; }
.brief-line { margin: 0 0 10px; font-size: 16.5px; font-weight: 700; line-height: 1.6; }
.brief-n {
  margin: 0 0 7px;
  padding-left: 15px;
  position: relative;
  font-size: 14.5px; color: var(--sub); line-height: 1.7;
}
.brief-n::before {
  content: ""; position: absolute; left: 2px; top: 11px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--main);
}
.brief-n:last-child { margin-bottom: 0; }

.note-card {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  background: var(--sheet-2);
  border-left: 4px solid var(--warn);
  border-radius: 14px;
  padding: 13px 15px;
  margin-bottom: 10px;
  font-size: 14.5px;
  line-height: 1.65;
}
.note-card .ni { flex: none; font-size: 17px; }
.note-card.is-ok { border-left-color: var(--ok); }

.legend { display: flex; flex-wrap: wrap; gap: 8px 15px; margin: 14px 0 6px; font-size: 13.5px; color: var(--sub); }
.legend span { display: flex; align-items: center; gap: 7px; }
.legend i { width: 12px; height: 12px; border-radius: 4px; }

.sync { font-size: 12.5px; color: var(--sub); margin-top: 12px; }

.set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--sheet-2);
  border-radius: 14px;
  padding: 12px 16px;
  margin-bottom: 9px;
}
.set-row label { font-size: 15px; }
.set-row input[type="checkbox"] {
  width: 22px; height: 22px;
  accent-color: var(--main);
  padding: 0;
  background: none;
  border: 0;
}
.set-row input, .set-row select {
  background: #000;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 7px 10px;
  width: 118px;
  text-align: center;
}
.set-desc { font-size: 13px; color: var(--sub); margin: -3px 0 16px; padding: 0 4px; line-height: 1.6; }

.btn-wide {
  width: 100%;
  background: var(--sheet-2);
  border: 0;
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 10px;
  font-weight: 700;
  cursor: pointer;
}
.btn-wide.is-danger { color: var(--danger); }

/* ---------- 下部ナビ ---------- */

.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(18px + env(safe-area-inset-bottom));
  width: min(340px, calc(100vw - 118px));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(32, 32, 35, 0.94);
  backdrop-filter: blur(12px);
  border-radius: 34px;
  padding: 9px 4px 7px;
  z-index: 30;
}

.tab {
  background: none;
  border: 0;
  color: var(--sub);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  padding: 0;
}
.tab svg { width: 23px; height: 23px; }
.tab.is-on { color: var(--main); }

.fab {
  position: fixed;
  right: max(18px, calc(50vw - 212px));
  bottom: calc(18px + env(safe-area-inset-bottom));
  width: 62px; height: 62px;
  border-radius: 50%;
  background: var(--main);
  border: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 31;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
}
.fab svg { width: 28px; height: 28px; }

/* ---------- 月カレンダー ---------- */

.mo-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 6px 0 14px;
  font-size: 21px;
  font-weight: 800;
}
.mo-head .nav-btn { width: 42px; height: 42px; font-size: 24px; }

.mo-week, .mo-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.mo-week { margin-bottom: 6px; }
.mo-week span { text-align: center; font-size: 12px; color: var(--sub); }

.mo-d {
  background: none;
  border: 0;
  padding: 5px 0 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  border-radius: 12px;
}
.mo-d:hover { background: var(--sheet-2); }
.mo-n {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  font-size: 16px; font-weight: 700;
}
.mo-d.is-out .mo-n { color: #4A4A4E; }
.mo-d.is-today .mo-n { color: var(--main); }
.mo-d.is-sel .mo-n { background: #fff; color: #000; }
.mo-dots { display: flex; gap: 2px; height: 6px; }
.mo-dots i { width: 5px; height: 5px; border-radius: 50%; }

/* ---------- 編集シート ---------- */

.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal[hidden] { display: none; }
.modal-back { position: absolute; inset: 0; background: rgba(0,0,0,0.6); }

.modal-card {
  position: relative;
  width: min(460px, 100%);
  background: var(--sheet);
  border-radius: 26px 26px 0 0;
  padding: 0 20px calc(26px + env(safe-area-inset-bottom));
  max-height: 92vh;
  overflow-y: auto;
}
.modal-card h3 { font-size: 19px; margin: 6px 0 16px; }

/* 予定は読むだけ。Googleカレンダーが本体なので、直せないことを見た目で伝える。 */
.ro {
  background: var(--sheet-2);
  border-radius: 16px;
  padding: 15px 17px;
  margin-bottom: 18px;
}
.ro-title { font-size: 18px; font-weight: 700; line-height: 1.45; }
.ro-time { font-size: 15px; color: var(--sub); font-variant-numeric: tabular-nums; margin-top: 2px; }
.ro-cal {
  display: inline-block;
  margin-top: 8px;
  padding: 2px 10px;
  border-radius: 8px;
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
}
.ro-note { font-size: 14.5px; color: var(--sub); margin-top: 10px; white-space: pre-wrap; line-height: 1.7; }
.ro-hint {
  font-size: 13px;
  color: var(--warn);
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px dashed var(--line);
  line-height: 1.6;
}

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--sub); margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%;
  background: #000;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  resize: vertical;
}
.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: -6px 0 16px; }
.chip {
  background: var(--sheet-2);
  border: 0;
  border-radius: 10px;
  padding: 6px 13px;
  font-size: 14px;
  color: var(--sub);
  cursor: pointer;
}
.chip.is-on { background: var(--main); color: #000; font-weight: 700; }
.chip.is-add { border: 1px dashed var(--line); background: none; }
.chip-note { display: flex; gap: 5px; width: 100%; margin-top: 4px; }
.chip-w { flex: 1; padding: 6px 0; text-align: center; font-size: 13px; }

.switch { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; font-size: 15px; }
.switch input { width: 20px; height: 20px; accent-color: var(--main); }

.modal-btns { display: flex; gap: 12px; }
.btn-ok, .btn-del {
  flex: 1;
  border: 0;
  border-radius: 15px;
  padding: 15px;
  font-weight: 800;
  cursor: pointer;
}
.btn-ok { background: var(--main); color: #000; }
.btn-del { background: var(--sheet-2); color: var(--danger); flex: 0 0 110px; }
