:root {
  --navy: #0f172a;
  --blue: #2563eb;
  --blue-pale: #eff6ff;
  --emerald: #059669;
  --emerald-pale: #ecfdf5;
  --amber: #d97706;
  --rose: #e11d48;
  --bg: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --radius: 16px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--navy); line-height: 1.65;
  font-family: "Inter", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
}
.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

.top-bar { background: linear-gradient(135deg, #0f172a, #1e3a8a); color: #fff; padding: 28px 0; }
.pill-tag { display: inline-block; background: rgba(255,255,255,.16); padding: 3px 12px; border-radius: 999px; font-size: .76rem; font-weight: 700; }
.top-bar h1 { margin: 6px 0; font-size: 1.85rem; }
.sub-lead { margin: 0; font-size: .9rem; color: #cbd5e1; }
.pr-badge { display: inline-block; font-size: .68rem; background: rgba(255,255,255,.2); padding: 1px 7px; border-radius: 4px; margin-left: 6px; }

.main-grid {
  display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 24px;
  padding: 28px 20px 60px; align-items: start;
}

.panel-card, .dashboard-card, .prescription-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: 0 4px 16px rgba(15, 23, 42, .05);
}
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.panel-head h2 { margin: 0; font-size: 1.2rem; }
.btn-outline { background: #fff; border: 1px solid #cbd5e1; border-radius: 8px; padding: 6px 12px; font-size: .8rem; font-weight: 700; cursor: pointer; }
.hint-text { font-size: .82rem; color: #64748b; margin: 6px 0 18px; }

.cat-block { margin-bottom: 20px; }
.cat-title { font-size: .95rem; font-weight: 800; margin: 0 0 10px; display: flex; align-items: center; gap: 6px; color: #334155; }
.sub-items-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.sub-item-label {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  border: 2px solid var(--border); border-radius: 12px; padding: 10px 12px;
  cursor: pointer; transition: .15s; background: #f8fafc; user-select: none;
}
.sub-item-label:hover { border-color: #93c5fd; }
.sub-item-label.checked { border-color: var(--blue); background: var(--blue-pale); }
.sub-left { display: flex; align-items: center; gap: 8px; font-size: .88rem; font-weight: 700; }
.sub-price { font-size: .82rem; font-weight: 800; color: #475569; white-space: nowrap; }

.custom-add-box { margin-top: 22px; background: #f8fafc; border-radius: 12px; padding: 16px; border: 1px dashed #cbd5e1; }
.custom-add-box h3 { margin: 0 0 10px; font-size: .92rem; }
.custom-row { display: flex; gap: 8px; flex-wrap: wrap; }
.custom-row input { flex: 1; min-width: 120px; padding: 9px 12px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: .9rem; }
.btn-add { background: var(--blue); color: #fff; border: none; border-radius: 8px; padding: 9px 16px; font-weight: 700; cursor: pointer; }

/* Dashboard */
.sticky-col { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 20px; }
.dash-label { font-size: .82rem; font-weight: 700; color: #64748b; }
.monthly-big { font-size: 2.5rem; font-weight: 900; color: var(--blue); margin: 4px 0 14px; line-height: 1.1; }
.monthly-big small { font-size: 1rem; color: #475569; font-weight: 700; }

.term-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.term-box { background: #f8fafc; border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; }
.term-box.warn { background: #fffbeb; border-color: #fde68a; }
.term-box.danger { background: #fff1f2; border-color: #fecdd3; }
.term-box.invest { background: var(--emerald-pale); border-color: #a7f3d0; }
.term-title { font-size: .74rem; font-weight: 700; color: #64748b; }
.term-box strong { font-size: 1.15rem; margin-top: 2px; }
.term-box.danger strong { color: var(--rose); }
.term-box.invest strong { color: var(--emerald); }

.breakdown-area { margin: 16px 0; }
.breakdown-title { font-size: .8rem; font-weight: 700; color: #64748b; }
.stacked-bar { height: 14px; background: #e2e8f0; border-radius: 999px; overflow: hidden; display: flex; margin: 6px 0 8px; }
.bar-seg { height: 100%; transition: width .25s; }
.bar-legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: .75rem; color: #475569; }
.legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 4px; }

.btn-share-x { width: 100%; background: #0f172a; color: #fff; border: none; border-radius: 999px; padding: 11px; font-weight: 800; cursor: pointer; font-size: .88rem; }

/* Prescription & Affiliate Cards */
.prescription-card h3 { margin: 0 0 10px; font-size: 1.08rem; }
.saving-banner {
  background: var(--emerald-pale); border: 2px solid #34d399; color: #065f46;
  border-radius: 12px; padding: 10px 14px; font-size: .9rem; font-weight: 700; margin-bottom: 14px; text-align: center;
}
.saving-banner strong { font-size: 1.3rem; color: var(--emerald); }

.rec-stack { display: flex; flex-direction: column; gap: 12px; }
.rec-item { border: 2px solid var(--border); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 6px; background: #fff; }
.rec-item.alert-dup { border-color: #fbbf24; background: #fffbeb; }
.rec-badge { align-self: flex-start; background: #dbeafe; color: #1d4ed8; font-size: .72rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; }
.rec-item.alert-dup .rec-badge { background: #fef3c7; color: #b45309; }
.rec-item strong { font-size: .96rem; }
.rec-item p { margin: 0; font-size: .83rem; color: #475569; }
.rec-cta {
  display: block; text-align: center; background: var(--emerald); color: #fff; text-decoration: none;
  font-weight: 800; font-size: .85rem; padding: 9px; border-radius: 10px; margin-top: 4px;
}

.site-footer { text-align: center; font-size: .76rem; color: #64748b; padding: 24px 0 40px; }

@media (max-width: 860px) {
  .main-grid { grid-template-columns: 1fr; }
  .sticky-col { position: static; }
}
