:root {
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-alt: #eef4ff;
  --primary: #0d3b66;
  --primary-soft: #dfeefe;
  --accent: #ffb703;
  --text: #192332;
  --muted: #6c7a89;
  --border: #dfe7f2;
  --success: #1d9b5c;
  --warning: #d57a00;
  --danger: #c44536;
  --shadow: 0 12px 30px rgba(22, 35, 56, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #eef5ff 0%, var(--bg) 80%);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: min(100% - 40px, 1440px);
  margin: 0 auto;
  padding: 32px 56px 18px;
}

.app-header {
  padding-top: 26px;
}

.brand,
.header-actions,
.toolbar,
.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: var(--primary);
  color: white;
  font-weight: 800;
  font-size: 1.35rem;
}

.status-pill i {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--success);
}

.outline-button {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--border);
  padding: 9px 13px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 28px;
  background: linear-gradient(120deg, #ffffff 0%, #edf6ff 100%);
}

.hero h2 {
  margin: 0;
  max-width: 720px;
  font-size: clamp(1.45rem, 1.2rem + 1vw, 2.15rem);
}

.hero-copy {
  max-width: 720px;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.hero-actions {
  flex-direction: column;
  align-items: flex-end;
  min-width: 205px;
}

.hero-actions .subtext {
  max-width: 230px;
  text-align: right;
}

.analytics-grid {
  grid-template-columns: repeat(2, minmax(300px, 1fr));
}

.funnel {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  align-items: end;
  min-height: 116px;
}

.funnel div {
  display: grid;
  gap: 8px;
  align-content: end;
  min-height: calc(44px + var(--step, 0px));
  padding: 12px 8px;
  border-radius: 10px 10px 4px 4px;
  background: linear-gradient(180deg, #dbeeff, #f6fbff);
  color: var(--muted);
  text-align: center;
}

.funnel div:nth-child(2) { --step: 24px; }
.funnel div:nth-child(3) { --step: 42px; }
.funnel div:nth-child(4) { --step: 58px; }
.funnel strong { color: var(--primary); font-size: 1.45rem; }

.bar-chart {
  display: grid;
  gap: 15px;
  padding-top: 5px;
}

.bar-chart > div:not(.bar-row) {
  display: grid;
  grid-template-columns: 50px 1fr;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 0.86rem;
}

.bar-chart > div:not(.bar-row) i {
  display: block;
  width: var(--value);
  min-width: 28px;
  height: 18px;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--primary), #20a0bd);
}

.bar-chart > div:not(.bar-row) b {
  position: relative;
  left: calc(100% + 7px);
  color: var(--text);
  font-style: normal;
}

.toolbar input {
  width: 190px;
  padding: 9px 11px;
}

.eyebrow {
  margin: 0 0 6px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-size: 0.72rem;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 1.8rem + 1vw, 2.8rem);
}

.status-pill {
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid rgba(13, 59, 102, 0.08);
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
}

.layout {
  display: grid;
  gap: 24px;
  width: min(100% - 40px, 1440px);
  margin: 0 auto;
  padding: 0 0 56px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 18px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px 22px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 140px;
}

.card.accent {
  background: linear-gradient(135deg, var(--primary) 0%, #114f8a 100%);
  color: white;
}

.card.accent-green {
  background: linear-gradient(135deg, #176b4d 0%, #2a9d70 100%);
  color: white;
}

.danger-card strong {
  color: var(--danger);
}

.mapping-panel {
  overflow: hidden;
}

.channel-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}

.channel-form input,
.channel-form select {
  min-width: 0;
  padding: 10px 11px;
  font-size: 0.86rem;
}

.channel-form button {
  padding: 10px 12px;
  font-size: 0.86rem;
}

.subtext {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.mapping-tag,
.risk {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
}

.mapping-tag.opportunity {
  background: rgba(29, 155, 92, 0.12);
  color: var(--success);
}

.mapping-tag.neutral {
  background: #edf1f6;
  color: var(--muted);
}

.risk.低 {
  background: rgba(29, 155, 92, 0.12);
  color: var(--success);
}

.risk.中 {
  background: rgba(255, 183, 3, 0.14);
  color: var(--warning);
}

.risk.高 {
  background: rgba(196, 69, 54, 0.12);
  color: var(--danger);
}

.pilot-select {
  min-width: 88px;
  padding: 7px 8px;
  font-size: 0.78rem;
}

.card span,
.card small {
  color: inherit;
  opacity: 0.82;
}

.card strong {
  font-size: clamp(2rem, 1.2rem + 1vw, 2.5rem);
  line-height: 1.2;
}

.panel-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(300px, 1fr));
  gap: 24px;
}

.strategy {
  background: linear-gradient(135deg, #ffffff 0%, #f2f8ff 100%);
}

.strategy-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.strategy-heading .eyebrow {
  margin-bottom: 4px;
}

.strategy-badge {
  color: var(--success);
  background: rgba(29, 155, 92, 0.1);
  border-radius: 999px;
  padding: 7px 11px;
  font-size: 0.8rem;
  font-weight: 700;
}

.strategy-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 26px;
}

.strategy h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.mapping-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
  font-size: 0.9rem;
}

.mapping-list li::marker {
  color: var(--primary);
  font-weight: 700;
}

.roadmap {
  display: grid;
  gap: 10px;
}

.roadmap div {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.roadmap strong {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.75rem;
}

.guardrail {
  border-left: 3px solid var(--accent);
  padding-left: 16px;
}

.guardrail p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
  font-size: 0.9rem;
}

.project-note p:last-child {
  max-width: 900px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.75;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 20px 22px;
}

.panel-header {
  margin-bottom: 18px;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.3rem;
}

.stacked-form {
  display: grid;
  gap: 16px;
}

.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 12px;
}

label {
  display: grid;
  gap: 8px;
  font-size: 0.94rem;
  color: var(--muted);
  font-weight: 600;
}

input,
select {
  width: 100%;
  background: #f9fbff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
}

button {
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary) 0%, #0b7aaa 100%);
  color: white;
  font-weight: 700;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

button:hover {
  transform: translateY(-1px);
}

.table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  min-width: 0;
  overscroll-behavior-x: contain;
}

table {
  width: 100%;
  border-collapse: collapse;
}

.mapping-panel {
  min-width: 0;
}

.mapping-panel table {
  min-width: 1420px;
}

th,
td {
  padding: 14px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

thead th {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.status {
  display: inline-flex;
  align-items: center;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.status.pending {
  background: rgba(255, 183, 3, 0.12);
  color: var(--warning);
}

.status.shipped {
  background: rgba(13, 59, 102, 0.1);
  color: var(--primary);
}

.status.delivered {
  background: rgba(29, 155, 92, 0.12);
  color: var(--success);
}

.status-select {
  min-width: 120px;
  font-size: 0.82rem;
}

.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: rgba(19, 26, 35, 0.92);
  color: white;
  padding: 12px 18px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.hero-stat { min-width: 150px; text-align: center; color: var(--primary); }
.hero-stat strong { display:block; font-size:3rem; line-height:1; }
.hero-stat span { color:var(--muted); font-size:.84rem; }
.secondary,.file-button { background:#edf3fb; color:var(--primary); border:1px solid var(--border); border-radius:10px; padding:11px 15px; cursor:pointer; font-weight:700; }
.file-button { display:inline-flex; align-items:center; }
.import-panel .panel-header { display:flex; justify-content:space-between; align-items:center; gap:20px; margin:0; }
.notice { color:var(--success); min-height:1.2em; margin-top:12px; font-size:.85rem; }
.table-tools { display:flex; gap:8px; flex-wrap:wrap; }
.table-tools input { width:220px; padding:9px 11px; }
.table-tools select { width:auto; padding:9px 10px; }
.target-cards { display:grid; grid-template-columns:repeat(5,minmax(140px,1fr)); gap:12px; }
.target-card { display:grid; gap:8px; text-align:left; background:#f7faff; color:var(--text); border:1px solid var(--border); border-radius:12px; padding:14px; }
.target-card:hover { border-color:var(--primary); transform:translateY(-2px); }
.target-card small { color:var(--muted); line-height:1.35; }
.score { border-radius:999px; padding:4px 8px; display:inline-block; font-size:.78rem; font-weight:700; white-space:nowrap; }
.score.high { background:#ffe6e1; color:var(--danger); }.score.medium { background:#fff1c7; color:var(--warning); }.score.low { background:#e7f4ec; color:var(--success); }
.matrix { height:245px; position:relative; margin:10px 28px 22px 35px; border-left:1px solid var(--border); border-bottom:1px solid var(--border); background:linear-gradient(135deg,transparent 49.5%,#e8eef7 50%,transparent 50.5%),linear-gradient(90deg,rgba(29,155,92,.04) 50%,rgba(255,183,3,.06) 50%); }
.matrix-x,.matrix-y { position:absolute; color:var(--muted); font-size:.72rem; }.matrix-x { bottom:-22px; left:35%; }.matrix-y { left:-38px; top:35%; transform:rotate(-90deg); }
.dot { position:absolute; width:16px; height:16px; padding:0; border:3px solid white; border-radius:50%; box-shadow:0 1px 4px #789; transform:translate(-50%,50%); }.dot.high{background:var(--danger)}.dot.medium{background:var(--warning)}.dot.low{background:var(--success)}
.bar-chart { min-height:210px; }
.bar-row { display:grid; grid-template-columns:minmax(112px, 0.9fr) minmax(0, 1.7fr); align-items:center; gap:12px; margin:13px 0; color:var(--muted); font-size:.8rem; }
.bar-label { min-width:0; line-height:1.35; }
.bar-visual { min-width:0; display:grid; gap:5px; }
.bar-visual > i { display:block; width:var(--value); min-width:25px; height:18px; border-radius:5px; background:linear-gradient(90deg,var(--primary),#20a0bd); }
.bar-value { display:block; min-width:0; color:var(--text); font-style:normal; font-size:.74rem; line-height:1.25; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.analytics-grid { grid-template-columns:repeat(3,minmax(0,1fr)); align-items:stretch; }
.mapping-panel td { font-size:.84rem; white-space:nowrap; vertical-align:middle; }.mapping-panel th { white-space:nowrap; }.mapping-panel td:first-child { font-weight:700; }.link-button { background:transparent; color:var(--primary); padding:5px 7px; font-size:.78rem; }
.drawer-backdrop { display:none; position:fixed; inset:0; background:rgba(15,27,44,.35); z-index:4; }.drawer-backdrop.open{display:block}.drawer { position:fixed; z-index:5; right:0; top:0; height:100%; width:min(430px,92vw); padding:34px 28px; background:white; box-shadow:-12px 0 35px rgba(22,35,56,.2); transform:translateX(105%); transition:transform .2s ease; overflow:auto; }.drawer.open{transform:translateX(0)}.drawer-close { position:absolute; right:16px; top:12px; border:0; background:transparent; color:var(--muted); font-size:2rem; padding:2px 8px; }.drawer h2{margin:0 0 8px}.drawer h3{margin:26px 0 8px}.drawer-score{margin-top:22px;padding:13px;border-radius:10px;background:var(--primary-soft);color:var(--primary);font-weight:700}.drawer dl{display:grid;grid-template-columns:1fr 1fr;border-top:1px solid var(--border);margin-top:18px}.drawer dt,.drawer dd{margin:0;padding:10px 0;border-bottom:1px solid var(--border)}.drawer dt{color:var(--muted)}.drawer dd{text-align:right;font-weight:700}
@media (max-width:820px){.target-cards{grid-template-columns:repeat(2,minmax(140px,1fr))}.import-panel .panel-header,.strategy-heading{align-items:flex-start;flex-direction:column}.table-tools{width:100%}.table-tools input{width:100%}.hero-stat{text-align:left}.matrix{height:200px}}
@media print{.import-panel,.target-card,.drawer,.drawer-backdrop,.table-tools,.link-button{display:none!important}.target-cards{display:none}.analytics-grid{grid-template-columns:repeat(3,1fr)}}

@media (max-width: 820px) {
  .topbar,
  .layout {
    width: calc(100% - 32px);
    padding-left: 0;
    padding-right: 0;
  }

  .panel-grid,
  .two-column,
  .strategy-grid,
  .channel-form {
    grid-template-columns: 1fr;
  }

  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analytics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-header,
  .hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar {
    padding-top: 22px;
    padding-bottom: 14px;
  }

  h1 {
    max-width: 440px;
    font-size: clamp(1.7rem, 5vw, 2.35rem);
  }

  .header-actions {
    gap: 8px;
  }

  .status-pill {
    padding: 8px 11px;
    font-size: .82rem;
  }

  .header-actions,
  .hero-actions {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .hero-actions .subtext {
    text-align: left;
  }

  .toolbar {
    width: 100%;
  }

  .toolbar input {
    flex: 1;
    width: auto;
  }

  .funnel {
    gap: 5px;
  }

  .analytics-grid .panel {
    min-width: 0;
    padding: 16px;
  }

  .analytics-grid .panel:last-child {
    grid-column: 1 / -1;
  }

  .bar-chart {
    min-height: 0;
  }

  .bar-row {
    grid-template-columns: minmax(78px, 0.75fr) minmax(0, 1.25fr);
    gap: 7px;
    margin: 10px 0;
    font-size: .72rem;
  }

  .bar-row b {
    font-size: .68rem;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .bar-value {
    font-size: .66rem;
  }

  .mapping-panel .panel-header {
    gap: 14px;
  }

  .table-tools {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  @media (max-width: 520px) {
    .cards {
      grid-template-columns: 1fr;
    }

    .topbar {
      align-items: flex-start;
    }

    .header-actions {
      flex-wrap: wrap;
    }
  }

  .table-tools input,
  .table-tools select {
    width: 100%;
    min-width: 0;
  }

  .table-tools input {
    grid-column: 1 / -1;
  }

  .table-wrap {
    max-height: 680px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 10px;
  }

  .mapping-panel table {
    min-width: 1420px;
  }

  .mapping-panel thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f7faff;
  }

  .mapping-panel th,
  .mapping-panel td {
    padding: 10px 9px;
  }
}

@media print {
  body { background: white; }
  .header-actions, .hero-actions, .toolbar, .toast { display: none; }
  .layout { padding: 0; }
  .panel, .card { box-shadow: none; break-inside: avoid; }
  .mapping-panel, .import-panel, .source-meta, .table-tools, .table-wrap, .link-button { display: none !important; }
  .model-note { display: block !important; }
  .next-actions-panel, .opportunity-matrix, .qualification-queue { break-inside: avoid; }
}

/* Shared opportunity-engine styles. Keep these outside responsive media queries. */
.model-legend { display:flex; gap:10px; align-items:center; color:var(--primary); font-size:.82rem; font-weight:700; white-space:nowrap; }
.model-legend small { color:var(--muted); font-weight:500; }
.decision-summary { padding:22px; }
.summary-heading { display:flex; justify-content:space-between; align-items:flex-start; gap:18px; margin-bottom:18px; }
.summary-heading h2 { margin:0; font-size:1.35rem; }
.summary-kpis { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; }
.summary-kpi { display:grid; gap:7px; padding:17px 19px; border-radius:14px; border:1px solid var(--border); background:#f7faff; }
.summary-kpi.primary { background:linear-gradient(135deg,var(--primary),#176b9b); color:#fff; }.summary-kpi.success{background:#edf9f2;color:#176b4d}.summary-kpi.warning{background:#fff8eb;color:#9b6500}
.summary-kpi span,.summary-kpi small{font-size:.82rem;opacity:.84}.summary-kpi strong{font-size:2.4rem;line-height:1}.secondary-metrics{display:flex;flex-wrap:wrap;gap:8px 18px;margin-top:16px;color:var(--muted);font-size:.8rem}.secondary-metrics b{color:var(--text);font-size:1rem}
.source-meta{display:flex;flex-wrap:wrap;gap:14px;margin-top:10px;color:var(--muted);font-size:.76rem}.source-meta b{color:var(--text)}
.notice.loading{color:var(--primary)}.notice.success{color:var(--success)}.notice.error{color:var(--danger)}
.empty-state{display:grid;gap:9px;margin-top:14px;padding:18px;border:1px dashed var(--border);border-radius:12px;background:#f7faff;color:var(--muted)}.empty-state strong{color:var(--text)}.empty-state div{display:flex;gap:8px;flex-wrap:wrap}.empty-state.compact{margin-top:0}.empty-state[hidden]{display:none}
.action-badge{display:inline-flex;width:max-content;padding:4px 7px;border-radius:999px;background:#edf1f6;color:var(--muted);font-size:.7rem;font-weight:800}.action-badge.call-today{background:#ffe6e1;color:var(--danger)}.action-badge.qualify-first{background:#fff1c7;color:var(--warning)}.action-badge.pilot-candidate{background:#e7f4ec;color:var(--success)}
.opportunity-matrix{position:relative;height:330px;margin:15px 35px 30px 42px;border-left:1px solid var(--border);border-bottom:1px solid var(--border);background:linear-gradient(90deg,rgba(75,104,148,.04) 50%,rgba(255,183,3,.07) 50%),linear-gradient(0deg,rgba(75,104,148,.04) 50%,rgba(29,155,92,.08) 50%);overflow:hidden}.opportunity-matrix::before,.opportunity-matrix::after{content:"";position:absolute;background:rgba(116,139,170,.35);z-index:0}.opportunity-matrix::before{left:50%;top:0;bottom:0;width:1px}.opportunity-matrix::after{left:0;right:0;top:50%;height:1px}.matrix-axis{position:absolute;color:var(--muted);font-size:.72rem;z-index:1}.matrix-axis.matrix-x{bottom:-24px;left:35%}.matrix-axis.matrix-y{left:-40px;top:42%;transform:rotate(-90deg)}.quadrant{position:absolute;z-index:1;color:var(--muted);font-size:.66rem;font-weight:800;letter-spacing:.04em}.q-tl{left:4%;top:4%}.q-tr{right:4%;top:4%;color:var(--danger)}.q-bl{left:4%;bottom:4%}.q-br{right:4%;bottom:4%;color:var(--warning)}.account-dot{position:absolute;z-index:2;padding:0;border:2px solid white;border-radius:50%;background:#607d9f;box-shadow:0 1px 5px #789;transform:translate(-50%,50%);min-width:10px}.account-dot.Conversion-Pilot{background:#e87942}.account-dot.Category-Creation-Pilot{background:#2a9d70}.account-dot.Strategic-Rollout{background:#7b61a8}.account-dot.Asahi-Incremental-Channel{background:#0b7aaa}.account-dot.Existing-Asahi{background:#8292a6}
.data-badge,.score-cell,.confidence-high,.confidence-medium,.confidence-low,.type-cell,.stage-cell{display:inline-flex;align-items:center;width:max-content;max-width:190px;border-radius:999px;padding:5px 8px;font-size:.72rem;font-weight:700;white-space:nowrap}.score-high{background:#ffe6e1;color:var(--danger)}.score-mid{background:#fff1c7;color:var(--warning)}.type-cell{background:#eaf4ff;color:var(--primary);white-space:normal}.confidence-high{background:#e7f4ec;color:var(--success)}.confidence-medium{background:#fff1c7;color:var(--warning)}.confidence-low{background:#ffe6e1;color:var(--danger)}.qualification-queue{display:grid;gap:9px}.queue-item{display:grid;gap:5px;text-align:left;background:#fff8eb;color:var(--text);border:1px solid #f1dfb0;border-radius:10px;padding:10px 12px}.queue-item small{color:var(--muted);line-height:1.35}
.cuisine-badge{display:inline-flex;align-items:center;width:max-content;max-width:180px;border-radius:999px;padding:4px 7px;background:#eef1f5;color:#42546b;font-size:.7rem;font-weight:700;white-space:normal}.cuisine-high{background:#e7f4ec;color:#176b4d}.cuisine-medium{background:#fff1c7;color:#9b6500}.cuisine-low{background:#edf1f6;color:#5c6b7d}.cuisine-unknown{background:#f1f3f5;color:#7a8795}
.mapping-panel table{min-width:900px}.mapping-panel td,.mapping-panel th{vertical-align:middle}.drawer-score-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:7px;margin:20px 0 12px}.drawer-score-grid div{display:grid;gap:4px;padding:10px 8px;background:var(--primary-soft);border-radius:9px;color:var(--primary)}.drawer-score-grid strong{font-size:1.25rem}
@media (max-width:820px){.summary-kpis{grid-template-columns:1fr}.model-legend{align-self:flex-start;white-space:normal}.opportunity-matrix{height:260px}}@media (max-width:520px){.summary-heading{flex-direction:column}.secondary-metrics{display:grid;grid-template-columns:repeat(2,1fr)}.drawer-score-grid{grid-template-columns:1fr}}

.action-editor{display:grid;gap:3px;min-width:0}
.action-editor span{font-size:.65rem;color:var(--muted)}
.action-editor input,.action-editor select{width:100%;min-width:0;height:32px;padding:5px 7px;border:1px solid var(--border);border-radius:6px;background:#fff;color:var(--text)}
.action-row-buttons{display:flex;gap:5px;flex-wrap:wrap}
.action-save{border:0;border-radius:6px;background:var(--primary);color:#fff;padding:7px 10px;font-weight:700;cursor:pointer}
.link-button{border:1px solid var(--border);border-radius:6px;background:#fff;padding:6px 8px;cursor:pointer}
.danger-link{color:#9b3f3f}
.attention-empty{color:var(--muted);font-size:.85rem}
@media (max-width:520px){.summary-kpis{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* Internal operations workspace refresh. */
:root {
  --bg: #eef1ef;
  --panel: #ffffff;
  --panel-alt: #f5f7f6;
  --primary: #185b45;
  --primary-soft: #e5f0eb;
  --text: #24312c;
  --muted: #718078;
  --border: #dbe3de;
  --shadow: 0 2px 10px rgba(32, 55, 45, .05);
}
body { background: var(--bg); color: var(--text); font-size: 14px; }
.topbar { width:min(100% - 32px, 1480px); padding:22px 8px 12px; }
.topbar h1 { font-size:1.55rem; }
.topbar .eyebrow { color:var(--primary); }
.header-actions { gap:8px; }
.status-pill { padding:7px 11px; background:var(--primary-soft); color:var(--primary); font-size:.75rem; }
.outline-button, .secondary, .file-button { border-radius:7px; border-color:var(--border); background:#fff; color:var(--primary); padding:8px 11px; }
.pill-tabs { display:flex; gap:4px; width:min(100% - 32px,1480px); margin:0 auto 14px; padding:4px; border:1px solid var(--border); border-radius:10px; background:#e6ebe8; }
.pill-tabs a { padding:8px 15px; border-radius:7px; color:var(--muted); text-decoration:none; font-size:.82rem; font-weight:700; }
.pill-tabs a.active, .pill-tabs a:hover { background:var(--primary); color:#fff; }
.layout { width:min(100% - 32px,1480px); gap:14px; padding-bottom:32px; }
.panel { border:1px solid var(--border); border-radius:10px; box-shadow:var(--shadow); padding:18px; }
.hero { background:#fff; }
.hero-copy { line-height:1.55; }
.decision-summary { padding:16px; }
.summary-kpi { border-radius:8px; padding:13px 15px; }
.summary-kpi strong { font-size:2rem; }
.mapping-panel table { min-width:100%; }
.mapping-panel th { background:#f1f5f2; color:#56665e; font-size:.72rem; }
.mapping-panel td, .mapping-panel th { padding:10px 9px; border-bottom:1px solid #edf1ee; }
.table-wrap { border-radius:8px; }
.table-tools { gap:6px; }
.table-tools input, .table-tools select { border:1px solid var(--border); border-radius:6px; padding:8px; background:#fff; }
.cuisine-reason, .cuisine-signals { margin:5px 0; color:var(--muted); font-size:.82rem; }
.empty-state { background:#fffaf0; border-color:#ead7a8; }
.notice.error { padding:10px 12px; border-radius:7px; background:#fff1ef; }
.priority-badge { display:inline-flex; width:max-content; align-items:center; border-radius:999px; padding:4px 8px; font-size:.68rem; font-weight:800; white-space:nowrap; background:#eef1f3; color:#687782; }
.priority-badge.must-attack { background:#185b45; color:#fff; }
.priority-badge.high-priority { background:#dff1e7; color:#176b4d; }
.priority-badge.medium-priority { background:#fff0ce; color:#9b6500; }
.priority-badge.watch { background:#e6edf4; color:#536b7d; }
.priority-badge.not-now { background:#edf0f1; color:#7b8589; }
.cuisine-badge { gap:4px; }
.panel-grid.analytics-grid > .panel { min-width:0; overflow:hidden; }
@media (max-width:520px) {
  .topbar { align-items:flex-start; flex-direction:column; gap:12px; }
  .pill-tabs { overflow-x:auto; white-space:nowrap; }
  .pill-tabs a { flex:0 0 auto; }
}

.attack-controls{display:flex;gap:6px;align-items:center;margin-bottom:10px;flex-wrap:wrap}
.attack-controls button,.attack-controls select{height:34px;border:1px solid var(--border);border-radius:7px;background:#fff;color:var(--text);padding:0 11px;font-weight:700;cursor:pointer}
.attack-controls button.active{background:var(--primary);border-color:var(--primary);color:#fff}
.attack-controls select{min-width:190px}
.action-editor{display:grid;gap:3px;min-width:0}
.action-editor span{font-size:.65rem;color:var(--muted)}
.action-editor input,.action-editor select{width:100%;min-width:0;height:32px;padding:5px 7px;border:1px solid var(--border);border-radius:6px;background:#fff;color:var(--text)}
.system-badge,.attack-state{display:inline-flex;padding:4px 7px;border-radius:999px;background:#edf0f3;color:#5f6f7a;font-size:.7rem;font-weight:800}
.attack-state.is-attack{background:#e3f2e9;color:var(--primary)}
.health-cell{color:#176b4d!important;font-weight:700}
.cuisine-cell{font-size:.75rem!important}
.drawer-save{position:sticky;bottom:0;z-index:2;box-shadow:0 -4px 12px rgba(32,55,45,.08)}

/* Stable drawer controls: keep native select text vertically centered and readable. */
.drawer {
  width: min(600px, 94vw);
  box-sizing: border-box;
  padding: 28px 24px 92px;
  overflow-x: hidden;
}
.drawer h3 {
  margin: 22px 0 10px;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f5f7f6;
  font-size: .88rem;
  color: var(--primary);
}
.drawer-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fbfcfb;
}
.drawer-form label {
  min-width: 0;
  gap: 5px;
  font-size: 12px;
  line-height: 1.25;
  color: var(--muted);
}
.drawer-form input,
.drawer-form select,
.drawer-form textarea {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  height: 38px;
  box-sizing: border-box;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  line-height: 1.25;
}
.drawer-form textarea {
  height: 72px;
  padding: 9px 10px;
  resize: vertical;
}
.drawer-form label:has(textarea) {
  grid-column: 1 / -1;
}
.drawer-save {
  position: sticky;
  bottom: -1px;
  z-index: 3;
  min-height: 44px;
  margin: 16px -12px -12px;
  width: calc(100% + 24px);
}
@media (max-width: 520px) {
  .drawer {
    width: 100vw;
    padding: 24px 14px 86px;
  }
  .drawer-form {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px;
  }
  .drawer-form label:has(textarea) {
    grid-column: auto;
  }
}

/* Attack list table rebuild: header + rows share one grid definition */
:root {
  --attack-grid-columns:
    minmax(180px, 1.3fr)
    minmax(140px, 0.9fr)
    minmax(110px, 0.75fr)
    minmax(140px, 1fr)
    minmax(180px, 1.2fr)
    minmax(130px, 0.9fr)
    minmax(135px, 0.9fr)
    minmax(150px, 1fr)
    minmax(220px, 1.5fr)
    minmax(220px, 1.5fr)
    minmax(150px, 0.9fr);
}
.attack-table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.next-actions,
.next-actions-panel {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
.action-table {
  display: block;
  min-width: 1680px;
  max-width: none;
  border: 0;
  border-radius: 0;
  overflow: visible;
}
.action-table-header,
.next-action-card {
  display: grid;
  grid-template-columns: var(--attack-grid-columns);
  gap: 10px;
  align-items: center;
  width: 100%;
  min-width: 0;
}
.action-table-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f1f5f2;
  border-bottom: 1px solid var(--border);
}
.action-table-header .action-table-head {
  padding: 9px 11px;
  font-size: .72rem;
  font-weight: 800;
  color: var(--muted);
  white-space: nowrap;
}
.next-action-card {
  border-top: 1px solid var(--border);
  padding: 11px;
  background: #fff;
  color: var(--text);
  text-align: left;
}
.next-action-card:hover {
  background: #f7faf8;
  transform: none;
}
.next-action-card.recommendation-row {
  background: #fbfdfb;
}
.action-table-empty-row {
  padding: 30px 16px;
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
  background: #fff;
}
.action-cell,
.action-editor {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.action-cell .cell-label,
.action-editor .cell-label {
  display: none;
}
.action-cell strong,
.action-cell span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: .82rem;
  line-height: 1.35;
}
.action-cell .name-cell {
  color: var(--text);
  font-weight: 700;
}
.action-cell .health-cell {
  color: #176b4d;
  font-weight: 700;
}
.action-cell .system-badge {
  display: inline-flex;
  width: fit-content;
  padding: 3px 8px;
  border-radius: 999px;
  background: #edf0f3;
  color: #5f6f7a;
  font-size: .68rem;
  font-weight: 800;
  white-space: nowrap;
}
.action-editor select,
.action-editor input {
  width: 100%;
  min-width: 0;
  height: 32px;
  padding: 5px 7px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font-size: .8rem;
}
.action-row-buttons-cell {
  align-items: flex-start;
}
.action-row-buttons {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

@media (max-width: 768px) {
  .attack-table-wrap {
    border: 0;
    overflow: visible;
  }
  .action-table {
    min-width: 0;
  }
  .action-table-header {
    display: none;
  }
  .next-action-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    grid-template-columns: none;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
    padding: 12px;
  }
  .health-segment-cell-wrap,
  .cuisine-cell-wrap {
    display: none;
  }
  .action-cell,
  .action-editor {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
  }
  .action-cell .cell-label,
  .action-editor .cell-label {
    display: inline-block;
    flex: 0 0 auto;
    font-size: .68rem;
    color: var(--muted);
    font-weight: 700;
    white-space: nowrap;
  }
  .action-cell strong,
  .action-cell span {
    white-space: normal;
    text-align: right;
  }
  .action-editor select,
  .action-editor input {
    width: auto;
    max-width: 62%;
  }
  .action-row-buttons-cell {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .action-row-buttons-cell .cell-label {
    display: none;
  }
  .action-row-buttons {
    justify-content: flex-end;
  }
}

/* Daily sync UI */
.source-settings {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #f5f7f6;
  font-size: .82rem;
  color: var(--muted);
}
.source-settings b {
  color: var(--text);
}
.source-settings code {
  word-break: break-all;
  color: var(--primary);
}
.sync-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 10px;
  color: var(--muted);
  font-size: .78rem;
}
.sync-meta b {
  color: var(--text);
}
@media (max-width: 520px) {
  .sync-meta {
    gap: 6px 12px;
  }
}

/* CEO Attention tiers */
.attention-group {
  margin-top: 10px;
}
.attention-group:first-child {
  margin-top: 0;
}
.attention-group-title {
  margin: 0 0 6px;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .02em;
}
.attention-group.high .attention-group-title { color: #a4302f; }
.attention-group.medium .attention-group-title { color: #9b6500; }
.attention-group.low .attention-group-title { color: #536b7d; }

/* CEO Attention panel: legible text on light backgrounds (v13) */
.ceo-attention-panel {
  margin-top: 16px;
  padding: 14px;
  background: #fff8e8;
  border: 1px solid #ead7a8;
  border-radius: 10px;
}
.ceo-attention-panel h3 {
  margin: 0 0 10px;
  color: #8a5a12;
  font-size: .92rem;
}
.attention-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-top: 6px;
  padding: 9px 11px;
  background: #fffaf0;
  color: #26332d;
  border: 1px solid #efdcae;
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  font-weight: 400;
}
.attention-group .attention-item:first-of-type { margin-top: 0; }
.attention-item strong {
  color: #22332b;
  font-weight: 700;
}
.attention-item span {
  color: #8a5a12;
  font-size: .78rem;
  text-align: right;
}
@media (max-width: 520px) {
  .attention-item { display: grid; gap: 3px; }
  .attention-item span { text-align: left; }
}

/* Health channel pipeline: compact steps instead of large gradient blocks (v13) */
.health-pipeline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 2px 0 4px;
}
.pipeline-step {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1 1 128px;
  min-width: 118px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  font-weight: 400;
}
.pipeline-step b {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}
.pipeline-step .pipeline-label {
  display: block;
  margin-top: 2px;
  font-size: .68rem;
  font-weight: 600;
  color: var(--muted);
  white-space: normal;
}
.pipeline-step .pipeline-rate {
  margin-left: auto;
  flex: 0 0 auto;
  font-size: .66rem;
  font-weight: 700;
  color: #176b4d;
  background: #e7f4ec;
  padding: 3px 7px;
  border-radius: 999px;
  white-space: nowrap;
}
@media (max-width: 520px) {
  .pipeline-step { flex: 1 1 45%; }
}

/* Primary vs. advanced analytics layout (v13) */
.analytics-primary { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
.advanced-analytics { margin-top: 16px; }
.advanced-analytics summary {
  cursor: pointer;
  font-weight: 700;
  color: var(--primary);
  padding: 4px 0;
  list-style: none;
}
.advanced-analytics summary::-webkit-details-marker { display: none; }
.advanced-analytics summary::before { content: "▸ "; }
.advanced-analytics[open] summary::before { content: "▾ "; }
.advanced-analytics .panel-grid { margin-top: 12px; }
.advanced-analytics .panel-sub { padding: 14px; }
.advanced-analytics .panel-sub .subtext { margin: 6px 0 0; font-size: .76rem; }
.opportunity-matrix.compact { height: 220px; margin: 12px 24px 26px 36px; }
.analytics-empty { margin-top: 16px; }

/* Data gap queue: actionable rows (v13) */
.queue-item.queue-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.2fr) minmax(0, 1.6fr) auto;
  align-items: center;
  gap: 10px;
  cursor: default;
}
.queue-item.queue-row .queue-main { display: grid; gap: 3px; min-width: 0; }
.queue-item.queue-row .queue-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.queue-item.queue-row .queue-actions button {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--primary);
  padding: 6px 9px;
  font-size: .74rem;
  font-weight: 700;
}
@media (max-width: 700px) {
  .queue-item.queue-row { grid-template-columns: 1fr; }
  .queue-item.queue-row .queue-actions { justify-content: flex-start; }
}
