:root {
  color-scheme: light;
  --bg: #f6f7f8;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #667085;
  --border: #d9dee5;
  --accent: #1769e0;
  --accent-soft: #eaf2ff;
  --danger: #b42318;
  --warning-bg: #fff7e6;
  --warning-border: #f3c969;
  --shadow: 0 2px 14px rgba(0,0,0,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, textarea { font: inherit; }
button { min-height: 40px; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 8px 12px; cursor: pointer; color: var(--text); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--accent); border-color: var(--accent); color: white; }
button.secondary { background: var(--accent-soft); border-color: #bfd5ff; color: #0d55bc; }
button.ghost { border-color: transparent; background: transparent; }
.hidden { display: none !important; }
.sr-only { position: absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
.app-shell { min-height: 100vh; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
.topbar { position: sticky; top: 0; z-index: 20; display:flex; justify-content:space-between; align-items:center; gap:12px; padding: max(10px, env(safe-area-inset-top)) 12px 10px; background:rgba(255,255,255,.96); border-bottom:1px solid var(--border); backdrop-filter: blur(10px); }
.brand { display:flex; align-items:center; gap:10px; min-width:0; }
.brand-mark { display:grid; place-items:center; width:38px; height:38px; border-radius:10px; background:var(--accent); color:#fff; font-size:22px; }
h1 { margin:0; font-size:16px; }
.subtle { font-size:12px; color:var(--muted); }
.top-actions { display:flex; gap:6px; flex-shrink:0; }
main { max-width: 1200px; margin: 0 auto; padding: 12px; }
.card { background:var(--surface); border:1px solid var(--border); border-radius:14px; box-shadow:var(--shadow); }
.picker-card { padding:12px; margin-bottom:10px; }
.card-row { display:flex; align-items:center; gap:12px; }
.grow { flex:1; min-width:0; }
.eyebrow { font-size:11px; font-weight:700; color:var(--muted); text-transform:none; }
.selection-title { font-size:15px; font-weight:700; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; margin-top:3px; }
.notice { margin-bottom:10px; border:1px solid #b9d0f7; background:#edf5ff; border-radius:10px; padding:10px 12px; font-size:13px; }
.notice.error { color:var(--danger); border-color:#f2b8b5; background:#fff1f0; }
.notice.warning { border-color:var(--warning-border); background:var(--warning-bg); }
.sheet-nav { overflow-x:auto; scrollbar-width:thin; margin-bottom:8px; }
.sheet-tabs { display:flex; gap:6px; padding:2px 0 5px; width:max-content; }
.sheet-tab { white-space:nowrap; min-height:36px; border-radius:18px; }
.sheet-tab.active { background:var(--accent); color:#fff; border-color:var(--accent); }
.sheet-tab.hidden-sheet::after { content:' 非表示'; font-size:10px; opacity:.7; }
.toolbar { padding:10px; margin-bottom:10px; }
.toolbar-row { display:flex; flex-wrap:wrap; gap:6px; margin-bottom:7px; }
.toolbar-row:last-child { margin-bottom:0; }
.jump-row input { flex:1; min-width:130px; min-height:40px; border:1px solid var(--border); border-radius:10px; padding:8px 10px; }
.position-label { font-size:12px; color:var(--muted); }
.table-card { position:relative; overflow:hidden; min-height:300px; }
.table-loading { position:absolute; z-index:8; inset:0; display:grid; place-items:center; background:rgba(255,255,255,.76); font-weight:700; }
.sheet-grid { overflow:auto; max-height:calc(100vh - 300px); min-height:300px; overscroll-behavior:contain; }
.grid-table { border-collapse:separate; border-spacing:0; min-width:max-content; width:100%; }
.grid-table th, .grid-table td { border-right:1px solid #e1e5ea; border-bottom:1px solid #e1e5ea; min-width:92px; max-width:280px; height:38px; padding:6px 8px; font-size:13px; vertical-align:top; background:#fff; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.grid-table th { position:sticky; top:0; z-index:3; background:#f4f6f8; font-weight:600; text-align:center; }
.grid-table .corner { position:sticky; left:0; z-index:5; min-width:48px; width:48px; }
.grid-table .row-head { position:sticky; left:0; z-index:2; min-width:48px; width:48px; background:#f4f6f8; text-align:center; color:var(--muted); }
.grid-table td { cursor:pointer; }
.grid-table td:hover, .grid-table td:focus { outline:2px solid #8bb7f5; outline-offset:-2px; }
.grid-table td.long { white-space:normal; min-width:180px; }
.cell-dialog { width:min(94vw, 620px); border:0; border-radius:16px; padding:0; box-shadow:0 20px 60px rgba(0,0,0,.25); }
.cell-dialog::backdrop { background:rgba(0,0,0,.35); }
.dialog-shell { padding:14px; }
.dialog-header { display:flex; justify-content:space-between; align-items:flex-start; gap:10px; }
.dialog-header h2 { margin:2px 0 0; font-size:18px; }
.icon-button { min-width:40px; padding:4px; font-size:24px; line-height:1; }
#cell-editor { width:100%; resize:vertical; min-height:180px; border:1px solid var(--border); border-radius:10px; padding:10px; margin:10px 0 6px; line-height:1.55; }
#cell-editor:disabled { background:#f3f4f6; color:#535862; }
.dialog-actions { display:flex; justify-content:flex-end; gap:8px; margin-top:12px; }
.chip-row { display:flex; flex-wrap:wrap; gap:5px; margin-top:8px; }
.chip { border-radius:999px; background:#f0f2f5; padding:4px 8px; font-size:11px; }
@media (max-width: 560px) {
  .topbar { align-items:flex-start; }
  .top-actions { flex-direction:column; }
  .top-actions button { min-height:34px; padding:5px 8px; font-size:12px; }
  main { padding:8px; }
  .toolbar-row button { flex:1 1 auto; }
  .grid-table th, .grid-table td { min-width:82px; }
  .sheet-grid { max-height:calc(100vh - 320px); }
}


/* 実装3: Googleログイン */
.login-card, .access-card { padding:14px; margin-bottom:10px; }
.signin-button { min-height:44px; display:flex; align-items:center; margin-top:8px; }
.account-panel { display:flex; align-items:center; gap:10px; margin-top:8px; }
.account-picture { width:38px; height:38px; border-radius:50%; object-fit:cover; }
.status-chip { display:inline-flex; align-items:center; min-height:26px; padding:2px 8px; border-radius:999px; font-size:12px; white-space:nowrap; }
.status-chip.success { background:#e8f5e9; color:#176b2c; }
.login-help { margin-top:8px; line-height:1.5; }
.setup-link { display:inline-block; margin-top:6px; }
@media (max-width: 520px) {
  .account-panel { align-items:flex-start; }
  .status-chip { margin-left:auto; }
}

.setup-page { max-width:720px; margin:0 auto; padding:16px; }
.setup-card { padding:18px; }
.setup-card h1 { margin:6px 0 12px; font-size:22px; }
.setup-field { display:block; margin:14px 0; font-weight:600; }
.setup-field input { display:block; width:100%; box-sizing:border-box; margin-top:6px; min-height:44px; padding:9px 10px; font:inherit; }
.setup-card code { overflow-wrap:anywhere; }

/* 実装3.1: 開発者設定を本体へ統合 */
.developer-setup { padding:18px; margin-bottom:10px; }
.developer-setup h2 { margin:6px 0 10px; font-size:20px; }
.developer-setup code { overflow-wrap:anywhere; }
