:root {
  --bg: #eef8f5;
  --surface: #ffffff;
  --soft: #edf8f4;
  --text: #0a1814;
  --muted: #53645f;
  --line: #cce3dc;
  --accent: #00a982;
  --accent-dark: #06775f;
  --danger: #c2413b;
  --shadow: 0 18px 48px rgba(21, 72, 62, 0.12);
}

:root[data-theme="dark"] {
  --bg: #071426;
  --surface: #0f2036;
  --soft: #122a43;
  --text: #f2fbff;
  --muted: #b8c7d8;
  --line: #29425d;
  --accent: #32d1c3;
  --accent-dark: #8af6d2;
  --shadow: 0 20px 54px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 0%, rgba(0, 169, 130, 0.16), transparent 30%),
    linear-gradient(180deg, var(--bg), #08111f);
  color: var(--text);
  font-family: "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body[data-page="login"] { display: grid; place-items: center; padding: 28px 14px; }
a { color: inherit; }
[hidden] { display: none !important; }

.mf-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.mf-nav {
  width: min(1180px, calc(100% - 32px));
  min-height: 74px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
  overflow-x: auto;
}
.mf-logo {
  margin-right: auto;
  color: var(--accent);
  font-size: 24px;
  font-weight: 950;
  text-decoration: none;
  white-space: nowrap;
}
.mf-nav a,
.mf-nav button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 14px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.mf-nav a.is-active {
  color: var(--accent-dark);
  background: rgba(0, 169, 130, 0.12);
  border-radius: 999px;
  padding: 11px 15px;
}
#userLabel { color: var(--muted); font-size: 13px; font-weight: 800; white-space: nowrap; }
#themeToggle {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 14px;
  color: var(--text);
}

.mf-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 30px 0 90px;
}
body[data-page="dashboard"] .mf-shell {
  min-height: calc(100vh - 74px);
  padding: 16px 0;
  display: grid;
  grid-template-rows: minmax(250px, 1.25fr) minmax(140px, .72fr) minmax(140px, .72fr);
  gap: 14px;
}
.mf-card,
.mf-auth,
.mf-program,
.mf-ai-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.mf-card { padding: clamp(22px, 3vw, 34px); margin-bottom: 22px; }
body[data-page="dashboard"] .mf-card { margin-bottom: 0; }
.mf-auth { width: min(100%, 540px); padding: 32px; }
.mf-auth-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding: 14px 0 0;
  color: var(--muted);
  font-weight: 800;
}
.mf-register-panel {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.24s ease, transform 0.24s ease;
}
.mf-register-panel.is-visible {
  opacity: 1;
  transform: translateY(0);
}
.mf-eyebrow {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: .18em;
  text-transform: uppercase;
}
h1, h2, h3, p { word-break: keep-all; }
h1 { margin: 10px 0 12px; font-size: clamp(34px, 5.8vw, 68px); line-height: 1.08; letter-spacing: -0.04em; }
h2 { margin: 0 0 16px; font-size: 25px; line-height: 1.25; }
h3 { margin: 0; }
p { color: var(--muted); line-height: 1.75; }

.mf-hero {
  padding: clamp(28px, 4.2vw, 50px);
  background: linear-gradient(135deg, #f7fffb, #e6fbf5 60%, #ffffff);
}
body[data-page="dashboard"] .mf-hero h1 { font-size: clamp(34px, 4.6vw, 58px); }
body[data-page="dashboard"] .mf-hero p { max-width: 760px; margin: 0 0 18px; }
body[data-page="dashboard"] .mf-grid {
  margin: 0;
}
body[data-page="dashboard"] .mf-grid .mf-card {
  padding: clamp(20px, 2.2vw, 28px);
  min-height: 0;
}
body[data-page="dashboard"] .mf-grid .mf-card h2 {
  margin-bottom: 10px;
  font-size: clamp(22px, 2.2vw, 28px);
}
body[data-page="dashboard"] .mf-grid .mf-card p {
  margin: 0;
  line-height: 1.62;
}
body[data-page="dashboard"] .mf-ad-slot {
  position: relative;
  overflow: hidden;
  color: #fff;
  background-color: transparent;
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  box-shadow: var(--shadow);
  text-decoration: none;
  isolation: isolate;
}
body[data-page="dashboard"] .mf-ad-slot__content {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: clamp(8px, 1.2vw, 14px);
  text-shadow: 0 2px 14px rgba(0, 0, 0, .5), 0 1px 2px rgba(0, 0, 0, .45);
}
body[data-page="dashboard"] .mf-hero.mf-ad-slot .mf-ad-slot__content {
  min-height: 260px;
  justify-content: center;
}
body[data-page="dashboard"] .mf-grid .mf-card.mf-ad-slot .mf-ad-slot__content {
  min-height: 136px;
}
body[data-page="dashboard"] .mf-ad-slot__content span,
.mf-ad-card__content span {
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, .52);
}
body[data-page="dashboard"] .mf-ad-slot__content strong {
  display: block;
  color: #fff;
  font-size: clamp(24px, 3vw, 42px);
  font-weight: 950;
  line-height: 1.18;
  letter-spacing: -0.025em;
  word-break: keep-all;
}
body[data-page="dashboard"] .mf-grid .mf-card.mf-ad-slot .mf-ad-slot__content strong {
  font-size: clamp(18px, 1.65vw, 25px);
  line-height: 1.26;
}
body[data-page="dashboard"] .mf-ad-slot__content p {
  max-width: 620px;
  margin: 14px 0 0;
  color: rgba(255, 255, 255, .96);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.65;
}
body[data-page="dashboard"] .mf-grid .mf-card.mf-ad-slot .mf-ad-slot__content p {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.55;
}
.mf-ad-fade {
  animation: mfAdFade 7.2s ease-in-out infinite;
}
@keyframes mfAdFade {
  0% {
    opacity: 0;
    transform: translateY(6px);
  }
  18%, 56% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-4px);
  }
}
:root[data-theme="dark"] .mf-hero { background: linear-gradient(135deg, #10243d, #0f2036); }
.mf-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.mf-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.mf-profile-split.is-active {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.mf-profile-summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.mf-profile-summary .mf-info {
  min-height: auto;
  padding: 13px 14px;
}
.mf-profile-summary .mf-info strong {
  font-size: 12px;
}
.mf-profile-summary .mf-info span {
  font-size: 14px;
}
.mf-keyword-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}
.mf-keyword-chips button {
  min-height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent-dark);
  border-color: var(--line);
  font-size: 12px;
}
.mf-keyword-chips button.is-selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.mf-pricing-hero {
  text-align: center;
  background:
    radial-gradient(circle at 50% 0%, rgba(0, 169, 130, .18), transparent 34%),
    linear-gradient(135deg, var(--surface), var(--soft));
}

.mf-pricing-hero h1 {
  font-size: clamp(34px, 4.6vw, 56px);
}

.mf-plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

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

.mf-plan-card {
  display: flex;
  flex-direction: column;
  min-height: 540px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.mf-plan-card--premium {
  color: #fff;
  background:
    radial-gradient(circle at 88% 0%, rgba(255, 255, 255, .22), transparent 26%),
    linear-gradient(145deg, #163936, #00a982);
  border-color: rgba(255, 255, 255, .26);
}

.mf-plan-card--premium p,
.mf-plan-card--premium .mf-eyebrow {
  color: rgba(255, 255, 255, .82);
}

.mf-price {
  margin: 10px 0 16px;
  color: var(--text);
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1;
  font-weight: 950;
  letter-spacing: -0.03em;
}

.mf-plan-card--premium .mf-price,
.mf-plan-card--premium h2,
.mf-plan-card--premium .mf-plan-list li {
  color: #fff;
}

.mf-price small {
  font-size: 14px;
  font-weight: 850;
}

.mf-plan-list {
  display: grid;
  gap: 12px;
  margin: 18px 0;
  padding: 0;
  list-style: none;
}

.mf-plan-list li {
  position: relative;
  padding-left: 24px;
  color: var(--text);
  font-weight: 850;
  line-height: 1.45;
}

.mf-plan-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .38em;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(0, 169, 130, .12);
}

.mf-plan-card--premium .mf-plan-list li::before {
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .18);
}

.mf-document-result {
  display: grid;
  gap: 10px;
}
.mf-inline-ai-btn {
  width: fit-content;
  margin-top: 10px;
}
.mf-doc-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(3, 14, 18, .42);
}
.mf-doc-modal.is-open { display: flex; }
.mf-doc-modal__inner {
  width: min(920px, 100%);
  max-height: min(820px, calc(100vh - 36px));
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
}
.mf-doc-modal__head,
.mf-doc-modal__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.mf-doc-modal__actions {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}
.mf-doc-modal__body {
  overflow: auto;
  padding: 18px;
  background: var(--soft);
}
.mf-doc-section {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: start;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}
.mf-doc-section h3 { margin: 0 0 10px; font-size: 18px; }
.mf-doc-section pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: keep-all;
  font: inherit;
  line-height: 1.7;
}
.mf-premium-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  margin-top: 10px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
  text-decoration: none;
}

.mf-bank-box {
  margin-top: 20px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--soft);
}

.mf-bank-box strong {
  display: block;
  margin: 10px 0;
  color: var(--text);
  font-size: 20px;
  line-height: 1.45;
}

.mf-premium-survey {
  max-width: 920px;
  margin-inline: auto;
}

.mf-ad-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 22px;
}
.mf-ad-card {
  position: relative;
  display: block;
  min-height: 160px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(135deg, #0f766e, #155e75);
  color: #fff;
  text-decoration: none;
  box-shadow: var(--shadow);
  isolation: isolate;
  transform: translateZ(0);
}
.mf-ad-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background: var(--ad-image, linear-gradient(135deg, #0f766e, #38bdf8)) center / cover no-repeat;
  transition: transform .28s ease;
}
.mf-ad-card::after {
  content: none;
  position: absolute;
  inset: 0;
  z-index: -1;
  background: none;
}
.mf-ad-card:hover::before { transform: scale(1.04); }
.mf-ad-card__content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 20px;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .54), 0 1px 2px rgba(0, 0, 0, .48);
}
.mf-ad-card__content span {
  display: inline-flex;
  margin-bottom: 10px;
  color: #fff;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: .18em;
  text-transform: uppercase;
}
.mf-ad-card__content strong {
  display: block;
  color: #fff;
  font-size: clamp(17px, 1.55vw, 23px);
  line-height: 1.3;
  word-break: keep-all;
}
.mf-ad-card__content p {
  margin: 8px 0 0;
  color: rgba(255,255,255,.96);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.55;
}
.mf-ad-admin {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
.mf-ad-admin__slot {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--soft);
}
.mf-ad-admin__slot h3 { font-size: 16px; }
.mf-ad-admin__slot input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 750;
}
.mf-ad-admin__slot textarea {
  width: 100%;
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  resize: vertical;
}
.mf-help {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.mf-readiness-list {
  display: grid;
  gap: 12px;
}

.mf-readiness-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--soft);
}

.mf-readiness-item strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
  font-size: 15px;
  font-weight: 950;
}

.mf-readiness-item p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
}

.mf-readiness-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 86px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 950;
}

.mf-readiness-status.is-ok {
  background: rgba(0, 169, 130, 0.16);
  color: var(--accent-dark);
}

.mf-readiness-status.is-check {
  background: rgba(245, 158, 11, 0.16);
  color: #a15b00;
}

.mf-readiness-status.is-needed {
  background: rgba(239, 68, 68, 0.12);
  color: #b42318;
}

.mf-readiness-control {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.mf-readiness-action {
  min-height: 34px;
  padding: 0 12px;
  border-color: var(--line);
  background: var(--surface);
  color: var(--accent-dark);
  font-size: 12px;
}

.mf-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.mf-actions-center { justify-content: center; }
.mf-btn,
button,
.mf-program-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--accent-dark);
  border-radius: 999px;
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease, border-color .15s ease, color .15s ease;
}
.mf-btn:hover,
button:hover,
.mf-program-actions a:hover {
  transform: translateY(-1px);
}
.mf-nav button {
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  padding: 8px 10px;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}
.mf-nav button:hover {
  transform: none;
  color: var(--accent-dark);
}
#themeToggle {
  border: 1px solid var(--line);
  padding: 10px 14px;
  color: var(--text);
}
.mf-btn.is-ghost,
.mf-program-actions button {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}

.mf-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 70%, var(--soft));
}
.mf-tabs button {
  background: var(--soft);
  border-color: transparent;
  color: var(--muted);
  min-height: 40px;
  padding: 0 16px;
}
.mf-tabs button.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.mf-type-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.mf-type-tabs button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  box-shadow: none;
}
.mf-type-tabs button.is-active {
  background: var(--accent);
  border-color: var(--accent-dark);
  color: #fff;
}
[data-tab-panel] { display: none; }
[data-tab-panel].is-active { display: block; }
[data-tab-panel].mf-profile-split.is-active {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.mf-form { display: grid; gap: 16px; }
.mf-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.mf-input-action {
  display: flex;
  gap: 8px;
  align-items: center;
}
.mf-input-action input { flex: 1 1 auto; min-width: 0; }
.mf-input-action .mf-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}
.mf-actions input[type="search"] {
  flex: 1 1 420px;
  min-width: min(100%, 320px);
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 750;
}
.mf-field { display: grid; gap: 8px; }
.mf-field:has(.mf-keyword-chips) {
  align-self: start;
}
.mf-field label,
.mf-check { color: var(--text); font-weight: 900; }
.mf-field input,
.mf-field select,
.mf-field textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  background: var(--soft);
  color: var(--text);
  font: inherit;
  font-weight: 750;
}
.mf-field textarea { min-height: 116px; resize: vertical; }
.mf-status { margin-top: 12px; color: var(--accent-dark); font-weight: 900; white-space: pre-line; }
.mf-status.is-error { color: var(--danger); }
.mf-db-count {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 34px;
  margin: 14px 0 0;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 950;
}
.mf-db-count strong { color: var(--text); }
.mf-db-count span { color: var(--muted); }
.mf-divider { height: 1px; background: var(--line); margin: 26px 0; }
.mf-field.is-attention {
  animation: mfFieldAttention 1.05s ease-in-out 2;
}

@keyframes mfFieldAttention {
  0%, 100% {
    border-radius: 16px;
    box-shadow: 0 0 0 0 rgba(0, 169, 130, 0);
  }
  35% {
    border-radius: 16px;
    box-shadow: 0 0 0 5px rgba(0, 169, 130, 0.18), 0 0 0 1px var(--accent);
  }
  70% {
    border-radius: 16px;
    box-shadow: 0 0 0 9px rgba(0, 169, 130, 0.08);
  }
}

.mf-info {
  min-height: 78px;
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--soft);
}
.mf-info strong { color: var(--accent-dark); font-size: 13px; }
.mf-info span { color: var(--text); font-weight: 850; line-height: 1.5; }

.mf-program-list { display: grid; gap: 14px; margin-top: 18px; }
.mf-program {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: center;
  padding: 22px;
}
.mf-program-meta { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--accent-dark); font-size: 13px; font-weight: 950; }
.mf-program-meta-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.mf-deadline {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--accent-dark);
  border: 1px solid var(--line);
}
.mf-program h3 { margin: 8px 0; font-size: 19px; }
.mf-program p { margin: 0; }
.mf-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.mf-badges span,
.mf-score {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  background: rgba(0, 169, 130, 0.12);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 950;
}
.mf-score { min-height: 34px; padding: 0 14px; }
.mf-score.is-high { background: rgba(0, 169, 130, 0.18); }
.mf-score.is-mid { background: rgba(245, 158, 11, 0.16); color: #a15b00; }
.mf-score.is-low { background: rgba(239, 68, 68, 0.12); color: #b42318; }
.mf-scorebar {
  width: 100%;
  height: 8px;
  margin: 12px 0 10px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--line) 70%, transparent);
}
.mf-scorebar span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-dark));
}
.mf-program-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; min-width: 230px; }
.mf-program-actions a,
.mf-program-actions button {
  min-width: 108px;
}

.mf-admin-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--soft);
  margin-bottom: 10px;
}
.mf-admin-row p { margin: 8px 0 0; }
.mf-admin-row span { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; font-weight: 800; }
.mf-list { display: grid; gap: 10px; margin-top: 18px; }
.mf-row-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

.mf-ai-open {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  box-shadow: var(--shadow);
}
.mf-ai-panel {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 60;
  width: min(760px, calc(100% - 28px));
  max-height: min(720px, calc(100vh - 28px));
  transform: translate(-50%, -50%) scale(.96);
  opacity: 0;
  pointer-events: none;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  transition: opacity .18s ease, transform .18s ease;
}
.mf-ai-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}
.mf-ai-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.mf-ai-messages { min-height: 280px; overflow: auto; padding: 18px; background: var(--soft); }
.mf-ai-message { max-width: 86%; margin-bottom: 12px; padding: 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.mf-ai-message--user { margin-left: auto; background: var(--accent); color: #fff; }
.mf-ai-message--user p, .mf-ai-message--user strong { color: #fff; }
.mf-ai-message p { margin: 6px 0 0; color: inherit; white-space: pre-line; }
.mf-ai-message.is-thinking p::after {
  content: "";
  display: inline-block;
  min-width: 1.2em;
  animation: mfThinkingDots 1.2s steps(4, end) infinite;
}
.mf-ai-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 14px; border-top: 1px solid var(--line); }
.mf-ai-form textarea { min-height: 72px; resize: vertical; border: 1px solid var(--line); border-radius: 14px; padding: 12px; font: inherit; }
.mf-ai-form button {
  width: 48px;
  height: 48px;
  align-self: end;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
}
.mf-ai-form button[data-state="stop"] {
  background: #111827;
  color: #fff;
}
.mf-ai-profile-proposal {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 86%, var(--accent) 14%);
}
.mf-ai-profile-proposal > strong {
  display: block;
  margin-bottom: 10px;
}
.mf-ai-profile-proposal table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 12px;
  overflow: hidden;
  border-radius: 10px;
  font-size: 13px;
}
.mf-ai-profile-proposal th,
.mf-ai-profile-proposal td {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.mf-ai-profile-proposal th {
  color: var(--accent-dark);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
.mf-ai-profile-proposal .mf-btn {
  min-height: 42px;
  padding: 0 16px;
}
@keyframes mfThinkingDots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75%, 100% { content: "..."; }
}

@media (max-width: 760px) {
  .mf-grid,
  .mf-ad-grid,
  .mf-ad-admin,
  .mf-plan-grid,
  .mf-profile-split.is-active,
  [data-tab-panel].mf-profile-split.is-active,
  .mf-grid-2,
  .mf-form-grid,
  .mf-program {
    grid-template-columns: 1fr;
  }
  .mf-program-actions { justify-content: flex-start; }
  .mf-program-actions { min-width: 0; }
  .mf-program-meta,
  .mf-program-meta-right,
  .mf-input-action {
    align-items: stretch;
    flex-direction: column;
  }
  .mf-input-action .mf-btn { width: 100%; }
  .mf-admin-row { flex-direction: column; }
  .mf-row-actions { justify-content: flex-start; }
  .mf-readiness-item { grid-template-columns: 1fr; }
  .mf-readiness-control { justify-content: flex-start; }
}
