/* pwa.css — Note PWA（iPhone・ライトテーマ）。タイムラインの見た目は
   timeline_render.css（.tl-light）を母艦とそのまま共有。 */
:root { color-scheme: light; }
* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: #f1f3f7;
  color: #1d2433;
  font-family: -apple-system, "Hiragino Kaku Gothic ProN", sans-serif;
  -webkit-text-size-adjust: 100%;
}

/* ---- setup ---- */
#setup { padding: max(20px, env(safe-area-inset-top)) 20px 20px; max-width: 420px; margin: 0 auto; }
#setup h1 { font-size: 18px; color: #2b3a55; }
#setup label { display: block; font-size: 12px; color: #5a6a8a; margin: 14px 0 4px; font-weight: 700; }
#setup input {
  width: 100%; font-size: 15px; padding: 9px 10px;
  border: 1px solid #c9d6f0; border-radius: 8px; outline: none;
}
#setup button {
  margin-top: 18px; width: 100%; padding: 11px;
  font-size: 15px; font-weight: 800;
  background: #2f6fde; color: #fff; border: none; border-radius: 10px;
}
#setup .hint { font-size: 11px; color: #8a93a3; line-height: 1.7; }

/* ---- main chrome ---- */
header {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: calc(8px + env(safe-area-inset-top)) 14px 8px;
  background: #f7f8fa; border-bottom: 1px solid #e2e7ef;
}
#hdr-date { font-size: 15px; font-weight: 800; color: #2b3a55; }
.hdr-state { font-size: 10px; color: #8a93a3; flex: 1; }
#btn-refresh {
  border: 1px solid #c9d6f0; background: #fff; color: #2f6fde;
  border-radius: 8px; font-size: 15px; padding: 3px 12px;
}
nav { display: flex; gap: 6px; padding: 8px 14px 0; background: #f7f8fa; }
.tab {
  flex: 1; padding: 7px 0; font-size: 13px; font-weight: 700;
  border: 1px solid #d8dde6; border-bottom: none;
  border-radius: 9px 9px 0 0; background: #eceff5; color: #5a6a8a;
}
.tab.on { background: #fff; color: #1d4fb0; }
.pane { display: none; padding: 12px 14px calc(20px + env(safe-area-inset-bottom)); background: #fff; min-height: 70vh; }
.pane.on { display: block; }
#today-timeline .tl-panel { width: 100%; }

/* ---- 契約ミニカード ---- */
#contract-mini {
  background: #f7f9fc; border: 1px solid #e2e7ef; border-radius: 10px;
  padding: 8px 10px; margin-bottom: 10px;
}
.cm-head { display: flex; justify-content: flex-end; }
.cm-ratio {
  font-size: 10px; font-weight: 700; color: #3c71f6;
  background: #eaf0ff; border-radius: 999px; padding: 2px 8px;
}
.cm-empty, .cm-rest { font-size: 12px; color: #8a93a3; padding: 2px 0 4px; }
.cm-item { display: flex; align-items: baseline; gap: 6px; font-size: 13px; padding: 2px 0; }
.cm-tick { color: #b9c2cf; font-weight: 800; width: 12px; }
.cm-item.ok .cm-tick { color: #2faf6b; }
.cm-mode { color: #2787c8; font-size: 11px; width: 10px; }
.cm-obj { font-weight: 700; color: #2457d0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- プロジェクト閲覧 ---- */
.proj-crumb { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin-bottom: 8px; font-size: 12px; }
.crumb { border: none; background: none; color: #2f6fde; font-size: 12px; padding: 2px 3px; font-weight: 700; }
.crumb.cur { color: #2b3a55; }
.crumb-sep { color: #b9c2cf; font-size: 11px; }
.proj-list { display: flex; flex-direction: column; }
.proj-divider {
  font-size: 11px; font-weight: 800; letter-spacing: .04em;
  margin: 12px 0 4px; padding-bottom: 3px; border-bottom: 1px solid #eef1f6;
}
.proj-divider:first-child { margin-top: 0; }
.proj-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  border: none; background: none; text-align: left;
  padding: 10px 4px; border-bottom: 1px solid #f1f3f8; font-size: 14px; color: #25304a;
}
.proj-item:active { background: #f3f6fc; }
.proj-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; }
.proj-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-count { flex: none; font-size: 11px; color: #8a93a3; }
.proj-arrow { flex: none; color: #c0c8d4; font-size: 16px; }
.proj-status { font-size: 12px; color: #8a93a3; padding: 6px 0; }
.proj-date {
  font-size: 13px; font-weight: 800; color: #1d4fb0;
  background: #eef4ff; border-radius: 7px; padding: 4px 10px;
  margin: 14px 0 6px; display: inline-block;
}
.proj-sec { margin-bottom: 4px; }

/* ---- ノート閲覧 ---- */
.note-nav { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.note-nav button {
  border: 1px solid #c9d6f0; background: #fff; color: #2f6fde;
  border-radius: 8px; font-size: 13px; padding: 6px 10px;
}
#note-date {
  flex: 1; text-align: center; font-size: 14px; font-weight: 700; color: #2b3a55;
  border: 1px solid #d8dde6; border-radius: 8px; padding: 5px 4px; background: #fff;
  -webkit-appearance: none; min-width: 0;
}
#note-chips {
  display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
}
#note-chips:empty { display: none; }
.note-chip {
  flex: none; font-size: 11px; font-weight: 700; color: #4a5d85;
  background: #eef2fa; border: 1px solid #dbe4f5; border-radius: 999px;
  padding: 3px 10px; white-space: nowrap;
}

#note-body { font-size: 14px; line-height: 1.75; color: #25304a; }
.md-sec { border-top: 1px solid #e8ecf3; padding: 10px 0 6px; }
.md-sec:first-child { border-top: none; padding-top: 0; }
.md-sec-h { display: flex; align-items: center; gap: 7px; margin: 2px 0 6px; }
.md-marker {
  flex: none; min-width: 18px; height: 18px; border-radius: 5px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800; color: #3c71f6; background: #eaf0ff;
  padding: 0 4px;
}
.md-sec-title { font-size: 16px; font-weight: 800; color: #1d2c4f; }
.md-h { font-weight: 800; color: #2b3a55; margin: 10px 0 4px; }
.md-h2 { font-size: 15px; border-bottom: 1px solid #e8ecf3; padding-bottom: 2px; }
.md-h3 { font-size: 14px; }
.md-h4 { font-size: 13px; color: #4a5d85; }
.md-p { margin: 4px 0; overflow-wrap: break-word; }
.md-quote {
  border-left: 3px solid #c9d6f0; background: #f7f9fc;
  padding: 5px 10px; margin: 6px 0; border-radius: 0 8px 8px 0; color: #44506b;
}
.md-callout { border-radius: 10px; padding: 7px 11px; margin: 8px 0; border: 1px solid; }
.md-callout-cap { font-size: 11px; font-weight: 800; letter-spacing: .04em; margin-bottom: 2px; }
.md-callout-note, .md-callout-info { background: #eef4ff; border-color: #cfdcf7; }
.md-callout-note .md-callout-cap, .md-callout-info .md-callout-cap { color: #2f6fde; }
.md-callout-warning { background: #e9eef8; border-color: #b9c8e8; }
.md-callout-warning .md-callout-cap { color: #1d3a8f; }
.md-callout-caution { background: #e7eaf2; border-color: #aab4cd; }
.md-callout-caution .md-callout-cap { color: #232f55; }
.md-callout-rest { background: #e9f6f0; border-color: #c2e4d4; }
.md-callout-rest .md-callout-cap { color: #1e7e54; }
.md-callout-tip { background: #e8f4f6; border-color: #c0dfe5; }
.md-callout-tip .md-callout-cap { color: #15707f; }
.md-list { margin: 4px 0 4px 2px; padding-left: 20px; }
.md-list li { margin: 2px 0; }
.md-code { margin: 8px 0; }
.md-code summary {
  font-size: 11px; color: #5a6a8a; background: #eef1f6;
  border-radius: 7px; padding: 4px 9px; cursor: pointer;
}
.md-code pre {
  font-size: 11px; line-height: 1.5; background: #f3f5f9; color: #33405e;
  border-radius: 8px; padding: 8px 10px; overflow-x: auto; margin: 4px 0 0;
  -webkit-overflow-scrolling: touch;
}
.md-icode {
  font-size: 12px; background: #eef1f6; border-radius: 4px; padding: 1px 5px; color: #1d4fb0;
}
.md-math-block { display: block; overflow-x: auto; text-align: center; margin: 10px 0; -webkit-overflow-scrolling: touch; }
mark { background: #fde7f0; color: inherit; border-radius: 3px; padding: 0 2px; }
.md-bis { font-style: italic; font-family: Georgia, "Times New Roman", serif; }
.md-link { color: #2f6fde; text-decoration: underline; word-break: break-all; }
.md-deadlink { color: #7a86a0; border-bottom: 1px dotted #aab4cd; }
.md-img {
  display: block; max-width: 100%; border-radius: 8px; margin: 8px 0;
  min-height: 40px; background: #f0f2f7;
}
.md-img-missing { min-height: 26px; font-size: 11px; color: #8a93a3; }
.md-table-wrap { overflow-x: auto; margin: 8px 0; -webkit-overflow-scrolling: touch; }
.md-table { border-collapse: collapse; font-size: 12px; }
.md-table th, .md-table td { border: 1px solid #dbe1ec; padding: 4px 8px; white-space: nowrap; }
.md-table th { background: #f0f4fb; color: #2b3a55; }
#note-body hr { border: none; border-top: 1px solid #e2e7ef; margin: 12px 0; }

/* ---- 一覧 ---- */
.list .li {
  display: flex; gap: 8px; align-items: baseline;
  padding: 7px 2px; border-bottom: 1px solid #eef1f6; font-size: 13px;
}
.li-by { color: #5a6a8a; font-size: 11px; font-weight: 700; min-width: 38px; }
.li.overdue .li-by { color: #1d3a8f; }
.li.queued .li-by::after { content: '▶'; color: #2faf6b; margin-left: 2px; font-size: 9px; }
.li-proj { color: #8a93a3; font-size: 11px; max-width: 28%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-obj { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
