/* ===== リセット・基本 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #f4f6f9;
  --surface:   #ffffff;
  --border:    #e2e8f0;
  --text:      #1e293b;
  --text-muted:#64748b;
  --primary:   #3b82f6;
  --primary-d: #2563eb;
  --green:     #22c55e;
  --green-d:   #16a34a;
  --orange:    #f97316;
  --red:       #ef4444;
  --purple:    #a855f7;
  --shadow:    0 1px 6px rgba(0,0,0,.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,.10);
  --radius:    10px;
}

body {
  font-family: 'Segoe UI', 'Hiragino Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

/* ===== ヘッダー ===== */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}
h1 { font-size: 18px; font-weight: 700; color: var(--text); white-space: nowrap; }
.version-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 20px;
  vertical-align: middle;
  letter-spacing: 0.02em;
}

nav { display: flex; gap: 6px; margin-left: auto; }
.nav-btn {
  padding: 7px 20px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.nav-btn:hover  { background: #f1f5f9; color: var(--text); }
.nav-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== メインレイアウト ===== */
main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

/* ===== カレンダー ===== */
.cal-wrapper {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.cal-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.cal-nav-btn {
  width: 32px; height: 32px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-size: 18px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  transition: all .15s;
}
.cal-nav-btn:hover { background: #f1f5f9; color: var(--text); }
.cal-month-label { font-size: 17px; font-weight: 700; min-width: 100px; }
.cal-today-btn {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  transition: all .15s;
}
.cal-today-btn:hover { background: #f1f5f9; color: var(--text); }
.cal-info { margin-left: auto; font-size: 12px; color: var(--text-muted); }

.cal-daynames {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 4px;
}
.cal-daynames span {
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 4px 0;
}
.cal-daynames .sun { color: #ef4444; }
.cal-daynames .sat { color: #3b82f6; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

/* 日付セル */
.cal-cell {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 6px 6px;
  cursor: pointer;
  transition: all .15s;
  background: var(--surface);
  min-height: 68px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.cal-cell:hover       { border-color: var(--primary); background: #eff6ff; }
.cal-cell.cal-empty   { background: transparent; border-color: transparent; cursor: default; pointer-events: none; }
.cal-cell.cal-partial { background: #fefce8; border-color: #fde68a; }
.cal-cell.cal-both    { background: #f0fdf4; border-color: #86efac; }
.cal-cell.cal-sel     { border-color: var(--primary); background: #eff6ff; box-shadow: 0 0 0 2px rgba(59,130,246,.3); }
.cal-cell.cal-today .cal-num { background: var(--primary); color: #fff; border-radius: 50%; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; }

.cal-num {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1;
}
.cal-cell.sun-col .cal-num { color: #ef4444; }
.cal-cell.sat-col .cal-num { color: #3b82f6; }

.cal-dots { display: flex; gap: 3px; }
.cdot {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 3px;
  line-height: 1.4;
  background: #e2e8f0;
  color: #94a3b8;
  transition: all .15s;
}
.cdot-br { background: #dcfce7; color: #16a34a; }
.cdot-ad { background: #dbeafe; color: #2563eb; }
.cdot-warn { background: #fef9c3; color: #854d0e; border: 1px solid #fde047; }

/* カレンダー不完全バッジ */
.cal-warn-badge {
  font-size: 9px;
  line-height: 1;
  position: absolute;
  top: 4px; right: 4px;
}
.cal-cell { position: relative; }
.cal-cell.cal-incomplete { border-color: #fde68a; }
.cal-cell.cal-incomplete:not(.cal-sel) { background: #fffdf0; }

/* ===== 取込パネル ===== */
.import-panel {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 2px solid var(--primary);
  padding: 20px;
  margin-bottom: 20px;
}

.import-panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}
.import-panel-date {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
}
.import-panel-actions { display: flex; gap: 8px; margin-left: auto; }

.import-slots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.import-slot {}

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  background: #f8fafc;
  margin-bottom: 10px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-muted);
}
.check-item.done {
  background: #f0fdf4;
  color: var(--green-d);
}
.check-icon { font-size: 16px; line-height: 1; }
.check-label { flex: 1; }
.check-count { font-size: 11px; font-weight: 400; color: var(--text-muted); }

.idrop {
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  color: var(--text-muted);
  min-height: 110px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.idrop:hover, .idrop.dragover { border-color: var(--primary); background: #eff6ff; color: var(--primary); }
.idrop.loaded  { border-color: var(--green); background: #f0fdf4; color: var(--green-d); border-style: solid; }
.idrop.loading { border-color: #fbbf24; background: #fffbeb; color: #92400e; }
.idrop.error   { border-color: var(--red); background: #fef2f2; color: var(--red); border-style: solid; }

.idrop-icon { font-size: 24px; }
.idrop-text { font-size: 13px; font-weight: 600; }
.idrop-sub  { font-size: 11px; color: #94a3b8; }

.slot-msg { font-size: 12px; color: var(--red); margin-top: 6px; min-height: 18px; }

/* ===== ボタン共通 ===== */
.btn-danger-sm {
  padding: 5px 12px;
  background: #fff;
  color: var(--red);
  border: 1px solid var(--red);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.btn-danger-sm:hover { background: #fef2f2; }

.btn-close {
  width: 28px; height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  font-size: 14px;
  cursor: pointer;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.btn-close:hover { background: #f1f5f9; color: var(--text); }

.btn-primary-sm {
  padding: 6px 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-primary-sm:hover { background: var(--primary-d); }

.btn-secondary-sm {
  padding: 6px 14px;
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.btn-secondary-sm:hover  { background: #f1f5f9; color: var(--text); }
.btn-secondary-sm.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.btn-month-nav {
  padding: 6px 10px;
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
}
.btn-month-nav:hover { background: #f1f5f9; color: var(--text); }

.btn-export {
  padding: 6px 12px;
  background: var(--surface);
  color: #059669;
  border: 1.5px solid #6ee7b7;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.btn-export:hover { background: #ecfdf5; border-color: #059669; }

/* ===== 分析バー ===== */
.analyze-bar {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.analyze-controls { display: flex; align-items: center; gap: 8px; }
.analyze-controls label { font-size: 13px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.analyze-controls input[type="date"],
.analyze-controls select {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
}
.range-sep { color: var(--text-muted); }

/* ===== 粒度トグル ===== */
.gran-toggle {
  display: flex;
}
.gran-btn {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 5px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all .15s;
}
.gran-btn:first-child { border-radius: 6px 0 0 6px; }
.gran-btn:last-child  { border-radius: 0 6px 6px 0; }
.gran-btn + .gran-btn { border-left: none; }
.gran-btn:hover      { background: #f1f5f9; color: var(--text); }
.gran-btn.gran-active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== グラフ／数値 切替 ===== */
.view-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.view-tab {
  padding: 5px 14px;
  border: none;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.view-tab + .view-tab { border-left: 1px solid var(--border); }
.view-tab:hover  { background: #f1f5f9; color: var(--text); }
.view-tab.active { background: var(--primary); color: #fff; }

/* ===== KPI グリッド ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.kpi-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  text-align: center;
}
.kpi-val { font-size: 22px; font-weight: 700; line-height: 1.2; }
.kpi-lbl { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.kpi-blue   .kpi-val { color: var(--primary); }
.kpi-green  .kpi-val { color: var(--green-d); }
.kpi-orange .kpi-val { color: var(--orange); }
.kpi-red    .kpi-val { color: var(--red); }
.kpi-purple .kpi-val { color: var(--purple); }
.kpi-good   .kpi-val { color: var(--green-d); }
.kpi-warn   .kpi-val { color: var(--orange); }
.kpi-bad    .kpi-val { color: var(--red); }

/* ===== KPI 前月・前年比較 ===== */
.kpi-sep {
  width: 100%;
  border: none;
  border-top: 1px solid var(--border);
  margin: 7px 0 3px;
}
.kpi-cmp {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  line-height: 1.5;
  gap: 4px;
}
.cmp-lbl  { color: var(--text-muted); white-space: nowrap; }
.cmp-good { color: var(--green-d); font-weight: 700; }
.cmp-bad  { color: var(--red);     font-weight: 700; }
.cmp-none { color: #cbd5e1; }

/* ===== 数値テーブル ===== */
.tbl-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
  margin-bottom: 20px;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table thead th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  padding: 10px 14px;
  border-bottom: 2px solid var(--border);
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  z-index: 1;
}
.data-table thead th:first-child { text-align: left; }
.data-table tbody td {
  padding: 8px 14px;
  border-bottom: 1px solid #f1f5f9;
  text-align: right;
  white-space: nowrap;
}
.data-table tbody td:first-child { text-align: left; font-weight: 600; }
.data-table tbody tr:hover td { background: #f8fafc; }
.data-table tfoot td {
  padding: 9px 14px;
  text-align: right;
  white-space: nowrap;
  font-weight: 700;
  border-top: 2px solid var(--border);
  background: #f8fafc;
  font-size: 12px;
}
.data-table tfoot td:first-child { text-align: left; color: var(--text-muted); }

/* ===== チャートグリッド ===== */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.chart-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.chart-card h3 { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; font-weight: 600; }
.chart-card canvas { max-height: 240px; }

/* ===== ASINランキング ===== */
.ranking-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.ranking-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.ranking-head h3 { font-size: 15px; font-weight: 700; }

.rank-sort-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.rank-tab {
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.rank-tab:hover  { background: #f1f5f9; color: var(--text); }
.rank-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

.rank-table-wrap { overflow-x: auto; }
.rank-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.rank-table th {
  background: #f8fafc;
  padding: 8px 10px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  color: var(--text-muted);
  text-align: right;
  cursor: pointer;
  user-select: none;
  font-weight: 600;
}
.rank-table th:first-child,
.rank-table th:nth-child(2) { text-align: left; }
.rank-table th:hover { background: #edf2fb; }
.rank-table th.sort-asc::after  { content: ' ↑'; color: var(--primary); }
.rank-table th.sort-desc::after { content: ' ↓'; color: var(--primary); }
.rank-table td {
  padding: 7px 10px;
  border-bottom: 1px solid #f1f5f9;
  white-space: nowrap;
  text-align: right;
}
.rank-table td:first-child,
.rank-table td:nth-child(2) { text-align: left; }
.rank-table tr:hover td { background: #f8fafc; }

.acos-good { color: var(--green-d); font-weight: 700; }
.acos-warn { color: var(--orange);  font-weight: 700; }
.acos-bad  { color: var(--red);     font-weight: 700; }

.bar-wrap { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.bar-mini { height: 6px; border-radius: 3px; background: var(--primary); min-width: 2px; }

/* ===== ランキング「もっと見る」 ===== */
#rankMoreWrap { text-align: center; padding: 14px 0 4px; }
.rank-more-btn {
  padding: 7px 28px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.rank-more-btn:hover { background: #f1f5f9; color: var(--text); border-color: #94a3b8; }

/* ===== 空状態 ===== */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
  font-size: 16px;
  font-weight: 600;
}

/* ===== 一括取込 ===== */
.bulk-drop-area {
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--surface);
  margin-bottom: 20px;
}
.bulk-drop-area:hover,
.bulk-drop-area.dragover { border-color: var(--primary); background: #eff6ff; }
.bulk-drop-icon  { font-size: 40px; margin-bottom: 10px; }
.bulk-drop-title { font-size: 16px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.bulk-drop-sub   { font-size: 12px; color: var(--text-muted); line-height: 1.6; }

.bulk-summary-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  font-size: 14px;
  flex-wrap: wrap;
}

.bulk-warn {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  color: #92400e;
  margin-bottom: 12px;
}
.bulk-warn code {
  background: #fef3c7;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11px;
}

.bulk-table-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}
.bulk-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bulk-table th {
  background: #f8fafc;
  padding: 10px 14px;
  border-bottom: 2px solid var(--border);
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
}
.bulk-table td {
  padding: 9px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.bulk-table tr:last-child td { border-bottom: none; }
.bulk-table tr:hover td { background: #f8fafc; }

.bulk-date  { font-weight: 600; font-size: 13px; }
.bulk-count {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}
.bulk-count.br { background: #dcfce7; color: #16a34a; }
.bulk-count.ad { background: #dbeafe; color: #2563eb; }
.bulk-empty    { color: #cbd5e1; font-size: 12px; }

.bulk-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
}
.bulk-status.new       { background: #dcfce7; color: #16a34a; }
.bulk-status.overwrite { background: #ffedd5; color: #c2410c; }

.bulk-progress-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow);
  text-align: center;
}
.bulk-progress-label   { font-size: 14px; font-weight: 600; margin-bottom: 14px; color: var(--text-muted); }
.bulk-progress-bar-bg  { background: #e2e8f0; border-radius: 8px; height: 10px; overflow: hidden; }
.bulk-progress-bar     { background: var(--primary); height: 100%; border-radius: 8px; transition: width .4s ease; }

.bulk-done-msg {
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: var(--radius);
  padding: 20px 24px;
  font-size: 15px;
  color: #15803d;
  text-align: center;
}

/* ===== マスタビュー ===== */
.master-drop-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
  background: var(--surface);
  margin: 24px auto;
  max-width: 600px;
}
.master-drop-area:hover,
.master-drop-area.dragover { border-color: var(--primary); background: #eff6ff; }
.master-drop-icon  { font-size: 40px; margin-bottom: 10px; }
.master-drop-title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.master-drop-sub   { font-size: 13px; color: var(--text-muted); }

.master-result-bar {
  display: flex;
  align-items: center;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  font-size: 14px;
}

.master-table-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: auto;
  max-height: 60vh;
}
.master-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.master-table th {
  position: sticky; top: 0;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}
.master-table td {
  padding: 8px 14px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.master-asin { font-family: monospace; font-size: 12px; color: #475569; }
.master-sku  { font-family: monospace; font-size: 12px; }
.master-name { max-width: 320px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.master-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 48px 24px;
  font-size: 14px;
}

/* ランキング — 商品名列 */
.rank-table td.rank-product-name {
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
  color: var(--text);
  text-align: left;
}
.rank-asin {
  font-family: monospace;
  font-size: 12px;
  color: #475569;
}

/* ===== ログインページ ===== */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}
.login-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 40px 36px;
  width: 100%;
  max-width: 360px;
  text-align: center;
}
.login-logo  { font-size: 48px; margin-bottom: 12px; }
.login-title { font-size: 18px; font-weight: 700; margin-bottom: 28px; }
.login-form  { text-align: left; display: flex; flex-direction: column; gap: 16px; }
.login-field { display: flex; flex-direction: column; gap: 5px; }
.login-field label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.login-field input {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s;
}
.login-field input:focus { border-color: var(--primary); }
.login-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}
.login-remember input { width: 15px; height: 15px; cursor: pointer; }
.login-error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: var(--red);
  border-radius: 7px;
  padding: 9px 12px;
  font-size: 13px;
}
.login-btn {
  padding: 11px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.login-btn:hover { background: var(--primary-d); }

/* ===== ログアウトボタン ===== */
.btn-switch {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  display: inline-block;
}
.btn-switch:hover { background: #f1f5f9; color: var(--text); }
.btn-logout {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
  display: inline-block;
}
.btn-logout:hover { background: #fef2f2; color: var(--red); border-color: #fca5a5; }

/* ===== データ未取込の自動取得 ===== */
.auto-fetch-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
}
.auto-fetch-icon { font-size: 20px; flex-shrink: 0; }
.auto-fetch-body { flex: 1; }
.auto-fetch-title { font-size: 13px; font-weight: 700; color: #1e40af; }
.auto-fetch-sub   { font-size: 11px; color: #3b82f6; margin-top: 2px; }
.btn-auto-fetch {
  flex-shrink: 0;
  padding: 7px 14px;
  background: #3b82f6;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}
.btn-auto-fetch:hover:not(:disabled) { background: #2563eb; }
.btn-auto-fetch:disabled { opacity: .6; cursor: default; }

/* ===== 不完全データ警告 ===== */
.incomplete-warn {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
}
.incomplete-warn-icon { font-size: 20px; flex-shrink: 0; }
.incomplete-warn-body { flex: 1; }
.incomplete-warn-title { font-size: 13px; font-weight: 700; color: #92400e; }
.incomplete-warn-sub   { font-size: 11px; color: #b45309; margin-top: 2px; }
.btn-refetch {
  flex-shrink: 0;
  padding: 7px 14px;
  background: #f59e0b;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}
.btn-refetch:hover:not(:disabled) { background: #d97706; }
.btn-refetch:disabled { opacity: .6; cursor: default; }

.refetch-result {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 14px;
}
.refetch-ok      { background: #f0fdf4; color: #15803d; border: 1px solid #86efac; }
.refetch-changed { background: #eff6ff; color: #1d4ed8; border: 1px solid #93c5fd; }
.refetch-error   { background: #fef2f2; color: #b91c1c; border: 1px solid #fca5a5; }

/* ===== 設定ビュー ===== */
.settings-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 32px;
  max-width: 640px;
}
.settings-section-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--text);
}
.settings-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
}
.settings-row:last-of-type { border-bottom: none; }
.settings-label {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.settings-label-main { font-size: 14px; font-weight: 600; color: var(--text); }
.settings-label-sub  { font-size: 12px; color: var(--text-muted); }

/* トグルスイッチ */
.toggle-switch { position: relative; display: inline-block; width: 48px; height: 26px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: #cbd5e1;
  border-radius: 26px;
  cursor: pointer;
  transition: .2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: .2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(22px); }

/* 時刻セレクト */
.settings-time-wrap { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.settings-select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.settings-time-unit { font-size: 13px; color: var(--text-muted); }

/* 前回実行・結果 */
.settings-last-run, .settings-last-status {
  font-size: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.status-ok    { color: var(--green-d); font-weight: 500; }
.status-error { color: var(--red);     font-weight: 500; }

/* 保存ボタン行 */
.settings-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
}
.settings-save-msg { font-size: 13px; }
.save-ok    { color: var(--green-d); }
.save-error { color: var(--red); }
