/* ============================================================
   Qoo10 Admin Console — style.css
   共通スタイル（全ページ共通）
   ============================================================ */

/* ---------- CSS変数 ---------- */
:root {
  --purple:      #7C3AED;
  --purple-light:#8B5CF6;
  --purple-dark: #6D28D9;
  --purple-bg:   #F5F3FF;
  --green:       #10B981;
  --green-bg:    #ECFDF5;
  --red:         #EF4444;
  --red-bg:      #FEF2F2;
  --orange:      #F59E0B;
  --orange-bg:   #FFFBEB;
  --blue:        #3B82F6;
  --blue-bg:     #EFF6FF;
  --bg:          #F5F5F7;
  --sidebar-w:   220px;
  --white:       #FFFFFF;
  --gray-50:     #F9FAFB;
  --gray-100:    #F3F4F6;
  --gray-200:    #E5E7EB;
  --gray-300:    #D1D5DB;
  --gray-400:    #9CA3AF;
  --gray-500:    #6B7280;
  --gray-600:    #4B5563;
  --gray-700:    #374151;
  --gray-900:    #111827;
  --shadow-sm:   0 1px 3px rgba(0,0,0,0.06);
  --shadow:      0 4px 6px -1px rgba(0,0,0,0.07);
  --shadow-lg:   0 10px 15px -3px rgba(0,0,0,0.08);
  --radius:      14px;
  --radius-sm:   9px;
}

/* ---------- リセット ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
svg { display: inline-block; vertical-align: middle; flex-shrink: 0; }

/* ---------- ベース ---------- */
body {
  font-family: 'DM Sans', 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--gray-900);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

/* ---------- サイドバー ---------- */
.sidebar {
  width: var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--gray-100);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}
.sidebar-logo {
  padding: 18px 16px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo-icon {
  width: 36px; height: 36px;
  background: var(--purple);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 700; font-size: 16px;
  flex-shrink: 0;
}
.logo-text { line-height: 1.2; }
.logo-text strong { font-size: 13px; font-weight: 700; color: var(--gray-900); display: block; }
.logo-text span   { font-size: 10px; color: var(--gray-400); letter-spacing: 0.5px; text-transform: uppercase; }

.sidebar-section { padding: 16px 10px 4px; }
.sidebar-section-label {
  font-size: 10px; font-weight: 600; color: var(--gray-400);
  letter-spacing: 1px; text-transform: uppercase;
  padding: 0 8px 6px;
}

.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--gray-600); text-decoration: none;
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all 0.15s; position: relative;
}
.nav-item:hover { background: var(--gray-50); color: var(--gray-900); }
.nav-item.active { background: var(--purple-bg); color: var(--purple); font-weight: 600; }
.nav-item .nav-badge {
  margin-left: auto; background: var(--red); color: white;
  font-size: 10px; font-weight: 700; padding: 1px 6px;
  border-radius: 10px; min-width: 18px; text-align: center;
}
.nav-item .nav-badge.orange { background: var(--orange); }

.nav-sub { padding-left: 28px; }
.nav-sub .nav-item { font-size: 12.5px; padding: 6px 10px; }

.sidebar-footer {
  margin-top: auto; padding: 14px 16px;
  border-top: 1px solid var(--gray-100);
  display: flex; align-items: center; gap: 10px;
}
.avatar {
  width: 32px; height: 32px; background: var(--purple);
  border-radius: 50%; display: flex; align-items: center;
  justify-content: center; color: white; font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
.sidebar-footer .user-info { flex: 1; line-height: 1.3; }
.sidebar-footer .user-info strong { font-size: 12px; display: block; }
.sidebar-footer .user-info span   { font-size: 11px; color: var(--gray-400); }

/* ---------- メインレイアウト ---------- */
.main {
  margin-left: var(--sidebar-w);
  flex: 1; display: flex; flex-direction: column; min-height: 100vh;
}

/* ---------- トップバー ---------- */
.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--gray-100);
  padding: 16px 28px;
  display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 50;
}
.topbar-title { flex: 1; }
.topbar-title h1  { font-size: 20px; font-weight: 700; color: var(--gray-900); }
.topbar-title p   { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

.topbar-actions { display: flex; gap: 8px; align-items: center; }

.icon-btn {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200); background: var(--white);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--gray-500); position: relative;
  transition: all 0.15s;
}
.icon-btn:hover { background: var(--gray-50); color: var(--gray-700); }
.icon-btn .notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px; background: var(--red);
  border-radius: 50%; border: 1.5px solid white;
}

/* ---------- コンテンツエリア ---------- */
.content { padding: 24px 28px; flex: 1; }

/* ---------- アラートバー ---------- */
.alert-bar {
  background: var(--red-bg); border: 1px solid #FECACA;
  border-radius: 10px; padding: 10px 16px;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 20px; font-size: 13px; color: #991B1B;
}
.alert-bar svg { color: var(--red); }

.info-bar {
  background: var(--blue-bg); border: 1px solid #BFDBFE;
  border-radius: 10px; padding: 10px 16px;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 20px; font-size: 13px; color: #1E40AF;
}
.info-bar svg { color: var(--blue); }

/* ---------- KPIカード ---------- */
.kpi-grid  { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 20px; }
.kpi-grid-5{ display: grid; grid-template-columns: repeat(5,1fr); gap: 16px; margin-bottom: 20px; }

.kpi-card {
  background: var(--white); border-radius: var(--radius);
  padding: 20px; border: 1px solid var(--gray-100); box-shadow: var(--shadow-sm);
}
.kpi-card .label {
  font-size: 11px; font-weight: 600; color: var(--gray-400);
  letter-spacing: 0.5px; text-transform: uppercase;
  margin-bottom: 8px; display: flex; align-items: center; gap: 6px;
}
.kpi-card .label .dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--purple);
  flex-shrink: 0;
}
.kpi-card .label .dot.green  { background: var(--green); }
.kpi-card .label .dot.red    { background: var(--red); }
.kpi-card .label .dot.orange { background: var(--orange); }
.kpi-card .label .dot.gray   { background: var(--gray-300); }

.kpi-card .value {
  font-size: 26px; font-weight: 700; color: var(--gray-900);
  line-height: 1; margin-bottom: 6px;
}
.kpi-card .value.red    { color: var(--red); }
.kpi-card .value.green  { color: var(--green); }
.kpi-card .value.orange { color: var(--orange); }

.kpi-card .sub-row {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--gray-500);
}
.badge-tag {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 6px;
}
.badge-tag.up     { background: var(--green-bg);  color: #065F46; }
.badge-tag.down   { background: var(--red-bg);    color: #991B1B; }
.badge-tag.neutral{ background: var(--gray-100);  color: var(--gray-600); }

/* ---------- カード共通 ---------- */
.card {
  background: var(--white); border-radius: var(--radius);
  border: 1px solid var(--gray-100); box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  padding: 18px 20px 14px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--gray-100);
}
.card-header h3 { font-size: 14px; font-weight: 600; flex: 1; }
.card-body { padding: 20px; }

/* ---------- セクションヘッダー ---------- */
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px 12px;
}
.section-header h3 { font-size: 14px; font-weight: 600; }
.see-all { font-size: 12px; color: var(--purple); text-decoration: none; font-weight: 500; }

/* ---------- タブ ---------- */
.tab-group {
  display: flex; background: var(--gray-100); border-radius: var(--radius-sm);
  padding: 3px; gap: 2px;
}
.tab-btn {
  padding: 6px 14px; border-radius: 7px; font-size: 12px; font-weight: 500;
  color: var(--gray-500); cursor: pointer; border: none; background: transparent;
  font-family: inherit; transition: all 0.15s;
}
.tab-btn.active {
  background: var(--white); color: var(--gray-900);
  font-weight: 600; box-shadow: var(--shadow-sm);
}
.tab-mini { display: flex; background: var(--gray-100); border-radius: 7px; padding: 2px; gap: 1px; }
.tab-mini button {
  padding: 4px 10px; border-radius: 5px; font-size: 11px; font-weight: 500;
  color: var(--gray-500); cursor: pointer; border: none; background: transparent;
  font-family: inherit; transition: all 0.15s;
}
.tab-mini button.active {
  background: var(--white); color: var(--gray-900);
  font-weight: 600; box-shadow: var(--shadow-sm);
}

/* ---------- ステータスバッジ ---------- */
.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; padding: 3px 9px;
  border-radius: 20px; white-space: nowrap;
}
.status-badge::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; opacity: 0.7;
}
.status-badge.done    { background: var(--green-bg);  color: #065F46; }
.status-badge.pending { background: var(--gray-100);  color: var(--gray-500); }
.status-badge.warn    { background: var(--orange-bg); color: #92400E; }
.status-badge.error   { background: var(--red-bg);    color: #991B1B; }

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; font-family: inherit;
  cursor: pointer; border: none; transition: all 0.15s; text-decoration: none;
  white-space: nowrap;
}
.btn-primary   { background: var(--purple); color: white; }
.btn-primary:hover { background: var(--purple-dark); box-shadow: 0 4px 10px rgba(124,58,237,0.3); }
.btn-secondary { background: var(--white); color: var(--gray-700); border: 1px solid var(--gray-200); }
.btn-secondary:hover { background: var(--gray-50); }
.btn-ghost     { background: transparent; color: var(--purple); }
.btn-ghost:hover { background: var(--purple-bg); }
.btn-danger    { background: var(--red-bg); color: var(--red); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-xs { padding: 3px 9px; font-size: 11px; border-radius: 6px; }

/* ---------- テーブル ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  padding: 10px 14px; font-size: 11px; font-weight: 600;
  color: var(--gray-400); letter-spacing: 0.5px; text-transform: uppercase;
  text-align: left; background: var(--gray-50);
  border-bottom: 1px solid var(--gray-100);
}
td {
  padding: 12px 14px; font-size: 13px; color: var(--gray-700);
  border-bottom: 1px solid var(--gray-100);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--gray-50); }

/* ---------- フォーム ---------- */
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block; font-size: 12.5px; font-weight: 600;
  color: var(--gray-700); margin-bottom: 7px;
}
.form-control {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm);
  font-size: 13.5px; font-family: inherit; color: var(--gray-900);
  background: var(--white); transition: all 0.2s; outline: none;
}
.form-control:focus {
  border-color: var(--purple-light); background: var(--white);
  box-shadow: 0 0 0 3px rgba(124,58,237,0.08);
}
.form-control::placeholder { color: var(--gray-400); }
.form-hint { font-size: 11.5px; color: var(--gray-400); margin-top: 5px; }

/* ---------- グラフ凡例 ---------- */
.legend { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--gray-500); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ============================================================
   データ取込TOP ページ 差分スタイル
   ============================================================ */

/* ---------- 取込カードグリッド ---------- */
.import-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}

/* ---------- 取込カード本体 ---------- */
.import-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: box-shadow 0.18s, border-color 0.18s;
}
.import-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--gray-300);
}

/* カードヘッダー */
.ic-head {
  padding: 18px 20px 14px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  border-bottom: 1px solid var(--gray-100);
}
.ic-icon {
  width: 40px; height: 40px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ic-icon.purple { background: var(--purple-bg); color: var(--purple); }
.ic-icon.green  { background: var(--green-bg);  color: var(--green); }
.ic-icon.orange { background: var(--orange-bg); color: var(--orange); }
.ic-icon.blue   { background: var(--blue-bg);   color: var(--blue); }

.ic-meta { flex: 1; min-width: 0; }
.ic-meta h3 { font-size: 14px; font-weight: 700; color: var(--gray-900); margin-bottom: 3px; }
.ic-meta p  { font-size: 12px; color: var(--gray-500); line-height: 1.45; }

/* カードボディ */
.ic-body { padding: 14px 20px; flex: 1; }

/* 取込項目タグ群 */
.ic-tags {
  display: flex; flex-wrap: wrap; gap: 5px;
  margin-bottom: 14px;
}
.ic-tag {
  font-size: 11px; font-weight: 500;
  padding: 3px 9px; border-radius: 20px;
  background: var(--gray-100); color: var(--gray-600);
  white-space: nowrap;
}

/* 最終取込情報行 */
.ic-last {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11.5px; color: var(--gray-400);
  margin-bottom: 12px;
}
.ic-last .last-date { }

/* ドロップゾーン */
.drop-zone {
  border: 1.5px dashed var(--gray-300);
  border-radius: 10px;
  padding: 14px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.18s;
  background: var(--gray-50);
  margin-bottom: 12px;
  position: relative;
}
.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--purple-light);
  background: var(--purple-bg);
}
.drop-zone.has-file {
  border-color: var(--green);
  background: var(--green-bg);
}
.drop-zone input[type="file"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.drop-icon {
  color: var(--gray-400); margin-bottom: 6px;
}
.drop-zone.has-file .drop-icon { color: var(--green); }
.drop-label {
  display: block; font-size: 12px; color: var(--gray-500); margin-bottom: 2px;
}
.drop-zone.has-file .drop-label { color: var(--green); font-weight: 600; }
.drop-preview {
  font-size: 11px; color: var(--gray-400); word-break: break-all;
}

/* プログレスバー */
.progress-wrap {
  height: 4px; background: var(--gray-100); border-radius: 4px;
  margin-bottom: 10px; overflow: hidden; display: none;
}
.progress-bar {
  height: 100%; width: 0%; background: var(--purple);
  border-radius: 4px; transition: width 0.16s linear;
}

/* カードフッター：アクション */
.ic-foot {
  padding: 12px 20px 16px;
  display: flex; gap: 8px; align-items: center;
  border-top: 1px solid var(--gray-100);
}
.btn-upload {
  flex: 1;
}
.btn-upload:disabled {
  opacity: 0.45; cursor: not-allowed;
  box-shadow: none !important;
  transform: none !important;
}

/* ---------- 取込フロー ---------- */
.import-flow {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius);
  padding: 22px 28px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
}
.import-flow h3 { font-size: 13px; font-weight: 700; color: var(--gray-700); margin-bottom: 18px; }
.flow-steps {
  display: flex; align-items: center; gap: 0;
  overflow-x: auto; padding-bottom: 4px;
}
.flow-step {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; min-width: 120px; position: relative;
  flex: 1;
}
.flow-step-num {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--purple-bg); color: var(--purple);
  font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 8px; position: relative; z-index: 1;
}
.flow-step.done .flow-step-num {
  background: var(--green-bg); color: var(--green);
}
.flow-arrow {
  flex: 1; height: 2px; background: var(--gray-200);
  position: relative; top: -18px; margin: 0 -2px;
}
.flow-step-label {
  font-size: 12px; font-weight: 600; color: var(--gray-700); margin-bottom: 3px;
}
.flow-step-sub {
  font-size: 11px; color: var(--gray-400); line-height: 1.4;
}

/* ---------- 注意事項 ---------- */
.notice-box {
  background: var(--blue-bg);
  border: 1px solid #BFDBFE;
  border-radius: var(--radius);
  padding: 18px 22px;
  margin-bottom: 24px;
}
.notice-box h4 {
  font-size: 13px; font-weight: 700; color: #1E40AF;
  margin-bottom: 10px; display: flex; align-items: center; gap: 7px;
}
.notice-list {
  list-style: none; display: flex; flex-direction: column; gap: 6px;
}
.notice-list li {
  font-size: 12.5px; color: #1D4ED8;
  display: flex; align-items: flex-start; gap: 8px;
}
.notice-list li::before {
  content: '·'; font-size: 18px; line-height: 1; color: #93C5FD; flex-shrink: 0;
}

/* ---------- 右パネル：履歴 & 次やること ---------- */
.import-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  align-items: start;
}
.side-panel { display: flex; flex-direction: column; gap: 16px; }

.history-item {
  padding: 10px 20px;
  display: flex; align-items: center; gap: 12px;
  border-top: 1px solid var(--gray-100);
  font-size: 12.5px;
}
.history-item .h-icon {
  width: 28px; height: 28px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.history-item .h-icon.success { background: var(--green-bg); color: var(--green); }
.history-item .h-icon.warn    { background: var(--orange-bg); color: var(--orange); }
.history-item .h-meta { flex: 1; }
.history-item .h-meta strong { display: block; font-weight: 600; font-size: 12.5px; }
.history-item .h-meta span   { font-size: 11px; color: var(--gray-400); }
.history-item .h-count { font-size: 11px; color: var(--gray-400); white-space: nowrap; }

.todo-item {
  padding: 10px 20px;
  display: flex; align-items: center; gap: 10px;
  border-top: 1px solid var(--gray-100);
  font-size: 12.5px;
}
.todo-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.todo-text { flex: 1; font-weight: 500; }
.todo-tag {
  font-size: 10.5px; font-weight: 600; padding: 2px 8px; border-radius: 5px;
}
.todo-tag.required { background: var(--red-bg); color: var(--red); }
.todo-tag.soon     { background: var(--orange-bg); color: var(--orange); }

/* ---------- サブアクションボタン群（ヘッダー右） ---------- */
.topbar-sub-actions {
  display: flex; gap: 8px; align-items: center;
}

/* ---------- kpi-grid-5 向け（5列） ---------- */
.kpi-grid-5 { grid-template-columns: repeat(5, 1fr); }

/* ---------- チャートカード（ダッシュボード） ---------- */
/* ★ チャートが無限に縦伸びしないための必須スタイル
      maintainAspectRatio: true と canvas の height 属性で制御する。
      .chart-body には max-height を設けて安全網にする。          */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 16px;
  margin-bottom: 20px;
}
.chart-card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--gray-100);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.chart-header {
  padding: 18px 20px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--gray-100);
}
.chart-header h3 { font-size: 14px; font-weight: 600; flex: 1; }

/* ★ chart-body に max-height を設定。canvas はこの中に収まる */
.chart-body {
  padding: 16px 20px 20px;
  max-height: 280px;   /* ← これがチャート無限伸び防止の核心 */
  overflow: hidden;
}
.chart-body canvas {
  display: block;
  width: 100% !important;  /* 横幅はフル */
  /* height は canvas の height 属性で制御（JSで maintainAspectRatio:true）*/
}

/* ダッシュボード右カード（ROAS） */
.roas-card { padding: 18px 20px; }
.roas-card h3 { font-size: 14px; font-weight: 600; margin-bottom: 16px; }
.roas-value { font-size: 36px; font-weight: 700; color: var(--purple); line-height: 1; margin-bottom: 4px; }
.roas-label { font-size: 12px; color: var(--gray-500); margin-bottom: 20px; }
.roas-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.roas-stat { background: var(--gray-50); border-radius: 10px; padding: 12px 14px; }
.roas-stat .rs-label { font-size: 11px; color: var(--gray-400); margin-bottom: 4px; }
.roas-stat .rs-val   { font-size: 16px; font-weight: 700; }
.roas-stat .rs-val.green { color: var(--green); }
.roas-stat .rs-val.red   { color: var(--red); }

/* ダッシュボード ボトムロー */
.bottom-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}
.alert-item {
  padding: 10px 20px;
  display: flex; gap: 12px; align-items: flex-start;
  border-top: 1px solid var(--gray-100);
}
.alert-icon {
  width: 28px; height: 28px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
}
.alert-icon.red    { background: var(--red-bg);    color: var(--red); }
.alert-icon.orange { background: var(--orange-bg); color: var(--orange); }
.alert-icon.blue   { background: var(--blue-bg);   color: var(--blue); }
.alert-text { flex: 1; }
.alert-text strong { font-size: 12.5px; display: block; margin-bottom: 2px; }
.alert-text span   { font-size: 11px; color: var(--gray-400); }

.deadline-item {
  padding: 10px 20px;
  display: flex; gap: 12px; align-items: center;
  border-top: 1px solid var(--gray-100);
}
.deadline-dot  { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.deadline-text { flex: 1; }
.deadline-text strong { font-size: 12.5px; display: block; }
.deadline-text span   { font-size: 11px; color: var(--gray-400); }
.deadline-badge {
  font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 6px;
}
.deadline-badge.urgent { background: var(--red-bg);    color: var(--red); }
.deadline-badge.soon   { background: var(--orange-bg); color: var(--orange); }
.deadline-badge.ok     { background: var(--green-bg);  color: var(--green); }

.red-item {
  padding: 10px 20px;
  display: flex; align-items: center; gap: 10px;
  border-top: 1px solid var(--gray-100); font-size: 12.5px;
}
.red-item .item-name { flex: 1; }
.red-item .profit    { color: var(--red); font-weight: 700; }

/* period-tabs（ダッシュボード topbar） */
.period-tabs {
  display: flex;
  background: var(--gray-100); border-radius: var(--radius-sm);
  padding: 3px; gap: 2px;
}
.period-tab {
  padding: 6px 14px; border-radius: 7px; font-size: 12px; font-weight: 500;
  color: var(--gray-500); cursor: pointer; border: none;
  background: transparent; font-family: inherit; transition: all 0.15s;
}
.period-tab.active {
  background: var(--white); color: var(--gray-900);
  font-weight: 600; box-shadow: var(--shadow-sm);
}
/* kpi-grid-2（ダッシュボード 2段目） */
.kpi-grid-2 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 20px; }



/* ============================================================
   data-import.css — データ取込TOPページ 差分スタイル
   ============================================================ */
 
/* ---------- レイアウト ---------- */
.import-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
  align-items: start;
}
 
/* ---------- 取込カードグリッド ---------- */
.import-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
 
/* ---------- 取込カード ---------- */
.import-card {
  background: var(--white);
  border: 1.5px solid var(--gray-100);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s, box-shadow 0.2s;
  overflow: hidden;
}
.import-card:hover {
  border-color: var(--purple-light);
  box-shadow: 0 4px 16px rgba(124,58,237,0.09);
}
.import-card.is-done   { border-left: 3px solid var(--green); }
.import-card.is-warn   { border-left: 3px solid var(--orange); }
.import-card.is-error  { border-left: 3px solid var(--red); }
.import-card.is-empty  { border-left: 3px solid var(--gray-300); }
 
/* カードヘッダー */
.ic-head {
  padding: 16px 18px 12px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-bottom: 1px solid var(--gray-100);
}
.ic-icon {
  width: 40px; height: 40px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.ic-icon.purple { background: var(--purple-bg); color: var(--purple); }
.ic-icon.green  { background: var(--green-bg);  color: var(--green);  }
.ic-icon.orange { background: var(--orange-bg); color: var(--orange); }
.ic-icon.blue   { background: var(--blue-bg);   color: var(--blue);   }
 
.ic-head-text { flex: 1; min-width: 0; }
.ic-head-text h3 {
  font-size: 14px; font-weight: 700; color: var(--gray-900);
  margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ic-head-text p { font-size: 12px; color: var(--gray-500); line-height: 1.4; }
 
.card-status { align-self: flex-start; margin-top: 2px; }
 
/* メタ情報 */
.ic-meta {
  padding: 10px 18px;
  display: flex; align-items: center; gap: 6px;
  border-bottom: 1px solid var(--gray-100);
  background: var(--gray-50);
}
.last-date {
  font-size: 11.5px; color: var(--gray-400); flex: 1;
}
.ic-meta .link-sm {
  font-size: 11.5px; color: var(--purple); text-decoration: none; font-weight: 500;
}
.ic-meta .link-sm:hover { text-decoration: underline; }
 
/* タグ */
.ic-tags {
  padding: 12px 18px 10px;
  display: flex; flex-wrap: wrap; gap: 5px;
}
.tag {
  display: inline-block;
  padding: 2px 8px; font-size: 11px; font-weight: 500;
  background: var(--gray-100); color: var(--gray-600);
  border-radius: 5px;
}
 
/* ドロップゾーン */
.drop-zone {
  margin: 0 18px 12px;
  border: 1.5px dashed var(--gray-200);
  border-radius: 10px;
  padding: 14px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: var(--gray-50);
  position: relative;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--purple-light);
  background: var(--purple-bg);
}
.drop-zone.has-file {
  border-color: var(--green);
  background: var(--green-bg);
}
.drop-zone input[type="file"] {
  position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; z-index: -1;
}
.drop-icon { color: var(--gray-300); margin-bottom: 6px; }
.drop-zone.has-file .drop-icon { color: var(--green); }
.drop-label {
  font-size: 12px; color: var(--gray-500); margin-bottom: 4px; display: block;
}
.drop-zone.has-file .drop-label { color: var(--green); font-weight: 600; }
.drop-choose {
  font-size: 12px; color: var(--purple); font-weight: 600; cursor: pointer;
}
.drop-preview {
  font-size: 11.5px; color: var(--gray-400); margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.drop-ext {
  font-size: 10.5px; color: var(--gray-300); margin-top: 3px;
}
 
/* プログレスバー */
.progress-wrap {
  margin: 0 18px 10px;
  display: none;
}
.progress-track {
  background: var(--gray-100); border-radius: 6px; height: 5px; overflow: hidden;
}
.progress-bar {
  height: 100%; background: var(--purple);
  border-radius: 6px; width: 0%;
  transition: width 0.15s ease;
}
.progress-label { font-size: 11px; color: var(--gray-400); text-align: right; margin-top: 4px; }
 
/* アクションフッター */
.ic-footer {
  padding: 0 18px 16px;
  display: flex; align-items: center; gap: 8px; margin-top: auto;
}
.btn-upload {
  background: var(--purple); color: white;
  padding: 7px 16px; border-radius: 8px;
  font-size: 12.5px; font-weight: 600; font-family: inherit;
  border: none; cursor: pointer; transition: all 0.15s;
}
.btn-upload:hover:not(:disabled) {
  background: var(--purple-dark);
}
.btn-upload:disabled { background: var(--gray-200); color: var(--gray-400); cursor: default; }
 
.btn-hist {
  background: var(--white); color: var(--gray-600);
  padding: 7px 12px; border-radius: 8px;
  font-size: 12.5px; font-weight: 600; font-family: inherit;
  border: 1px solid var(--gray-200); cursor: pointer; transition: all 0.15s;
}
.btn-hist:hover { background: var(--gray-50); }
 
/* ---------- フローガイド ---------- */
.flow-section {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.flow-section h3 { font-size: 13px; font-weight: 600; color: var(--gray-700); margin-bottom: 16px; }
.flow-steps {
  display: flex; align-items: center; gap: 0;
}
.flow-step {
  flex: 1; text-align: center;
}
.flow-step-inner {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.flow-num {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--purple-bg); color: var(--purple);
  font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto;
}
.flow-step-title { font-size: 12.5px; font-weight: 600; color: var(--gray-700); }
.flow-step-sub   { font-size: 11px; color: var(--gray-400); }
.flow-arrow {
  width: 28px; flex-shrink: 0; text-align: center; color: var(--gray-300);
}
 
/* ---------- 右サイドバー ---------- */
.side-widget {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 16px;
}
.side-widget-head {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 13px; font-weight: 600; color: var(--gray-900);
  display: flex; align-items: center; gap: 8px;
}
.side-widget-head .icon { color: var(--purple); }
 
.hist-item {
  padding: 10px 16px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--gray-50);
  font-size: 12px;
}
.hist-item:last-child { border-bottom: none; }
.hist-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.hist-info { flex: 1; }
.hist-name { font-weight: 600; color: var(--gray-700); }
.hist-date { font-size: 11px; color: var(--gray-400); }
.hist-cnt  { font-size: 11.5px; color: var(--gray-400); }
 
.todo-item {
  padding: 10px 16px;
  display: flex; align-items: flex-start; gap: 10px;
  border-bottom: 1px solid var(--gray-50);
  font-size: 12.5px;
}
.todo-item:last-child { border-bottom: none; }
.todo-item .ti-icon {
  width: 24px; height: 24px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; margin-top: 1px;
}
.todo-item .ti-icon.orange { background: var(--orange-bg); color: var(--orange); }
.todo-item .ti-icon.gray   { background: var(--gray-100);  color: var(--gray-400); }
.todo-item .ti-text { flex: 1; }
.todo-item .ti-title { font-weight: 600; color: var(--gray-700); line-height: 1.3; }
.todo-item .ti-sub   { font-size: 11px; color: var(--gray-400); margin-top: 2px; }
 
/* ---------- 注意事項エリア ---------- */
.notice-box {
  background: var(--blue-bg);
  border: 1px solid #BFDBFE;
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 20px;
}
.notice-box h4 {
  font-size: 12.5px; font-weight: 700; color: #1E40AF;
  margin-bottom: 10px; display: flex; align-items: center; gap: 6px;
}
.notice-box ul {
  list-style: none; display: flex; flex-direction: column; gap: 5px;
}
.notice-box ul li {
  font-size: 12px; color: #1E40AF;
  padding-left: 14px; position: relative;
  line-height: 1.5;
}
.notice-box ul li::before {
  content: '·'; position: absolute; left: 3px; font-weight: 700;
}
 
/* ---------- KPI grid 5列 ---------- */
.kpi-grid-5 {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.kpi-grid-5 .kpi-card .value { font-size: 22px; }



/* ================================================================
   sales.php 差分スタイル
   ※ style.css 定義済みのクラスはここに書かない
   ================================================================ */

/* ── KPI 拡張：トレンド行 ── */
.kpi-card .trend-row {
  display: flex; align-items: center; gap: 6px;
  margin-top: 8px; padding-top: 8px;
  border-top: 1px solid var(--gray-100);
  font-size: 11.5px; color: var(--gray-500);
}
.kpi-card .trend-val       { font-weight: 700; }
.kpi-card .trend-val.up    { color: var(--green); }
.kpi-card .trend-val.down  { color: var(--red); }
.kpi-card .trend-val.muted { color: var(--gray-400); }

/* ── フィルターバー ── */
.filter-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--white); border: 1px solid var(--gray-100);
  border-radius: var(--radius); padding: 12px 18px;
  box-shadow: var(--shadow-sm); margin-bottom: 20px;
}
.filter-label { font-size: 12px; font-weight: 600; color: var(--gray-500); white-space: nowrap; }
.filter-select {
  padding: 6px 10px; border: 1.5px solid var(--gray-200); border-radius: 8px;
  font-size: 12.5px; font-family: inherit; color: var(--gray-700);
  background: var(--white); outline: none; cursor: pointer; transition: border-color .15s;
}
.filter-select:focus { border-color: var(--purple-light); }
.filter-sep    { width: 1px; height: 18px; background: var(--gray-200); flex-shrink: 0; }
.filter-spacer { flex: 1; }
.filter-note   { font-size: 12px; color: var(--gray-400); white-space: nowrap; }

/* ── 更新日時バッジ ── */
.updated-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; color: var(--gray-500);
  background: var(--gray-50); border: 1px solid var(--gray-100);
  border-radius: 20px; padding: 4px 11px; white-space: nowrap;
}
.updated-badge svg { color: var(--gray-400); }

/* ── セクション見出し ── */
.section-heading {
  font-size: 12px; font-weight: 700; color: var(--gray-500);
  text-transform: uppercase; letter-spacing: .6px;
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 14px;
}
.section-heading::before {
  content: ''; width: 3px; height: 14px;
  background: var(--purple); border-radius: 2px; flex-shrink: 0;
}

/* ── 日別売上チャートカード ── */
.sales-chart-card {
  background: var(--white); border-radius: var(--radius);
  border: 1px solid var(--gray-100); box-shadow: var(--shadow-sm);
  margin-bottom: 20px; overflow: hidden;
}
.sales-chart-head {
  padding: 18px 24px 0;
  display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap;
}
.sales-chart-head h2 { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.sales-chart-head p  { font-size: 12px; color: var(--gray-400); }
.sales-chart-head-left { flex: 1; }

/* チャート上の集計バー（カード内水平分割） */
.chart-kpi-row {
  display: flex; border-top: 1px solid var(--gray-100);
  border-bottom: 1px solid var(--gray-100); margin-top: 14px;
}
.chart-kpi-item {
  flex: 1; padding: 10px 20px 12px;
  border-right: 1px solid var(--gray-100);
}
.chart-kpi-item:last-child { border-right: none; }
.ck-label { font-size: 10.5px; font-weight: 600; color: var(--gray-400); letter-spacing: .5px; text-transform: uppercase; margin-bottom: 3px; }
.ck-val   { font-size: 17px; font-weight: 700; color: var(--gray-900); line-height: 1; }
.ck-val.purple { color: var(--purple); }
.ck-val.green  { color: var(--green);  }

/* チャートキャンバスラッパー */
.sales-chart-body { padding: 20px 24px 24px; }
.sales-chart-body canvas { display: block; width: 100% !important; }

/* ── カート別カード ── */
.cart-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; margin-bottom: 22px; }
.cart-card {
  background: var(--white); border: 1px solid var(--gray-100);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm);
  transition: box-shadow .15s, transform .15s;
}
.cart-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }

/* 上端カラーライン */
.cart-card-line { height: 3px; }
.cart-card-body { padding: 18px 20px 16px; }
.cart-card-name {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; color: var(--gray-700); margin-bottom: 10px;
}
.cart-color-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.cart-sales-val { font-size: 24px; font-weight: 700; color: var(--gray-900); line-height: 1; margin-bottom: 6px; }
.cart-meta {
  display: flex; gap: 8px; flex-wrap: wrap;
  font-size: 12px; color: var(--gray-500); margin-bottom: 12px;
}
.cart-meta .sep { color: var(--gray-300); }
.cart-meta strong { color: var(--gray-700); }
.cart-pct { font-weight: 700; }
.cart-ratio-track { height: 4px; background: var(--gray-100); border-radius: 4px; overflow: hidden; }
.cart-ratio-fill  { height: 100%; border-radius: 4px; transition: width .7s cubic-bezier(.4,0,.2,1); }

/* ── 商品別ランキング ── */
.ranking-card {
  background: var(--white); border-radius: var(--radius);
  border: 1px solid var(--gray-100); box-shadow: var(--shadow-sm);
  overflow: hidden; margin-bottom: 24px;
}
.ranking-head {
  padding: 16px 22px; display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--gray-100);
}
.ranking-head h2  { font-size: 15px; font-weight: 700; flex: 1; }
.ranking-head .sub { font-size: 12px; color: var(--gray-400); }
.rtable-wrap { overflow-x: auto; }

/* テーブル（style.css の table/th/td と名前衝突しないよう .rt- prefix） */
.rtable { width: 100%; border-collapse: collapse; }
.rtable th {
  padding: 9px 14px; font-size: 10.5px; font-weight: 600;
  color: var(--gray-400); letter-spacing: .6px; text-transform: uppercase;
  text-align: left; background: var(--gray-50);
  border-bottom: 1px solid var(--gray-100); white-space: nowrap;
}
.rtable th.r, .rtable td.r { text-align: right; }
.rtable th.c, .rtable td.c { text-align: center; }
.rtable td {
  padding: 12px 14px; font-size: 13px; color: var(--gray-700);
  border-bottom: 1px solid var(--gray-100); vertical-align: middle;
}
.rtable tr:last-child td { border-bottom: none; }
.rtable tbody tr { transition: background .1s; }
.rtable tbody tr:hover td { background: var(--gray-50); }

/* 順位バッジ */
.rank-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 7px;
  font-size: 12px; font-weight: 700;
}
.rank-badge.r1 { background: #FEF9C3; color: #854D0E; }
.rank-badge.r2 { background: #F1F5F9; color: #475569; }
.rank-badge.r3 { background: #FEF0E7; color: #92400E; }
.rank-badge.rn { background: var(--gray-50); color: var(--gray-400); font-size: 11px; }

/* 商品名 */
.pname { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--gray-800); }
.pno   { font-size: 11px; color: var(--gray-400); margin-top: 1px; }

/* カートバッジ */
.cbadge { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 20px; white-space: nowrap; }
.cbadge-mira   { background: #EDE9FE; color: #5B21B6; }
.cbadge-sophie { background: #D1FAE5; color: #065F46; }
.cbadge-other  { background: var(--gray-100); color: var(--gray-600); }

/* 売上金額 */
.sale-amt { font-weight: 700; font-size: 13.5px; color: var(--gray-900); letter-spacing: -.2px; }

/* インラインバー */
.sbar-cell { min-width: 90px; }
.sbar-wrap { display: flex; align-items: center; gap: 7px; }
.sbar-track { flex: 1; height: 4px; background: var(--gray-100); border-radius: 3px; overflow: hidden; }
.sbar-fill  { height: 100%; background: var(--purple); opacity: .4; border-radius: 3px; }
.sbar-pct   { font-size: 11px; color: var(--gray-400); white-space: nowrap; min-width: 26px; text-align: right; }

/* ── レスポンシブ ── */
@media (max-width: 1100px) { .cart-grid { grid-template-columns: repeat(2,1fr); } }
@media (max-width: 800px) {
  .cart-grid { grid-template-columns: 1fr; }
  .kpi-grid  { grid-template-columns: repeat(2,1fr); }
  .chart-kpi-row { flex-wrap: wrap; }
  .chart-kpi-item { border-right: none; border-bottom: 1px solid var(--gray-100); }
}