/* =============================================================
   Personal Hub - スタイル
   デザイン変更はまず下の「デザイントークン」を触る。
   個別ルールに直値(色/角丸/影)を新しく増やさないこと。

   配色は Misionero Hub(茶・緑)と意図的に変えている。
   個人事業用と会社用を、開いた瞬間に取り違えないための区別。
   ============================================================= */
:root {
  /* ── 色: ブランド ───────────────────────── */
  --navy: #1b2340;      /* 主色: トップバー/主ボタン */
  --navy-2: #3d4a80;    /* 副色: 見出し・テキストボタン */
  --bg: #f4f5f9;        /* ページ背景 */
  --ink: #171b2b;       /* 本文文字 */
  --muted: #6b7288;     /* 補助文字 */
  --line: #dcdfea;      /* 枠線 */
  --unread: #eef1fb;    /* 未読カード背景 */
  --red: #c93643;       /* 危険・未読バッジ */
  --orange: #b96a0c;    /* 警告 */
  --green: #17805c;     /* 正常 */
  --gray: #8b91a6;      /* 停止・不明 */

  /* ── 色: 面/アクセント ──────────────────── */
  --surface: #fff;
  --surface-2: #e7eaf4;
  --accent-soft: #e6eaf9;
  --critical-soft: #fff0f1;
  --warn-soft: #fff6e9;
  --ok-soft: #e9f6f1;
  --info-soft: #eef1f8;
  --body-text: #39405a;
  --on-dark: #fff;

  /* ── 角丸 ──────────────────────────────── */
  --r-sm: 8px;
  --r-md: 12px;
  --r-card: 16px;
  --r-pill: 999px;

  /* ── 影・タイポ・寸法 ───────────────────── */
  --shadow-card: 0 1px 2px #171b2b14, 0 8px 24px #171b2b0a;
  --font-sans: -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
  --page-max: 680px;
  --topbar-h: 54px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  padding-top: env(safe-area-inset-top);
}
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 13px; line-height: 1.6; margin: 4px 0 0; }

/* ---------------------------------------------------------- ログイン */
#login { min-height: 100dvh; display: grid; place-items: center; background: var(--navy); padding: 20px; }
.login-card {
  width: 100%; max-width: 340px; background: var(--surface);
  border-radius: var(--r-card); padding: 28px 22px; box-shadow: var(--shadow-card);
}
.login-card .logo { font-size: 21px; font-weight: 700; text-align: center; }
.login-card .sub { text-align: center; color: var(--muted); font-size: 13px; margin: 6px 0 20px; }
.login-card label, .form-card label {
  display: block; font-size: 12px; color: var(--muted); margin-bottom: 14px; font-weight: 600;
}
.login-card input, .login-card select,
.form-card input, .form-card select, .form-card textarea {
  display: block; width: 100%; margin-top: 6px; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink);
}
.form-card textarea { resize: vertical; line-height: 1.6; }
.login-card button, .form-card > button, .drop-card button {
  width: 100%; padding: 13px; border: 0; border-radius: var(--r-md);
  background: var(--navy); color: var(--on-dark); font-weight: 700;
}
.err { color: var(--red); font-size: 13px; min-height: 18px; margin: 10px 0 0; text-align: center; }

/* ---------------------------------------------------------- 骨組み */
.app-shell { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar-h);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 14px; background: var(--navy); color: var(--on-dark);
}
.topbar .brand { font-weight: 700; font-size: 15px; white-space: nowrap; }
.topbar .page-title { font-size: 13px; opacity: .85; }
.topbar .who { font-size: 12px; opacity: .8; }
.topbar .ghost {
  background: #ffffff26; color: var(--on-dark); border: 0;
  padding: 7px 11px; border-radius: var(--r-pill); font-size: 13px;
}
.app-main { flex: 1; width: 100%; max-width: var(--page-max); margin: 0 auto; padding: 16px 14px 92px; }

.page-heading { margin-bottom: 18px; }
.page-heading.compact { margin-bottom: 12px; }
.page-heading .eyebrow {
  font-size: 11px; letter-spacing: .12em; color: var(--navy-2); font-weight: 700; margin: 0 0 4px;
}
.page-heading h1 { font-size: 22px; margin: 0; }

/* ---------------------------------------------------------- ホーム */
.alert-banner {
  background: var(--critical-soft); border: 1px solid #f0c4c8; color: var(--red);
  border-radius: var(--r-md); padding: 12px 14px; font-size: 13px; font-weight: 600; margin-bottom: 14px;
}
.notice-summary {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 14px; margin-bottom: 14px; box-shadow: var(--shadow-card); color: inherit;
}
.notice-summary .notice-icon {
  width: 38px; height: 38px; display: grid; place-items: center;
  background: var(--accent-soft); border-radius: var(--r-pill); flex: none;
}
.notice-summary span > strong { display: block; font-size: 14px; }
.notice-summary span > small { color: var(--muted); font-size: 12px; }
.notice-summary .arrow { margin-left: auto; color: var(--muted); }

.drop-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 16px 14px; box-shadow: var(--shadow-card); margin-bottom: 14px;
}
.drop-label { font-size: 12px; font-weight: 700; color: var(--navy-2); }
.drop-card input {
  display: block; width: 100%; margin: 8px 0 6px; padding: 12px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
}
.drop-kind { font-size: 12px; color: var(--muted); min-height: 17px; margin: 0 0 10px; }
.drop-msg { font-size: 13px; margin: 10px 0 0; min-height: 18px; }
.drop-msg.ok { color: var(--green); }
.drop-msg.ng { color: var(--red); }

.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 14px 8px; text-align: center; color: inherit; box-shadow: var(--shadow-card);
}
.stat b { display: block; font-size: 22px; }
.stat small { color: var(--muted); font-size: 11px; }

/* ---------------------------------------------------------- 共通パーツ */
.form-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 16px 14px; box-shadow: var(--shadow-card); margin-bottom: 16px;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin: 14px 0 8px; font-size: 13px; color: var(--muted);
}
.toolbar .text-button, .text-button {
  margin-left: auto; background: none; border: 0; color: var(--navy-2); font-weight: 700; font-size: 13px;
}
.icon-button {
  background: var(--surface-2); border: 0; border-radius: var(--r-pill);
  width: 30px; height: 30px; color: var(--navy);
}
.badge {
  background: var(--red); color: var(--on-dark); border-radius: var(--r-pill);
  padding: 1px 8px; font-size: 12px;
}
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  flex: none; padding: 7px 13px; border-radius: var(--r-pill); border: 1px solid var(--line);
  background: var(--surface); color: var(--muted); font-size: 13px;
}
.tabs button.active { background: var(--navy); border-color: var(--navy); color: var(--on-dark); font-weight: 700; }

.list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.list li {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 13px 14px; box-shadow: var(--shadow-card);
}
.list li.unread { background: var(--unread); }
.item-head { display: flex; align-items: center; gap: 8px; }
.item-title { font-weight: 700; font-size: 14px; flex: 1; }
.item-body { color: var(--body-text); font-size: 13px; line-height: 1.6; margin: 6px 0 0; white-space: pre-wrap; }
.item-meta { color: var(--muted); font-size: 11px; margin-top: 7px; display: flex; gap: 8px; flex-wrap: wrap; }
.empty { text-align: center; color: var(--muted); font-size: 13px; padding: 32px 0; }

.pill {
  font-size: 11px; padding: 2px 9px; border-radius: var(--r-pill); font-weight: 700;
  background: var(--info-soft); color: var(--navy-2); white-space: nowrap;
}
.pill.ok { background: var(--ok-soft); color: var(--green); }
.pill.warn { background: var(--warn-soft); color: var(--orange); }
.pill.critical, .pill.ng { background: var(--critical-soft); color: var(--red); }
.pill.off { background: var(--surface-2); color: var(--gray); }

.push-card {
  display: flex; align-items: center; gap: 10px; background: var(--accent-soft);
  border-radius: var(--r-md); padding: 11px 13px; font-size: 13px; margin-bottom: 12px;
}
.push-card button {
  margin-left: auto; background: var(--navy); color: var(--on-dark);
  border: 0; border-radius: var(--r-pill); padding: 7px 14px; font-size: 13px; font-weight: 700;
}

/* ---------------------------------------------------------- 稼働状況 */
.sys-group { margin-bottom: 18px; }
.sys-group > h2 {
  font-size: 12px; color: var(--muted); letter-spacing: .06em; margin: 0 0 8px; text-transform: uppercase;
}
.sys-card {
  display: flex; align-items: center; gap: 11px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 12px 14px; margin-bottom: 8px; box-shadow: var(--shadow-card); width: 100%;
  text-align: left; color: inherit;
}
.sys-dot { width: 10px; height: 10px; border-radius: var(--r-pill); flex: none; background: var(--gray); }
.sys-dot.ok { background: var(--green); }
.sys-dot.down, .sys-dot.fail { background: var(--red); }
.sys-dot.unknown { background: var(--gray); }
.sys-dot.off { background: var(--line); }
.sys-main { flex: 1; min-width: 0; }
.sys-main strong { display: block; font-size: 14px; }
.sys-main small { color: var(--muted); font-size: 11px; }

/* ---------------------------------------------------------- 出品エディタ */
.overlay {
  position: fixed; inset: 0; z-index: 50; background: var(--bg); overflow-y: auto;
  padding-top: env(safe-area-inset-top);
}
.exp-pane { max-width: var(--page-max); margin: 0 auto; padding: 14px 14px 60px; }
.exp-h3 { font-size: 13px; color: var(--navy-2); margin: 20px 0 8px; }
.check-list { display: flex; flex-direction: column; gap: 6px; }
.check-list label {
  display: flex; align-items: center; gap: 10px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-md); padding: 11px 13px; font-size: 13px;
}
.check-list input { width: 18px; height: 18px; }
.rule-list { margin: 0; padding-left: 20px; color: var(--body-text); font-size: 13px; line-height: 1.8; }

.settings-card {
  display: flex; align-items: center; gap: 12px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-card); padding: 14px; margin-bottom: 12px;
}
.settings-card strong { display: block; font-size: 15px; }
.settings-card small { color: var(--muted); font-size: 12px; }
.settings-row {
  display: flex; align-items: center; width: 100%; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 14px; margin-bottom: 8px; font-size: 14px; color: inherit; text-align: left;
}
.settings-row .arrow { margin-left: auto; color: var(--muted); }
.settings-row.danger { color: var(--red); }
.foot-note { margin-top: 18px; }

/* ---------------------------------------------------------- 下部ナビ */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav button {
  background: none; border: 0; color: var(--muted);
  font-size: 10px; padding: 8px 0 9px; display: grid; gap: 2px; justify-items: center;
}
.bottom-nav button > span { font-size: 17px; line-height: 1; position: relative; }
.bottom-nav button.active { color: var(--navy); font-weight: 700; }
.nav-badge {
  position: absolute; top: -5px; right: -11px; background: var(--red); color: var(--on-dark);
  border-radius: var(--r-pill); font-size: 10px; padding: 0 5px; font-weight: 700;
}
