/* =============================================================================
 * design-system.css — 追加工事管理ツール 共通デザイン基盤（R5 / cunimi 色味）
 *
 * 承認済みログインデザイン（docs/mockups/login.html）の雰囲気を全画面へ展開する
 * ための土台。色・フォント・余白・角丸・影などの「見た目トークン」と、
 * それを用いた共通コンポーネントを定義する。
 *
 * 方針: クリーム背景＋白カード＋オレンジのプライマリ。
 *   - 見出し = Nunito / 本文 = Noto Sans JP（Google Fonts、system-ui フォールバック）
 *   - ダークヘッダ(#1f2937)・青(#2563eb)は廃し、白系ヘッダ＋オレンジアクセント。
 *   - 文具/ノート罫線/付箋/グラデーションは使わない。
 *   - タップ領域 >= 44px、入力フォントは 16px 維持（iOS ズーム防止）。
 *
 * ※ 既存の app.css のクラス名・構造は維持し、色トークンのみ cunimi に更新している。
 *    JS が参照する id / class / name / data 属性は一切変更しない。
 * ========================================================================== */

@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@600;700;800;900&family=Noto+Sans+JP:wght@400;500;700&display=swap");

/* ---------------------------------------------------------------------------
 * 1. デザイントークン（cunimi 色味・login.html と一致）
 * ------------------------------------------------------------------------- */
:root {
  /* ブランドカラー */
  --orange: #f5820a; /* プライマリ（CTA・アクセント） */
  --orange-hover: #d96e00;
  --orange-subtle: #fff4e6; /* 背景アクセント */

  /* 面・背景 */
  --cream: #fffdf5; /* 画面背景 */
  --bg-alt: #f5f5f7;
  --white: #ffffff;

  /* テキスト */
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;

  /* 境界線 */
  --border: #d2d2d7;
  --border-light: #e8e8ed;

  /* 状態色 */
  --green: #34c759; /* 完了 */
  --red: #ff3b30; /* 施工中 / エラー */

  /* 角丸 */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* 影 */
  --ds-shadow-sm: 0 1px 2px rgba(29, 29, 31, 0.06);
  --ds-shadow: 0 4px 16px rgba(29, 29, 31, 0.08);
  --ds-shadow-lg: 0 12px 40px rgba(29, 29, 31, 0.1);

  /* フォント */
  --font-heading: "Nunito", "Noto Sans JP", system-ui, -apple-system, sans-serif;
  --font-body: "Noto Sans JP", "Nunito", system-ui, -apple-system,
    "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;

  /* タップ領域最小 */
  --tap-min: 44px;
}

/* ---------------------------------------------------------------------------
 * 2. ベース
 * ------------------------------------------------------------------------- */
.ds-body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}

.ds-heading {
  font-family: var(--font-heading);
  font-weight: 800;
  letter-spacing: -0.2px;
}

/* ---------------------------------------------------------------------------
 * 3. アプリヘッダ（白系＋オレンジアクセント＋下ボーダー）
 * ------------------------------------------------------------------------- */
.ds-app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
  background: var(--white);
  color: var(--text);
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--ds-shadow-sm);
}
.ds-app-header__logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  background: var(--orange);
  color: #fff;
  border-radius: 10px;
  font-family: var(--font-heading);
  font-weight: 900;
  font-size: 17px;
  box-shadow: 0 3px 10px rgba(245, 130, 10, 0.32);
}
.ds-app-header__title {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 17px;
  margin: 0;
}
.ds-app-header__spacer {
  flex: 1;
}
.ds-app-header__user {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ---------------------------------------------------------------------------
 * 4. ボタン
 * ------------------------------------------------------------------------- */
.ds-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap-min);
  padding: 12px 22px;
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 16px;
  line-height: 1.2;
  color: #fff;
  background: var(--orange);
  border: 1.5px solid var(--orange);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, transform 0.05s;
  -webkit-tap-highlight-color: transparent;
}
.ds-btn:hover {
  background: var(--orange-hover);
  border-color: var(--orange-hover);
}
.ds-btn:active {
  transform: translateY(1px);
}
.ds-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ds-btn--sub {
  color: var(--text);
  background: var(--white);
  border-color: var(--border);
}
.ds-btn--sub:hover {
  background: var(--bg-alt);
  border-color: var(--border);
}

.ds-btn--danger {
  color: var(--red);
  background: var(--white);
  border-color: var(--red);
}
.ds-btn--danger:hover {
  color: #fff;
  background: var(--red);
  border-color: var(--red);
}

/* ---------------------------------------------------------------------------
 * 5. 入力 / フィールド
 * ------------------------------------------------------------------------- */
.ds-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ds-field__label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
}
.ds-input {
  width: 100%;
  min-height: var(--tap-min);
  padding: 0 14px;
  font-size: 16px; /* iOS ズーム防止 */
  font-family: var(--font-body);
  color: var(--text);
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.ds-input:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-subtle);
}

/* ---------------------------------------------------------------------------
 * 6. カード
 * ------------------------------------------------------------------------- */
.ds-card {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--ds-shadow-sm);
  padding: 16px;
}

/* ---------------------------------------------------------------------------
 * 7. バッジ（状態）
 * ------------------------------------------------------------------------- */
.ds-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  line-height: 1.4;
}
.ds-badge--in-progress {
  color: #fff;
  background: var(--red);
}
.ds-badge--completed {
  color: #fff;
  background: var(--green);
}
.ds-badge--neutral {
  color: var(--text);
  background: var(--orange-subtle);
}

/* ---------------------------------------------------------------------------
 * 8. ピン凡例
 * ------------------------------------------------------------------------- */
.ds-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  padding: 12px 16px;
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}
.ds-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
}
.ds-legend__dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(0, 0, 0, 0.12);
  flex: none;
}
.ds-legend__dot--in-progress {
  background: var(--red);
}
.ds-legend__dot--completed {
  background: var(--green);
}

/* ---------------------------------------------------------------------------
 * 9. モーダル土台
 * ------------------------------------------------------------------------- */
.ds-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(29, 29, 31, 0.5);
}
.ds-modal {
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--ds-shadow-lg);
  padding: 20px 16px;
}

/* ===========================================================================
 * R8: アカウントメニュー（≡）＆ 初期パスワード案内バナー（app.js が生成）
 * 全画面が design-system.css を読み込むため、共通スタイルはここに置く。
 * ========================================================================= */

/* --- アカウントメニュー ------------------------------------------------- */
.acct-menu { position: relative; flex: 0 0 auto; }
.acct-menu__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
  color: var(--orange-hover);
  background: var(--orange-subtle);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.acct-menu__panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 3000;
  min-width: 200px;
  padding: 6px;
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--ds-shadow-lg);
}
.acct-menu__panel[hidden] { display: none; }
.acct-menu__head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 6px;
}
.acct-menu__name { font-size: 14px; font-weight: 700; color: var(--text); }
.acct-menu__role { font-size: 11px; color: var(--text-secondary); }
.acct-menu__item {
  display: block;
  width: 100%;
  padding: 12px 10px;              /* 指操作前提の当たり判定 */
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  color: var(--text);
  text-decoration: none;
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.acct-menu__item:hover { background: var(--orange-subtle); }
.acct-menu__item--danger { color: var(--red); }
.acct-menu__sep {
  height: 1px;
  margin: 6px 4px;
  background: var(--border-light);
}

/* --- 初期パスワード案内バナー ------------------------------------------- */
.pw-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: #fff4e6;
  border-bottom: 1px solid #f5c98a;
  color: #8a4b00;
  font-size: 13px;
}
.pw-banner__msg { flex: 1 1 auto; min-width: 0; }
.pw-banner__action {
  flex: 0 0 auto;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--white);
  background: var(--orange);
  border-radius: var(--radius-sm);
  text-decoration: none;
}
.pw-banner__close {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
  color: #8a4b00;
  background: none;
  border: none;
  cursor: pointer;
}

/* ===========================================================================
 * R10: 多言語化 — 言語スイッチャー（案A・セグメント/ピル。i18n.js が生成）
 * ========================================================================= */
.i18n-seg {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--orange-subtle);
  border-radius: 999px;
}
.i18n-seg__btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 9px 6px;
  border: none;
  background: transparent;
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  color: var(--orange-hover);
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.i18n-seg__btn[aria-pressed="true"] {
  background: var(--orange);
  color: #fff;
  box-shadow: 0 2px 6px rgba(245, 130, 10, .35);
}
.i18n-seg--compact .i18n-seg__btn { font-size: 12px; padding: 8px 4px; }

/* ログイン画面の言語切替（カード幅いっぱい・フォームの上に配置） */
.auth-lang {
  margin-bottom: 14px;
}

/* アカウントメニュー内の言語切替（ラベル＋フルワイドのセグメントを縦に） */
.acct-menu__lang {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border-top: 1px solid var(--border-light);
  margin-top: 6px;
}
.acct-menu__lang-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 700;
}
