/* 業務用の管理パネル（Googleアカウント風）。ライト／ダーク両対応 */
:root {
  --bg: #f8fafd; --surface: #fff; --text: #1f1f1f; --muted: #5f6368; --border: #dadce0; --hover: #f1f3f4;
  --primary: #0b57d0; --primary-ink: #fff; --primary-soft: #d3e3fd; --primary-soft-ink: #041e49;
  --danger: #b3261e; --danger-soft: #fce8e6; --ok: #146c2e; --ok-soft: #e6f4ea; --warn-soft: #fef7e0; --warn: #7a5900;
  --line: #06c755; --radius: 12px; --shadow: 0 1px 2px rgba(60, 64, 67, .15), 0 1px 3px 1px rgba(60, 64, 67, .08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131314; --surface: #1e1f20; --text: #e3e3e3; --muted: #a8abaf; --border: #3c4043; --hover: #2a2b2d;
    --primary: #a8c7fa; --primary-ink: #062e6f; --primary-soft: #0842a0; --primary-soft-ink: #d3e3fd;
    --danger: #f2b8b5; --danger-soft: #601410; --ok: #6dd58c; --ok-soft: #0f3b1e; --warn-soft: #3d3000; --warn: #f5d76e;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", "Segoe UI", sans-serif; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
h1, h2 { font-weight: 500; letter-spacing: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.nowrap { white-space: nowrap; }
.c { text-align: center; }

/* ブランドマーク・アバター */
.mark, .avatar { display: inline-grid; place-items: center; border-radius: 50%; font-weight: 600; color: #fff; background: #3f6f60; flex: none; }
.mark { width: 32px; height: 32px; font-size: 15px; }
.avatar { width: 32px; height: 32px; font-size: 14px; background: #5e5ce6; }
.avatar.sm { width: 26px; height: 26px; font-size: 12px; margin-right: 10px; vertical-align: middle; }
.avatar.xl { width: 72px; height: 72px; font-size: 30px; }

/* ── ログイン前：中央のカード ── */
.auth-body { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 480px; background: var(--surface); border: 1px solid var(--border); border-radius: 28px; padding: 36px 32px 28px; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--muted); margin-bottom: 20px; }
.auth-card h1 { font-size: 26px; margin: 0 0 6px; }
.auth-card .sub { color: var(--muted); margin: 0 0 22px; font-size: 15px; }
.auth-foot { margin-top: 18px; font-size: 12px; color: var(--muted); }
.next-step { font-size: 13px; color: var(--muted); background: var(--hover); border-radius: 8px; padding: 8px 12px; margin: -8px 0 18px; }
.hint { font-size: 12px; color: var(--muted); margin: 18px 0 0; }
.status-text { min-height: 1.6em; font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.chip { display: inline-block; padding: 2px 10px; border: 1px solid var(--border); border-radius: 999px; font-size: 13px; color: var(--text); }

.who { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 999px; margin: 0 0 18px; }
.consent { border-top: 1px solid var(--border); padding-top: 14px; }
.consent-title { font-size: 13px; color: var(--muted); margin: 0 0 4px; }
.consent ul { margin: 0 0 14px; padding-left: 20px; }

/* ボタン */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 22px; border-radius: 999px; border: 1px solid transparent;
  font: inherit; font-weight: 500; cursor: pointer; text-decoration: none; background: var(--hover); color: var(--text); white-space: nowrap; }
.btn:hover { text-decoration: none; filter: brightness(.97); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--primary); }
.btn-danger { background: transparent; border-color: var(--border); color: var(--danger); }
.btn-line { background: var(--line); color: #fff; }
/* ログイン画面の縦に並ぶ大きいボタンだけ全幅にする（確認画面のボタンは横並び） */
.btn-block { display: flex; width: 100%; min-height: 46px; margin: 0 0 12px; font-size: 15px; }
.line-mark { font-size: 10px; font-weight: 800; letter-spacing: .02em; background: #fff; color: var(--line); border-radius: 6px; padding: 2px 5px; }
.btn-text { background: none; border: 0; padding: 8px 12px; font: inherit; font-weight: 500; color: var(--primary); cursor: pointer; border-radius: 999px; }
.btn-text:hover { background: var(--hover); text-decoration: none; }
.btn-text.danger { color: var(--danger); }
.row-end { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 20px; }
.row-end .btn { min-width: 112px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* 入力 */
.field { display: block; margin: 0 0 16px; }
.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select { width: 100%; min-height: 44px; padding: 10px 14px; font: inherit; font-size: 15px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; }
.field input:focus, .field select:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }
.field.inline { max-width: 360px; }
.switch { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.switch input { width: 18px; height: 18px; accent-color: var(--primary); margin: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 24px; margin-bottom: 4px; }

.notice { padding: 12px 16px; border-radius: 8px; background: var(--primary-soft); color: var(--primary-soft-ink); margin: 0 0 16px; }
.notice.error { background: var(--danger-soft); color: var(--danger); }

/* ── ログイン後：上部バー＋左メニュー ── */
.appbar { position: sticky; top: 0; z-index: 10; height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px 0 20px;
  background: var(--bg); border-bottom: 1px solid var(--border); }
.appbar-brand { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 18px; }
.appbar-brand b { font-weight: 500; color: var(--text); }
.appbar-brand:hover { text-decoration: none; }
.panel { display: flex; max-width: 1180px; margin: 0 auto; }
.sidenav { width: 260px; flex: none; padding: 12px 12px 12px 0; position: sticky; top: 64px; align-self: flex-start; }
.nav-item { display: flex; align-items: center; gap: 18px; height: 48px; padding: 0 24px; border-radius: 0 999px 999px 0; color: var(--text); font-weight: 500; }
.nav-item svg { color: var(--muted); }
.nav-item:hover { background: var(--hover); text-decoration: none; }
.nav-item.active { background: var(--primary-soft); color: var(--primary-soft-ink); }
.nav-item.active svg { color: var(--primary-soft-ink); }
.content { flex: 1; min-width: 0; max-width: 900px; padding: 28px 24px 64px; }
.page-title { font-size: 28px; margin: 0 0 20px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .page-title { margin: 0; }
.hero { text-align: center; margin: 8px 0 28px; }
.hero h1 { font-size: 28px; margin: 12px 0 2px; }
.hero p { margin: 0; }
.hero.left { display: flex; align-items: center; gap: 18px; text-align: left; }
.hero.left h1 { margin: 0 0 4px; }
.back { display: inline-block; margin-bottom: 12px; }

/* カードと行（Googleアカウントの設定一覧風） */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin: 0 0 20px; overflow: hidden; }
.card.pad { padding: 24px; }
.card-head { padding: 20px 24px 8px; }
.card-head h2 { font-size: 20px; margin: 0; }
.card-head p { color: var(--muted); margin: 4px 0 0; font-size: 13px; }
.card-body { padding: 16px 24px 20px; }
.card-foot { padding: 16px 24px 20px; border-top: 1px solid var(--border); }
.row { display: flex; align-items: center; gap: 16px; min-height: 56px; padding: 10px 24px; border-top: 1px solid var(--border); color: var(--text); }
.card-head + .row { border-top: 0; }
.row.link:hover { background: var(--hover); text-decoration: none; }
.row-label { width: 200px; flex: none; color: var(--muted); font-size: 12px; text-transform: none; }
.row-value { flex: 1; min-width: 0; }
.row-main { flex: 1; min-width: 0; }
.row-icon { width: 36px; height: 36px; border-radius: 50%; background: var(--hover); display: grid; place-items: center; color: var(--muted); flex: none; }
.chev { color: var(--muted); }

/* 表 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
th { font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; background: var(--surface); }
tbody tr:last-child td { border-bottom: 0; }
tr.clickable:hover td { background: var(--hover); }
.cell-link { color: var(--text); font-weight: 500; display: inline-flex; align-items: center; white-space: nowrap; }
.cell-link:hover { text-decoration: none; color: var(--primary); }
.badge { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--hover); color: var(--muted); white-space: nowrap; }
.badge.active { background: var(--ok-soft); color: var(--ok); }
.badge.pending { background: var(--warn-soft); color: var(--warn); }
.badge.disabled { background: var(--danger-soft); color: var(--danger); }
.badge.admin { background: var(--primary-soft); color: var(--primary-soft-ink); }
.badge.root { background: #3c4043; color: #fff; }

/* セットアップコード表示 */
.codebox { border: 1px solid var(--primary); background: var(--primary-soft); color: var(--primary-soft-ink); border-radius: var(--radius); padding: 16px 20px; margin: 0 0 20px; }
.codebox .code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 30px; font-weight: 600; letter-spacing: .14em; margin: 4px 0 8px; }

/* スマホ：左メニューを上部のタブに */
@media (max-width: 760px) {
  .appbar { padding: 0 12px 0 16px; height: 56px; }
  .appbar-brand { font-size: 16px; }
  .panel { display: block; }
  .sidenav { position: sticky; top: 56px; z-index: 9; width: auto; display: flex; overflow-x: auto; gap: 4px; padding: 8px 12px; background: var(--bg); border-bottom: 1px solid var(--border); }
  .nav-item { height: 36px; padding: 0 14px; gap: 8px; border-radius: 999px; white-space: nowrap; font-size: 13px; }
  .nav-item svg { width: 18px; height: 18px; }
  .content { padding: 20px 16px 48px; }
  .page-title, .hero h1 { font-size: 24px; }
  .row { padding: 10px 16px; flex-wrap: wrap; gap: 4px 12px; }
  .row-label { width: 100%; }
  .row.link .row-label, .row .row-icon + .row-main { width: auto; }
  .card-head, .card-body, .card-foot { padding-left: 16px; padding-right: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .auth-card { padding: 28px 20px 22px; border-radius: 20px; }
  th, td { padding: 10px 12px; }
}
