/* 顧客データベース 共通スタイル(ビルドなし・自前CSS)
   配色・字送りは commit-check に合わせている(同アプリの C トークンを移植)。
   詰まった情報密度・角丸3px・数字は等幅、が基本トーン。
   旧来の変数名(--gray-200 等)は既存CSSが参照しているため残し、値だけ差し替えた。 */

:root {
  /* commit-check の設計トークン */
  --ink: #0f1419;      /* 主文字 */
  --sub: #5c6672;      /* 副文字 */
  --faint: #98a2ae;    /* 淡い文字 */
  --line: #d6dde5;     /* 罫線 */
  --sel: #f2f7fd;      /* 選択・強調の面 */
  --note: #f6f8fa;     /* 補助の面 */
  --surface: #ffffff;  /* カード */
  --page: #eaeef3;     /* ページ背景 */

  --blue-600: #14487f;
  --blue-700: #10395f;
  --blue-800: #0c2b48;
  --blue-50: #f2f7fd;
  --gray-50: #fafbfc;
  --gray-100: #f6f8fa;
  --gray-200: #eaeef3;
  --gray-400: #98a2ae;
  --gray-600: #5c6672;
  --gray-800: #0f1419;
  --red-600: #9e2a2a;
  --red-50: #fdf3f3;
  --orange-600: #8a5209;
  --orange-50: #fbf5ea;
  --green-600: #15603d;
  --green-50: #f6faf7;

  --radius: 3px;
  --radius-pill: 99px;
  --shadow: none;

  --font-jp: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", sans-serif;
  --font-num: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font-jp);
  background: var(--page);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--blue-600); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 認証ページ(中央カード) ---------- */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: linear-gradient(160deg, var(--blue-800), var(--blue-600));
}

.auth-card {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  padding: 40px 32px;
  width: 100%;
  max-width: 420px;
}

.auth-brand {
  text-align: center;
  font-size: 26px;
  font-weight: 700;
  color: var(--blue-600);
  margin-bottom: 4px;
}

.auth-sub {
  text-align: center;
  color: var(--gray-600);
  font-size: 14px;
  margin-bottom: 24px;
}

.auth-note {
  margin-top: 20px;
  font-size: 12.5px;
  color: var(--gray-600);
  text-align: center;
}

/* ---------- フォーム ---------- */

.field { margin-bottom: 16px; }

.field label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 6px;
}

.input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  font-size: 15px;
  font-family: inherit;
}

.input:focus {
  outline: 2px solid var(--blue-600);
  outline-offset: -1px;
  border-color: var(--blue-600);
}

.input-code {
  text-align: center;
  font-size: 24px;
  letter-spacing: 8px;
  font-variant-numeric: tabular-nums;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--gray-600);
  cursor: pointer;
}

.check input { width: 16px; height: 16px; accent-color: var(--blue-600); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
}

.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-primary { background: var(--blue-600); color: #fff; border-color: var(--blue-600); }
.btn-primary:hover:not(:disabled) { background: var(--blue-700); }
.btn-secondary { background: var(--surface); color: var(--ink); }
.btn-secondary:hover:not(:disabled) { background: var(--gray-400); }
.btn-danger { background: var(--red-600); color: #fff; border-color: var(--red-600); }

.alert {
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 16px;
}

.alert-error {
  background: var(--red-50);
  color: var(--red-600);
  border: 1px solid #fecaca;
}

.hidden { display: none !important; }

/* ---------- MFAセットアップ ---------- */

.qr-box {
  display: flex;
  justify-content: center;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.qr-box svg { width: 180px; height: 180px; }

.secret-box {
  font-family: Consolas, monospace;
  font-size: 13px;
  background: var(--gray-50);
  border: 1px dashed var(--gray-400);
  border-radius: var(--radius);
  padding: 8px 10px;
  text-align: center;
  word-break: break-all;
  margin-bottom: 16px;
  user-select: all;
}

.steps { font-size: 11.5px; color: var(--gray-600); margin-bottom: 16px; padding-left: 18px; }
.steps li { margin-bottom: 4px; }

/* ---------- アプリレイアウト(サイドバー+メイン) ---------- */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 200px;
  flex-shrink: 0;
  background: var(--surface);
  color: var(--ink);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  padding: 14px 14px 10px;
  color: var(--ink);
}

.sidebar-brand img { width: 22px; height: 22px; border-radius: 5px; }

.sidebar-brand a { color: var(--ink); }
.sidebar-brand a:hover { text-decoration: none; opacity: 0.85; }

.sidebar-nav { flex: 1; padding: 0 12px; }

.sidebar-nav a {
  display: block;
  padding: 6px 10px;
  border-radius: var(--radius);
  color: var(--sub);
  font-size: 12.5px;
  margin-bottom: 2px;
}

.sidebar-nav a:hover { background: var(--note); color: var(--ink); text-decoration: none; }
.sidebar-nav a.active { background: var(--sel); color: var(--blue-600); font-weight: 600; }

.sidebar-foot {
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  color: var(--sub);
}

.main { flex: 1; min-width: 0; }

.header {
  background: var(--surface);
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header h1 { font-size: 15px; font-weight: 700; }

.content { padding: 14px 16px; }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}

.card h2 { font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.card h3 { font-size: 13px; font-weight: 700; margin-bottom: 8px; }

.text-muted { color: var(--sub); font-size: 11.5px; }

/* ---------- テーブル・バッジ・フォーム行 ---------- */

.table { width: 100%; border-collapse: collapse; font-size: 12px; }
.table th, .table td { padding: 5px 8px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { font-size: 11px; font-weight: 600; color: var(--sub); background: var(--note); }

.badge { display: inline-block; padding: 1px 7px; border-radius: var(--radius-pill); font-size: 11px; font-weight: 600; }
.badge-green { background: var(--green-50); color: var(--green-600); }
.badge-orange { background: var(--orange-50); color: var(--orange-600); }
.badge-gray { background: var(--note); color: var(--sub); }

.btn-sm { padding: 3px 9px; font-size: 11px; font-weight: 600; }

.form-row { display: flex; flex-wrap: wrap; gap: 12px; }
.form-row .field { flex: 1 1 160px; margin-bottom: 8px; }

/* ---------- タブ・モーダル・進捗・タスク行 ---------- */

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 10px; flex-wrap: wrap; }
.tab {
  padding: 8px 14px; border: none; background: none; font-family: inherit;
  font-size: 14px; font-weight: 600; color: var(--gray-600); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -2px;
}
.tab.active { color: var(--blue-600); border-bottom-color: var(--blue-600); }
.tab .count { font-weight: 400; font-size: 12px; margin-left: 4px; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px;
}
.modal {
  background: var(--surface); border-radius: 12px; padding: 24px;
  width: 100%; max-width: 520px; max-height: 85vh; overflow-y: auto;
}
.modal h3 { font-size: 16px; margin-bottom: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.progress-wrap { background: var(--gray-200); border-radius: var(--radius-pill); height: 8px; overflow: hidden; }
.progress-bar { background: var(--green-600); height: 100%; transition: width 0.3s; }

.task-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 8px;
  border-bottom: 1px solid var(--gray-100); flex-wrap: wrap;
}
.task-row:hover { background: var(--gray-50); }
.task-name { flex: 1 1 200px; font-size: 12.5px; }
.task-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.task-done .task-name { text-decoration: line-through; color: var(--gray-400); }

.due-overdue { color: var(--red-600); font-weight: 700; }
.due-soon { color: var(--orange-600); font-weight: 600; }
.due-normal { color: var(--gray-600); }

.badge-blue { background: var(--blue-50); color: var(--blue-700); }
.badge-red { background: var(--red-50); color: var(--red-600); }

.list-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 8px; border-bottom: 1px solid var(--gray-100); flex-wrap: wrap; }

/* カレンダー */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); border-left: 1px solid var(--gray-200); border-top: 1px solid var(--gray-200); }
.cal-head { background: var(--gray-50); text-align: center; font-size: 12px; font-weight: 600; color: var(--gray-600); padding: 6px 0; border-right: 1px solid var(--gray-200); border-bottom: 1px solid var(--gray-200); }
.cal-cell { min-height: 92px; border-right: 1px solid var(--gray-200); border-bottom: 1px solid var(--gray-200); padding: 4px; font-size: 12px; background: var(--surface); }
.cal-cell.other-month { background: var(--gray-50); color: var(--gray-400); }
.cal-cell.today { background: var(--blue-50); }
.cal-date { font-weight: 600; margin-bottom: 2px; }
.cal-event { display: block; border-radius: 4px; padding: 1px 5px; margin-bottom: 2px; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.cal-event.ev-construction { background: var(--red-600); color: #fff; font-weight: 600; }
.cal-event.ev-task { background: var(--blue-50); color: var(--blue-700); }
.cal-event.ev-personal { background: #dcfce7; color: var(--green-600); }

/* モバイル */
@media (max-width: 767px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .sidebar-nav { display: flex; flex-wrap: wrap; padding-bottom: 12px; }
  .sidebar-nav a { margin-right: 4px; }
  .sidebar-foot { display: none; }
}
