/* ===========================================================
   議事録作成保存ソフト - スタイルシート
   =========================================================== */

:root {
  --color-bg: #f5f6f8;
  --color-surface: #ffffff;
  --color-border: #e2e5eb;
  --color-text: #1f2430;
  --color-text-mute: #6b7280;
  --color-primary: #2c5282;
  --color-primary-dark: #1e3a5f;
  --color-primary-light: #ebf2fa;
  --color-accent: #2f855a;
  --color-accent-light: #e9f6ef;
  --color-danger: #c0392b;
  --color-danger-light: #fbeae8;
  --color-warn: #b7791f;
  --color-warn-light: #fdf3e0;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(20, 24, 33, 0.06), 0 1px 3px rgba(20, 24, 33, 0.08);
  --shadow-lg: 0 4px 14px rgba(20, 24, 33, 0.10);
  --font: -apple-system, BlinkMacSystemFont, "Hiragino Kaku Gothic ProN", "Yu Gothic", "Noto Sans JP", Meiryo, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--color-text);
  background: var(--color-bg);
  font-size: 15px;
  line-height: 1.6;
}

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

/* ---------- サイドバー ---------- */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--color-primary-dark);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 20px 0;
}

.sidebar-brand {
  padding: 0 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  margin-bottom: 12px;
}

.sidebar-brand .app-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.sidebar-brand .org-name {
  font-size: 12.5px;
  color: rgba(255,255,255,0.65);
  margin-top: 4px;
  word-break: break-all;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 20px;
  color: rgba(255,255,255,0.82);
  cursor: pointer;
  font-size: 14px;
  border-left: 3px solid transparent;
  user-select: none;
}

.nav-item:hover { background: rgba(255,255,255,0.06); color: #fff; }

.nav-item.active {
  background: rgba(255,255,255,0.10);
  border-left-color: #7fb2e5;
  color: #fff;
  font-weight: 600;
}

.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.sidebar-auth {
  margin-top: auto;
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,0.12);
}

.sidebar-auth .auth-email {
  font-size: 12px;
  color: rgba(255,255,255,0.85);
  margin-bottom: 8px;
  word-break: break-all;
}

.sidebar-auth .btn {
  width: 100%;
  justify-content: center;
}

.roster-chip.disabled { opacity: .4; cursor: not-allowed; pointer-events: none; }

.sidebar-footer {
  padding: 14px 20px 0;
  font-size: 11px;
  color: rgba(255,255,255,0.4);
}

/* ---------- メイン ---------- */
.main {
  flex: 1;
  min-width: 0;
  padding: 28px 34px 60px;
}

.view { display: none; }
.view.active { display: block; }

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-size: 21px;
  font-weight: 700;
  margin: 0 0 4px;
}

.page-subtitle {
  color: var(--color-text-mute);
  font-size: 13.5px;
  margin: 0;
}

.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--color-border);
  background: #fff;
  color: var(--color-text);
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, border-color .12s;
  white-space: nowrap;
}
.btn:hover { background: #f2f4f7; }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}
.btn-primary:hover { background: var(--color-primary-dark); }

.btn-accent {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #fff;
}
.btn-accent:hover { background: #276749; }

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

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--color-primary);
}
.btn-ghost:hover { background: var(--color-primary-light); }

.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------- カード ---------- */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}

.stat-card .stat-label {
  font-size: 12.5px;
  color: var(--color-text-mute);
  margin-bottom: 6px;
}

.stat-card .stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--color-primary-dark);
}

.stat-card .stat-value.warn { color: var(--color-warn); }
.stat-card .stat-value.danger { color: var(--color-danger); }

/* ---------- フォーム ---------- */
label.field-label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--color-text-mute);
  margin-bottom: 5px;
}

input[type="text"], input[type="date"], input[type="time"], input[type="search"],
input[type="password"], input[type="url"], select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  font-family: var(--font);
  font-size: 14px;
  background: #fff;
  color: var(--color-text);
}

textarea { resize: vertical; min-height: 70px; line-height: 1.55; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(44, 82, 130, 0.12);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.field { margin-bottom: 14px; }
.field-hint { font-size: 11.5px; color: var(--color-text-mute); margin-top: 4px; }

.roster-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  background: #fbfbfc;
  max-height: 130px;
  overflow-y: auto;
}

.roster-chip {
  border: 1px solid var(--color-border);
  background: #fff;
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 12.5px;
  cursor: pointer;
  user-select: none;
}
.roster-chip.selected {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* ---------- 議題ブロック ---------- */
.agenda-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  background: #fcfcfd;
  position: relative;
}

.agenda-item-head {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.agenda-item-num {
  background: var(--color-primary);
  color: #fff;
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}

.agenda-item-head .field { flex: 1; margin-bottom: 0; }
.agenda-type-select { max-width: 120px; }

.todo-row {
  display: grid;
  grid-template-columns: 1fr 120px 130px 110px 32px;
  gap: 8px;
  align-items: center;
  margin-bottom: 6px;
}

.todo-row select { padding: 6px 8px; font-size: 13px; }

.icon-btn {
  background: transparent;
  border: none;
  color: var(--color-text-mute);
  cursor: pointer;
  font-size: 15px;
  padding: 4px;
  border-radius: 4px;
}
.icon-btn:hover { background: #eee; color: var(--color-danger); }

/* ---------- 一覧テーブル ---------- */
.table-wrap {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }

thead th {
  text-align: left;
  padding: 10px 14px;
  background: #f7f8fa;
  color: var(--color-text-mute);
  font-weight: 700;
  font-size: 12px;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfc; cursor: pointer; }

.tag {
  display: inline-block;
  background: var(--color-primary-light);
  color: var(--color-primary-dark);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  margin: 1px 3px 1px 0;
}

.badge-status {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}
.badge-status.todo { background: var(--color-warn-light); color: var(--color-warn); }
.badge-status.doing { background: var(--color-primary-light); color: var(--color-primary-dark); }
.badge-status.done { background: var(--color-accent-light); color: var(--color-accent); }

.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--color-text-mute);
}
.empty-state .empty-icon { font-size: 36px; margin-bottom: 10px; }

.search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.search-bar input[type="search"] { max-width: 260px; }
.search-bar select { max-width: 160px; }
.search-bar input[type="date"] { max-width: 150px; }

/* ---------- 詳細ビュー（印刷対象） ---------- */
.doc-sheet {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 48px;
  max-width: 820px;
  margin: 0 auto;
}

.doc-title {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 4px;
}
.doc-subtitle {
  text-align: center;
  color: var(--color-text-mute);
  font-size: 13px;
  margin-bottom: 22px;
}

.doc-meta-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 24px;
  font-size: 13.5px;
}
.doc-meta-table td {
  border: 1px solid var(--color-border);
  padding: 8px 12px;
}
.doc-meta-table td.meta-label {
  background: #f7f8fa;
  font-weight: 700;
  width: 110px;
  color: var(--color-text-mute);
}

.doc-agenda {
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px dashed var(--color-border);
}
.doc-agenda:last-child { border-bottom: none; }

.doc-agenda-title {
  font-size: 15.5px;
  font-weight: 700;
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.doc-agenda-body { white-space: pre-wrap; font-size: 13.5px; margin-bottom: 8px; }

.doc-block-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-text-mute);
  margin: 8px 0 4px;
}

.doc-todo-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 4px; }
.doc-todo-table th, .doc-todo-table td {
  border: 1px solid var(--color-border);
  padding: 6px 10px;
  text-align: left;
}
.doc-todo-table th { background: #f7f8fa; font-size: 11.5px; color: var(--color-text-mute); }

/* ---------- モーダル ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(20,24,33,0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-overlay.active { display: flex; }

.modal {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 86vh;
  overflow-y: auto;
  padding: 24px;
}
.modal-lg { max-width: 760px; }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.modal-title { font-size: 16px; font-weight: 700; margin: 0; }
.modal-close { cursor: pointer; font-size: 20px; color: var(--color-text-mute); background: none; border: none; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ---------- トースト ---------- */
#toast-wrap {
  position: fixed;
  bottom: 22px;
  right: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}
.toast {
  background: #1f2430;
  color: #fff;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.err { background: var(--color-danger); }
.toast.ok { background: var(--color-accent); }

/* ---------- ヘルパー ---------- */
.text-mute { color: var(--color-text-mute); }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.items-center { align-items: center; }
.small { font-size: 12px; }
hr.sep { border: none; border-top: 1px solid var(--color-border); margin: 18px 0; }

/* ---------- 印刷用 ---------- */
@media print {
  .sidebar, .page-header .page-actions, .no-print { display: none !important; }
  .main { padding: 0; }
  #app { display: block; }
  .doc-sheet { box-shadow: none; border: none; padding: 0; max-width: 100%; }
  body { background: #fff; }
}

/* ---------- レスポンシブ ---------- */
@media (max-width: 760px) {
  #app { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; overflow-x: auto; padding: 10px; }
  .sidebar-brand { display: none; }
  .nav-item { border-left: none; border-bottom: 3px solid transparent; padding: 8px 14px; }
  .nav-item.active { border-left-color: transparent; border-bottom-color: #7fb2e5; }
  .sidebar-footer { display: none; }
  .main { padding: 18px; }
  .todo-row { grid-template-columns: 1fr; }
  .doc-sheet { padding: 20px; }
}
