/* 配色は事業者さま向け説明資料 Ver 5.1 の画面イメージ（濃紺の選んだ希望、灰色の選べない予定）に合わせる。 */
:root {
  --ink: #1a1a1a;
  --ink-2: #555;
  --accent: #173f66;
  --accent-tint: #eef3f8;
  --hairline: #d9d9d9;
  --fill-gray: #e7e9ec;
  --busy-edge: #8e8e8e;
  --paper: #fff;
  --error: #a33c2e;
  /* 1時間あたりの高さ。src/page/render.ts の HOUR_PX と合わせる。 */
  --hour-px: 48px;
  --axis-w: 28px;
  --head-h: 32px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", Meiryo, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

body.has-action-bar main { padding-bottom: calc(140px + env(safe-area-inset-bottom)); }

button { font: inherit; }
button:focus-visible, .days:focus-visible, textarea:focus-visible { outline: 3px solid #4a90d9; outline-offset: 2px; }

.top {
  border-top: 6px solid var(--accent);
  border-bottom: 1px solid var(--hairline);
  padding: 10px 16px;
}
.top h1 { margin: 0; font-size: 17px; text-align: center; }

main { max-width: 760px; margin: 0 auto; padding: 12px 16px 24px; }

.notice { margin: 24px 0 16px; font-weight: 600; }
.lead { display: block; font-weight: 600; margin: 4px 0 8px; }
.hint, .legend { font-size: 12px; color: var(--ink-2); margin: 6px 0 0; text-align: center; }
.hint-left { font-size: 13px; color: var(--ink-2); margin: 8px 0 0; }
.error-text { color: var(--error); font-size: 13px; min-height: 1.6em; margin: 6px 0; }

#screen-loading { min-height: 60vh; }

/* 日付の送り */
.day-nav { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.nav-button {
  min-height: 44px; min-width: 44px; padding: 0 14px;
  border: 1px solid var(--accent); background: var(--paper); color: var(--accent);
  font-weight: 700; border-radius: 6px; cursor: pointer;
}
.nav-button:disabled { border-color: var(--hairline); color: var(--ink-2); background: var(--fill-gray); cursor: default; }

/* 表: 左に時刻の軸、右に横へずらせる日ごとの列 */
.table { display: flex; border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); }
.axis { flex: 0 0 var(--axis-w); }
.axis-body { position: relative; height: calc(var(--hours) * var(--hour-px)); }
.axis-label { position: absolute; right: 4px; font-size: 11px; color: var(--ink-2); transform: translateY(-1px); }
.days {
  flex: 1; min-width: 0; display: flex;
  overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.days::-webkit-scrollbar { display: none; }
.day { flex: 0 0 calc(100% / 3); scroll-snap-align: start; border-left: 1px solid var(--hairline); min-width: 0; }
.day-head {
  height: var(--head-h); margin: 0; font-size: 13px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border-bottom: 1px solid var(--hairline);
}
.axis-head { border-bottom: 1px solid var(--hairline); }
.day-body {
  position: relative;
  height: calc(var(--hours) * var(--hour-px));
  background: repeating-linear-gradient(to bottom, var(--hairline) 0, var(--hairline) 1px, transparent 1px, transparent var(--hour-px));
}

.piece {
  position: absolute; left: 2px; right: 2px;
  overflow: hidden; padding: 2px 4px; margin: 0;
  display: flex; flex-direction: column; align-items: flex-start; text-align: left;
  font-size: 11.5px; line-height: 1.3; font-weight: 600;
  border: 1px solid var(--accent); border-left-width: 4px; border-radius: 3px;
  background: var(--paper); color: var(--ink);
}
button.piece { cursor: pointer; }
.piece-busy { background: var(--fill-gray); border-color: var(--fill-gray); border-left-color: var(--busy-edge); color: var(--ink); }
.piece-chosen { background: var(--accent); color: #fff; }
.piece-title { word-break: break-all; }
.piece-sub { font-weight: 400; font-size: 10.5px; }
.piece-badge { margin-top: 2px; padding: 0 4px; background: #fff; color: var(--accent); font-size: 10.5px; font-weight: 700; border-radius: 2px; }

.legend { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 6px; }
.swatch { display: inline-block; width: 12px; height: 12px; border: 1px solid var(--accent); vertical-align: middle; }
.swatch-open { background: var(--paper); }
.swatch-chosen { background: var(--accent); }
.swatch-busy { background: var(--fill-gray); border-color: var(--busy-edge); }

.more-status { min-height: 44px; margin-top: 8px; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 13px; }

.copy { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--hairline); text-align: center; }
.copy-status { min-height: 1.6em; font-size: 13px; margin: 6px 0 0; }

/* ボタン */
.main-button, .sub-button {
  min-height: 48px; width: 100%; padding: 0 16px; border-radius: 6px; font-weight: 700; cursor: pointer;
}
.main-button { border: 0; background: var(--accent); color: #fff; }
.main-button:disabled { background: var(--fill-gray); color: var(--ink); cursor: default; }
.sub-button { border: 1px solid var(--accent); background: var(--paper); color: var(--accent); }

/* 画面の下の、相談するボタン */
.action-bar {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--paper); border-top: 1px solid var(--hairline);
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.06);
  padding: 8px 16px calc(10px + env(safe-area-inset-bottom));
}
.action-bar > * { max-width: 728px; margin-left: auto; margin-right: auto; }
.choice-status { margin: 0 auto 6px; font-size: 13px; min-height: 2.6em; display: flex; align-items: center; }

/* 相談文の確認 */
textarea {
  width: 100%; font: inherit; font-size: 16px; line-height: 1.7;
  padding: 10px; border: 1px solid var(--ink-2); border-radius: 4px; resize: vertical;
}
.compose-actions { display: grid; gap: 10px; margin-top: 8px; }

/* パソコンで開いたとき */
.desktop-panel {
  display: flex; align-items: center; gap: 16px;
  padding: 12px; margin-bottom: 12px;
  border: 1px solid var(--accent); background: var(--accent-tint); border-radius: 6px;
}
.desktop-panel[hidden] { display: none; }
.desktop-panel img { flex: none; background: #fff; }
.desktop-panel p { margin: 0; font-weight: 600; }

/* 実機での確認用の記録（ページの設定 diagnostics が true のときだけ出る） */
.diagnostics {
  max-width: 760px; margin: 0 auto; padding: 8px 16px calc(150px + env(safe-area-inset-bottom));
  font-size: 11px; line-height: 1.5; white-space: pre-wrap; word-break: break-all;
  color: var(--ink); background: var(--paper); border-top: 1px dashed var(--ink-2);
}

[hidden] { display: none !important; }
