/* ─── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:  #6d28d9;
  --danger:   #dc2626;
  --success:  #16a34a;
  --border:   #dfd2fb;
  --bg:       #f6f1ff;
  --sidebar:  #24153c;
  --sid-t:    #b7add6;
  --sid-a:    #c4b5fd;
  --text:     #241b3a;
  --muted:    #756a96;
  --radius:   16px;
  --shadow:   0 8px 28px rgba(76,29,149,.10);
  --yellow:   #c4b5fd;
  --cream:    #f3edff;
}

.inventory-metrics { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:12px; margin-bottom:18px; }
.inventory-metrics article { background:#fff; border:1px solid #d9e0dc; border-radius:10px; padding:16px; }
.inventory-metrics strong { display:block; color:#143d34; font-family:Georgia,serif; font-size:28px; }
.inventory-metrics span { color:#66756f; font-size:12px; }
.inventory-run { color:#66756f; font-size:13px; }
.inventory-warning { border-left:4px solid #b66a18; }
.inventory-table small { display:block; max-width:420px; color:#6e7975; overflow-wrap:anywhere; }
.inventory-orphan { color:#a6412d; font-weight:700; }
.inventory-summary dl { display:grid; grid-template-columns:150px 1fr 150px 1fr; gap:8px 16px; }
.inventory-summary dt { color:#66756f; font-size:12px; text-transform:uppercase; }
.inventory-summary dd { margin:0; overflow-wrap:anywhere; }
.inventory-clusters { display:flex; flex-wrap:wrap; gap:10px; }
.inventory-clusters div { min-width:180px; padding:12px 14px; background:#f8faf9; border:1px solid #d9e0dc; border-radius:8px; }
.inventory-clusters strong, .inventory-clusters span { display:block; }
.inventory-clusters span { margin-top:4px; color:#66756f; font-size:12px; }
.overlap-hero { display:flex; justify-content:space-between; align-items:end; gap:20px; padding:24px; margin-bottom:16px; color:#f7f2df; background:linear-gradient(125deg,#173f35,#8a4b22); border-radius:16px; }
.overlap-hero span,.comparison-label { font-size:11px; letter-spacing:.12em; text-transform:uppercase; }
.overlap-hero h2 { margin:4px 0 8px; font-family:Georgia,serif; font-size:30px; }
.overlap-hero p,.overlap-hero small { color:#e4ddc9; }
.overlap-metrics { display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:10px; margin-bottom:16px; }
.overlap-metrics article { padding:15px; background:#fff; border:1px solid var(--border); border-radius:12px; }
.overlap-metrics strong,.overlap-metrics span { display:block; }
.overlap-metrics strong { font-family:Georgia,serif; font-size:28px; }
.overlap-metrics .critical { border-top:4px solid #851f1f; }
.overlap-metrics .high { border-top:4px solid #b65d1e; }
.parent-protection a { display:block; padding:10px 0; border-top:1px solid var(--border); }
.parent-protection a span { float:right; }
.overlap-filter { display:flex; align-items:center; gap:8px; margin:12px 0; }
.overlap-table td:first-child,.overlap-table td:nth-child(2) { min-width:220px; }
.risk { display:inline-block; padding:3px 8px; border-radius:999px; font-size:11px; font-weight:700; }
.risk-CRITICAL { color:#fff; background:#851f1f; }
.risk-HIGH { color:#fff; background:#b65d1e; }
.risk-MEDIUM { color:#664100; background:#f1cf7b; }
.risk-LOW { color:#255240; background:#cce5d7; }
.risk-NONE { color:#59615e; background:#e4e9e7; }
.comparison-grid,.explanation-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.comparison-grid article { border-top:5px solid #8a4b22; }
.comparison-grid dl { display:grid; grid-template-columns:110px 1fr; gap:8px; margin-top:18px; }
.comparison-grid dt { color:var(--muted); }
.comparison-grid dd { margin:0; }
.signal-grid { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:10px; }
.signal-grid div { padding:14px; background:#f8f4e9; border-radius:10px; }
.signal-grid strong,.signal-grid span { display:block; }
.signal-grid strong { font-family:Georgia,serif; font-size:24px; }
@media (max-width: 980px) {
  .overlap-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .comparison-grid,.explanation-grid,.signal-grid { grid-template-columns:1fr; }
}
@media (max-width: 980px) {
  .inventory-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .inventory-summary dl { grid-template-columns:1fr; }
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Meiryo', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  display: flex;
  min-height: 100vh;
}

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

/* ─── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: 248px;
  min-height: 100vh;
  background: var(--sidebar);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  position: fixed;
  top: 0; left: 0; bottom: 0;
}

.sidebar-logo {
  padding: 26px 22px 20px;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .02em;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-logo span {
  display: block;
  font-size: 10px;
  color: var(--sid-t);
  font-weight: 400;
  margin-top: 2px;
}

.sidebar-nav { flex: 1; padding: 18px 12px; overflow-y: auto; }

.sidebar-section {
  padding: 10px 10px 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--sid-t);
  text-transform: uppercase;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  color: #cbd5e1;
  font-size: 13px;
  transition: background .15s, color .15s, transform .15s, border-color .15s;
  border-radius: 14px;
  margin: 4px 0;
  border: 1px solid transparent;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(196,181,253,.16);
  color: #fff;
  text-decoration: none;
  border-color: rgba(196,181,253,.14);
}

.sidebar-nav a.active { color: var(--yellow); box-shadow: inset 3px 0 0 var(--sid-a); }

.nav-order {
  min-width: 26px;
  height: 26px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.06);
  color: var(--sid-t);
  font-size: 10px;
  font-weight: 700;
}

.sidebar-project-card {
  margin: 0 18px 18px;
  padding: 14px;
  border-radius: 14px;
  background: #f3edff;
  border: 1px solid #d8ccf4;
}

.sidebar-project-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sidebar-project-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  color: #756a96;
}

.sidebar-project-manage {
  color: var(--primary);
  font-size: 11px;
  text-decoration: none;
}

.sidebar-project-manage:hover {
  color: var(--primary);
  text-decoration: none;
}

.sidebar-project-name {
  margin-top: 7px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.sidebar-project-meta {
  margin-top: 5px;
  font-size: 12px;
  color: #756a96;
  line-height: 1.6;
}

.sidebar-watchdog {
  margin-top: 12px;
  display: grid;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid #dfd2fb;
}

.sidebar-watchdog small {
  color: #756a96;
  font-size: 11px;
  line-height: 1.5;
}

.sidebar-project-actions {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #d8ccf4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-project-count {
  color: #756a96;
  font-size: 11px;
}

.sidebar-project-link {
  display: inline-flex;
  font-size: 12px;
  color: var(--primary);
  text-decoration: none;
}

.sidebar-project-link:hover {
  color: var(--primary);
  text-decoration: none;
}

.sidebar-footer {
  padding: 12px 16px;
  font-size: 11px;
  color: var(--sid-t);
  border-top: 1px solid #334155;
}

/* ─── Main ──────────────────────────────────────────────────── */
.main { margin-left: 248px; flex: 1; display: flex; flex-direction: column; }

.topbar {
  background: rgba(246,241,255,.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(76,29,149,.10);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-heading { display: grid; gap: 4px; }
.topbar-kicker {
  font-size: 10px;
  letter-spacing: .14em;
  font-weight: 800;
  color: #756a96;
}
.topbar h1 { font-size: 18px; font-weight: 700; letter-spacing: -.02em; }
.topbar-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.topbar-status { display: grid; gap: 3px; justify-items: end; }
.topbar-status small { font-size: 11px; color: var(--muted); }
.topbar-actions { display:flex;gap:8px;align-items:center;flex-wrap:wrap;justify-content:flex-end; }
.content { padding: 24px 28px 40px; flex: 1; }

/* ─── Flash ─────────────────────────────────────────────────── */
.flash-list { list-style: none; margin-bottom: 16px; }

.flash {
  padding: 10px 16px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 500;
}

.flash.success { background: #dcfce7; color: var(--success); border: 1px solid #bbf7d0; }
.flash.error   { background: #fee2e2; color: var(--danger);  border: 1px solid #fecaca; }
.flash.info    { background: #ede9fe; color: var(--primary); border: 1px solid #ddd6fe; }

/* ─── Card ──────────────────────────────────────────────────── */
.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-header h2 { font-size: 14px; font-weight: 700; }
.card-body { padding: 20px; }

/* ─── Table ─────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

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

th {
  background: #f4f0ff;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td { padding: 10px 12px; border-bottom: 1px solid #f4f0ff; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #faf7ff; }

/* ─── Badge ─────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-未分析           { background: #f1f5f9; color: #64748b; }
.badge-分析済み         { background: #dbeafe; color: #1d4ed8; }
.badge-メール作成済み    { background: #fef9c3; color: #92400e; }
.badge-送信済み         { background: #fde68a; color: #92400e; }
.badge-フォーム送信済み  { background: #fed7aa; color: #9a3412; }
.badge-返信あり         { background: #bbf7d0; color: #15803d; }
.badge-商談化           { background: #86efac; color: #15803d; font-weight: 700; }
.badge-見積提出         { background: #c4b5fd; color: #5b21b6; }
.badge-契約             { background: #6ee7b7; color: #065f46; font-weight: 700; }
.badge-失注             { background: #fecaca; color: #991b1b; }
.badge-対象外           { background: #e2e8f0; color: #94a3b8; }

.rank-A { color: #dc2626; font-weight: 700; }
.rank-B { color: #d97706; font-weight: 700; }
.rank-C { color: #64748b; font-weight: 700; }

.pri-高 { color: #dc2626; font-weight: 700; }
.pri-中 { color: #d97706; font-weight: 600; }
.pri-低 { color: #94a3b8; }

/* ─── Button ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: opacity .15s, transform .15s, border-color .15s;
  text-decoration: none;
}

.btn:hover { opacity: .92; transform: translateY(-1px); text-decoration: none; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 20px rgba(109,40,217,.18); }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-outline { background: #fff; border-color: var(--border); color: var(--primary); }
.btn-sm      { padding: 4px 10px; font-size: 12px; }

/* ─── Workflow ─────────────────────────────────────────────── */
.workflow-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.workflow-summary-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  color: var(--muted);
  text-transform: uppercase;
}

.workflow-summary-value {
  margin-top: 5px;
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
}

.workflow-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.workflow-steps.compact {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}

.workflow-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 8px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  line-height: 1.35;
}

.workflow-step.complete {
  background: #dcfce7;
  border-color: #bbf7d0;
  color: #166534;
}

.workflow-step.in_progress {
  background: #ede9fe;
  border-color: #ddd6fe;
  color: #6d28d9;
}

.workflow-step.not_started {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #64748b;
}

.workflow-step.optional {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}

.workflow-step.error {
  background: #fee2e2;
  border-color: #fecaca;
  color: #b91c1c;
}

.workflow-step-card {
  min-height: 92px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background: #fff;
}

.workflow-step-card.complete {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.workflow-step-card.in_progress {
  background: #f5f3ff;
  border-color: #ddd6fe;
}

.workflow-step-card.not_started {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.workflow-step-card.optional {
  background: #fff7ed;
  border-color: #fed7aa;
}

.workflow-step-card.error {
  background: #fef2f2;
  border-color: #fecaca;
}

.workflow-step-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.workflow-step-detail {
  margin-top: 6px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}

.workflow-next {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #f5f3ff;
  color: #5b21b6;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}

/* ─── Form ──────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group.full { grid-column: 1 / -1; }

label { font-size: 12px; font-weight: 600; color: var(--muted); }

input[type=text], input[type=email], input[type=tel], input[type=url],
input[type=date], select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(109,40,217,.12);
}

textarea { resize: vertical; }

input[type=password] {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 13px; font-family: inherit;
}

/* Clinic Knowledge Base */
.kb-hero { display:flex; justify-content:space-between; gap:24px; padding:24px; margin-bottom:16px; border-radius:22px; color:#f8fafc; background:linear-gradient(130deg,#12352c,#245947 58%,#b48238); box-shadow:var(--shadow); }
.kb-hero h2 { margin-top:7px; font-size:27px; }
.kb-hero p { margin-top:8px; max-width:680px; color:#d9eee7; line-height:1.7; }
.kb-auth { display:flex; align-items:flex-start; gap:8px; }
.kb-login-form { display:grid; grid-template-columns:140px 160px auto; gap:7px; }
.kb-metrics { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:12px; margin-bottom:16px; }
.kb-metric { padding:17px 18px; }
.kb-metric span { color:var(--muted); font-size:11px; font-weight:700; letter-spacing:.06em; }
.kb-metric strong { display:block; margin-top:6px; font-size:27px; }
.kb-key { margin-top:4px; color:var(--muted); font:11px ui-monospace,monospace; }
.kb-status-VERIFIED,.kb-use-ALLOWED { background:#dcfce7; color:#166534; }
.kb-status-PENDING,.kb-use-REVIEW_REQUIRED { background:#fef3c7; color:#92400e; }
.kb-status-EXPIRED,.kb-status-REJECTED,.kb-use-BLOCKED { background:#fee2e2; color:#991b1b; }
.kb-detail-actions { display:flex; gap:8px; border-top:1px solid var(--border); }
.kb-audit-list { display:grid; gap:10px; }
.kb-audit-list > div { display:grid; gap:3px; padding-bottom:10px; border-bottom:1px solid var(--border); }
.kb-audit-list span,.kb-audit-list small { color:var(--muted); }

/* ─── Search bar ────────────────────────────────────────────── */
.search-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.search-bar input, .search-bar select { width: auto; }

/* ─── Pagination ────────────────────────────────────────────── */
.pagination {
  display: flex;
  gap: 4px;
  align-items: center;
  justify-content: center;
  padding: 16px 0;
}

.pagination a, .pagination span {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text);
}

.pagination a:hover { background: #f4f0ff; text-decoration: none; }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ─── Detail ────────────────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

.dl-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 16px;
  font-size: 13px;
}

.dl-grid dt { color: var(--muted); font-weight: 600; }
.dl-grid dd { color: var(--text); word-break: break-all; }

/* ─── Activity ──────────────────────────────────────────────── */
.activity-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
  align-items: flex-start;
}

.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary);
  margin-top: 5px;
  flex-shrink: 0;
}

.activity-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ─── Status sidebar ────────────────────────────────────────── */
.status-sidebar { display: flex; flex-direction: column; gap: 2px; }

.status-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  transition: background .1s;
  text-decoration: none;
  color: inherit;
}

.status-item:hover { background: #f4f0ff; text-decoration: none; }
.status-item.active { background: #ede9fe; color: var(--primary); font-weight: 700; }
.status-count { font-size: 11px; color: var(--muted); background: #f4f0ff; padding: 1px 7px; border-radius: 10px; }

/* ─── Upload area ───────────────────────────────────────────── */
.upload-area {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .15s;
  display: block;
}

.upload-area:hover { border-color: var(--primary); }

/* ─── Empty ─────────────────────────────────────────────────── */
.empty { text-align: center; padding: 48px; color: var(--muted); }
.empty p { margin-top: 8px; font-size: 13px; }

.app-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.tone-good { background: #dcfce7; color: #166534; }
.tone-warn { background: #fef3c7; color: #92400e; }
.tone-bad { background: #fee2e2; color: #b42318; }
.tone-muted { background: #ede9fe; color: #5b21b6; }

.page-banner {
  margin-bottom: 18px;
  padding: 22px 24px;
  border-radius: 24px;
  background:
    linear-gradient(135deg, rgba(109,40,217,.08), rgba(255,255,255,.7)),
    #fcfbff;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.page-banner-compact {
  padding: 18px 20px;
}

.page-banner-main {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
}

.page-banner-title {
  display: block;
  margin-top: 6px;
  font-size: 24px;
  line-height: 1.1;
  color: var(--text);
}

.page-banner-copy {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.page-banner-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.page-banner-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.info-card {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: #fff;
  box-shadow: var(--shadow);
}

.info-card strong {
  display: block;
  font-size: 13px;
  color: var(--text);
}

.info-card div {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.7;
}

/* ─── Template type badge ───────────────────────────────────── */
.type-mail   { background: #ede9fe; color: #6d28d9; }
.type-form   { background: #dcfce7; color: #15803d; }
.type-follow { background: #f3e8ff; color: #7e22ce; }
.type-other  { background: #f4f0ff; color: #756a96; }

/* ─── SIMPLISM Operations Dashboard ────────────────────────── */
.ops-dashboard {
  max-width: 1440px;
  margin: 0 auto;
}

.dashboard-hero {
  min-height: 188px;
  padding: 31px 34px;
  margin-bottom: 18px;
  border-radius: 28px;
  color: var(--text);
  background:
    radial-gradient(circle at 82% 10%, rgba(255,255,255,.72) 0 5%, transparent 5.2%),
    linear-gradient(120deg, #f7f2ff 0%, #d9c7ff 100%);
  border: 1px solid rgba(109,40,217,.10);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 30px;
  overflow: hidden;
  position: relative;
}

.dashboard-hero::after {
  content: '';
  width: 220px;
  height: 220px;
  border: 1px solid rgba(109,40,217,.12);
  border-radius: 50%;
  position: absolute;
  right: -60px;
  bottom: -155px;
}

.eyebrow, .section-kicker {
  display: block;
  color: #7a6da1;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .15em;
}

.dashboard-hero h2 {
  margin: 9px 0 8px;
  font-size: clamp(29px, 3.2vw, 46px);
  line-height: 1.08;
  letter-spacing: -.045em;
  font-weight: 650;
}

.dashboard-hero p { color: #645785; font-size: 13px; }
.dashboard-hero p { color: #645785; font-size: 13px; }

.hero-goal {
  min-width: 275px;
  display: flex;
  align-items: center;
  gap: 17px;
  z-index: 1;
}

.goal-ring {
  width: 106px;
  height: 106px;
  padding: 9px;
  flex-shrink: 0;
  border-radius: 50%;
  background: conic-gradient(#6d28d9 var(--progress), rgba(255,255,255,.58) 0);
  box-shadow: 0 7px 22px rgba(109,40,217,.18);
}

.goal-ring > div {
  height: 100%;
  border-radius: 50%;
  background: #fcfaff;
  display: flex;
  align-items: baseline;
  justify-content: center;
  padding-top: 28px;
}

.goal-ring strong { font-size: 30px; line-height: 1; }
.goal-ring span { color: #8678ab; font-size: 11px; margin-left: 2px; }
.goal-copy { display: flex; flex-direction: column; gap: 4px; }
.goal-copy span { color: #76689c; font-size: 11px; }
.goal-copy strong { font-size: 21px; letter-spacing: -.03em; }

.pipeline-card, .seo-card, .quick-actions {
  background: #fcfbff;
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.pipeline-card { padding: 25px 28px 22px; margin-bottom: 18px; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-heading h2 { margin-top: 5px; font-size: 18px; letter-spacing: -.02em; }
.round-link {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  background: #f1ebff;
  color: var(--primary);
  display: grid;
  place-items: center;
  font-size: 17px;
  transition: transform .15s, background .15s;
}
.round-link:hover { background: var(--yellow); transform: translateX(2px); text-decoration: none; }

.pipeline-grid {
  display: grid;
  grid-template-columns: 1fr 24px 1fr 24px 1fr 24px 1fr 24px 1fr;
  align-items: center;
  margin-top: 21px;
}

.pipeline-step {
  min-width: 0;
  min-height: 104px;
  padding: 17px 18px;
  border-radius: 17px;
  background: #f2edff;
  display: flex;
  flex-direction: column;
}
.pipeline-step.is-yellow { background: var(--yellow); }
.pipeline-step.is-dark { background: #3b2467; color: #fff; }
.pipeline-number { font-size: 31px; line-height: 1; font-weight: 650; letter-spacing: -.05em; }
.pipeline-label { font-size: 12px; font-weight: 700; margin-top: 9px; }
.pipeline-note { color: #867aa8; font-size: 9px; margin-top: 3px; }
.pipeline-step.is-yellow .pipeline-note { color: #5b3f99; }
.pipeline-step.is-dark .pipeline-note { color: #d3c8ee; }
.pipeline-arrow { color: #aa9dcd; text-align: center; }

.deal-progress {
  margin-top: 17px;
  display: grid;
  grid-template-columns: 105px 1fr 38px;
  align-items: center;
  gap: 12px;
  color: #76689a;
  font-size: 10px;
}
.progress-track { height: 7px; border-radius: 20px; background: #ebe4ff; overflow: hidden; }
.progress-track div { height: 100%; border-radius: inherit; background: #6d28d9; }
.deal-progress strong { color: var(--text); font-size: 11px; text-align: right; }

.dashboard-work-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.32fr) minmax(340px, .68fr);
  gap: 18px;
  margin-bottom: 18px;
}

.focus-card {
  min-height: 408px;
  padding: 25px 28px 22px;
  background: linear-gradient(180deg, #312052 0%, #24153c 100%);
  color: #f8f4ff;
  border-radius: 24px;
  box-shadow: 0 13px 32px rgba(44,19,87,.22);
  display: flex;
  flex-direction: column;
}
.section-heading-light .section-kicker { color: #b7add6; }
.section-heading-light h2 { color: #fff; }
.task-count { color: #cdbff4; font-size: 9px; letter-spacing: .12em; }
.focus-list { margin-top: 16px; flex: 1; max-height: 260px; overflow-y: auto; padding-right: 3px; }
.focus-item {
  color: #f7f5ee;
  padding: 13px 4px;
  border-bottom: 1px solid rgba(255,255,255,.09);
  display: flex;
  align-items: center;
  gap: 12px;
}
.focus-item:hover { text-decoration: none; }
.focus-check { width: 19px; height: 19px; border: 1px solid #7c6aa7; border-radius: 50%; flex-shrink: 0; transition: border .15s, background .15s; }
.focus-item:hover .focus-check { border-color: var(--yellow); background: var(--yellow); }
.focus-text { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.focus-text strong { font-size: 12px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.focus-text small { color: #b7add6; font-size: 9px; }
.focus-arrow { color: #b7add6; }
.focus-empty { min-height: 200px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; text-align: center; }
.focus-empty > span { width: 46px; height: 46px; border-radius: 50%; background: var(--yellow); color: #24153c; display: grid; place-items: center; font-size: 18px; }
.focus-empty strong { margin-top: 6px; font-size: 14px; }
.focus-empty small { color: #b7add6; font-size: 10px; }
.dark-card-action { margin-top: 14px; border-top: 1px solid rgba(255,255,255,.09); padding-top: 17px; color: var(--yellow); display: flex; justify-content: space-between; font-size: 11px; font-weight: 650; }
.dark-card-action:hover { text-decoration: none; color: #ddd6fe; }

.seo-card { padding: 25px 26px 22px; min-width: 0; }
.seo-score { margin-top: 26px; display: flex; align-items: center; gap: 18px; }
.seo-score-number { display: flex; align-items: baseline; }
.seo-score-number strong { font-size: 43px; line-height: 1; letter-spacing: -.06em; }
.seo-score-number span { color: #8a7fb0; font-size: 12px; }
.seo-score > div:last-child { display: flex; flex-direction: column; gap: 3px; }
.seo-score > div:last-child > span { font-weight: 700; font-size: 12px; }
.seo-score small { color: #9a8ec0; font-size: 9px; }
.seo-progress-track { height: 12px; margin: 17px 0 23px; border-radius: 20px; background: #ece4ff; overflow: hidden; padding: 3px; }
.seo-progress-track div { height: 100%; border-radius: inherit; background: linear-gradient(90deg, #8b5cf6 0%, #6d28d9 100%); min-width: 0; }
.seo-metrics { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.seo-metrics > div { padding: 13px 10px; border-radius: 13px; background: #f2edff; display: flex; flex-direction: column; gap: 7px; }
.seo-metrics span { color: #776b99; font-size: 9px; }
.seo-metrics strong { font-size: 20px; }
.seo-metrics strong small { margin-left: 2px; font-size: 9px; font-weight: 500; }
.seo-rewrite-link { margin-top: 16px; padding: 13px 2px 0; border-top: 1px solid #e3d8fb; color: var(--text); display: flex; align-items: center; justify-content: space-between; }
.seo-rewrite-link:hover { text-decoration: none; }
.seo-rewrite-link > span:first-child { display: flex; flex-direction: column; gap: 2px; }
.seo-rewrite-link strong { font-size: 11px; }
.seo-rewrite-link small { color: #9387b8; font-size: 9px; }

.quick-actions { padding: 22px 26px; display: grid; grid-template-columns: 190px 1fr; gap: 30px; align-items: center; }
.quick-actions h2 { font-size: 17px; margin-top: 5px; }
.quick-action-links { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.quick-action-links a { min-height: 59px; padding: 0 15px; border-radius: 14px; background: #f2edff; color: var(--text); display: flex; align-items: center; gap: 9px; font-size: 11px; font-weight: 650; }
.quick-action-links a:hover { text-decoration: none; background: var(--yellow); }
.quick-action-links span { color: #9084b6; font-size: 9px; }
.quick-action-links b { margin-left: auto; font-size: 14px; }

.monitor-grid {
  display: grid;
  grid-template-columns: minmax(320px, .9fr) minmax(0, 1.1fr);
  gap: 18px;
  margin-bottom: 18px;
}

.monitor-card {
  padding: 22px 24px;
  border-radius: 24px;
  border: 1px solid var(--border);
  background: #fcfbff;
  box-shadow: var(--shadow);
}

.monitor-card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.monitor-card-head h2 {
  margin-top: 4px;
  font-size: 20px;
  letter-spacing: -.03em;
}

.monitor-card-copy {
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
}

.monitor-metrics {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.monitor-metrics > div {
  padding: 14px;
  border-radius: 16px;
  background: #f2edff;
}

.monitor-metrics span {
  display: block;
  font-size: 10px;
  letter-spacing: .08em;
  color: #756a96;
}

.monitor-metrics strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
  line-height: 1;
}

.monitor-log {
  margin-top: 14px;
  display: grid;
  gap: 12px;
}

.monitor-log-item {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 10px;
  align-items: flex-start;
}

.monitor-log-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  margin-top: 3px;
}

.monitor-log-item strong {
  display: block;
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}

.monitor-log-item small {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}

.monitor-empty {
  color: var(--muted);
  font-size: 12px;
}

.contract-planning-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr);
  gap: 16px;
}

.monthly-contract-card,
.seo-actions-card {
  padding: 24px;
  border: 1px solid #d8d0b7;
  border-radius: 24px;
  background: linear-gradient(145deg, #fffdf6 0%, #f5f0df 100%);
  box-shadow: 0 18px 45px rgba(53, 45, 22, .08);
}

.seo-actions-card {
  border-color: #d9e2dc;
  background: linear-gradient(145deg, #f8fbf8 0%, #e8f0ea 100%);
}

.contract-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.contract-card-head h2 {
  margin-top: 4px;
  font-size: 20px;
  letter-spacing: -.03em;
}

.delivery-status {
  padding: 7px 10px;
  border-radius: 999px;
  background: #e7efe5;
  color: #315f3a;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .08em;
}

.delivery-state {
  display: grid;
  gap: 6px;
  justify-items: end;
}

.delivery-state small {
  color: #7a735c;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.delivery-at_risk,
.delivery-not-set {
  background: #fff0c7;
  color: #8a5b00;
}

.delivery-failed {
  background: #fee2e2;
  color: #991b1b;
}

.delivery-complete {
  background: #d9f4df;
  color: #176b2c;
}

.contract-quota {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-top: 22px;
}

.contract-quota strong {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 64px;
  line-height: .9;
  color: #2e321f;
}

.contract-quota span {
  max-width: 120px;
  color: #70694d;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.contract-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 22px;
}

.contract-metrics > div,
.seo-action-list > div {
  padding: 13px 14px;
  border: 1px solid rgba(88, 79, 44, .13);
  border-radius: 15px;
  background: rgba(255, 255, 255, .65);
}

.contract-metrics span,
.seo-action-list span {
  display: block;
  color: #756f5a;
  font-size: 10px;
  letter-spacing: .06em;
}

.contract-metrics strong,
.seo-action-list strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
}

.contract-note,
.contract-empty {
  margin-top: 16px;
  color: #70694d;
  font-size: 12px;
  line-height: 1.7;
}

.seo-action-list {
  display: grid;
  gap: 9px;
  margin-top: 18px;
}

.seo-action-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-color: rgba(47, 86, 58, .12);
}

.seo-action-list strong {
  margin-top: 0;
  color: #315f3a;
  font-size: 18px;
}

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .pipeline-grid { grid-template-columns: repeat(5, 1fr); gap: 8px; }
  .pipeline-arrow { display: none; }
  .dashboard-work-grid { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: 1fr; gap: 17px; }
  .monitor-grid { grid-template-columns: 1fr; }
  .contract-planning-grid { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  .form-grid, .detail-grid { grid-template-columns: 1fr; }
  .workflow-summary, .workflow-steps, .workflow-steps.compact { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .topbar { padding: 13px 17px; }
  .topbar-meta { align-items: flex-start; justify-content: flex-start; }
  .page-banner-main { flex-direction: column; align-items: flex-start; }
  .dashboard-hero { padding: 25px 22px; align-items: flex-start; flex-direction: column; border-radius: 22px; }
  .dashboard-hero h2 { font-size: 31px; }
  .hero-goal { min-width: 0; }
  .goal-ring { width: 83px; height: 83px; }
  .goal-ring > div { padding-top: 20px; }
  .goal-ring strong { font-size: 23px; }
  .pipeline-card, .focus-card, .seo-card, .quick-actions { padding: 21px 18px; border-radius: 20px; }
  .pipeline-grid { grid-template-columns: repeat(2,1fr); }
  .pipeline-step:last-child { grid-column: 1 / -1; }
  .quick-action-links { grid-template-columns: 1fr; }
  .deal-progress { grid-template-columns: 90px 1fr 35px; }
  .monitor-metrics { grid-template-columns: 1fr 1fr; }
  .contract-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kb-hero { flex-direction:column; }
  .kb-metrics { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .kb-login-form { grid-template-columns:1fr; }
}
