/* =========================================================================
   設備スケジュール — デザインシステム
   ・色は「種別チップ」に集約し、地の面は無彩色に寄せて一覧の可読性を確保する
   ・タップ領域は最小 44px（Androidタブレット運用のため）
   ・ライト/ダークは OS 設定に追従し、設定画面から上書きもできる
   ========================================================================= */

:root {
  color-scheme: light dark;

  --bg:          #eef1f7;
  --bg-grad:     radial-gradient(1200px 600px at 15% -10%, #dfe6fb 0%, transparent 60%),
                 radial-gradient(900px 500px at 100% 0%, #e6ecfa 0%, transparent 55%);
  --surface:     #ffffff;
  --surface-2:   #f7f9fd;
  --surface-3:   #eef2f9;
  --border:      #dde3ee;
  --border-soft: #e8edf5;
  --text:        #131a2a;
  --text-2:      #46506a;
  --muted:       #737f9c;
  --accent:      #2f56d9;
  --accent-ink:  #ffffff;
  --accent-weak: #e7edff;
  --accent-line: #c2d0fb;
  --danger:      #d92d20;
  --danger-weak: #fde9e7;
  --warn:        #c2710a;
  --warn-weak:   #fdf0dc;
  --ok:          #067a55;
  --ok-weak:     #dff5ec;
  --today:       #fff8e6;
  --sat:         #2563eb;
  --sun:         #dc2626;

  --shadow-1: 0 1px 2px rgba(19,26,42,.06), 0 1px 3px rgba(19,26,42,.05);
  --shadow-2: 0 2px 6px rgba(19,26,42,.07), 0 8px 24px rgba(19,26,42,.08);
  --shadow-3: 0 12px 40px rgba(19,26,42,.18);

  --r-s: 8px; --r-m: 12px; --r-l: 16px; --r-xl: 22px;
  --topbar-h: 58px;
  --side-w: 232px;
  --tabbar-h: 60px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --font: "Segoe UI", "Yu Gothic UI", "Hiragino Sans", "Noto Sans JP", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, "Yu Gothic UI", monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:          #080d19;
    --bg-grad:     radial-gradient(1200px 600px at 15% -10%, #16203c 0%, transparent 60%),
                   radial-gradient(900px 500px at 100% 0%, #131c33 0%, transparent 55%);
    --surface:     #111a2e;
    --surface-2:   #16203a;
    --surface-3:   #1c2745;
    --border:      #253352;
    --border-soft: #1d2842;
    --text:        #eaeffb;
    --text-2:      #b6c2dc;
    --muted:       #8492b2;
    --accent:      #6d8cff;
    --accent-ink:  #0a1024;
    --accent-weak: #1b2a52;
    --accent-line: #33477e;
    --danger:      #ff7b6e;
    --danger-weak: #3a1c1c;
    --warn:        #f0b357;
    --warn-weak:   #38290f;
    --ok:          #4fd1a5;
    --ok-weak:     #12332a;
    --today:       #1e2a1c;
    --sat:         #7aa2ff;
    --sun:         #ff8a8a;
    --shadow-1: 0 1px 2px rgba(0,0,0,.4);
    --shadow-2: 0 2px 8px rgba(0,0,0,.45), 0 12px 32px rgba(0,0,0,.35);
    --shadow-3: 0 16px 50px rgba(0,0,0,.6);
  }
}
:root[data-theme="dark"] {
  --bg:          #080d19;
  --bg-grad:     radial-gradient(1200px 600px at 15% -10%, #16203c 0%, transparent 60%),
                 radial-gradient(900px 500px at 100% 0%, #131c33 0%, transparent 55%);
  --surface:     #111a2e;
  --surface-2:   #16203a;
  --surface-3:   #1c2745;
  --border:      #253352;
  --border-soft: #1d2842;
  --text:        #eaeffb;
  --text-2:      #b6c2dc;
  --muted:       #8492b2;
  --accent:      #6d8cff;
  --accent-ink:  #0a1024;
  --accent-weak: #1b2a52;
  --accent-line: #33477e;
  --danger:      #ff7b6e;
  --danger-weak: #3a1c1c;
  --warn:        #f0b357;
  --warn-weak:   #38290f;
  --ok:          #4fd1a5;
  --ok-weak:     #12332a;
  --today:       #1e2a1c;
  --sat:         #7aa2ff;
  --sun:         #ff8a8a;
  --shadow-1: 0 1px 2px rgba(0,0,0,.4);
  --shadow-2: 0 2px 8px rgba(0,0,0,.45), 0 12px 32px rgba(0,0,0,.35);
  --shadow-3: 0 16px 50px rgba(0,0,0,.6);
}

/* ------------------------------------------------------------------ reset */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
h1,h2,h3,h4 { margin: 0; font-weight: 700; line-height: 1.35; letter-spacing: .01em; }
p { margin: 0 0 .6em; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
svg.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8;
         stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
[hidden] { display: none !important; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ------------------------------------------------------------------ splash */
.splash {
  position: fixed; inset: 0; z-index: 90; display: grid; place-content: center; justify-items: center;
  gap: 14px; background: var(--bg); background-image: var(--bg-grad);
  transition: opacity .35s ease, visibility .35s;
}
.splash.gone { opacity: 0; visibility: hidden; pointer-events: none; }
.splash-mark, .brand-mark, .splash-name { --m: 1; }
.splash-mark {
  width: 76px; height: 76px; border-radius: 20px;
  background: linear-gradient(150deg, var(--accent), #7d5cff);
  box-shadow: var(--shadow-2); position: relative;
}
.splash-mark::before, .brand-mark::before {
  content: ""; position: absolute; inset: 26% 22% 22%; border-radius: 4px;
  background: #fff; opacity: .95;
  box-shadow: inset 0 6px 0 rgba(0,0,0,.18);
}
.splash-mark::after, .brand-mark::after {
  content: ""; position: absolute; left: 33%; right: 33%; top: 14%; height: 14%;
  border-radius: 3px; border: 2.5px solid #fff; border-bottom: 0; opacity: .9;
}
.splash-name { font-weight: 800; font-size: 19px; letter-spacing: .06em; }
.splash-bar { width: 168px; height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.splash-bar i { display: block; width: 40%; height: 100%; border-radius: 4px; background: var(--accent);
                animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-110%);} 100% { transform: translateX(320%);} }

/* ------------------------------------------------------------------ 参加前画面 */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px calc(24px + var(--safe-b)); }
.gate-card {
  width: min(560px, 100%); background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); box-shadow: var(--shadow-2); padding: 30px 26px; animation: rise .3s ease both;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px);} }
.gate-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.gate-head .brand-mark { width: 46px; height: 46px; border-radius: 13px; }
.gate-title { font-size: 20px; font-weight: 800; }
.gate-sub { color: var(--muted); font-size: 13.5px; }
.gate-card .field { margin-bottom: 14px; }
.gate-note { font-size: 13px; color: var(--muted); margin-top: 14px; }

/* ------------------------------------------------------------------ シェル */
.shell {
  display: grid; height: 100dvh;
  grid-template-columns: var(--side-w) minmax(0, 1fr);
  grid-template-rows: calc(var(--topbar-h) + var(--safe-t)) minmax(0, 1fr);
  grid-template-areas: "top top" "side view";
}

.topbar {
  grid-area: top; display: flex; align-items: center; gap: 10px;
  padding: var(--safe-t) 14px 0; background: color-mix(in srgb, var(--surface) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--border);
  position: relative; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: .02em; white-space: nowrap; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; position: relative;
              background: linear-gradient(150deg, var(--accent), #7d5cff); box-shadow: var(--shadow-1); }
.brand-text { font-size: 15.5px; }
.topbar-search {
  flex: 1 1 auto; max-width: 460px; margin-inline: 10px; position: relative; display: flex; align-items: center;
}
.topbar-search .ic { position: absolute; left: 11px; color: var(--muted); width: 18px; height: 18px; }
.topbar-search input {
  width: 100%; height: 38px; padding: 0 12px 0 36px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-2); outline: none;
}
.topbar-search input:focus { border-color: var(--accent-line); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-weak); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 4px; }

.icon-btn {
  width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px;
  border: 0; background: transparent; color: var(--text-2); cursor: pointer; position: relative;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.badge {
  position: absolute; top: 5px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center; border: 2px solid var(--surface); line-height: 1;
}
.avatar {
  width: 38px; height: 38px; border-radius: 50%; border: 0; cursor: pointer; margin-left: 4px;
  background: linear-gradient(150deg, var(--accent), #7d5cff); color: #fff; font-weight: 800; font-size: 14px;
  display: grid; place-items: center; box-shadow: var(--shadow-1);
}

.sidebar {
  grid-area: side; display: flex; flex-direction: column; gap: 4px; padding: 14px 10px;
  border-right: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 60%, transparent);
  overflow-y: auto;
}
.side-group { display: flex; flex-direction: column; gap: 2px; }
.side-group + .side-group { margin-top: 16px; }
.side-bottom { margin-top: auto !important; }
.side-title { font-size: 11.5px; font-weight: 700; color: var(--muted); letter-spacing: .1em;
              padding: 6px 12px 4px; text-transform: uppercase; }
.side-link {
  display: flex; align-items: center; gap: 11px; min-height: 44px; padding: 0 12px;
  border-radius: 11px; color: var(--text-2); font-weight: 600; font-size: 14.5px;
}
.side-link:hover { background: var(--surface-3); color: var(--text); }
.side-link.active { background: var(--accent-weak); color: var(--accent); }
.side-link.active .ic { stroke-width: 2.1; }
.side-count {
  margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 11.5px; font-weight: 700; display: grid; place-items: center;
}

.view { grid-area: view; overflow-y: auto; overscroll-behavior: contain; scroll-behavior: smooth; }
.page { padding: 20px 22px 40px; max-width: 1360px; margin: 0 auto; }

.tabbar { display: none; }
.fab { display: none; }

/* --------------------------------------------------------- タブレット / スマホ */
@media (max-width: 1100px) { :root { --side-w: 72px; } .side-link span:not(.side-count) { display: none; }
  .side-link { justify-content: center; padding: 0; } .side-title { text-align: center; font-size: 10px; padding: 6px 0 4px; }
  .side-count { position: absolute; margin: 0; transform: translate(14px, -12px); }
  .side-link { position: relative; }
}
@media (max-width: 780px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: calc(var(--topbar-h) + var(--safe-t)) minmax(0, 1fr) calc(var(--tabbar-h) + var(--safe-b));
    grid-template-areas: "top" "view" "tab";
  }
  .sidebar {
    position: fixed; top: 0; bottom: 0; left: 0; width: 258px; z-index: 60; padding-top: calc(16px + var(--safe-t));
    background: var(--surface); transform: translateX(-102%); transition: transform .24s cubic-bezier(.2,.7,.3,1);
    box-shadow: var(--shadow-3);
  }
  .sidebar.open { transform: none; }
  .sidebar .side-link { justify-content: flex-start; padding: 0 14px; }
  .sidebar .side-link span:not(.side-count) { display: inline; }
  .sidebar .side-count { position: static; transform: none; margin-left: auto; }
  .sidebar .side-title { text-align: left; font-size: 11.5px; padding: 6px 14px 4px; }
  .only-wide { display: grid; }
  .topbar-search { display: none; }
  .brand-text { font-size: 15px; }
  .page { padding: 14px 13px 24px; }
  .tabbar {
    grid-area: tab; display: grid; grid-template-columns: repeat(4, 1fr);
    border-top: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(12px); padding-bottom: var(--safe-b); z-index: 30;
  }
  .tab { display: grid; place-items: center; gap: 2px; font-size: 11px; font-weight: 700;
         color: var(--muted); padding-top: 8px; position: relative; }
  .tab.active { color: var(--accent); }
  .tab .ic { width: 22px; height: 22px; }
  .tab-dot { position: absolute; top: 6px; right: calc(50% - 18px); width: 8px; height: 8px;
             border-radius: 50%; background: var(--danger); }
  .fab {
    display: grid; place-items: center; position: fixed; right: 16px;
    bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); width: 58px; height: 58px; border-radius: 20px;
    border: 0; background: linear-gradient(150deg, var(--accent), #6b4fff); color: #fff;
    box-shadow: var(--shadow-3); z-index: 25; cursor: pointer;
  }
  .fab .ic { width: 26px; height: 26px; stroke-width: 2.4; }
}
@media (min-width: 781px) { .only-wide { display: none; } }
/* 狭い画面ではボタンのラベルを隠してアイコンだけにする */
@media (max-width: 900px) { .only-pc { display: none; } }

.scrim { position: fixed; inset: 0; background: rgba(10,14,26,.45); z-index: 55;
         backdrop-filter: blur(2px); animation: fade .2s ease both; }
@keyframes fade { from { opacity: 0; } }

/* ------------------------------------------------------------------ 見出し・ツールバー */
.page-head { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.page-title { font-size: 21px; font-weight: 800; letter-spacing: .01em; }
.page-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.page-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-l);
  padding: 9px 11px; box-shadow: var(--shadow-1); margin-bottom: 14px;
}
.toolbar .spacer { flex: 1 1 auto; }
.period-label { font-size: 17px; font-weight: 800; min-width: 8.5em; text-align: center; }

.segmented { display: inline-flex; background: var(--surface-3); border-radius: 11px; padding: 3px; gap: 2px; }
.segmented button {
  border: 0; background: transparent; border-radius: 8px; padding: 0 13px; height: 34px;
  font-weight: 700; font-size: 13.5px; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.segmented button.on { background: var(--surface); color: var(--accent); box-shadow: var(--shadow-1); }

/* ------------------------------------------------------------------ ボタン・入力 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 0 15px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 700; font-size: 14px;
  cursor: pointer; white-space: nowrap; transition: transform .08s ease, background .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn .ic { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); border-color: transparent; color: var(--accent-ink); box-shadow: var(--shadow-1); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.btn-danger:hover { background: var(--danger-weak); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field > label, .label { font-size: 12.5px; font-weight: 700; color: var(--text-2); }
.req::after { content: "必須"; margin-left: 6px; font-size: 10.5px; font-weight: 700; color: var(--danger);
              background: var(--danger-weak); padding: 1px 5px; border-radius: 4px; }
.input, input[type="text"], input[type="search"], input[type="email"], input[type="number"],
input[type="date"], input[type="time"], input[type="datetime-local"], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px; border-radius: 11px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); outline: none;
}
textarea { min-height: 92px; resize: vertical; line-height: 1.6; }
select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 32px;
}
.input:focus, input:focus, select:focus, textarea:focus {
  border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-weak);
}
.hint { font-size: 12px; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 13px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 620px) { .form-grid { grid-template-columns: minmax(0,1fr); } }

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; min-height: 44px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch i {
  width: 44px; height: 26px; border-radius: 999px; background: var(--surface-3);
  border: 1px solid var(--border); position: relative; transition: background .18s;
}
.switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; box-shadow: var(--shadow-1); transition: transform .18s; }
.switch input:checked + i { background: var(--accent); border-color: transparent; }
.switch input:checked + i::after { transform: translateX(18px); }
.switch span { font-weight: 600; font-size: 14px; }

.check-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.chip-check { position: relative; }
.chip-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.chip-check span {
  display: grid; place-items: center; min-width: 44px; height: 40px; padding: 0 12px;
  border-radius: 11px; border: 1px solid var(--border); background: var(--surface);
  font-weight: 700; font-size: 14px; color: var(--text-2); cursor: pointer;
}
.chip-check input:checked + span { background: var(--accent-weak); border-color: var(--accent-line); color: var(--accent); }

/* ------------------------------------------------------------------ カード・一覧 */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-l);
  box-shadow: var(--shadow-1); padding: 16px 17px; margin-bottom: 14px;
}
.card-head { display: flex; align-items: center; gap: 10px; margin: -2px 0 12px; }
.card-title { font-size: 15px; font-weight: 800; }
.card-head .spacer { flex: 1; }

.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 11px; margin-bottom: 16px; }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-l);
  padding: 13px 15px; box-shadow: var(--shadow-1); display: flex; flex-direction: column; gap: 2px;
  cursor: pointer; transition: transform .1s ease, box-shadow .15s;
}
.stat:hover { transform: translateY(-1px); box-shadow: var(--shadow-2); }
.stat-k { font-size: 12px; font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stat-v { font-size: 26px; font-weight: 800; letter-spacing: -.01em; line-height: 1.2; }
.stat-v small { font-size: 13px; font-weight: 700; color: var(--muted); margin-left: 3px; }
.stat.alert .stat-v { color: var(--danger); }
.stat.warn .stat-v { color: var(--warn); }

.empty { text-align: center; padding: 40px 18px; color: var(--muted); }
.empty .ic { width: 40px; height: 40px; opacity: .5; margin-bottom: 8px; stroke-width: 1.4; }
.empty-title { font-weight: 700; color: var(--text-2); margin-bottom: 4px; }

.list { display: flex; flex-direction: column; gap: 8px; }
.row-card {
  display: flex; align-items: center; gap: 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-m); padding: 11px 13px;
  box-shadow: var(--shadow-1); cursor: pointer; transition: border-color .15s, transform .08s;
  min-height: 56px;
}
.row-card:hover { border-color: var(--accent-line); }
.row-card:active { transform: scale(.995); }
.row-main { min-width: 0; flex: 1; }
.row-title { font-weight: 700; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-meta { font-size: 12.5px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; margin-top: 1px; }
.row-side { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px;
  border-radius: 6px; font-size: 11.5px; font-weight: 700; background: var(--surface-3); color: var(--text-2);
  white-space: nowrap;
}
.chip-dot { width: 8px; height: 8px; border-radius: 3px; flex: 0 0 auto; }
.chip.danger { background: var(--danger-weak); color: var(--danger); }
.chip.warn { background: var(--warn-weak); color: var(--warn); }
.chip.ok { background: var(--ok-weak); color: var(--ok); }
.chip.accent { background: var(--accent-weak); color: var(--accent); }

.filters { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.filter-sel { min-height: 36px; height: 36px; padding: 0 30px 0 11px; border-radius: 9px; font-size: 13.5px;
              width: auto; min-width: 118px; background-color: var(--surface-2); }
.filter-clear { font-size: 12.5px; color: var(--accent); font-weight: 700; cursor: pointer; background: 0; border: 0; }

/* ------------------------------------------------------------------ カレンダー：月 */
.cal-month { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-l);
             overflow: hidden; box-shadow: var(--shadow-1); }
.cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--surface-2);
           border-bottom: 1px solid var(--border); }
.cal-dow div { text-align: center; padding: 7px 0; font-size: 12px; font-weight: 800; color: var(--muted); }
.cal-dow div:first-child { color: var(--sun); }
.cal-dow div:last-child { color: var(--sat); }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); grid-auto-rows: minmax(104px, auto); }
.cal-cell { border-right: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft);
            padding: 4px 5px 6px; min-width: 0; display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell:hover { background: var(--surface-2); }
.cal-cell.out { background: var(--surface-2); opacity: .62; }
.cal-cell.today { background: var(--today); }
.cal-daynum { font-size: 12.5px; font-weight: 800; color: var(--text-2); width: 25px; height: 22px;
              display: grid; place-items: center; border-radius: 7px; }
.cal-cell.today .cal-daynum { background: var(--accent); color: var(--accent-ink); }
.cal-cell.sun .cal-daynum { color: var(--sun); }
.cal-cell.sat .cal-daynum { color: var(--sat); }
.cal-cell.today.sun .cal-daynum, .cal-cell.today.sat .cal-daynum { color: var(--accent-ink); }
.ev {
  display: flex; align-items: center; gap: 4px; font-size: 11.5px; line-height: 1.45; font-weight: 600;
  padding: 2px 5px; border-radius: 5px; background: var(--surface-3); color: var(--text);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis; border-left: 3px solid var(--muted);
}
.ev:hover { filter: brightness(.97); }
.ev-time { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 700; flex: 0 0 auto; }
.ev-title { overflow: hidden; text-overflow: ellipsis; }
.ev.allday { color: #fff; border-left: 0; }
.ev-more { font-size: 11px; font-weight: 700; color: var(--muted); padding-left: 5px; }
.ev-rep { opacity: .65; flex: 0 0 auto; }

/* ------------------------------------------------------------------ カレンダー：週 */
.cal-week { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-l);
            box-shadow: var(--shadow-1); overflow: hidden; }
.week-head { display: grid; grid-template-columns: 52px repeat(7, minmax(0,1fr)); border-bottom: 1px solid var(--border);
             background: var(--surface-2); position: sticky; top: 0; z-index: 5; }
.week-head .wh { padding: 6px 2px; text-align: center; border-left: 1px solid var(--border-soft); }
.week-head .wh:first-child { border-left: 0; }
.wh-dow { font-size: 11px; font-weight: 800; color: var(--muted); }
.wh-num { font-size: 16px; font-weight: 800; }
.wh.today .wh-num { color: var(--accent); }
.wh.sun .wh-dow, .wh.sun .wh-num { color: var(--sun); }
.wh.sat .wh-dow, .wh.sat .wh-num { color: var(--sat); }
.week-allday { display: grid; grid-template-columns: 52px repeat(7, minmax(0,1fr));
               border-bottom: 1px solid var(--border); background: var(--surface-2); }
.week-allday .lab { font-size: 10.5px; color: var(--muted); text-align: center; padding-top: 5px; font-weight: 700; }
.week-allday .cellx { border-left: 1px solid var(--border-soft); padding: 3px; min-height: 26px;
                      display: flex; flex-direction: column; gap: 2px; }
.week-body { position: relative; display: grid; grid-template-columns: 52px repeat(7, minmax(0,1fr));
             max-height: min(64vh, 760px); overflow-y: auto; }
.week-hours { display: grid; }
.hour-cell { height: 46px; border-bottom: 1px solid var(--border-soft); font-size: 11px; color: var(--muted);
             text-align: right; padding-right: 6px; font-variant-numeric: tabular-nums; }
.week-col { position: relative; border-left: 1px solid var(--border-soft); }
.week-col .slot { height: 46px; border-bottom: 1px solid var(--border-soft); }
.week-col.today { background: var(--today); }
.wev {
  position: absolute; left: 2px; right: 2px; border-radius: 6px; padding: 2px 5px; overflow: hidden;
  font-size: 11px; line-height: 1.35; color: #fff; cursor: pointer; box-shadow: var(--shadow-1);
  border-left: 3px solid rgba(255,255,255,.55);
}
.wev b { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--danger); z-index: 4; }
.now-line::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px;
                    border-radius: 50%; background: var(--danger); }

/* スマホでは7日分を画面幅に詰めると1日40px程度になり操作できないので、
   1日あたりの幅を確保して横スクロールさせる（見出し・終日・本体が一緒に動く） */
@media (max-width: 780px) {
  .cal-week { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .week-head, .week-allday, .week-body { min-width: 700px; }
  .week-body { max-height: 58vh; }
}

/* ------------------------------------------------------------------ カレンダー：日/一覧 */
.day-groups { display: flex; flex-direction: column; gap: 16px; }
.day-group { }
.day-head {
  display: flex; align-items: baseline; gap: 9px; padding: 6px 3px 8px; position: sticky; top: 0;
  background: linear-gradient(var(--bg) 72%, transparent); z-index: 3;
}
.day-head b { font-size: 16px; font-weight: 800; }
.day-head .dow { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.day-head.is-today b { color: var(--accent); }
.day-head.sun b, .day-head.sun .dow { color: var(--sun); }
.day-head.sat b, .day-head.sat .dow { color: var(--sat); }
.day-head .cnt { margin-left: auto; font-size: 12px; color: var(--muted); }

.ev-card {
  display: flex; gap: 12px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-m); padding: 11px 13px; box-shadow: var(--shadow-1); cursor: pointer;
  border-left: 4px solid var(--muted); min-height: 58px; align-items: center;
}
.ev-card:hover { border-color: var(--accent-line); }
.ev-when { flex: 0 0 74px; font-variant-numeric: tabular-nums; font-weight: 800; font-size: 13.5px; line-height: 1.35; }
.ev-when small { display: block; font-size: 11.5px; font-weight: 700; color: var(--muted); }
.ev-body { min-width: 0; flex: 1; }
.ev-name { font-weight: 700; font-size: 14.5px; }
.ev-sub { font-size: 12.5px; color: var(--muted); display: flex; gap: 9px; flex-wrap: wrap; margin-top: 1px; }

/* ------------------------------------------------------------------ 詳細・モーダル */
#modal-host:not(:empty), #sheet-host:not(:empty) { position: fixed; inset: 0; z-index: 70; }
.modal-back { position: absolute; inset: 0; background: rgba(10,14,26,.5); backdrop-filter: blur(3px);
              animation: fade .18s ease both; }
.modal {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(660px, calc(100vw - 28px)); max-height: min(88dvh, 900px); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-xl);
  box-shadow: var(--shadow-3); overflow: hidden; animation: pop .2s cubic-bezier(.2,.8,.3,1) both;
}
@keyframes pop { from { opacity: 0; transform: translate(-50%, -46%) scale(.97);} }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 15px 16px; border-bottom: 1px solid var(--border); }
.modal-head h3 { font-size: 16.5px; flex: 1; min-width: 0; }
.modal-body { padding: 16px; overflow-y: auto; }
.modal-foot { display: flex; gap: 8px; padding: 12px 16px calc(12px + var(--safe-b));
              border-top: 1px solid var(--border); background: var(--surface-2); }
.modal-foot .spacer { flex: 1; }
@media (max-width: 620px) {
  .modal { left: 0; right: 0; top: auto; bottom: 0; transform: none; width: 100%;
           max-height: 92dvh; border-radius: var(--r-xl) var(--r-xl) 0 0; animation: up .22s cubic-bezier(.2,.8,.3,1) both; }
  @keyframes up { from { transform: translateY(14px); opacity: 0; } }
}

.detail-hero { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.detail-bar { width: 5px; align-self: stretch; border-radius: 3px; background: var(--muted); flex: 0 0 auto; }
.detail-title { font-size: 18px; font-weight: 800; }
.detail-when { color: var(--text-2); font-weight: 700; font-size: 14px; margin-top: 3px; }
.kv { display: grid; grid-template-columns: 92px 1fr; gap: 7px 12px; font-size: 14px; align-items: start; }
.kv dt { color: var(--muted); font-size: 12.5px; font-weight: 700; padding-top: 2px; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.note-box { white-space: pre-wrap; background: var(--surface-2); border: 1px solid var(--border-soft);
            border-radius: var(--r-m); padding: 10px 12px; font-size: 13.5px; }

/* ------------------------------------------------------------------ 通知パネル */
.panel {
  position: fixed; top: calc(var(--topbar-h) + var(--safe-t) + 6px); right: 12px; width: min(392px, calc(100vw - 24px));
  max-height: min(72dvh, 640px); display: flex; flex-direction: column; z-index: 65;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-l);
  box-shadow: var(--shadow-3); overflow: hidden; animation: pop2 .16s ease both;
}
@keyframes pop2 { from { opacity: 0; transform: translateY(-6px);} }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 11px 13px; border-bottom: 1px solid var(--border); }
.panel-head b { flex: 1; font-size: 14.5px; }
.panel-body { overflow-y: auto; }
.noti {
  display: flex; gap: 10px; padding: 11px 13px; border-bottom: 1px solid var(--border-soft); cursor: pointer;
}
.noti:hover { background: var(--surface-2); }
.noti.unread { background: color-mix(in srgb, var(--accent-weak) 55%, var(--surface)); }
.noti-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 7px; flex: 0 0 auto; }
.noti.read .noti-dot { background: transparent; }
.noti-t { font-weight: 700; font-size: 13.5px; }
.noti-b { font-size: 12.5px; color: var(--text-2); }
.noti-at { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.menu { padding: 6px; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; padding: 0 11px;
             border: 0; background: transparent; border-radius: 9px; font-size: 14px; font-weight: 600;
             cursor: pointer; text-align: left; }
.menu-item:hover { background: var(--surface-3); }
.menu-sep { height: 1px; background: var(--border); margin: 5px 4px; }
.menu-head { padding: 9px 11px 4px; }
.menu-head b { display: block; font-size: 14.5px; }
.menu-head span { font-size: 12px; color: var(--muted); }

/* ------------------------------------------------------------------ トースト */
.toast-host { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + var(--safe-b));
              z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
@media (max-width: 780px) { .toast-host { bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); } }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 9px; max-width: min(92vw, 460px);
  padding: 11px 15px; border-radius: 13px; background: #171f33; color: #fff; font-size: 13.5px; font-weight: 600;
  box-shadow: var(--shadow-3); animation: toastin .22s cubic-bezier(.2,.8,.3,1) both;
}
@keyframes toastin { from { opacity: 0; transform: translateY(10px) scale(.97);} }
.toast.err { background: #7a1d17; }
.toast.ok { background: #0d5c45; }
.toast .ic { width: 18px; height: 18px; }

/* ------------------------------------------------------------------ テーブル */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-l); background: var(--surface); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
table.tbl th, table.tbl td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border-soft); }
table.tbl th { font-size: 12px; color: var(--muted); font-weight: 800; background: var(--surface-2);
               position: sticky; top: 0; white-space: nowrap; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .num { font-variant-numeric: tabular-nums; }
.tbl .act { text-align: right; white-space: nowrap; }

/* ------------------------------------------------------------------ その他 */
.qr-box { display: grid; place-items: center; gap: 10px; padding: 16px; background: #fff; border-radius: var(--r-l);
          border: 1px solid var(--border); }
.qr-box canvas, .qr-box svg { width: min(240px, 62vw); height: auto; image-rendering: pixelated; }
.code-strong { font-family: var(--mono); font-size: 22px; font-weight: 800; letter-spacing: .22em;
               background: var(--surface-3); padding: 9px 14px; border-radius: 11px; text-align: center; }
.copy-row { display: flex; gap: 7px; }
.copy-row input { font-family: var(--mono); font-size: 12.5px; }

.callout { display: flex; gap: 10px; padding: 12px 13px; border-radius: var(--r-m); font-size: 13.5px;
           border: 1px solid var(--border); background: var(--surface-2); }
.callout .ic { flex: 0 0 auto; margin-top: 2px; }
.callout.info { background: var(--accent-weak); border-color: var(--accent-line); color: var(--accent); }
.callout.warn { background: var(--warn-weak); border-color: color-mix(in srgb, var(--warn) 35%, transparent); color: var(--warn); }
.callout.danger { background: var(--danger-weak); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }
.callout b { font-weight: 800; }

details.acc { border: 1px solid var(--border); border-radius: var(--r-m); background: var(--surface); margin-bottom: 9px; }
details.acc > summary { list-style: none; cursor: pointer; padding: 12px 14px; font-weight: 700; font-size: 14px;
                        display: flex; align-items: center; gap: 9px; min-height: 46px; }
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .18s; margin-left: 2px; }
details.acc[open] > summary::before { transform: rotate(45deg); }
details.acc .acc-body { padding: 0 14px 14px; font-size: 13.5px; color: var(--text-2); }
details.acc .acc-body ol, details.acc .acc-body ul { margin: 0; padding-left: 1.3em; }
details.acc .acc-body li { margin-bottom: .35em; }

.skeleton { background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 37%, var(--surface-3) 63%);
            background-size: 400% 100%; animation: sk 1.3s ease infinite; border-radius: 8px; }
@keyframes sk { 0% { background-position: 100% 50%;} 100% { background-position: 0 50%;} }

.overdue { color: var(--danger); font-weight: 800; }
.done-title { text-decoration: line-through; color: var(--muted); }
.avatar-sm { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
             font-size: 11px; font-weight: 800; color: #fff; background: var(--muted); flex: 0 0 auto; }

/* ------------------------------------------------------------------ タッチ操作向けの拡大
   Androidタブレット等の指で操作する端末と、狭い画面では押せる大きさまで広げる。
   マウス環境では情報量を優先してそのままにする。
   （後勝ちにするため、各部品の定義より後ろに置いている） */
@media (max-width: 900px), (pointer: coarse) {
  .btn-sm { min-height: 40px; padding: 0 13px; }
  .filter-sel { min-height: 42px; height: 42px; font-size: 14px; }
  .segmented button { height: 40px; padding: 0 15px; }
  .icon-btn { width: 44px; height: 44px; }
  .chip-check span { min-height: 44px; height: 44px; }
  table.tbl th, table.tbl td { padding: 13px 12px; }
  .row-card { min-height: 62px; }
}

/* ------------------------------------------------------------------ 印刷 */
@media print {
  .topbar, .sidebar, .tabbar, .fab, .toolbar, .page-actions, #toast-host, .scrim { display: none !important; }
  .shell { display: block; height: auto; }
  body { background: #fff; }
  .view { overflow: visible; }
  .page { padding: 0; max-width: none; }
  .card, .cal-month, .row-card, .ev-card, .table-wrap { box-shadow: none; break-inside: avoid; }
  .cal-grid { grid-auto-rows: minmax(92px, auto); }
  .print-head { display: block !important; margin-bottom: 10px; }
  .print-head h1 { font-size: 17px; }
  .no-print { display: none !important; }
  a { color: #000; }
}
.print-head { display: none; }
