/* =========================================================
   共通スタイル（Sales Target）
   ========================================================= */
:root {
  --c-bg: #f5f7fa;
  --c-panel: #ffffff;
  --c-border: #d8dee6;
  --c-text: #1f2937;
  --c-text-muted: #6b7280;
  --c-primary: #2563eb;
  --c-primary-dark: #1e40af;
  --c-success: #16a34a;
  --c-warning: #f59e0b;
  --c-danger: #dc2626;
  --c-gold-bg: #fff7e0;
  --c-gold-border: #d4a83a;
  --c-visit-bg: #e8f5e9;
  --c-visit-border: #66bb6a;
  --c-past-bg: #f0f0f0;
  --c-past-border: #c0c0c0;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", Meiryo, sans-serif;
  background: var(--c-bg); color: var(--c-text);
}

/* ===== ヘッダ ===== */
.app-header {
  background: var(--c-panel);
  border-bottom: 1px solid var(--c-border);
  padding: 0 20px;
  display: flex; align-items: center; gap: 16px;
  height: 56px;
  position: sticky; top: 0; z-index: 100;
}
.app-header .logo {
  font-size: 16px; font-weight: 600; color: var(--c-text);
}
.app-header nav {
  display: flex; gap: 4px; margin-left: 16px;
}
.app-header nav a {
  padding: 8px 12px; color: var(--c-text-muted);
  text-decoration: none; border-radius: 6px;
  font-size: 14px;
}
.app-header nav a:hover { background: #f0f4f8; color: var(--c-text); }
.app-header nav a.active { background: #e0ebff; color: var(--c-primary-dark); font-weight: 500; }
.app-header .spacer { flex: 1; }
.app-header .user-info { font-size: 13px; color: var(--c-text-muted); }
.app-header .logout-btn {
  background: transparent; border: 1px solid var(--c-border);
  padding: 5px 10px; border-radius: 6px;
  cursor: pointer; font-size: 13px; color: var(--c-text);
}
.app-header .logout-btn:hover { background: #f0f4f8; }

/* ===== 通知バッジ ===== */
.notify-wrap { position: relative; }
.notify-btn {
  background: transparent; border: 1px solid var(--c-border);
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 16px; position: relative;
}
.notify-btn:hover { background: #f0f4f8; }
.unread-badge {
  position: absolute; top: -4px; right: -4px;
  background: var(--c-danger); color: white;
  font-size: 11px; font-weight: 600;
  min-width: 18px; height: 18px;
  border-radius: 9px; padding: 0 5px;
  display: inline-flex; align-items: center; justify-content: center;
}
.unread-badge[hidden] { display: none; }

/* ===== コンテナ ===== */
.container {
  max-width: 1400px; margin: 20px auto; padding: 0 20px;
}
.panel {
  background: var(--c-panel); border: 1px solid var(--c-border);
  border-radius: 8px; padding: 20px; margin-bottom: 20px;
}
.panel-title {
  font-size: 18px; font-weight: 600; margin: 0 0 16px;
  display: flex; align-items: center; gap: 8px;
}

/* ===== ボタン / フォーム ===== */
.btn {
  background: var(--c-primary); color: white;
  border: 0; padding: 8px 16px; border-radius: 6px;
  font-size: 14px; cursor: pointer;
}
.btn:hover { background: var(--c-primary-dark); }
.btn.btn-secondary { background: #6b7280; }
.btn.btn-secondary:hover { background: #4b5563; }
.btn.btn-danger { background: var(--c-danger); }
.btn.btn-success { background: var(--c-success); }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
input[type=text], input[type=email], input[type=password], textarea, select {
  border: 1px solid var(--c-border); padding: 8px 10px;
  border-radius: 6px; font-size: 14px; font-family: inherit;
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid #93c5fd; outline-offset: -1px;
}
textarea { width: 100%; min-height: 120px; resize: vertical; }
label { display: block; font-size: 13px; color: var(--c-text-muted); margin-bottom: 4px; }

/* ===== テーブル ===== */
table.data {
  width: 100%; border-collapse: collapse;
  background: var(--c-panel);
}
table.data th, table.data td {
  padding: 8px 10px; border-bottom: 1px solid #eaecef;
  font-size: 13px; text-align: left;
}
table.data th { background: #f9fafb; font-weight: 600; color: var(--c-text-muted); }
table.data tr:hover { background: #fafbfc; }

/* ===== ステータスバッジ ===== */
.tag {
  display: inline-block; padding: 2px 8px;
  border-radius: 10px; font-size: 11px; font-weight: 500;
}
.tag-matched   { background: #dcfce7; color: #166534; }
.tag-low       { background: #fef3c7; color: #92400e; }
.tag-mismatch  { background: #fee2e2; color: #991b1b; }
.tag-pending   { background: #e5e7eb; color: #374151; }
.tag-sent      { background: #dbeafe; color: #1e40af; }
.tag-rejected  { background: #fee2e2; color: #991b1b; }
.tag-reviewed  { background: #dcfce7; color: #166534; }
.tag-draft     { background: #fef3c7; color: #92400e; }

/* ===== ダッシュボード ===== */
.dash-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px; margin-bottom: 20px;
}
.stat-card {
  background: var(--c-panel); border: 1px solid var(--c-border);
  border-radius: 8px; padding: 16px;
}
.stat-card .label { font-size: 12px; color: var(--c-text-muted); }
.stat-card .value { font-size: 28px; font-weight: 600; color: var(--c-text); margin-top: 6px; }
.stat-card.gold  { background: var(--c-gold-bg); border-color: var(--c-gold-border); }
.stat-card.visit { background: var(--c-visit-bg); border-color: var(--c-visit-border); }

.event-row {
  background: var(--c-panel); border: 1px solid var(--c-border);
  border-left: 4px solid var(--c-past-border);
  padding: 12px 16px; margin-bottom: 8px; border-radius: 6px;
  display: flex; align-items: center; gap: 16px;
}
.event-row.gold  {
  background: var(--c-gold-bg); border-color: var(--c-gold-border);
  border-left-color: var(--c-gold-border); border-left-width: 6px;
}
.event-row.visit {
  background: var(--c-visit-bg); border-color: var(--c-visit-border);
  border-left-color: var(--c-visit-border);
}
.event-row.read { opacity: 0.55; }
.event-row .time { font-size: 12px; color: var(--c-text-muted); width: 140px; flex-shrink: 0; }
.event-row .name { font-weight: 500; flex: 1; }
.event-row .meta { font-size: 12px; color: var(--c-text-muted); }
.event-row a { color: var(--c-primary); text-decoration: none; }
.event-row a:hover { text-decoration: underline; }

/* ===== ログイン ===== */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--c-bg);
}
.login-box {
  background: var(--c-panel); border: 1px solid var(--c-border);
  border-radius: 8px; padding: 32px;
  width: 380px; max-width: 90vw;
}
.login-box h1 { margin: 0 0 24px; font-size: 18px; text-align: center; }
.login-box .field { margin-bottom: 16px; }
.login-box .field input { width: 100%; }
.login-box .submit { width: 100%; padding: 10px; font-size: 15px; }
.login-box .error {
  background: #fee2e2; color: #991b1b;
  padding: 8px 12px; border-radius: 6px; margin-bottom: 16px; font-size: 13px;
}

/* ===== ドラフトエディタ ===== */
.draft-editor textarea { min-height: 200px; font-family: ui-monospace, monospace; }
.draft-editor .val-errs {
  background: #fef3c7; color: #92400e; padding: 8px 12px;
  border-radius: 6px; font-size: 13px; margin-top: 8px;
}
.draft-editor .actions { display: flex; gap: 8px; margin-top: 12px; }

/* ===== ヘルパ ===== */
.muted { color: var(--c-text-muted); }
.row { display: flex; gap: 12px; align-items: center; }
.right { margin-left: auto; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.empty { padding: 40px; text-align: center; color: var(--c-text-muted); }

/* jobs.html: 法人番号列を非表示 */
#companies-table th:nth-child(4),
#companies-table td:nth-child(4),
table.companies-table th:nth-child(4),
table.companies-table td:nth-child(4) {
  display: none !important;
}


/* companies table: 法人番号列だけ非表示 */
table th:nth-child(4),
table td:nth-child(4) {
  display: none !important;
}
