@import url("https://fonts.googleapis.com/css2?family=Sora:wght@500;600;700&family=Manrope:wght@400;500;600;700&display=swap");

:root {
  --md-ink: #0f1c2e;
  --md-muted: #5b6b7c;
  --md-paper: #eef3f8;
  --md-panel: #ffffff;
  --md-line: #d5dee8;
  --md-accent: #0f766e;
  --md-accent-deep: #0b5f59;
  --md-accent-soft: rgba(15, 118, 110, 0.12);
  --md-hot: #c2410c;
  --md-hot-soft: rgba(194, 65, 12, 0.12);
  --md-sky: #0284c7;
  --md-violet: #5b6ee1;
  --md-amber: #b45309;
  --md-rose: #be123c;
  --md-font-display: "Sora", "Segoe UI", sans-serif;
  --md-font-body: "Manrope", "Segoe UI", system-ui, sans-serif;
  --md-radius: 18px;
  --md-shadow: 0 14px 36px rgba(15, 28, 46, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
}

.md-body {
  font-family: var(--md-font-body);
  color: var(--md-ink);
  background:
    radial-gradient(900px 480px at 8% -8%, rgba(15, 118, 110, 0.16), transparent 55%),
    radial-gradient(700px 420px at 100% 0%, rgba(2, 132, 199, 0.12), transparent 50%),
    linear-gradient(165deg, #e7eef6 0%, var(--md-paper) 45%, #e8edf4 100%);
  background-attachment: fixed;
}

.md-main {
  min-height: calc(100vh - 64px);
}

.md-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(14px);
  background: rgba(255, 255, 255, 0.82);
  border-bottom: 1px solid rgba(213, 222, 232, 0.9);
}

.md-topbar-inner {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0.85rem clamp(1rem, 2.5vw, 2.5rem);
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.md-brand {
  font-family: var(--md-font-display);
  font-weight: 700;
  font-size: 1.28rem;
  color: var(--md-accent-deep);
  text-decoration: none;
  letter-spacing: -0.03em;
}

.md-nav {
  display: flex;
  gap: 0.35rem;
  flex: 1;
}

.md-nav a {
  color: var(--md-muted);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  transition: background 0.2s ease, color 0.2s ease;
}

.md-nav a:hover {
  color: var(--md-accent-deep);
  background: var(--md-accent-soft);
}

.md-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.88rem;
  color: var(--md-muted);
}

.md-link-btn {
  border: 0;
  background: transparent;
  color: var(--md-accent);
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.md-page {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 1.5rem clamp(1rem, 2.5vw, 2.5rem) 3rem;
  box-sizing: border-box;
}

.md-body:not(.md-login-page) {
  overflow-x: clip;
}

.md-dash-head h1,
.md-tool-page h1,
.md-page h1 {
  font-family: var(--md-font-display);
  font-size: clamp(1.75rem, 3vw, 2.35rem);
  margin: 0.25rem 0 0.5rem;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.md-name {
  color: var(--md-accent-deep);
}

.md-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--md-accent);
  margin: 0;
}

.md-lead {
  color: var(--md-muted);
  max-width: 42rem;
  margin: 0 0 1.5rem;
  line-height: 1.55;
}

.md-section-title {
  font-family: var(--md-font-display);
  font-size: 1.15rem;
  margin: 1.75rem 0 0.85rem;
  letter-spacing: -0.02em;
}

/* Stats */
.md-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.md-stat {
  background: var(--md-panel);
  border: 1px solid var(--md-line);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  box-shadow: 0 6px 18px rgba(15, 28, 46, 0.04);
}

.md-stat-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--md-muted);
  margin-bottom: 0.25rem;
}

.md-stat-value {
  font-family: var(--md-font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--md-ink);
}

.md-stat-value.is-on { color: var(--md-accent); }
.md-stat-value.is-off { color: var(--md-hot); }
.md-stat-time { font-size: 1rem; }

/* Hot strip */
.md-hot-strip {
  margin-bottom: 1.75rem;
}

.md-hot-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.md-hot-head h2 {
  font-family: var(--md-font-display);
  font-size: 1.05rem;
  margin: 0;
}

.md-hot-head a {
  color: var(--md-accent);
  font-weight: 700;
  text-decoration: none;
  font-size: 0.9rem;
}

.md-hot-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.md-hot-card {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  text-decoration: none;
  color: inherit;
  background: linear-gradient(160deg, #fff 0%, #f3f8fb 100%);
  border: 1px solid var(--md-line);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  min-height: 120px;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.md-hot-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--md-shadow);
}

.md-hot-score {
  align-self: flex-start;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--md-hot);
  background: var(--md-hot-soft);
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
}

.md-hot-title {
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.md-hot-src {
  margin-top: auto;
  font-size: 0.78rem;
  color: var(--md-muted);
}

/* Tool grid */
.md-tool-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.md-tool {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-decoration: none;
  color: inherit;
  background: var(--md-panel);
  border: 1px solid var(--md-line);
  border-radius: var(--md-radius);
  padding: 1.25rem 1.2rem 1.35rem;
  overflow: hidden;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
  animation: md-rise 0.45s ease both;
}

.md-tool:nth-child(1) { animation-delay: 0.02s; }
.md-tool:nth-child(2) { animation-delay: 0.06s; }
.md-tool:nth-child(3) { animation-delay: 0.1s; }
.md-tool:nth-child(4) { animation-delay: 0.14s; }
.md-tool:nth-child(5) { animation-delay: 0.18s; }
.md-tool:nth-child(6) { animation-delay: 0.22s; }

.md-tool::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 4px;
  background: var(--tool-accent, var(--md-accent));
  opacity: 0.9;
}

.md-tool:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--tool-accent, var(--md-accent)) 35%, var(--md-line));
  box-shadow: var(--md-shadow);
}

.md-tool-ideas { --tool-accent: #0f766e; }
.md-tool-trends { --tool-accent: #c2410c; }
.md-tool-draft { --tool-accent: #0284c7; }
.md-tool-titles { --tool-accent: #5b6ee1; }
.md-tool-proof { --tool-accent: #15803d; }
.md-tool-tts { --tool-accent: #be123c; }

.md-tool-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  margin-bottom: 0.55rem;
  color: var(--tool-accent, var(--md-accent));
  background: color-mix(in srgb, var(--tool-accent, var(--md-accent)) 14%, white);
}

.md-tool-icon svg {
  width: 28px;
  height: 28px;
}

.md-tool-num {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--tool-accent, var(--md-accent));
}

.md-tool h2 {
  font-family: var(--md-font-display);
  font-size: 1.12rem;
  margin: 0;
  letter-spacing: -0.02em;
}

.md-tool p {
  margin: 0;
  color: var(--md-muted);
  font-size: 0.92rem;
  line-height: 1.4;
}

/* Tool pages */
.md-tool-hero {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.md-tool-hero .md-tool-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  flex-shrink: 0;
}

.md-tool-hero .md-tool-icon svg {
  width: 34px;
  height: 34px;
}

.md-tool-icon-ideas {
  color: #0f766e;
  background: rgba(15, 118, 110, 0.12);
}

.md-tool-icon-trends {
  color: #c2410c;
  background: rgba(194, 65, 12, 0.12);
}

.md-back {
  display: inline-block;
  margin-bottom: 0.85rem;
  color: var(--md-accent);
  text-decoration: none;
  font-weight: 600;
}

.md-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.md-form-wide {
  max-width: 640px;
  background: var(--md-panel);
  border: 1px solid var(--md-line);
  border-radius: var(--md-radius);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 8px 24px rgba(15, 28, 46, 0.04);
}

.md-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .md-form-grid {
    grid-template-columns: 1.4fr 1fr;
  }
}

.md-sort-hint {
  margin: -0.35rem 0 0;
  color: var(--md-muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.md-sort-hint.is-warn {
  color: var(--md-hot, #be123c);
}

.md-sort-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 0.85rem;
  margin: 0 0 1.15rem;
  padding: 0.75rem 0.9rem;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--md-line);
  border-radius: 14px;
}

.md-sort-bar-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--md-muted);
  letter-spacing: 0.01em;
}

.md-sort-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.md-sort-pill {
  appearance: none;
  border: 1px solid var(--md-line);
  background: #fff;
  color: var(--md-ink);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 650;
  padding: 0.42rem 0.75rem;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.md-sort-pill:hover {
  border-color: rgba(15, 118, 110, 0.45);
  color: var(--md-accent-deep);
}

.md-sort-pill.is-active {
  background: var(--md-accent);
  border-color: var(--md-accent);
  color: #fff;
}

.md-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.md-field label {
  font-weight: 700;
  font-size: 0.9rem;
}

.md-input {
  border: 1px solid var(--md-line);
  background: #fff;
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
  font: inherit;
  color: var(--md-ink);
}

.md-input:focus {
  outline: 2px solid rgba(15, 118, 110, 0.28);
  border-color: var(--md-accent);
}

.md-multiselect {
  position: relative;
}

.md-multiselect-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  cursor: pointer;
  color: var(--md-muted);
}

.md-multiselect-trigger.has-value {
  color: var(--md-ink);
}

.md-multiselect-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.md-multiselect-caret {
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  margin-top: -0.25rem;
  opacity: 0.55;
  flex-shrink: 0;
}

.md-multiselect.is-open .md-multiselect-caret {
  transform: rotate(-135deg);
  margin-top: 0.15rem;
}

.md-multiselect-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--md-line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
  max-height: 320px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.md-multiselect-toolbar {
  display: flex;
  gap: 0.5rem;
  padding: 0.65rem;
  border-bottom: 1px solid var(--md-line);
  align-items: center;
}

.md-multiselect-search {
  flex: 1;
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
}

.md-multiselect-options {
  overflow: auto;
  padding: 0.35rem 0;
}

.md-multiselect-option {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.45rem 0.85rem;
  padding-left: calc(0.85rem + (var(--md-depth, 0) * 1rem));
  cursor: pointer;
  font-size: 0.92rem;
  color: var(--md-ink);
}

.md-multiselect-option:hover {
  background: rgba(15, 118, 110, 0.06);
}

.md-multiselect-option input {
  margin-top: 0.2rem;
  accent-color: var(--md-accent);
}

.md-multiselect-option[data-depth="0"] span {
  font-weight: 600;
}

.md-textarea {
  resize: vertical;
  min-height: 120px;
}

.md-check {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--md-muted);
  font-size: 0.92rem;
}

.md-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--md-line);
  background: #fff;
  color: var(--md-ink);
  font: inherit;
  font-weight: 700;
  padding: 0.72rem 1.15rem;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease;
}

.md-btn:hover {
  transform: translateY(-1px);
}

.md-btn-primary {
  background: var(--md-accent);
  border-color: var(--md-accent);
  color: #fff;
}

.md-btn-primary:hover {
  background: var(--md-accent-deep);
}

.md-btn-ghost {
  background: transparent;
  border-color: var(--md-line);
  color: var(--md-ink);
}

.md-btn-ghost:hover {
  background: #f8fafc;
}

.md-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.md-btn-tts {
  border-color: #be123c;
  color: #9f1239;
  background: #fff1f2;
}

.md-btn-tts:hover {
  background: #ffe4e6;
  border-color: #9f1239;
  color: #881337;
}

.md-btn-tts:disabled {
  opacity: 0.65;
  cursor: wait;
}

.md-tts-panel {
  margin-top: 0.85rem;
  padding: 0.85rem 1rem;
  border: 1px solid #fecdd3;
  border-radius: 12px;
  background: #fff7f8;
}

.md-tts-panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.85rem;
  margin-bottom: 0.55rem;
}

.md-tts-panel-head .md-eyebrow {
  margin: 0;
}

.md-tts-status {
  margin: 0;
  font-size: 0.9rem;
  color: var(--md-muted);
}

.md-tts-status.is-error {
  color: #9b2c2c;
}

.md-tts-player {
  display: block;
  width: 100%;
  max-width: 36rem;
  height: 2.5rem;
}

.md-tts-preview {
  margin-top: 0.55rem;
  margin-bottom: 0;
}

.md-field-error,
.md-error {
  color: #9b2c2c;
  font-size: 0.88rem;
}

.md-flash {
  background: #e5f4ef;
  border: 1px solid #b7ddd1;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  color: var(--md-accent-deep);
}

.md-meta {
  color: var(--md-muted);
  font-size: 0.9rem;
}

.md-result {
  background: var(--md-panel);
  border: 1px solid var(--md-line);
  border-radius: var(--md-radius);
  padding: 1rem 1.15rem 1.25rem;
  margin-top: 1.25rem;
  animation: md-rise 0.35s ease;
}

.md-result-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  color: #8a5a10;
  background: #fff3d6;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  margin-bottom: 0.75rem;
}

.md-result-badge-live {
  color: #0b5f59;
  background: #d9f3ee;
}

.md-result-badge-ai {
  color: #1d4ed8;
  background: #dbeafe;
}

/* AI topic clusters */
.md-topics {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.md-topic-card {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 0.85rem;
  background: var(--md-panel);
  border: 1px solid var(--md-line);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.md-topic-card:hover {
  box-shadow: var(--md-shadow);
  transform: translateY(-2px);
}

.md-topic-card.is-clustered {
  border-color: color-mix(in srgb, #2563eb 30%, var(--md-line));
  background: linear-gradient(120deg, #fff 55%, #f0f6ff 100%);
}

.md-topic-rank {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-family: var(--md-font-display);
  font-weight: 700;
  color: #1d4ed8;
  background: #dbeafe;
}

.md-topic-title {
  font-family: var(--md-font-display);
  font-size: 1.08rem;
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.md-topic-summary,
.md-topic-reason {
  margin: 0.25rem 0 0;
  color: var(--md-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.md-topic-reason {
  color: var(--md-ink);
}

.md-chip-ai {
  background: #dbeafe;
  color: #1d4ed8;
}

.md-topic-articles {
  list-style: none;
  margin: 0.65rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.md-topic-articles li {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 0.5rem;
  align-items: baseline;
  font-size: 0.9rem;
  line-height: 1.4;
}

.md-topic-article-score {
  font-weight: 700;
  color: var(--md-hot);
  font-variant-numeric: tabular-nums;
}

.md-topic-articles a {
  color: inherit;
  text-decoration: none;
}

.md-topic-articles a:hover {
  color: var(--md-accent);
}

.md-topic-article-src {
  color: var(--md-muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.md-topic-error {
  margin-bottom: 1.25rem;
}

.md-result-body {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--md-font-body);
  font-size: 0.95rem;
  line-height: 1.55;
  color: var(--md-ink);
}

.md-result-rich {
  max-width: 760px;
}

.md-prose {
  font-family: var(--md-font-body);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--md-ink);
}

.md-prose > *:first-child {
  margin-top: 0;
}

.md-prose h1,
.md-prose h2,
.md-prose h3,
.md-prose h4 {
  font-family: var(--md-font-display);
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin: 1.35rem 0 0.55rem;
  color: var(--md-ink);
}

.md-prose h1 { font-size: 1.45rem; }
.md-prose h2 { font-size: 1.22rem; }
.md-prose h3 { font-size: 1.05rem; }

.md-prose p {
  margin: 0.55rem 0;
}

.md-prose ul,
.md-prose ol {
  margin: 0.45rem 0 0.75rem;
  padding-left: 1.35rem;
}

.md-prose li {
  margin: 0.25rem 0;
}

.md-prose blockquote {
  margin: 0.75rem 0;
  padding: 0.65rem 0.9rem;
  border-left: 3px solid var(--md-accent);
  background: rgba(15, 118, 110, 0.06);
  border-radius: 0 12px 12px 0;
  color: var(--md-accent-deep);
}

.md-prose blockquote p {
  margin: 0.2rem 0;
}

.md-prose strong {
  font-weight: 700;
}

.md-prose hr {
  border: 0;
  border-top: 1px solid var(--md-line);
  margin: 1.25rem 0;
}

.md-prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.92rem;
}

.md-prose th,
.md-prose td {
  border: 1px solid var(--md-line);
  padding: 0.45rem 0.6rem;
  text-align: left;
}

.md-prose th {
  background: rgba(15, 28, 46, 0.04);
}

/* Feed cards */
.md-feed {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.md-feed-card {
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 0.85rem;
  background: var(--md-panel);
  border: 1px solid var(--md-line);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.md-feed-card:hover {
  box-shadow: var(--md-shadow);
  transform: translateY(-2px);
}

.md-feed-card.is-hot {
  border-color: color-mix(in srgb, var(--md-hot) 35%, var(--md-line));
  background: linear-gradient(120deg, #fff 60%, #fff7f2 100%);
}

.md-feed-rank {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-family: var(--md-font-display);
  font-weight: 700;
  color: var(--md-accent-deep);
  background: var(--md-accent-soft);
}

.md-feed-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.4rem;
}

.md-chip {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.16rem 0.48rem;
  border-radius: 999px;
  background: #eef2f7;
  color: var(--md-muted);
}

.md-chip-hot {
  background: var(--md-hot-soft);
  color: var(--md-hot);
}

.md-chip-stale {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #cbd5e1;
}

.md-chip-muted {
  font-weight: 600;
}

.md-ideas-trend-card.is-stale,
.md-feed-card.is-stale {
  opacity: 0.82;
}

.md-feed-title {
  font-family: var(--md-font-display);
  font-size: 1.02rem;
  margin: 0 0 0.35rem;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.md-feed-title a {
  color: inherit;
  text-decoration: none;
}

.md-feed-title a:hover {
  color: var(--md-accent);
}

.md-feed-sapo,
.md-feed-angle,
.md-feed-time {
  margin: 0.25rem 0 0;
  color: var(--md-muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.md-feed-angle {
  color: var(--md-ink);
}

.md-empty {
  background: var(--md-panel);
  border: 1px dashed var(--md-line);
  border-radius: var(--md-radius);
  padding: 1.25rem;
  color: var(--md-muted);
}

.md-code {
  margin: 0.75rem 0 0;
  padding: 0.75rem 1rem;
  background: #0f1c2e;
  color: #d7e6f5;
  border-radius: 10px;
  font-size: 0.88rem;
  overflow-x: auto;
}

/* Login — galactic AI workspace */
.md-login-page {
  background: #03070f;
}

.md-login-page .md-main {
  min-height: 100vh;
  display: grid;
  place-items: stretch;
  background: transparent;
}

.md-login {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem 2.5rem;
  overflow: hidden;
  color: #e8f1f7;
}

.md-login-stage {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background: #03070f;
}

.md-login-galaxy {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(ellipse 80% 50% at 50% 45%, rgba(88, 28, 135, 0.35), transparent 70%),
    radial-gradient(ellipse 60% 40% at 30% 30%, rgba(20, 184, 166, 0.28), transparent 65%),
    radial-gradient(ellipse 55% 45% at 75% 25%, rgba(99, 102, 241, 0.3), transparent 60%),
    radial-gradient(ellipse 50% 40% at 70% 75%, rgba(244, 114, 182, 0.22), transparent 65%),
    radial-gradient(ellipse 45% 35% at 20% 70%, rgba(251, 191, 36, 0.14), transparent 60%),
    radial-gradient(ellipse 40% 30% at 55% 55%, rgba(56, 189, 248, 0.18), transparent 55%),
    linear-gradient(160deg, #02060e 0%, #0b1228 40%, #12081f 70%, #040a14 100%);
  animation: md-login-galaxy-drift 90s ease-in-out infinite alternate;
  filter: saturate(1.15);
}

.md-login-nebula {
  position: absolute;
  border-radius: 50%;
  filter: blur(40px);
  mix-blend-mode: screen;
  opacity: 0.7;
}

.md-login-nebula-a {
  width: min(70vw, 720px);
  height: min(55vw, 560px);
  top: -8%;
  left: -12%;
  background:
    radial-gradient(circle at 40% 40%, rgba(45, 212, 191, 0.55), transparent 60%),
    radial-gradient(circle at 70% 60%, rgba(129, 140, 248, 0.4), transparent 55%);
  animation: md-login-nebula-drift 70s ease-in-out infinite;
}

.md-login-nebula-b {
  width: min(65vw, 680px);
  height: min(50vw, 520px);
  right: -14%;
  top: 10%;
  background:
    radial-gradient(circle at 45% 45%, rgba(244, 114, 182, 0.45), transparent 58%),
    radial-gradient(circle at 60% 30%, rgba(56, 189, 248, 0.35), transparent 55%);
  animation: md-login-nebula-drift 85s ease-in-out infinite reverse;
}

.md-login-nebula-c {
  width: min(80vw, 800px);
  height: min(40vw, 420px);
  left: 15%;
  bottom: -18%;
  background:
    radial-gradient(circle at 50% 40%, rgba(251, 191, 36, 0.28), transparent 55%),
    radial-gradient(circle at 30% 60%, rgba(20, 184, 166, 0.35), transparent 60%);
  animation: md-login-nebula-drift 100s ease-in-out infinite;
  animation-delay: -20s;
}

.md-login-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.md-login-veil {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 60% at 50% 45%, transparent 30%, rgba(3, 7, 15, 0.45) 100%),
    linear-gradient(180deg, rgba(3, 7, 15, 0.2) 0%, transparent 35%, transparent 65%, rgba(3, 7, 15, 0.35) 100%);
}

.md-login-shell {
  position: relative;
  z-index: 1;
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.15fr 0.95fr;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
}

.md-login-hero {
  animation: md-rise 0.55s ease both;
  max-width: 28rem;
}

.md-login-brand {
  font-family: var(--md-font-display);
  font-size: clamp(2.6rem, 6vw, 3.6rem);
  font-weight: 700;
  color: #f7fcff;
  margin: 0 0 0.65rem;
  letter-spacing: -0.045em;
  line-height: 0.95;
  text-shadow:
    0 2px 24px rgba(3, 7, 15, 0.65),
    0 0 48px rgba(56, 189, 248, 0.28);
}

.md-login-headline {
  font-family: var(--md-font-display);
  font-size: clamp(1.25rem, 2.4vw, 1.55rem);
  font-weight: 600;
  margin: 0 0 0.65rem;
  letter-spacing: -0.02em;
  color: #d7ece8;
}

.md-login-sub {
  color: rgba(214, 228, 238, 0.78);
  margin: 0 0 1.5rem;
  line-height: 1.55;
  font-size: 1.02rem;
}

.md-login-signals {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.md-login-signals li {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(190, 220, 216, 0.88);
}

.md-login-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #14b8a6;
  box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.55);
  animation: md-login-pulse 2.2s ease-out infinite;
}

.md-login-signals li:nth-child(2) .md-login-pulse {
  animation-delay: 0.35s;
  background: #22d3ee;
  box-shadow: 0 0 0 0 rgba(34, 211, 238, 0.55);
}

.md-login-signals li:nth-child(3) .md-login-pulse {
  animation-delay: 0.7s;
}

.md-login-panel {
  width: min(420px, 100%);
  justify-self: end;
  background: rgba(248, 252, 255, 0.94);
  color: var(--md-ink);
  padding: 1.85rem 1.65rem 1.7rem;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 48px rgba(2, 12, 24, 0.35);
  animation: md-rise 0.55s ease 0.08s both;
}

.md-login-panel-label {
  margin: 0 0 1.1rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--md-accent);
}

.md-login-panel .md-input {
  background: rgba(255, 255, 255, 0.92);
  border-color: #c9d6e3;
}

.md-login-panel .md-input:focus {
  outline: 2px solid rgba(20, 184, 166, 0.28);
  border-color: #14b8a6;
}

.md-login-submit {
  width: 100%;
  margin-top: 0.25rem;
  background: linear-gradient(135deg, #0f766e 0%, #0d9488 55%, #0891b2 100%);
  border-color: transparent;
  letter-spacing: 0.01em;
}

.md-login-submit:hover {
  background: linear-gradient(135deg, #0b5f59 0%, #0f766e 55%, #0e7490 100%);
}

@media (max-width: 860px) {
  .md-login-shell {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }

  .md-login-hero {
    max-width: none;
    text-align: center;
  }

  .md-login-signals {
    align-items: center;
  }

  .md-login-panel {
    justify-self: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .md-login-galaxy,
  .md-login-nebula,
  .md-login-pulse {
    animation: none;
  }
}

@keyframes md-login-galaxy-drift {
  0% { transform: translate3d(0, 0, 0) scale(1) rotate(0deg); }
  100% { transform: translate3d(-3%, 2%, 0) scale(1.06) rotate(2deg); }
}

@keyframes md-login-nebula-drift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); opacity: 0.55; }
  50% { transform: translate3d(4%, -3%, 0) scale(1.12); opacity: 0.85; }
}

@keyframes md-login-pulse {
  0% { box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.55); }
  70% { box-shadow: 0 0 0 10px rgba(20, 184, 166, 0); }
  100% { box-shadow: 0 0 0 0 rgba(20, 184, 166, 0); }
}

@keyframes md-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 960px) {
  .md-tool-grid,
  .md-hot-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .md-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Idea Studio — full-bleed immersive */
.md-idea-body {
  --md-idea-ink: #0b1a2a;
  --md-idea-glass: rgba(255, 255, 255, 0.72);
  --md-idea-glass-strong: rgba(255, 255, 255, 0.88);
  --md-idea-stroke: rgba(15, 28, 46, 0.1);
  --md-idea-cyan: #0d9488;
  --md-idea-sky: #0284c7;
}

.md-idea-body .md-topbar {
  background: rgba(238, 243, 248, 0.72);
  border-bottom-color: rgba(15, 28, 46, 0.08);
}

.md-idea-body .md-topbar-inner {
  max-width: none;
  width: 100%;
  padding-left: clamp(1rem, 2.5vw, 2.5rem);
  padding-right: clamp(1rem, 2.5vw, 2.5rem);
}

.md-idea-body .md-main {
  min-height: calc(100vh - 64px);
  padding: 0;
}

.md-idea-studio {
  position: relative;
  isolation: isolate;
  min-height: calc(100vh - 64px);
  /* Chỉ clip ngang — tránh cắt danh sách tin khi trang dài */
  overflow-x: clip;
  overflow-y: visible;
}

.md-idea-atmosphere {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(1200px 600px at 12% -10%, rgba(13, 148, 136, 0.22), transparent 58%),
    radial-gradient(900px 520px at 92% 8%, rgba(2, 132, 199, 0.16), transparent 55%),
    linear-gradient(165deg, #e6eef7 0%, #eef3f8 42%, #e4ecf5 100%);
}

.md-idea-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(8px);
  opacity: 0.55;
  will-change: transform;
}

.md-idea-orb-a {
  width: min(42vw, 420px);
  height: min(42vw, 420px);
  top: -8%;
  right: 8%;
  background: radial-gradient(circle at 35% 35%, rgba(13, 148, 136, 0.45), transparent 68%);
  animation: md-idea-orb-drift 18s ease-in-out infinite alternate;
}

.md-idea-orb-b {
  width: min(36vw, 360px);
  height: min(36vw, 360px);
  bottom: 12%;
  left: -6%;
  background: radial-gradient(circle at 60% 40%, rgba(2, 132, 199, 0.35), transparent 70%);
  animation: md-idea-orb-drift 22s ease-in-out infinite alternate-reverse;
}

.md-idea-orb-c {
  width: min(28vw, 280px);
  height: min(28vw, 280px);
  top: 42%;
  right: -4%;
  background: radial-gradient(circle at 40% 50%, rgba(15, 118, 110, 0.22), transparent 72%);
  animation: md-idea-orb-drift 26s ease-in-out infinite alternate;
}

.md-idea-gridline {
  position: absolute;
  inset: 0;
  opacity: 0.28;
  background-image:
    linear-gradient(rgba(15, 28, 46, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 28, 46, 0.045) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 20%, transparent 75%);
}

.md-idea-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  min-height: calc(100vh - 64px);
  padding: clamp(1rem, 2.2vw, 1.75rem) clamp(1rem, 2.5vw, 2.5rem) clamp(2rem, 4vw, 3.5rem);
  display: flex;
  flex-direction: column;
  gap: clamp(1rem, 2vw, 1.5rem);
}

.md-idea-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem 2rem;
  flex-wrap: wrap;
  animation: md-idea-rise 0.55s ease both;
}

.md-idea-hero-copy {
  min-width: min(100%, 36rem);
  max-width: 46rem;
}

.md-idea-back {
  display: inline-block;
  margin-bottom: 0.55rem;
  color: var(--md-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 650;
}

.md-idea-back:hover {
  color: var(--md-accent-deep);
}

.md-idea-kicker {
  margin: 0 0 0.35rem;
  font-family: var(--md-font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--md-idea-cyan);
}

.md-idea-hero h1 {
  margin: 0 0 0.45rem;
  font-family: var(--md-font-display);
  font-size: clamp(1.9rem, 4.2vw, 3rem);
  letter-spacing: -0.04em;
  line-height: 1.08;
  color: var(--md-idea-ink);
}

.md-idea-sub {
  margin: 0;
  max-width: 40rem;
  color: var(--md-muted);
  font-size: clamp(0.95rem, 1.4vw, 1.05rem);
  line-height: 1.55;
}

.md-idea-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.md-idea-ghost {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--md-idea-stroke);
  border-radius: 12px;
  background: var(--md-idea-glass);
  color: var(--md-ink);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 700;
  backdrop-filter: blur(10px);
  transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.md-idea-ghost:hover {
  border-color: rgba(13, 148, 136, 0.45);
  background: #fff;
  transform: translateY(-1px);
}

.md-idea-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.45fr) minmax(240px, 0.85fr);
  grid-template-areas:
    "modes composer rail";
  gap: clamp(0.85rem, 1.5vw, 1.25rem);
  align-items: stretch;
  flex: 1;
  min-height: 0;
  animation: md-idea-rise 0.65s ease 0.06s both;
}

.md-idea-modes {
  grid-area: modes;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
  padding: 1rem 1.05rem 1.1rem;
  border: 1px solid var(--md-idea-stroke);
  border-radius: 22px;
  background: var(--md-idea-glass);
  backdrop-filter: blur(16px);
}

.md-idea-modes-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.md-idea-label,
.md-idea-chips-label {
  margin: 0 0 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--md-muted);
}

.md-idea-mode-live {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.md-idea-mode-live strong {
  font-family: var(--md-font-display);
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--md-idea-ink);
}

.md-idea-mode-live span {
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--md-muted);
}

.md-idea-count-pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: rgba(13, 148, 136, 0.12);
  color: var(--md-accent-deep);
  font-size: 0.72rem;
  font-weight: 700;
}

.md-idea-group-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.md-idea-group-tab {
  appearance: none;
  border: 1px solid transparent;
  background: rgba(15, 28, 46, 0.04);
  color: var(--md-muted);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.42rem 0.7rem;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.md-idea-group-tab:hover {
  color: var(--md-accent-deep);
  background: rgba(13, 148, 136, 0.1);
}

.md-idea-group-tab.is-active {
  color: #fff;
  background: linear-gradient(135deg, var(--md-idea-cyan), #0f766e);
  border-color: transparent;
}

.md-idea-mode-panel {
  min-height: 0;
  flex: 1;
}

.md-idea-mode-panel[hidden] {
  display: none !important;
}

.md-idea-mode-rail {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.45rem;
  max-height: min(52vh, 520px);
  overflow: auto;
  padding-right: 0.15rem;
  scrollbar-width: thin;
}

.md-idea-mode-panel[data-group-panel="Hình thức"] .md-idea-mode-rail {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-height: min(58vh, 640px);
}

.md-idea-mode-panel[data-group-panel="Hình thức"] .md-idea-mode {
  min-height: 4.6rem;
}

.md-idea-mode-panel[data-group-panel="Hình thức"] .md-idea-mode span {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.md-idea-mode {
  appearance: none;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 14px;
  padding: 0.78rem 0.85rem;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.md-idea-mode strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.18rem;
  color: var(--md-idea-ink);
}

.md-idea-mode span {
  display: block;
  font-size: 0.76rem;
  line-height: 1.35;
  color: var(--md-muted);
}

.md-idea-mode:hover {
  border-color: rgba(13, 148, 136, 0.35);
  background: #fff;
  transform: translateX(2px);
}

.md-idea-mode.is-active {
  border-color: rgba(13, 148, 136, 0.55);
  background: linear-gradient(135deg, rgba(232, 247, 244, 0.95) 0%, #fff 70%);
  box-shadow: 0 8px 22px rgba(13, 148, 136, 0.12);
}

.md-idea-goals {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.85rem 0.9rem 0.75rem;
  border-radius: 16px;
  border: 1px solid rgba(13, 148, 136, 0.2);
  background:
    linear-gradient(135deg, rgba(13, 148, 136, 0.08), rgba(255, 255, 255, 0.78) 46%, rgba(245, 158, 11, 0.1));
}

.md-idea-goal-row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.45rem;
}

.md-idea-goal-kicker {
  flex: 0 0 100%;
  margin: 0;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--md-accent-deep);
}

.md-idea-goal-row + .md-idea-goal-row .md-idea-goal-kicker {
  color: #9a3412;
}

.md-idea-goal {
  appearance: none;
  flex: 1 1 9.2rem;
  text-align: left;
  border: 1px solid rgba(13, 148, 136, 0.28);
  background: rgba(255, 255, 255, 0.9);
  color: var(--md-idea-ink);
  font: inherit;
  border-radius: 12px;
  padding: 0.55rem 0.7rem;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.md-idea-goal strong {
  display: block;
  font-size: 0.84rem;
}

.md-idea-goal span {
  display: block;
  margin-top: 0.12rem;
  font-size: 0.72rem;
  line-height: 1.3;
  color: var(--md-muted);
}

.md-idea-goal-engage {
  border-color: rgba(180, 83, 9, 0.28);
}

.md-idea-goal:hover {
  transform: translateY(-1px);
  border-color: var(--md-idea-cyan);
}

.md-idea-goal-engage:hover {
  border-color: #c2410c;
}

.md-idea-goal.is-active {
  background: linear-gradient(135deg, #0f766e, #115e59);
  border-color: transparent;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.22);
}

.md-idea-goal-engage.is-active {
  background: linear-gradient(135deg, #c2410c, #9a3412);
  box-shadow: 0 8px 18px rgba(154, 52, 18, 0.2);
}

.md-idea-goal.is-active strong,
.md-idea-goal.is-active span {
  color: #fff;
}

.md-idea-goal-note {
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.45;
  color: var(--md-muted);
}

.md-idea-composer {
  grid-area: composer;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--md-idea-stroke);
  border-radius: 22px;
  background: var(--md-idea-glass-strong);
  backdrop-filter: blur(18px);
  overflow: hidden;
}

.md-idea-composer-main {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.15rem 1.2rem 1rem;
  flex: 1;
}

.md-idea-topic-field .md-idea-topic {
  font-size: 1.05rem;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  background: #fff;
  border-color: rgba(13, 148, 136, 0.22);
  box-shadow: inset 0 0 0 1px rgba(13, 148, 136, 0.04);
}

.md-idea-topic:focus {
  outline: 2px solid rgba(13, 148, 136, 0.28);
  border-color: var(--md-idea-cyan);
}

.md-optional {
  font-weight: 500;
  color: var(--md-muted);
  font-size: 0.85em;
}

.md-form-grid-3 {
  grid-template-columns: 1fr;
}

@media (min-width: 720px) {
  .md-form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
  }
}

.md-idea-chips-inline {
  margin-top: 0.55rem;
}

.md-idea-advanced {
  border: 1px dashed rgba(15, 28, 46, 0.12);
  border-radius: 14px;
  padding: 0.15rem 0.85rem 0.85rem;
  background: rgba(255, 255, 255, 0.45);
}

.md-idea-advanced summary {
  cursor: pointer;
  list-style: none;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--md-accent-deep);
  padding: 0.7rem 0 0.35rem;
  user-select: none;
}

.md-idea-advanced summary::-webkit-details-marker {
  display: none;
}

.md-idea-advanced summary::before {
  content: "+";
  display: inline-block;
  width: 1.1rem;
  margin-right: 0.35rem;
  color: var(--md-idea-cyan);
}

.md-idea-advanced[open] summary::before {
  content: "–";
}

.md-idea-advanced-body {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-top: 0.35rem;
}

.md-idea-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
}

.md-idea-chip {
  appearance: none;
  border: 1px solid rgba(13, 148, 136, 0.22);
  background: rgba(13, 148, 136, 0.06);
  color: var(--md-accent-deep);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 650;
  padding: 0.36rem 0.68rem;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.md-idea-chip:hover {
  background: rgba(13, 148, 136, 0.14);
  border-color: var(--md-idea-cyan);
  transform: translateY(-1px);
}

.md-idea-chip.md-lang-chip.is-active {
  background: rgba(13, 148, 136, 0.22);
  border-color: var(--md-accent-deep);
  color: var(--md-ink, #0f172a);
  box-shadow: inset 0 0 0 1px rgba(13, 148, 136, 0.25);
}

.md-idea-composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
  padding: 0.9rem 1.2rem;
  border-top: 1px solid rgba(15, 28, 46, 0.08);
  background: linear-gradient(180deg, rgba(248, 251, 253, 0.65), rgba(255, 255, 255, 0.92));
  position: sticky;
  bottom: 0;
}

.md-idea-count {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--md-idea-ink);
}

.md-idea-count .md-input {
  width: auto;
  min-width: 4.5rem;
  padding: 0.48rem 0.6rem;
  background: #fff;
}

.md-idea-bar-hint {
  margin: 0;
  flex: 1;
  min-width: 12rem;
  color: var(--md-muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.md-idea-bar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.md-idea-submit {
  position: relative;
  overflow: hidden;
  min-width: 11.5rem;
  background: linear-gradient(135deg, #0d9488, #0f766e 55%, #0e7490);
  border: 0;
  box-shadow: 0 10px 28px rgba(13, 148, 136, 0.28);
}

.md-idea-submit-label {
  position: relative;
  z-index: 1;
}

.md-idea-submit-glow {
  position: absolute;
  inset: -40% auto -40% -30%;
  width: 40%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-18deg);
  animation: md-idea-shine 3.2s ease-in-out infinite;
}

.md-idea-submit.is-loading {
  opacity: 0.85;
}

.md-idea-rail {
  grid-area: rail;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
  position: sticky;
  top: 80px;
  align-self: start;
  max-height: calc(100vh - 96px);
  overflow: auto;
  scrollbar-width: thin;
}

.md-idea-dock {
  padding: 0.95rem 1rem;
  border: 1px solid var(--md-idea-stroke);
  border-radius: 18px;
  background: var(--md-idea-glass);
  backdrop-filter: blur(14px);
}

.md-idea-dock h2 {
  font-family: var(--md-font-display);
  font-size: 0.92rem;
  margin: 0 0 0.55rem;
  letter-spacing: -0.02em;
}

.md-idea-steps-ol,
.md-idea-check {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--md-muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.md-idea-pulse-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.md-idea-pulse-head a {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--md-accent);
  text-decoration: none;
}

.md-idea-pulse-hint {
  margin: 0 0 0.55rem;
  color: var(--md-muted);
  font-size: 0.8rem;
  line-height: 1.4;
}

.md-idea-pulse-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.md-idea-pulse-item {
  width: 100%;
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 0.45rem;
  align-items: start;
  text-align: left;
  border: 1px solid rgba(15, 28, 46, 0.08);
  background: rgba(255, 255, 255, 0.75);
  border-radius: 12px;
  padding: 0.5rem 0.55rem;
  cursor: pointer;
  font: inherit;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.md-idea-pulse-item:hover {
  border-color: rgba(13, 148, 136, 0.45);
  background: #fff;
  transform: translateY(-1px);
}

.md-idea-pulse-score {
  font-size: 0.72rem;
  font-weight: 700;
  color: #c2410c;
  background: rgba(194, 65, 12, 0.12);
  border-radius: 8px;
  padding: 0.2rem 0;
  text-align: center;
}

.md-idea-pulse-title {
  font-size: 0.8rem;
  line-height: 1.35;
  color: var(--md-ink);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.md-flash-warn {
  background: #fff7e8;
  border-color: #f0d39a;
  color: #8a5a10;
}

.md-idea-flash {
  margin: 0;
  animation: md-idea-rise 0.4s ease both;
}

.md-idea-results {
  margin-top: 0.25rem;
  padding-top: 0.25rem;
  animation: md-idea-rise 0.5s ease both;
  scroll-margin-top: 88px;
}

.md-idea-results-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin-bottom: 0.95rem;
}

.md-idea-results-head .md-section-title {
  margin: 0.15rem 0 0;
  font-size: clamp(1.2rem, 2vw, 1.45rem);
}

.md-idea-results-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.md-idea-results-head .md-result-badge {
  margin: 0;
}

.md-idea-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.95rem;
  margin-bottom: 0.5rem;
}

/* —— Bản tin digest (Thời sự / Trend) —— */
.md-news-digest {
  background: linear-gradient(165deg, #0f172a 0%, #1e293b 55%, #0f172a 100%);
  color: #e2e8f0;
  border-radius: 20px;
  padding: 1.35rem 1.4rem 1.6rem;
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.35);
}

.md-digest-hero {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.md-news-digest .md-idea-label {
  color: #94a3b8;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.md-digest-title {
  margin: 0.35rem 0 0.4rem;
  font-size: clamp(1.35rem, 2.6vw, 1.85rem);
  font-weight: 750;
  line-height: 1.25;
  color: #f8fafc;
  letter-spacing: -0.02em;
}

.md-digest-sub {
  margin: 0;
  color: #94a3b8;
  font-size: 0.92rem;
}

.md-digest-lead {
  margin: 0.65rem 0 0;
  color: #cbd5e1;
  font-size: 0.95rem;
  line-height: 1.5;
  max-width: 52rem;
}

.md-digest-group {
  margin-top: 1.15rem;
}

.md-digest-group-title {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: #f1f5f9;
}

.md-digest-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.md-digest-item {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 0.95rem;
  align-items: start;
  padding: 0.75rem;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(148, 163, 184, 0.14);
  animation: md-idea-rise 0.4s ease both;
  animation-delay: calc(var(--i, 0) * 0.04s);
}

.md-digest-item:hover {
  border-color: rgba(45, 212, 191, 0.35);
  background: rgba(15, 23, 42, 0.7);
}

.md-digest-thumb {
  width: 132px;
  height: 88px;
  border-radius: 10px;
  overflow: hidden;
  background: #334155;
  flex-shrink: 0;
}

.md-digest-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.md-digest-thumb-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: #94a3b8;
  font-size: 0.8rem;
  font-weight: 600;
}

.md-digest-headline {
  margin: 0 0 0.35rem;
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.35;
  color: #f8fafc;
}

.md-digest-headline a {
  color: inherit;
  text-decoration: none;
}

.md-digest-headline a:hover {
  color: #5eead4;
  text-decoration: underline;
}

.md-digest-summary {
  margin: 0 0 0.45rem;
  color: #94a3b8;
  font-size: 0.9rem;
  line-height: 1.45;
}

.md-digest-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: center;
  font-size: 0.8rem;
  color: #64748b;
  margin-bottom: 0.55rem;
}

.md-digest-source {
  color: #94a3b8;
  text-decoration: none;
}

.md-digest-source:hover {
  color: #5eead4;
}

.md-digest-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.md-btn-sm {
  padding: 0.35rem 0.75rem !important;
  font-size: 0.85rem !important;
}

.md-news-digest .md-btn {
  border-color: rgba(148, 163, 184, 0.35);
  color: #e2e8f0;
}

.md-news-digest .md-btn-primary {
  background: #0d9488;
  border-color: #0d9488;
  color: #fff;
}

@media (max-width: 720px) {
  .md-digest-item {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 0.7rem;
  }

  .md-digest-thumb {
    width: 96px;
    height: 72px;
  }
}

.md-idea-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--md-idea-stroke);
  border-radius: 18px;
  padding: 1.05rem 1.1rem 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  backdrop-filter: blur(10px);
  animation: md-idea-rise 0.45s ease both;
  animation-delay: calc(var(--i, 0) * 0.05s);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.md-idea-card:hover {
  transform: translateY(-4px);
  border-color: rgba(13, 148, 136, 0.35);
  box-shadow: 0 18px 40px rgba(15, 28, 46, 0.1);
}

.md-idea-card.is-selected {
  border-color: rgba(13, 148, 136, 0.55);
  box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.18), 0 18px 40px rgba(15, 28, 46, 0.1);
}

.md-idea-steps-ol li.is-current {
  color: var(--md-accent-deep);
  font-weight: 700;
}

.md-idea-suggested-topics {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.md-idea-suggested-topic {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--md-idea-stroke);
  border-radius: 16px;
  padding: 1rem 1.1rem;
  animation: md-idea-rise 0.4s ease both;
  animation-delay: calc(var(--i, 0) * 0.05s);
}

.md-idea-suggested-topic-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}

.md-idea-suggested-topic h3 {
  font-family: var(--md-font-display);
  font-size: 1.02rem;
  margin: 0 0 0.35rem;
  line-height: 1.35;
}

.md-idea-source {
  margin: 0 0 0.65rem;
  font-size: 0.84rem;
  color: var(--md-muted);
}

.md-idea-source a {
  margin-left: 0.35rem;
  color: #0369a1;
}

.md-src-crawler {
  color: #0f766e !important;
  background: #ccfbf1 !important;
}

.md-src-google {
  color: #1d4ed8 !important;
  background: #dbeafe !important;
}

.md-btn-compose-focus {
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.25);
}

.md-btn-assign {
  background: #0f766e;
  border-color: #0f766e;
  color: #fff;
}

.md-btn-assign:hover {
  background: #0d9488;
  border-color: #0d9488;
  color: #fff;
}

body.md-assign-open {
  overflow: hidden;
}

.md-assign-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.md-assign-modal[hidden] {
  display: none !important;
}

.md-assign-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
}

.md-assign-modal-panel {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: min(92vh, 820px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--md-idea-stroke, #dbe4ee);
  border-radius: 16px;
  padding: 1.1rem 1.15rem 1rem;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.18);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.md-assign-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.md-assign-modal-head h2 {
  margin: 0.15rem 0 0;
  font-family: var(--md-font-display);
  font-size: 1.2rem;
}

.md-assign-lead {
  margin: 0.35rem 0 0;
  color: var(--md-muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.md-assign-close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  color: var(--md-muted);
  padding: 0.15rem 0.4rem;
}

.md-assign-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.md-assign-user-ms {
  z-index: 2;
}

.md-assign-user-panel {
  z-index: 50;
  max-height: 280px;
}

.md-assign-user-panel .md-multiselect-options {
  max-height: 200px;
}

.md-assign-user-option span {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.md-assign-user-option strong {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--md-ink);
}

.md-assign-user-option small {
  font-size: 0.78rem;
  color: var(--md-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.md-assign-user-hint {
  margin: 0;
  padding: 0.85rem 1rem;
  color: var(--md-muted);
  font-size: 0.9rem;
}

.md-assign-status {
  margin: 0;
  font-size: 0.88rem;
  color: #0f766e;
}

.md-assign-status.is-error {
  color: #9b2c2c;
}

.md-assign-status.is-ok {
  color: #0f766e;
}

.md-assign-modal-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.55rem;
  margin-top: 0.25rem;
}

@media (max-width: 500px) {
  .md-assign-modal {
    padding: 0.5rem;
    align-items: flex-end;
  }

  .md-assign-modal-panel {
    width: 100%;
    max-height: 94vh;
    border-radius: 16px 16px 0 0;
  }

  .md-assign-modal-foot .md-btn {
    flex: 1 1 auto;
  }

  .md-assign-grid {
    grid-template-columns: 1fr;
  }
}

.md-idea-card-top {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.md-idea-index {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-family: var(--md-font-display);
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--md-accent-deep);
  background: rgba(13, 148, 136, 0.12);
}

.md-idea-format {
  font-size: 0.72rem;
  font-weight: 700;
  color: #0369a1;
  background: #e0f2fe;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}

.md-idea-risk {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}

.md-idea-risk-green {
  color: #166534;
  background: #dcfce7;
}

.md-idea-risk-amber {
  color: #92400e;
  background: #fef3c7;
}

.md-idea-risk-red {
  color: #9f1239;
  background: #ffe4e6;
}

.md-idea-card h3 {
  font-family: var(--md-font-display);
  font-size: 1.08rem;
  margin: 0.15rem 0 0;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.md-idea-angle {
  margin: 0;
  color: var(--md-ink);
  font-size: 0.92rem;
  line-height: 1.45;
}

.md-idea-meta {
  margin: 0;
  color: var(--md-muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.md-idea-hook {
  margin: 0;
  padding: 0.55rem 0.7rem;
  border-left: 3px solid var(--md-idea-cyan);
  background: rgba(13, 148, 136, 0.07);
  border-radius: 0 10px 10px 0;
  font-size: 0.9rem;
  font-style: italic;
  color: var(--md-accent-deep);
}

.md-idea-steps {
  margin: 0.15rem 0 0.35rem;
  padding-left: 1.1rem;
  color: var(--md-muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.md-idea-topics {
  margin: 0.2rem 0 0.4rem;
}

.md-idea-topics-label {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--md-idea-cyan);
}

.md-idea-topics-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.4rem;
}

.md-idea-topics-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.55rem;
  align-items: start;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--md-idea-stroke);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.55);
}

.md-idea-topic-text {
  font-size: 0.88rem;
  line-height: 1.4;
  color: var(--md-idea-ink);
}

.md-idea-topic-write {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--md-idea-sky);
  text-decoration: none;
  white-space: nowrap;
  padding-top: 0.1rem;
}

.md-idea-topic-write:hover {
  text-decoration: underline;
}

.md-idea-card .md-btn-row {
  margin-top: auto;
  padding-top: 0.35rem;
}

.md-idea-card .md-btn {
  font-size: 0.86rem;
  padding: 0.55rem 0.85rem;
}

.md-idea-fallback-result {
  max-width: 920px;
}

@keyframes md-idea-orb-drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(24px, 18px, 0) scale(1.06); }
}

@keyframes md-idea-shine {
  0%, 55%, 100% { transform: translateX(0) skewX(-18deg); opacity: 0; }
  60% { opacity: 1; }
  85% { transform: translateX(420%) skewX(-18deg); opacity: 0; }
}

@keyframes md-idea-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1280px) {
  .md-idea-workspace {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    grid-template-areas:
      "modes composer"
      "rail rail";
  }

  .md-idea-rail {
    position: static;
    max-height: none;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .md-idea-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .md-idea-workspace {
    grid-template-columns: 1fr;
    grid-template-areas:
      "modes"
      "composer"
      "rail";
  }

  .md-idea-mode-rail,
  .md-idea-mode-panel[data-group-panel="Hình thức"] .md-idea-mode-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: none;
  }

  .md-idea-rail {
    grid-template-columns: 1fr 1fr;
  }

  .md-idea-pulse {
    grid-column: 1 / -1;
  }

  .md-idea-cards {
    grid-template-columns: 1fr;
  }

  .md-idea-composer-bar {
    position: sticky;
    bottom: 0;
    z-index: 5;
  }
}

@media (max-width: 720px) {
  .md-nav {
    display: flex;
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 0.2rem;
    scrollbar-width: none;
  }

  .md-nav::-webkit-scrollbar {
    display: none;
  }

  .md-nav a {
    flex: 0 0 auto;
    white-space: nowrap;
    font-size: 0.82rem;
    padding: 0.35rem 0.55rem;
  }

  .md-topbar-inner {
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
  }

  .md-user {
    margin-left: auto;
  }

  .md-tool-grid,
  .md-hot-grid {
    grid-template-columns: 1fr;
  }

  .md-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .md-tool-hero {
    flex-direction: column;
  }

  .md-topic-articles li {
    grid-template-columns: 40px 1fr;
  }

  .md-topic-article-src {
    grid-column: 2;
    white-space: normal;
  }

  .md-idea-shell {
    padding: 0.85rem 0.85rem 5.5rem;
  }

  .md-idea-hero h1 {
    font-size: clamp(1.65rem, 8vw, 2.15rem);
  }

  .md-idea-mode-rail,
  .md-idea-mode-panel[data-group-panel="Hình thức"] .md-idea-mode-rail {
    grid-template-columns: 1fr;
  }

  .md-idea-rail {
    grid-template-columns: 1fr;
  }

  .md-idea-composer-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .md-idea-bar-actions {
    width: 100%;
  }

  .md-idea-bar-actions .md-btn {
    flex: 1;
  }

  .md-idea-orb {
    opacity: 0.35;
  }
}

@media (prefers-reduced-motion: reduce) {
  .md-idea-orb,
  .md-idea-submit-glow,
  .md-idea-hero,
  .md-idea-workspace,
  .md-idea-card,
  .md-idea-results {
    animation: none !important;
  }

  .md-idea-mode:hover,
  .md-idea-card:hover,
  .md-idea-ghost:hover,
  .md-idea-chip:hover,
  .md-idea-goal:hover,
  .md-idea-pulse-item:hover {
    transform: none;
  }
}

/* Ideas hub — dense workspace (trend + evergreen) */
.md-ideas-hub.md-idea-studio .md-idea-shell {
  gap: 0.65rem;
  padding-top: clamp(0.75rem, 1.6vw, 1.15rem);
  padding-bottom: clamp(1.25rem, 3vw, 2rem);
}

.md-ideas-hub .md-idea-hero {
  align-items: center;
  gap: 0.55rem 1rem;
}

.md-ideas-hub .md-idea-hero-copy {
  min-width: 0;
  max-width: 30rem;
  flex: 1 1 14rem;
}

.md-ideas-hub .md-idea-back {
  margin-bottom: 0.15rem;
  font-size: 0.8rem;
}

.md-ideas-hub .md-idea-kicker {
  margin: 0 0 0.15rem;
  font-size: 0.7rem;
}

.md-ideas-hub .md-idea-hero h1 {
  margin: 0;
  font-size: clamp(1.25rem, 2vw, 1.55rem);
  line-height: 1.15;
}

.md-ideas-hub .md-idea-sub {
  margin: 0.25rem 0 0;
  font-size: 0.84rem;
  line-height: 1.35;
  max-width: 32rem;
}

.md-ideas-hub .md-idea-hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-left: auto;
  flex: 0 1 auto;
  max-width: 100%;
}

.md-ideas-hub .md-idea-ghost {
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  border-radius: 10px;
}

.md-ideas-hub .md-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.4rem;
  margin-bottom: 0;
}

.md-ideas-hub .md-stat {
  padding: 0.4rem 0.65rem;
  border-radius: 10px;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}

.md-ideas-hub .md-stat-label {
  font-size: 0.65rem;
  margin-bottom: 0.05rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.md-ideas-hub .md-stat-value {
  font-size: 0.98rem;
  line-height: 1.15;
}

.md-ideas-hub .md-stat-time {
  font-size: 0.88rem;
}

.md-ideas-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0;
  padding: 0.25rem;
  border-radius: 12px;
  border: 1px solid var(--md-idea-stroke, rgba(15, 28, 46, 0.1));
  background: var(--md-idea-glass, rgba(255, 255, 255, 0.72));
  width: fit-content;
  max-width: 100%;
}

.md-ideas-tab {
  appearance: none;
  text-decoration: none;
  color: var(--md-muted, #5b6b7c);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  padding: 0.4rem 0.85rem;
  border-radius: 9px;
  border: 1px solid transparent;
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.md-ideas-tab:hover {
  color: var(--md-idea-cyan, #0d9488);
  background: rgba(13, 148, 136, 0.08);
}

.md-ideas-tab.is-active {
  color: #fff;
  background: linear-gradient(135deg, var(--md-idea-cyan, #0d9488), #0f766e);
}

.md-ideas-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.md-ideas-panel-lead {
  margin: 0;
  color: var(--md-muted, #5b6b7c);
  font-size: 0.84rem;
  line-height: 1.4;
  max-width: 52rem;
}

.md-ideas-form {
  margin-bottom: 0;
}

.md-ideas-form-dense {
  position: relative;
  border-radius: 14px;
}

.md-ideas-form-dense .md-idea-composer-main {
  padding: 0.6rem 0.75rem;
  gap: 0;
}

.md-ideas-form-grid {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.5rem 0.55rem;
  align-items: end;
}

.md-ideas-form-grid .md-field {
  flex: 1 1 7.5rem;
  min-width: 0;
  width: auto;
  max-width: none;
}

.md-ideas-form-grid .md-ideas-limit-field {
  flex: 0 1 5rem;
}

.md-ideas-form-grid .md-idea-label {
  margin-bottom: 0.15rem;
  font-size: 0.68rem;
}

.md-ideas-form-grid .md-input {
  min-height: 2.2rem;
  padding: 0.35rem 0.55rem;
  font-size: 0.88rem;
}

.md-ideas-sort-field {
  /* Giữ select trong form (POST + Fresh reload) nhưng UI dùng pills */
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.md-ideas-form-action {
  display: flex;
  align-items: flex-end;
  flex: 0 0 auto;
  margin-left: auto;
}

.md-ideas-form-action .md-idea-submit {
  min-height: 2.2rem;
  padding: 0.4rem 0.85rem;
  font-size: 0.86rem;
  white-space: nowrap;
}

.md-ideas-hub .md-ideas-sort-bar {
  margin: 0;
  padding: 0.45rem 0.7rem;
  gap: 0.45rem 0.65rem;
  border-radius: 12px;
}

.md-ideas-hub .md-sort-pill {
  font-size: 0.78rem;
  padding: 0.32rem 0.65rem;
  border-radius: 8px;
}

.md-ideas-hub .md-sort-hint {
  margin: 0;
  flex: 1 1 12rem;
  font-size: 0.78rem;
  color: var(--md-muted, #5b6b7c);
  line-height: 1.35;
}

.md-ideas-hub .md-idea-card {
  padding: 0.75rem 0.85rem 0.85rem;
  border-radius: 14px;
  gap: 0.32rem;
}

.md-ideas-hub .md-idea-card h3 {
  font-size: 0.98rem;
  margin: 0.05rem 0 0;
}

.md-ideas-hub .md-idea-angle,
.md-ideas-hub .md-idea-hook,
.md-ideas-hub .md-idea-meta {
  font-size: 0.84rem;
  margin: 0;
}

.md-ideas-hub .md-idea-card .md-btn {
  font-size: 0.8rem;
  padding: 0.42rem 0.7rem;
}

.md-ideas-hub .md-eg-chip-group {
  margin-bottom: 0.55rem;
}

.md-ideas-hub .md-eg-chip {
  padding: 0.32rem 0.7rem;
  font-size: 0.82rem;
}

.md-ideas-hub #md-evergreen-form .md-idea-composer-main {
  padding: 0.85rem 1rem 0.75rem;
  gap: 0.65rem;
}

.md-ideas-hub #md-evergreen-form .md-idea-composer-bar {
  padding: 0.65rem 1rem;
}

/* Evergreen chip picker */
.md-eg-chip-group {
  margin-bottom: 0.85rem;
}

.md-eg-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 0.35rem;
}

.md-eg-chip {
  appearance: none;
  border: 1px solid var(--md-idea-stroke, #d5dde8);
  background: rgba(255, 255, 255, 0.92);
  color: var(--md-ink, #0f1c2e);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.88rem;
  line-height: 1.25;
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.md-eg-chip:hover {
  border-color: rgba(13, 148, 136, 0.4);
}

.md-eg-chip.is-selected {
  border-color: rgba(13, 148, 136, 0.55);
  background: rgba(13, 148, 136, 0.1);
  color: #0b5f59;
  box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.14);
  font-weight: 600;
}

.md-eg-count-field {
  max-width: 12rem;
}

.md-eg-pick-panel {
  position: sticky;
  bottom: 0.75rem;
  z-index: 5;
  margin-top: 1.15rem;
}

.md-eg-pick-panel-inner {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 1rem 1.1rem;
  border-radius: 16px;
  border: 1px solid rgba(13, 148, 136, 0.35);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 40px rgba(15, 28, 46, 0.12);
  backdrop-filter: blur(10px);
}

.md-eg-pick-title {
  margin: 0 0 0.35rem;
  font-family: var(--md-font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.35;
}

.md-idea-topic-write.md-eg-pick-btn {
  appearance: none;
  border: none;
  background: transparent;
  color: #0b5f59;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

@media (max-width: 640px) {
  .md-eg-pick-panel {
    bottom: 0.4rem;
  }
}

.md-ideas-trend-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
}

.md-ideas-trend-card.is-hot {
  border-color: rgba(220, 38, 38, 0.28);
}

@media (max-width: 1280px) {
  .md-ideas-trend-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  .md-ideas-hub .md-idea-hero-actions {
    margin-left: 0;
  }
}

@media (max-width: 768px) {
  .md-ideas-trend-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .md-ideas-hub .md-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .md-ideas-form-action {
    margin-left: 0;
    flex: 1 1 100%;
  }

  .md-ideas-form-action .md-idea-submit {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .md-ideas-tabs {
    width: 100%;
  }

  .md-ideas-tab {
    flex: 1 1 auto;
    text-align: center;
  }

  .md-ideas-hub .md-idea-hero-actions {
    width: 100%;
  }

  .md-ideas-hub .md-idea-ghost {
    flex: 1 1 calc(50% - 0.3rem);
    text-align: center;
    justify-content: center;
  }

  .md-ideas-form-grid .md-field {
    flex: 1 1 calc(50% - 0.3rem);
  }

  .md-ideas-hub .md-sort-hint {
    flex-basis: 100%;
  }
}

@media (max-width: 500px) {
  .md-ideas-hub .md-idea-hero h1 {
    font-size: 1.25rem;
  }

  .md-ideas-hub .md-stat-value {
    font-size: 0.98rem;
  }
}

/* Trends — dense workspace */
.md-trends-dense {
  padding-top: 0.85rem;
  padding-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.md-trends-dense > .md-back {
  display: none;
}

.md-trends-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  flex-wrap: wrap;
}

.md-trends-head-copy {
  min-width: 0;
  flex: 1 1 16rem;
}

.md-trends-head-copy .md-back {
  display: inline-block;
  margin-bottom: 0.2rem;
  font-size: 0.82rem;
}

.md-trends-head-copy .md-eyebrow {
  margin: 0 0 0.15rem;
  font-size: 0.7rem;
}

.md-trends-dense .md-trends-head h1 {
  margin: 0;
  font-size: clamp(1.25rem, 2vw, 1.55rem);
  line-height: 1.15;
}

.md-trends-dense .md-trends-head .md-lead {
  margin: 0.3rem 0 0;
  font-size: 0.86rem;
  line-height: 1.4;
  max-width: 36rem;
}

.md-trends-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-left: auto;
}

.md-trends-head-actions .md-btn-ghost {
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
  border-radius: 10px;
  min-height: 0;
}

.md-trends-dense .md-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.4rem;
  margin-bottom: 0;
}

.md-trends-dense .md-stat {
  padding: 0.4rem 0.65rem;
  border-radius: 10px;
  box-shadow: none;
}

.md-trends-dense .md-stat-label {
  font-size: 0.65rem;
  margin-bottom: 0.05rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.md-trends-dense .md-stat-value {
  font-size: 0.98rem;
  line-height: 1.15;
}

.md-trends-dense .md-stat-time {
  font-size: 0.88rem;
}

.md-trends-form {
  position: relative;
  max-width: none;
  width: 100%;
  margin-bottom: 0;
  padding: 0.6rem 0.75rem;
  border-radius: 14px;
}

.md-trends-form-row {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.5rem 0.55rem;
  align-items: end;
}

.md-trends-cat-field {
  flex: 1 1 14rem;
  min-width: 0;
}

.md-trends-form-row .md-idea-label,
.md-trends-form-row label {
  display: block;
  margin-bottom: 0.15rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--md-muted);
}

.md-trends-form-row .md-input {
  min-height: 2.2rem;
  padding: 0.35rem 0.55rem;
  font-size: 0.88rem;
}

.md-trends-sort-field {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.md-trends-form-action {
  flex: 0 0 auto;
  margin-left: auto;
}

.md-trends-form-action .md-btn {
  min-height: 2.2rem;
  padding: 0.4rem 0.9rem;
  font-size: 0.86rem;
  white-space: nowrap;
}

.md-trends-dense .md-trends-sort-bar {
  margin: 0;
  padding: 0.45rem 0.7rem;
  gap: 0.45rem 0.65rem;
  border-radius: 12px;
}

.md-trends-dense .md-sort-pill {
  font-size: 0.78rem;
  padding: 0.32rem 0.65rem;
  border-radius: 8px;
}

.md-trends-dense .md-sort-hint {
  margin: 0;
  flex: 1 1 12rem;
  font-size: 0.78rem;
  line-height: 1.35;
}

.md-trends-block {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.md-trends-dense .md-section-title {
  margin: 0.15rem 0 0;
  font-size: 1rem;
}

.md-trends-dense .md-topic-error,
.md-trends-dense .md-empty.md-topic-error {
  margin: 0;
  padding: 0.55rem 0.75rem;
  border-style: solid;
  border-radius: 10px;
  font-size: 0.86rem;
}

.md-trends-dense .md-topic-error p {
  margin: 0;
}

.md-trends-dense .md-feed {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
}

.md-trends-dense .md-feed-card {
  gap: 0.65rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  margin: 0;
}

.md-trends-dense .md-feed-rank {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  font-size: 0.88rem;
}

.md-trends-dense .md-feed-title {
  font-size: 0.95rem;
  margin: 0 0 0.2rem;
}

.md-trends-dense .md-feed-sapo,
.md-trends-dense .md-feed-angle,
.md-trends-dense .md-feed-time {
  font-size: 0.82rem;
  margin: 0.15rem 0 0;
  line-height: 1.4;
}

.md-trends-dense .md-feed-meta {
  margin-bottom: 0.25rem;
  gap: 0.25rem;
}

.md-trends-dense .md-topics {
  gap: 0.65rem;
}

.md-trends-dense .md-topic-card {
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  gap: 0.65rem;
}

@media (max-width: 900px) {
  .md-trends-dense .md-feed {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .md-trends-dense .md-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .md-trends-form-action {
    margin-left: 0;
    flex: 1 1 100%;
  }

  .md-trends-form-action .md-btn {
    width: 100%;
  }

  .md-trends-head-actions {
    margin-left: 0;
    width: 100%;
  }
}

@media (max-width: 500px) {
  .md-trends-dense {
    padding-left: 0.85rem;
    padding-right: 0.85rem;
  }

  .md-trends-dense .md-trends-head h1 {
    font-size: 1.2rem;
  }

  .md-trends-head-actions .md-btn-ghost {
    flex: 1 1 calc(50% - 0.25rem);
    justify-content: center;
  }

  .md-trends-dense .md-sort-hint {
    flex-basis: 100%;
  }
}

.md-draft-page {
  max-width: none;
  width: 100%;
}

.md-draft-page .md-form-draft {
  max-width: none;
}

.md-briefing {
  margin: 0.35rem 0 1rem;
  padding: 0.95rem 1rem 1rem;
  border: 1px solid var(--md-line);
  border-radius: 14px;
  background: #f8fafc;
}

.md-source-mode {
  border-color: rgba(13, 148, 136, 0.28);
  background: linear-gradient(120deg, #f8fafc 40%, #f0fdfa 100%);
}

.md-briefing-legend {
  font-family: var(--md-font-display);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  padding: 0 0.25rem;
}

.md-briefing-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem 1rem;
  margin-top: 0.65rem;
}

@media (min-width: 768px) {
  .md-briefing-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 1100px) {
  .md-briefing-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .md-briefing-channel {
    grid-column: span 1;
  }
}

.md-select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #64748b 50%), linear-gradient(135deg, #64748b 50%, transparent 50%);
  background-position: calc(100% - 16px) calc(50% - 3px), calc(100% - 11px) calc(50% - 3px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 2rem;
}

.md-channel-rules {
  margin-top: 0.85rem;
  padding: 0.75rem 0.85rem;
  border-radius: 12px;
  border: 1px dashed var(--md-line);
  background: #fff;
  font-size: 0.88rem;
  line-height: 1.45;
  color: #334155;
}

.md-channel-rules p {
  margin: 0.25rem 0;
}

.md-channel-rules strong {
  color: var(--md-ink);
}

.md-article-studio {
  margin-top: 1.5rem;
  padding: 1.25rem;
  background: var(--md-panel);
  border: 1px solid var(--md-line);
  border-radius: var(--md-radius);
  box-shadow: 0 8px 24px rgba(15, 28, 46, 0.04);
}

.md-article-studio-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 0.9rem;
}

.md-article-studio-head h2 {
  font-family: var(--md-font-display);
  font-size: 1.45rem;
  margin: 0.15rem 0 0;
  letter-spacing: -0.03em;
}

.md-article-pills,
.md-article-check {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.md-article-pill {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  background: #eef2f7;
  color: #334155;
}

.md-article-pill.is-green { background: #d9f3ee; color: #0b5f59; }
.md-article-pill.is-amber { background: #fff3d6; color: #8a5a10; }
.md-article-pill.is-red { background: #fee2e2; color: #991b1b; }

.md-article-alert {
  border: 1px solid var(--md-line);
  background: #f8fafc;
  border-radius: 12px;
  padding: 0.7rem 0.9rem;
  margin: 0 0 0.8rem;
  font-size: 0.9rem;
  line-height: 1.45;
}

.md-article-alert.is-green { background: #e5f4ef; border-color: #b7ddd1; color: var(--md-accent-deep); }
.md-article-alert.is-amber { background: #fff7e6; border-color: #f3d7a1; color: #8a5a10; }
.md-article-alert.is-red { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

.md-angle-panel {
  border: 1px dashed #93c5fd;
  background: #f0f9ff;
  border-radius: 12px;
  padding: 0.75rem 0.9rem 0.5rem;
  margin-bottom: 0.85rem;
}

.md-angle-panel label { color: #075985; }

.md-angle-input {
  background: #fff;
  border-color: #bae6fd;
}

.md-angle-banner {
  background: #f0f9ff;
  border-color: #93c5fd;
  color: #0c4a6e;
}

.md-article-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}

@media (min-width: 1024px) {
  .md-article-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
  }

  .md-article-preview {
    position: sticky;
    top: 1rem;
    max-height: calc(100vh - 2rem);
    overflow: auto;
  }
}

.md-add-to-chat {
  position: absolute;
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.7rem;
  border-radius: 10px;
  border: 1px solid rgba(15, 28, 46, 0.12);
  background: #1e1e1e;
  color: #f3f4f6;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(15, 28, 46, 0.22);
  transform: translateX(-50%);
  white-space: nowrap;
}

.md-add-to-chat:hover {
  background: #111827;
}

.md-add-to-chat-kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.72rem;
  font-weight: 500;
  opacity: 0.72;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  padding: 0.05rem 0.3rem;
}

.md-sel-chat {
  margin: 0.85rem 0 1rem;
  border: 1px solid rgba(13, 148, 136, 0.28);
  border-radius: 16px;
  background: linear-gradient(160deg, #0f172a 0%, #134e4a 120%);
  color: #e2e8f0;
  box-shadow: 0 18px 40px rgba(15, 28, 46, 0.16);
  overflow: hidden;
}

.md-sel-chat-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.9rem 1rem 0.55rem;
}

.md-sel-chat-head .md-eyebrow {
  color: #99f6e4;
  margin: 0;
}

.md-sel-chat-title {
  margin: 0.15rem 0 0;
  font-family: var(--md-font-display);
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: #f8fafc;
}

.md-sel-chat-close {
  appearance: none;
  border: none;
  background: transparent;
  color: #94a3b8;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.1rem 0.35rem;
}

.md-sel-chat-close:hover {
  color: #fff;
}

.md-sel-chat-snip {
  margin: 0 1rem 0.65rem;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.88rem;
  line-height: 1.45;
  max-height: 5.5rem;
  overflow: auto;
  white-space: pre-wrap;
}

.md-sel-chat-log {
  margin: 0 1rem;
  max-height: 14rem;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.md-sel-chat-msg {
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  font-size: 0.9rem;
  line-height: 1.45;
  white-space: pre-wrap;
}

.md-sel-chat-msg.is-user {
  align-self: flex-end;
  background: rgba(45, 212, 191, 0.18);
  border: 1px solid rgba(45, 212, 191, 0.28);
  max-width: 92%;
}

.md-sel-chat-msg.is-assistant {
  align-self: stretch;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.md-sel-chat-msg.is-system {
  align-self: stretch;
  color: #94a3b8;
  font-size: 0.82rem;
  padding: 0.2rem 0.35rem;
}

.md-sel-chat-compose {
  padding: 0.75rem 1rem 1rem;
}

.md-sel-chat-compose .md-input {
  background: rgba(15, 23, 42, 0.55);
  border-color: rgba(255, 255, 255, 0.14);
  color: #f8fafc;
}

.md-sel-chat-compose .md-input::placeholder {
  color: #94a3b8;
}

.md-sel-chat-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 0.55rem;
}

.md-sel-chat-hint {
  color: #94a3b8 !important;
  margin: 0.45rem 0 0;
}

.md-sel-chat .md-btn-ghost {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.22);
  color: #e2e8f0;
}

.md-editor {
  position: relative;
  border: 1px solid var(--md-line);
  border-radius: 16px;
  background: #fff;
  overflow: hidden;
}

.md-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.45rem 0.55rem;
  border-bottom: 1px solid var(--md-line);
  background: #f8fafc;
}

.md-editor-toolbar button {
  border: 1px solid var(--md-line);
  background: #fff;
  color: var(--md-ink);
  border-radius: 8px;
  min-width: 2.1rem;
  height: 2.1rem;
  padding: 0 0.65rem;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
}

.md-editor-toolbar button:hover,
.md-editor-toolbar button:focus-visible {
  border-color: var(--md-accent);
  color: var(--md-accent-deep);
  outline: none;
}

.md-editor-surface {
  min-height: 52vh;
  max-height: none;
  padding: 1.15rem 1.25rem 1.5rem;
  overflow: auto;
  line-height: 1.65;
  font-size: 1.02rem;
}

.md-editor-surface.md-prose img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
  background: #eef2f7;
  margin: 0.85rem 0 0.25rem;
}

.md-editor-surface.md-prose em {
  display: block;
  margin: 0.25rem 0 1rem;
  color: var(--md-muted);
  font-size: 0.82rem;
  font-style: italic;
}

.md-editor-surface:focus {
  outline: 2px solid rgba(15, 118, 110, 0.28);
  outline-offset: -2px;
}

.md-editor-surface h2,
.md-editor-surface h3 {
  display: block;
  font-family: var(--md-font-display);
  font-weight: 700;
  line-height: 1.3;
  margin: 1.15rem 0 0.45rem;
}

.md-editor-surface h2 { font-size: 1.35rem; }
.md-editor-surface h3 { font-size: 1.2rem; }

.md-editor-source {
  display: none;
}

.md-article-form,
.md-article-preview {
  border: 1px solid var(--md-line);
  border-radius: 16px;
  padding: 1rem;
  background: #fff;
}

.md-article-body-input {
  min-height: 280px;
  font-size: 0.92rem;
}

.md-article-preview h3 {
  font-family: var(--md-font-display);
  font-size: 1.45rem;
  line-height: 1.25;
  letter-spacing: -0.03em;
  margin: 0.4rem 0 0.55rem;
}

.md-article-sapo {
  font-size: 1.02rem;
  line-height: 1.5;
  color: #334155;
  margin: 0 0 0.8rem;
}

.md-article-hero {
  margin: 0 0 0.8rem;
}

.md-article-hero img,
.md-article-preview .md-prose img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  display: block;
  background: #eef2f7;
  margin: 0.85rem 0 0.25rem;
}

.md-article-hero figcaption,
.md-article-preview .md-prose em {
  display: block;
  margin: 0.25rem 0 1rem;
  color: var(--md-muted);
  font-size: 0.82rem;
  font-style: italic;
}

.md-article-hero-empty {
  display: grid;
  place-items: center;
  min-height: 140px;
  border: 1px dashed var(--md-line);
  border-radius: 12px;
  color: var(--md-muted);
  background: #f8fafc;
}

.md-article-sources {
  white-space: pre-wrap;
}

.md-article-check {
  list-style: none;
  margin: 0.9rem 0 0;
  padding: 0;
}

.md-article-check li {
  background: #f8fafc;
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.82rem;
  color: #334155;
}


/* ===== Editor analytics workspace ===== */
.md-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0.85rem 0 1.1rem;
}

.md-banner {
  border-radius: 14px;
  padding: 0.75rem 1rem;
  margin: 0 0 1rem;
  font-size: 0.92rem;
  font-weight: 600;
}

.md-banner a {
  margin-left: 0.4rem;
  color: inherit;
  font-weight: 700;
}

.md-banner-warn {
  background: rgba(194, 65, 12, 0.12);
  color: #9a3412;
  border: 1px solid rgba(194, 65, 12, 0.25);
}

.md-banner-info {
  background: rgba(2, 132, 199, 0.1);
  color: #075985;
  border: 1px solid rgba(2, 132, 199, 0.22);
}

.md-banner-ok {
  background: rgba(15, 118, 110, 0.12);
  color: #0b5f59;
  border: 1px solid rgba(15, 118, 110, 0.25);
}

.md-stats-ga {
  margin-bottom: 0.75rem;
}

.md-action-box {
  background: var(--md-panel);
  border: 1px solid var(--md-line);
  border-radius: var(--md-radius);
  box-shadow: var(--md-shadow);
  padding: 1rem 1.2rem;
  margin: 0 0 1.25rem;
}

.md-action-box h2 {
  font-family: var(--md-font-display);
  font-size: 1.05rem;
  margin: 0 0 0.55rem;
}

.md-action-box ol,
.md-action-box ul {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--md-muted);
}

.md-action-box li {
  margin: 0.35rem 0;
}

.md-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 0 0 1.5rem;
}

.md-chart-card {
  background: var(--md-panel);
  border: 1px solid var(--md-line);
  border-radius: var(--md-radius);
  box-shadow: var(--md-shadow);
  padding: 1rem 1.1rem 0.85rem;
}

.md-chart-card h3 {
  font-family: var(--md-font-display);
  font-size: 0.95rem;
  margin: 0 0 0.65rem;
  letter-spacing: -0.02em;
}

.md-chart-wide {
  grid-column: 1 / -1;
}

.md-table-card {
  background: var(--md-panel);
  border: 1px solid var(--md-line);
  border-radius: var(--md-radius);
  box-shadow: var(--md-shadow);
  padding: 1rem 1.15rem 1.2rem;
  margin: 0 0 1.25rem;
}

.md-table-card h2 {
  font-family: var(--md-font-display);
  font-size: 1.1rem;
  margin: 0 0 0.75rem;
}

.md-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.md-table th,
.md-table td {
  border-bottom: 1px solid var(--md-line);
  padding: 0.55rem 0.45rem;
  text-align: left;
  vertical-align: top;
}

.md-table th {
  color: var(--md-muted);
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.md-table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.md-mono {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.8rem;
  word-break: break-all;
}

.md-engage-list {
  display: grid;
  gap: 0.75rem;
}

.md-engage-item {
  border: 1px solid var(--md-line);
  border-radius: 14px;
  padding: 0.85rem 1rem;
  background: #f8fafc;
}

.md-engage-item h3 {
  font-size: 1rem;
  margin: 0.35rem 0;
}

.md-engage-item p {
  margin: 0 0 0.4rem;
  color: var(--md-muted);
  font-size: 0.9rem;
}

.md-prio {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--md-accent-soft);
  color: var(--md-accent-deep);
}

.md-prio-cao { background: var(--md-hot-soft); color: var(--md-hot); }
.md-prio-th?p, .md-prio-thap { background: #e2e8f0; color: #475569; }

.md-split-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.md-simple-list {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--md-muted);
}

.md-simple-list li {
  margin: 0.4rem 0;
}

.md-muted { color: var(--md-muted); }

.md-status {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #e2e8f0;
  color: #334155;
}

.md-status-proposed { background: rgba(180, 83, 9, 0.12); color: #b45309; }
.md-status-confirmed { background: rgba(2, 132, 199, 0.12); color: #0369a1; }
.md-status-developed { background: rgba(91, 110, 225, 0.14); color: #4338ca; }
.md-status-review { background: rgba(2, 132, 199, 0.16); color: #075985; }
.md-status-done { background: rgba(15, 118, 110, 0.12); color: #0b5f59; }
.md-status-rejected { background: rgba(190, 18, 60, 0.12); color: #be123c; }
.md-status-pending { background: rgba(100, 116, 139, 0.14); color: #475569; }

.md-manager-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.85rem;
  margin: 1.25rem 0 1.5rem;
}

.md-manager-kpi {
  background: var(--md-panel);
  border: 1px solid var(--md-line);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  box-shadow: var(--md-shadow);
}

a.md-manager-kpi {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
  cursor: pointer;
}

a.md-manager-kpi:hover,
a.md-manager-kpi:focus-visible {
  border-color: var(--md-teal, #0f766e);
  box-shadow: 0 4px 14px rgba(15, 118, 110, 0.12);
  transform: translateY(-1px);
  outline: none;
}

a.md-manager-kpi.is-warn:hover,
a.md-manager-kpi.is-warn:focus-visible {
  border-color: var(--md-hot);
  box-shadow: 0 4px 14px rgba(190, 18, 60, 0.12);
}

.md-manager-kpi strong {
  display: block;
  font-family: var(--md-font-display);
  font-size: 1.75rem;
  letter-spacing: -0.03em;
  margin-top: 0.25rem;
}

.md-manager-kpi-label {
  color: var(--md-muted);
  font-size: 0.85rem;
  font-weight: 600;
}

.md-manager-kpi.is-warn strong { color: var(--md-hot); }

.md-work-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.1rem;
}

.md-work-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--md-line);
  background: var(--md-panel);
  color: var(--md-text, #0f172a);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
}

.md-work-chip:hover,
.md-work-chip:focus-visible {
  border-color: var(--md-teal, #0f766e);
  outline: none;
}

.md-work-chip.is-active {
  background: #0f766e;
  border-color: #0f766e;
  color: #fff;
}

.md-work-chip.is-warn.is-active {
  background: var(--md-hot, #be123c);
  border-color: var(--md-hot, #be123c);
}

.md-mq-table tr.is-overdue-row td { background: rgba(190, 18, 60, 0.04); }
.md-overdue { color: var(--md-hot, #be123c); font-weight: 600; }

.md-manager-filters {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.85rem;
  width: 100%;
  margin-bottom: 0.85rem;
  padding: 0.45rem 0.7rem;
  background: #fff;
  border: 1px solid var(--md-line);
  border-radius: 12px;
}

.md-manager-filters .md-assign-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
  flex: 1 1 auto;
  min-width: 0;
}

.md-manager-filter-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  flex: 0 0 auto;
}

.md-manager-filters .md-field {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  flex: 0 0 auto;
  width: auto;
}

.md-manager-filters .md-field.md-field-grow {
  flex: 1 1 11rem;
  min-width: 10rem;
  max-width: 16rem;
}

.md-manager-filters .md-field label {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--md-muted);
  white-space: nowrap;
  line-height: 1.2;
}

.md-manager-filters .md-input {
  padding: 0.38rem 0.55rem;
  border-radius: 9px;
  width: 4.75rem;
  font-size: 0.9rem;
}

.md-manager-filters .md-field.md-field-grow .md-input {
  width: 100%;
  min-width: 0;
}

.md-manager-filters .md-btn {
  width: auto;
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 0.38rem 0.8rem;
  border-radius: 9px;
  font-size: 0.86rem;
}

@media (max-width: 500px) {
  .md-manager-filters {
    align-items: stretch;
  }

  .md-manager-filters .md-assign-grid,
  .md-manager-filter-actions {
    width: 100%;
  }

  .md-manager-filters .md-field,
  .md-manager-filters .md-field.md-field-grow {
    flex: 1 1 100%;
    max-width: none;
    min-width: 0;
  }

  .md-manager-filters .md-input,
  .md-manager-filters .md-field.md-field-grow .md-input {
    flex: 1 1 auto;
    width: auto;
  }

  .md-manager-filter-actions .md-btn {
    flex: 1 1 auto;
  }
}

.md-manager-tools {
  margin-top: 0.5rem;
}

.md-manager-dept-total {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.25rem;
  align-items: center;
  padding: 0.7rem 0.95rem;
  border-radius: 12px;
  border: 1px solid var(--md-line);
  background: var(--md-panel);
  margin-bottom: 1rem;
}

.md-manager-dept-nums {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  color: var(--md-muted);
  font-size: 0.92rem;
}

.md-health {
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
}

.health-success, .md-health.health-success { color: #0b5f59; background: rgba(15, 118, 110, 0.12); }
.health-warning, .md-health.health-warning { color: #b45309; background: rgba(180, 83, 9, 0.12); }
.health-danger, .md-health.health-danger { color: #be123c; background: rgba(190, 18, 60, 0.12); }
.health-muted, .md-health.health-muted { color: #64748b; background: rgba(100, 116, 139, 0.12); }

.md-banner-warn {
  background: rgba(180, 83, 9, 0.12);
  color: #9a3412;
  border: 1px solid rgba(180, 83, 9, 0.25);
}

.md-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.md-section-title {
  font-family: var(--md-font-display);
  font-size: 1.2rem;
  margin: 1.5rem 0 0.75rem;
}

@media (max-width: 1024px) {
  .md-chart-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .md-chart-grid,
  .md-split-2 {
    grid-template-columns: 1fr;
  }
  .md-chart-wide {
    grid-column: auto;
  }

  .md-editor-actions {
    flex-wrap: wrap;
  }

  .md-editor-actions form {
    flex: 1 1 100%;
  }

  .md-editor-actions form .md-btn {
    width: 100%;
  }

  .md-table {
    font-size: 0.82rem;
  }
}

@media (max-width: 500px) {
  .md-page {
    padding: 1rem 0.85rem 2.5rem;
  }

  .md-stats.md-stats-ga,
  .md-stats {
    grid-template-columns: 1fr 1fr;
  }

  .md-chart-card {
    padding: 0.85rem;
  }
}

@media (max-width: 380px) {
  .md-stats.md-stats-ga,
  .md-stats {
    grid-template-columns: 1fr;
  }
}

/* ===== Analytics dense dashboard (1 viewport) ===== */
.md-analytics-dense {
  padding-top: 0.85rem;
  padding-bottom: 1.25rem;
  min-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.md-an-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.md-an-toolbar-left {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  flex-wrap: wrap;
  min-width: 0;
}

.md-an-toolbar-left h1 {
  font-family: var(--md-font-display);
  font-size: 1.25rem;
  margin: 0;
  letter-spacing: -0.02em;
}

.md-an-back {
  margin: 0;
  font-size: 0.82rem;
}

.md-an-meta {
  color: var(--md-muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.md-an-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.md-an-chips {
  display: flex;
  gap: 0.3rem;
}

.md-an-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--md-line);
  background: #fff;
  color: var(--md-ink);
  font-size: 0.78rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.md-an-chip.is-active,
.md-an-chip-sync {
  background: var(--md-accent);
  border-color: var(--md-accent);
  color: #fff;
}

.md-an-chip-sync {
  border: 0;
}

.md-banner-compact {
  padding: 0.45rem 0.75rem;
  margin: 0;
  font-size: 0.82rem;
}

.md-an-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
}

.md-an-kpi {
  background: var(--md-panel);
  border: 1px solid var(--md-line);
  border-radius: 12px;
  padding: 0.55rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-height: 0;
}

.md-an-kpi-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--md-muted);
}

.md-an-kpi-value {
  font-family: var(--md-font-display);
  font-size: clamp(1.05rem, 1.6vw, 1.35rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.md-an-main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(160px, 0.7fr) minmax(160px, 0.7fr);
  grid-template-rows: clamp(150px, 26vh, 220px) minmax(200px, 1fr);
  gap: 0.5rem;
}

.md-an-box {
  background: var(--md-panel);
  border: 1px solid var(--md-line);
  border-radius: 12px;
  padding: 0.55rem 0.7rem 0.6rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  box-shadow: 0 4px 14px rgba(15, 28, 46, 0.04);
}

.md-an-box h3 {
  font-family: var(--md-font-display);
  font-size: 0.82rem;
  margin: 0 0 0.35rem;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.md-an-count {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--md-muted);
}

.md-an-chart {
  flex: 1;
  min-height: 110px;
  position: relative;
}

.md-an-chart-sm {
  min-height: 100px;
}

.md-an-traffic { grid-column: 1; grid-row: 1; }
.md-an-donut { grid-row: 1; }
.md-an-insights { grid-column: 1; grid-row: 2; }
.md-an-pages { grid-column: 2 / span 2; grid-row: 2; }

.md-an-insights ul {
  margin: 0;
  padding-left: 1rem;
  color: var(--md-muted);
  font-size: 0.8rem;
  line-height: 1.4;
  overflow: auto;
  max-height: 100%;
}

.md-an-insights li {
  margin: 0.25rem 0;
}

.md-an-table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.md-an-table {
  font-size: 0.78rem;
}

.md-an-table th,
.md-an-table td {
  padding: 0.35rem 0.35rem;
  vertical-align: top;
}

.md-an-title {
  display: block;
  font-weight: 700;
  color: var(--md-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 42vw;
}

.md-an-path {
  display: block;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.68rem;
  color: var(--md-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 42vw;
}

.md-an-empty {
  font-size: 0.85rem;
  padding: 0.75rem 0;
}

@media (max-width: 1100px) {
  .md-an-main {
    grid-template-columns: 1.2fr 1fr;
    grid-template-rows: clamp(140px, 22vh, 200px) clamp(140px, 22vh, 200px) minmax(220px, 1fr);
  }
  .md-an-traffic { grid-column: 1; grid-row: 1; }
  .md-an-donut:nth-of-type(2) { grid-column: 2; grid-row: 1; }
  .md-an-donut:nth-of-type(3) { grid-column: 2; grid-row: 2; }
  .md-an-insights { grid-column: 1; grid-row: 2; max-height: none; }
  .md-an-pages { grid-column: 1 / -1; grid-row: 3; max-height: 280px; }
}

@media (max-width: 720px) {
  .md-an-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .md-an-main {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
  }
  .md-an-traffic { grid-column: 1 / -1; min-height: 150px; }
  .md-an-donut { min-height: 150px; grid-column: auto; grid-row: auto; }
  .md-an-insights { grid-column: 1 / -1; max-height: 120px; grid-row: auto; }
  .md-an-pages { grid-column: 1 / -1; max-height: 260px; grid-row: auto; }
  .md-an-title,
  .md-an-path { max-width: 70vw; }
}

@media (max-width: 380px) {
  .md-an-kpis {
    grid-template-columns: 1fr 1fr;
  }
}

/* ===== Editor home dense dashboard ===== */
.md-ed-dense {
  padding-top: 0.85rem;
  padding-bottom: 1rem;
  min-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.md-ed-kpis {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 0.4rem;
}

.md-ed-kpis .md-an-kpi-value.is-on { color: var(--md-accent-deep); }
.md-ed-kpis .md-an-kpi-value.is-off { color: var(--md-hot); }

.md-ed-main {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(140px, 0.65fr) minmax(140px, 0.65fr) minmax(220px, 0.9fr);
  grid-template-rows: clamp(140px, 24vh, 200px) minmax(180px, 1fr);
  gap: 0.5rem;
}

.md-ed-traffic { grid-column: 1; grid-row: 1; }
.md-ed-channel { grid-column: 2; grid-row: 1; }
.md-ed-device { grid-column: 3; grid-row: 1; }
.md-ed-trend { grid-column: 1 / span 2; grid-row: 2; }
.md-ed-publisher { grid-column: 3; grid-row: 2; }
.md-ed-side { grid-column: 4; grid-row: 1 / span 2; }

.md-ed-actions {
  margin: 0 0 0.5rem;
  padding-left: 1rem;
  font-size: 0.78rem;
  color: var(--md-muted);
  line-height: 1.35;
  max-height: 38%;
  overflow: auto;
}

.md-ed-actions li { margin: 0.2rem 0; }

.md-ed-hot-title {
  margin-top: 0.35rem !important;
}

.md-ed-hot-title a {
  color: var(--md-accent);
  text-decoration: none;
  font-size: 0.78rem;
}

.md-ed-hot {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: auto;
  flex: 1;
  min-height: 0;
}

.md-ed-hot li {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 0.35rem;
  align-items: start;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--md-line);
  font-size: 0.78rem;
}

.md-ed-hot a {
  color: var(--md-ink);
  text-decoration: none;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.md-ed-hot a:hover { color: var(--md-accent-deep); }

.md-ed-score {
  font-family: var(--md-font-display);
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--md-hot);
}

@media (max-width: 1200px) {
  .md-ed-kpis {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .md-ed-main {
    grid-template-columns: 1.2fr 1fr 1fr;
    grid-template-rows: clamp(130px, 20vh, 180px) clamp(130px, 20vh, 180px) minmax(200px, 1fr);
  }
  .md-ed-traffic { grid-column: 1; grid-row: 1; }
  .md-ed-channel { grid-column: 2; grid-row: 1; }
  .md-ed-device { grid-column: 3; grid-row: 1; }
  .md-ed-trend { grid-column: 1 / span 2; grid-row: 2; }
  .md-ed-publisher { grid-column: 3; grid-row: 2; }
  .md-ed-side {
    grid-column: 1 / -1;
    grid-row: 3;
    max-height: 240px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }
  .md-ed-side h3:first-child { grid-column: 1; }
  .md-ed-actions { grid-column: 1; max-height: none; }
  .md-ed-hot-title { grid-column: 2; grid-row: 1; margin-top: 0 !important; }
  .md-ed-hot { grid-column: 2; grid-row: 2; }
}

@media (max-width: 720px) {
  .md-ed-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .md-ed-main {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto;
  }
  .md-ed-traffic,
  .md-ed-trend,
  .md-ed-side { grid-column: 1 / -1; grid-row: auto; max-height: none; }
  .md-ed-channel,
  .md-ed-device,
  .md-ed-publisher { min-height: 150px; grid-column: auto; grid-row: auto; }
  .md-ed-side { display: flex; flex-direction: column; }
  .md-an-toolbar-right .md-an-chips {
    overflow-x: auto;
    max-width: 100%;
  }
}

/* ========== AI News Digest ========== */
.md-digest-body {
  --md-d-ink: #102033;
  --md-d-muted: #5b6b7c;
  --md-d-line: rgba(16, 32, 51, 0.12);
  --md-d-accent: #0f766e;
  --md-d-accent-2: #0369a1;
  --md-d-paper: #f3f6f9;
  --md-d-card: rgba(255, 255, 255, 0.9);
}

.md-digest-body .md-topbar {
  background: rgba(243, 246, 249, 0.82);
  border-bottom-color: var(--md-d-line);
}

.md-digest-body .md-topbar-inner,
.md-digest-body .md-main {
  max-width: none;
  width: 100%;
}

.md-digest-body .md-main {
  padding: 0;
  min-height: calc(100vh - 64px);
}

.md-digest {
  position: relative;
  isolation: isolate;
  min-height: calc(100vh - 64px);
  overflow-x: clip;
  color: var(--md-d-ink);
  background: var(--md-d-paper);
}

.md-digest-atmosphere {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(1000px 480px at 8% -8%, rgba(15, 118, 110, 0.18), transparent 55%),
    radial-gradient(900px 420px at 96% 0%, rgba(3, 105, 161, 0.14), transparent 50%),
    linear-gradient(180deg, #eef3f7 0%, #f3f6f9 42%, #f7f9fb 100%);
}

.md-digest-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: clamp(1rem, 2.5vw, 2.25rem);
  padding-bottom: 3rem;
}

.md-digest-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
  animation: md-digest-rise 0.5s ease both;
}

.md-digest-back {
  display: inline-block;
  margin-bottom: 0.4rem;
  color: var(--md-d-muted);
  text-decoration: none;
  font-size: 0.92rem;
}

.md-digest-back:hover { color: var(--md-d-accent); }

.md-digest-kicker {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--md-d-accent);
  font-weight: 700;
}

.md-digest-hero h1 {
  margin: 0;
  font-size: clamp(1.55rem, 2.6vw, 2.35rem);
  line-height: 1.2;
  font-weight: 750;
  max-width: 40rem;
}

.md-digest-body .md-digest-lead {
  margin: 0.55rem 0 0;
  color: var(--md-d-muted);
  font-size: 0.98rem;
  line-height: 1.5;
  max-width: 46rem;
}

.md-digest-meta {
  margin: 0.65rem 0 0;
  color: var(--md-d-muted);
  font-size: 0.95rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  align-items: center;
}

.md-digest-meta code {
  font-size: 0.85em;
  background: rgba(15, 118, 110, 0.08);
  padding: 0.1rem 0.35rem;
  border-radius: 0.3rem;
}

.md-digest-dot { opacity: 0.45; }

.md-digest-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.md-digest-btn {
  appearance: none;
  border: 1px solid var(--md-d-line);
  background: #fff;
  color: var(--md-d-ink);
  border-radius: 0.55rem;
  padding: 0.55rem 0.95rem;
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.md-digest-btn:hover { border-color: rgba(15, 118, 110, 0.35); transform: translateY(-1px); }
.md-digest-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.md-digest-btn-primary {
  background: linear-gradient(135deg, #0f766e, #0e7490);
  border-color: transparent;
  color: #fff;
}

.md-digest-btn-ghost { background: rgba(255, 255, 255, 0.7); }

.md-digest-filters {
  display: grid;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border: 1px solid var(--md-d-line);
  border-radius: 0.9rem;
  background: var(--md-d-card);
  backdrop-filter: blur(8px);
  margin-bottom: 1.25rem;
  animation: md-digest-rise 0.55s ease 0.05s both;
}

.md-digest-prompt-block {
  display: grid;
  gap: 0.45rem;
}

.md-digest-prompt-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.65rem;
  align-items: stretch;
}

.md-digest-prompt {
  width: 100%;
  min-height: 3.4rem;
  resize: vertical;
  border: 1px solid var(--md-d-line);
  border-radius: 0.75rem;
  padding: 0.75rem 0.9rem;
  font-size: 1rem;
  line-height: 1.45;
  color: var(--md-d-ink);
  background: #fff;
  font-family: inherit;
}

.md-digest-prompt:focus {
  outline: 2px solid rgba(15, 118, 110, 0.35);
  border-color: rgba(15, 118, 110, 0.55);
}

.md-digest-prompt-go {
  align-self: stretch;
  min-width: 7.5rem;
  white-space: nowrap;
}

.md-digest-prompt-hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--md-d-muted);
}

.md-digest-filter-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--md-d-muted);
  margin-bottom: 0.45rem;
}

.md-digest-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.md-digest-chip {
  border: 1px solid var(--md-d-line);
  background: #fff;
  color: var(--md-d-ink);
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.md-digest-chip.is-active {
  background: rgba(15, 118, 110, 0.12);
  border-color: rgba(15, 118, 110, 0.45);
  color: #0f5f59;
}

.md-digest-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
}

.md-digest-limit {
  display: grid;
  gap: 0.3rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--md-d-muted);
}

.md-digest-limit select {
  min-width: 5.5rem;
  border: 1px solid var(--md-d-line);
  border-radius: 0.5rem;
  padding: 0.45rem 0.6rem;
  background: #fff;
  color: var(--md-d-ink);
}

.md-digest-status {
  margin: 0 0 0.85rem;
  padding: 0.65rem 0.85rem;
  border-radius: 0.6rem;
  font-size: 0.92rem;
}

.md-digest-status.is-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.md-digest-status.is-ok {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.md-digest-alert {
  margin: 0 0 0.85rem;
  padding: 0.75rem 0.95rem;
  border-radius: 0.65rem;
}

.md-digest-alert-error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.md-digest-warnings {
  margin: 0 0 1rem;
  padding-left: 1.15rem;
  color: #92400e;
  font-size: 0.9rem;
}

.md-digest-loading {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin: 0 0 1rem;
  color: var(--md-d-muted);
}

.md-digest-spinner {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  border: 2px solid rgba(15, 118, 110, 0.2);
  border-top-color: var(--md-d-accent);
  animation: md-digest-spin 0.8s linear infinite;
}

.md-digest-list {
  display: grid;
  gap: 0.95rem;
}

.md-digest-item {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 0.95rem;
  align-items: start;
  padding: 1.1rem 1.2rem;
  border: 1px solid var(--md-d-line);
  border-radius: 0.9rem;
  background: var(--md-d-card);
  animation: md-digest-rise 0.45s ease both;
}

.md-digest-item .md-digest-body {
  min-width: 0;
}

.md-digest-item .md-digest-thumb {
  width: 132px;
  height: 88px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.06);
  border: 1px solid var(--md-d-line);
  text-decoration: none;
  color: inherit;
}

.md-digest-item .md-digest-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.md-digest-item .md-digest-thumb-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--md-d-muted, #64748b);
  text-align: center;
  padding: 0.35rem;
}

.md-digest-item-title-link {
  color: inherit;
  text-decoration: none;
}

.md-digest-item-title-link:hover {
  text-decoration: underline;
  color: var(--md-d-accent-2, #0369a1);
}

.md-digest-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
  align-items: center;
}

.md-digest-cat {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--md-d-accent-2);
  background: rgba(3, 105, 161, 0.1);
  padding: 0.2rem 0.5rem;
  border-radius: 0.35rem;
}

.md-digest-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 0.35rem;
  border: 1px solid transparent;
}

.md-digest-badge-ok {
  color: #065f46;
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.md-digest-badge-warn {
  color: #92400e;
  background: #fff7ed;
  border-color: #fed7aa;
}

.md-digest-score {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 650;
  color: var(--md-d-muted);
  background: rgba(16, 32, 51, 0.05);
  padding: 0.2rem 0.5rem;
  border-radius: 0.35rem;
}

.md-digest-item-title {
  margin: 0 0 0.45rem;
  font-size: clamp(1.05rem, 1.5vw, 1.28rem);
  line-height: 1.35;
  font-weight: 750;
}

.md-digest-summary {
  margin: 0 0 0.65rem;
  color: #334155;
  line-height: 1.55;
  font-size: 0.98rem;
}

.md-digest-source {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  color: var(--md-d-muted);
  font-size: 0.88rem;
  margin-bottom: 0.55rem;
}

.md-digest-sources {
  list-style: none;
  margin: 0 0 0.85rem;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.md-digest-source-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.65rem;
  font-size: 0.9rem;
  line-height: 1.4;
}

.md-digest-source-row a {
  color: var(--md-d-accent-2);
  text-decoration: none;
  font-weight: 600;
  word-break: break-word;
}

.md-digest-source-row a:hover { text-decoration: underline; }

.md-digest-url-badge {
  flex: 0 0 auto;
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 0.15rem 0.4rem;
  border-radius: 0.3rem;
  border: 1px solid transparent;
}

.md-digest-url-ok {
  color: #065f46;
  background: #ecfdf5;
  border-color: #a7f3d0;
}

.md-digest-url-warn {
  color: #92400e;
  background: #fff7ed;
  border-color: #fed7aa;
}

.md-digest-url-bad {
  color: #991b1b;
  background: #fef2f2;
  border-color: #fecaca;
}

.md-digest-url-mute {
  color: #475569;
  background: #f1f5f9;
  border-color: #e2e8f0;
}

.md-digest-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.md-digest-draft-link {
  font-size: 0.88rem;
  padding: 0.45rem 0.8rem;
}

.md-digest-empty {
  padding: 2rem 1.25rem;
  border: 1px dashed var(--md-d-line);
  border-radius: 0.9rem;
  background: rgba(255, 255, 255, 0.65);
  color: var(--md-d-muted);
  text-align: center;
}

.md-digest-empty-hint { font-size: 0.9rem; margin-top: 0.35rem; }

@keyframes md-digest-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@keyframes md-digest-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 768px) {
  .md-digest-prompt-row {
    grid-template-columns: 1fr;
  }

  .md-digest-prompt-go {
    width: 100%;
  }

  .md-digest-hero-actions,
  .md-digest-filter-row {
    width: 100%;
  }

  .md-digest-btn {
    flex: 1 1 auto;
    text-align: center;
    justify-content: center;
  }

  .md-digest-hero h1 {
    font-size: clamp(1.35rem, 6vw, 1.8rem);
  }
}

@media (max-width: 500px) {
  .md-digest-shell {
    padding: 0.85rem;
  }

  .md-digest-chip {
    padding: 0.35rem 0.7rem;
    font-size: 0.85rem;
  }

  .md-digest-item {
    grid-template-columns: 1fr;
    padding: 0.9rem;
  }

  .md-digest-item .md-digest-thumb {
    width: 100%;
    height: 160px;
  }
}

/* —— Editor Assign workspace —— */
.md-assign-page {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding-top: 1rem;
  padding-bottom: 1.5rem;
}

.md-assign-page > .md-banner,
.md-assign-page > .md-assign-idea,
.md-assign-page > .md-assign-form,
.md-assign-page > .md-assign-list {
  margin-bottom: 0;
}

.md-assign-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.md-assign-head-text {
  min-width: 0;
  flex: 1 1 18rem;
}

.md-assign-head-text .md-back {
  display: inline-block;
  margin-bottom: 0.15rem;
}

.md-assign-head-text h1 {
  margin: 0.1rem 0 0.25rem;
  font-size: clamp(1.45rem, 2.4vw, 1.9rem);
}

.md-assign-head-text .md-lead {
  margin: 0;
  max-width: 40rem;
  font-size: 0.92rem;
}

.md-assign-head-stat {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--md-line);
  border-radius: 12px;
  background: var(--md-panel);
  min-width: 6.5rem;
}

.md-assign-head-stat strong {
  font-family: var(--md-font-display);
  font-size: 1.35rem;
  line-height: 1;
  color: var(--md-accent-deep);
}

.md-assign-head-stat span {
  font-size: 0.78rem;
  color: var(--md-muted);
  font-weight: 600;
}

.md-assign-idea {
  border: 1px solid var(--md-line);
  border-left: 4px solid #0f766e;
  border-radius: 14px;
  padding: 0.85rem 1rem 0.9rem;
  background: #f4fbf8;
}

.md-assign-idea h2 {
  margin: 0.15rem 0 0.35rem;
  font-size: 1.15rem;
  line-height: 1.35;
}

.md-assign-idea-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.85rem;
  margin-bottom: 0.15rem;
}

.md-assign-idea-brief,
.md-assign-idea-angle {
  margin: 0.3rem 0 0;
  white-space: pre-wrap;
  line-height: 1.5;
  font-size: 0.92rem;
}

.md-assign-form {
  gap: 0;
}

.md-assign-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.9fr);
  gap: 0.85rem;
  align-items: stretch;
  width: 100%;
}

.md-assign-main,
.md-assign-people {
  min-width: 0;
}

.md-assign-panel {
  background: var(--md-panel);
  border: 1px solid var(--md-line);
  border-radius: 14px;
  box-shadow: var(--md-shadow);
  padding: 0.95rem 1.05rem 1.05rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  height: 100%;
  box-sizing: border-box;
}

.md-assign-panel-title {
  font-family: var(--md-font-display);
  font-size: 1rem;
  margin: 0;
  letter-spacing: -0.02em;
}

.md-assign-panel .md-field {
  margin: 0;
}

.md-assign-panel .md-assign-grid {
  gap: 0.7rem;
}

.md-assign-grid-3 {
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 0.7fr);
}

.md-assign-actions {
  margin: 0.15rem 0 0;
}

.md-assign-people-panel {
  min-height: 0;
  position: sticky;
  top: 0.75rem;
  max-height: calc(100vh - 5.5rem);
}

.md-assign-people-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.md-assign-user-count {
  padding: 0 !important;
  font-size: 0.82rem !important;
  font-weight: 700;
  color: var(--md-accent-deep) !important;
  white-space: nowrap;
}

.md-assign-people-search {
  margin: 0;
}

.md-assign-dir-note {
  margin: -0.25rem 0 0;
  font-size: 0.8rem;
  line-height: 1.4;
}

.md-assign-users {
  border: 1px solid var(--md-line);
  border-radius: 12px;
  max-height: min(52vh, 420px);
  overflow: auto;
  background: #fff;
  margin: 0;
  flex: 1 1 auto;
  min-height: 220px;
}

.md-assign-user-option {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.42rem 0.65rem;
  border-bottom: 1px solid var(--md-line);
  cursor: pointer;
  margin: 0;
}

.md-assign-user-option:last-child {
  border-bottom: 0;
}

.md-assign-user-option:hover {
  background: #f8fafc;
}

.md-assign-user-option:has(input:checked) {
  background: #ecfdf8;
}

.md-assign-user-option input {
  margin-top: 0.22rem;
  flex: 0 0 auto;
}

.md-assign-user-option[hidden] {
  display: none !important;
}

.md-assign-list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.md-assign-list-head h2 {
  margin: 0;
}

.md-assign-list .tbl-scroll {
  max-height: min(48vh, 480px);
  overflow: auto;
}

@media (max-width: 900px) {
  .md-assign-grid-3 {
    grid-template-columns: 1fr 1fr;
  }

  .md-assign-grid-3 .md-field:first-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 768px) {
  .md-assign-workspace {
    grid-template-columns: 1fr;
  }

  .md-assign-people-panel {
    position: static;
    max-height: none;
  }

  .md-assign-users {
    max-height: min(40vh, 320px);
    min-height: 180px;
  }

  .md-assign-grid-3 {
    grid-template-columns: 1fr;
  }

  .md-assign-grid-3 .md-field:first-child {
    grid-column: auto;
  }
}

@media (max-width: 500px) {
  .md-assign-head-stat {
    width: 100%;
    align-items: flex-start;
    flex-direction: row;
    justify-content: space-between;
  }

  .md-assign-panel {
    padding: 0.85rem 0.9rem;
  }

  .md-assign-actions .md-btn {
    flex: 1 1 auto;
  }
}

.md-work-list {
  display: grid;
  gap: 0.75rem;
}

.md-work-card {
  display: grid;
  gap: 0.3rem;
  padding: 0.95rem 1.05rem;
  border: 1px solid var(--md-line);
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
  background: #fff;
}

.md-work-card:hover {
  border-color: var(--md-accent);
}

.md-work-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.md-work-card-top strong {
  font-size: 1.02rem;
  line-height: 1.35;
}

.md-work-note {
  margin: 0;
  color: var(--md-muted);
  font-size: 0.9rem;
}

.md-work-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem 1rem;
  margin-top: 0.35rem;
}

.md-work-confirm {
  display: inline;
  margin: 0;
}

.md-work-confirm .md-btn {
  padding: 0.4rem 0.9rem;
  font-size: 0.88rem;
}

.md-work-open {
  color: var(--md-accent);
  font-weight: 700;
  font-size: 0.88rem;
  text-decoration: none;
}

.md-work-open:hover {
  text-decoration: underline;
}

.md-work-done-hint {
  color: var(--md-muted);
  font-weight: 600;
  cursor: default;
}

.md-work-done-hint:hover {
  text-decoration: none;
}

@media (max-width: 720px) {
  .md-work-card-top {
    flex-direction: column;
  }

  .md-work-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .md-assign-grid {
    grid-template-columns: 1fr;
  }
}

/* —— Quản lý tòa soạn (ThuVien Dashboard embed) —— */
.md-body.md-embed-body .md-main {
  min-height: calc(100vh - 64px);
  padding: 0;
}

.md-newsroom {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: calc(100vh - 64px);
}

.md-newsroom-bare {
  background: #0f1c2e;
}

.md-newsroom-frame {
  display: block;
  width: 100%;
  border: 0;
  background: #fff;
}

.md-newsroom-frame-full {
  height: calc(100vh - 64px);
  min-height: 480px;
}

/* —— Dashboard quản trị §3.4.2 —— */
.md-exec-summary {
  background: var(--md-panel);
  border: 1px solid var(--md-line);
  border-radius: 14px;
  padding: 1.1rem 1.25rem;
  margin: 1rem 0 1.25rem;
  box-shadow: var(--md-shadow);
}

.md-exec-summary h2 {
  font-family: var(--md-font-display);
  font-size: 1.05rem;
  margin: 0 0 0.5rem;
}

.md-exec-summary p { margin: 0.35rem 0; line-height: 1.55; }

.md-pipeline-kpis { margin-top: 0; }

.md-manager-split {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.md-alert-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.md-alert {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--md-line);
  font-size: 0.92rem;
}

.md-alert span { color: var(--md-muted); }

.md-alert-red {
  background: rgba(190, 18, 60, 0.08);
  border-color: rgba(190, 18, 60, 0.25);
}

.md-alert-red strong { color: #be123c; }

.md-alert-yellow {
  background: rgba(180, 83, 9, 0.08);
  border-color: rgba(180, 83, 9, 0.25);
}

.md-alert-yellow strong { color: #b45309; }

.md-decision-list {
  margin: 0.5rem 0 1rem;
  padding-left: 1.2rem;
  line-height: 1.55;
}

.md-load {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.md-load-ok { background: rgba(15, 118, 110, 0.12); color: #0b5f59; }
.md-load-yellow { background: rgba(180, 83, 9, 0.12); color: #b45309; }
.md-load-red { background: rgba(190, 18, 60, 0.12); color: #be123c; }

@media (max-width: 900px) {
  .md-manager-split { grid-template-columns: 1fr; }
}

/* —— Manager Workspace shell (mockup Dashboard hiệu quả) —— */
.md-body.md-mq-body {
  background: #f3f5f8;
}

.md-mq-app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  width: 100%;
}

.md-mq-sidebar {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-right: 1px solid var(--md-line);
  padding: 1.1rem 0.85rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.md-mq-brand {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  padding: 0.35rem 0.55rem 1.1rem;
}

.md-mq-brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: var(--md-accent-deep);
  background: var(--md-accent-soft);
}

.md-mq-brand-mark svg { width: 28px; height: 28px; }

.md-mq-brand strong {
  display: block;
  font-family: var(--md-font-display);
  font-size: 0.95rem;
  letter-spacing: -0.02em;
}

.md-mq-brand span {
  color: var(--md-muted);
  font-size: 0.78rem;
}

.md-mq-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.md-mq-nav-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.72rem 0.8rem;
  border-radius: 12px;
  color: #334155;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
  position: relative;
}

.md-mq-nav-item:hover { background: rgba(15, 118, 110, 0.06); color: var(--md-accent-deep); }

.md-mq-nav-item.is-active {
  background: rgba(15, 118, 110, 0.14);
  color: var(--md-accent-deep);
}

.md-mq-ico {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.md-mq-ico svg { width: 20px; height: 20px; }

.md-mq-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35rem;
  height: 1.35rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #e11d48;
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  margin-left: auto;
}

.md-mq-badge-abs {
  position: absolute;
  top: -4px;
  right: -4px;
  margin: 0;
}

.md-mq-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 0.55rem 0.35rem;
  border-top: 1px solid var(--md-line);
  margin-top: 0.75rem;
}

.md-mq-avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--md-accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.md-mq-user strong { display: block; font-size: 0.9rem; }
.md-mq-user span { color: var(--md-muted); font-size: 0.75rem; }
.md-mq-user > div { flex: 1; min-width: 0; }

.md-mq-logout {
  border: 0;
  background: transparent;
  color: var(--md-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0.25rem;
}

.md-mq-main {
  min-width: 0;
  width: 100%;
}

.md-mq-page {
  padding: 1.25rem clamp(1rem, 2.2vw, 2rem) 2rem;
  width: 100%;
}

.md-mq-page-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.15rem;
}

.md-mq-page-head h1 {
  font-family: var(--md-font-display);
  font-size: clamp(1.45rem, 2.4vw, 1.85rem);
  margin: 0;
  letter-spacing: -0.03em;
}

.md-mq-sub {
  margin: 0.35rem 0 0;
  color: var(--md-muted);
  font-size: 0.95rem;
}

.md-mq-head-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.md-mq-datepill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--md-line);
  background: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  color: #334155;
}

.md-mq-iconbtn {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--md-line);
  background: #fff;
  display: grid;
  place-items: center;
  color: #334155;
  text-decoration: none;
}

.md-mq-banner { margin-bottom: 1rem; }

.md-mq-kpi-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.1rem;
}

.md-mq-kpi-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.md-mq-kpi-card {
  background: #fff;
  border: 1px solid var(--md-line);
  border-radius: 16px;
  padding: 1.05rem 1.15rem;
  box-shadow: 0 8px 24px rgba(15, 28, 46, 0.04);
}

a.md-mq-kpi-link {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

a.md-mq-kpi-link:hover,
a.md-mq-kpi-link:focus-visible {
  border-color: var(--md-teal, #0f766e);
  box-shadow: 0 6px 18px rgba(15, 118, 110, 0.12);
  transform: translateY(-1px);
  outline: none;
}

a.md-mq-kpi-link.md-mq-kpi-danger:hover,
a.md-mq-kpi-link.md-mq-kpi-danger:focus-visible {
  border-color: #e11d48;
  box-shadow: 0 6px 18px rgba(225, 29, 72, 0.14);
}

.md-alert-link {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  text-decoration: none;
  color: inherit;
}

.md-alert-link:hover strong { text-decoration: underline; }

.md-mq-kpi-label {
  margin: 0;
  color: var(--md-muted);
  font-size: 0.86rem;
  font-weight: 600;
}

.md-mq-kpi-value {
  margin: 0.35rem 0 0.25rem;
  font-family: var(--md-font-display);
  font-size: 2rem;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.md-mq-kpi-value.is-danger { color: #e11d48; }

.md-mq-kpi-delta {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
}

.md-mq-kpi-delta.is-up { color: #0f766e; }
.md-mq-kpi-delta.is-down { color: #e11d48; }

.md-mq-kpi-hint {
  margin: 0;
  color: var(--md-muted);
  font-size: 0.82rem;
}

.md-mq-tag {
  display: inline-block;
  margin-left: 0.25rem;
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  background: rgba(180, 83, 9, 0.12);
  color: #b45309;
  font-size: 0.7rem;
}

.md-mq-grid-2 {
  display: grid;
  grid-template-columns: 1.05fr 1.35fr;
  gap: 1rem;
  align-items: stretch;
}

.md-mq-panel {
  background: #fff;
  border: 1px solid var(--md-line);
  border-radius: 16px;
  padding: 1rem 1.1rem 1.15rem;
  box-shadow: 0 8px 24px rgba(15, 28, 46, 0.04);
  min-width: 0;
}

.md-mq-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.md-mq-panel-head h2 {
  font-family: var(--md-font-display);
  font-size: 1.05rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.md-mq-panel-note {
  margin: 0 0 0.5rem;
  color: var(--md-muted);
  font-size: 0.8rem;
}

.md-mq-selectlike {
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
  border: 1px solid var(--md-line);
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  background: #f8fafc;
}

.md-mq-link {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--md-accent-deep);
  text-decoration: none;
}

.md-mq-chart-wrap {
  height: 260px;
  position: relative;
}

.md-mq-table-wrap { overflow-x: auto; width: 100%; }

.md-mq-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.md-mq-table th {
  text-align: left;
  color: var(--md-muted);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.55rem 0.45rem;
  border-bottom: 1px solid var(--md-line);
  white-space: nowrap;
}

.md-mq-table td {
  padding: 0.7rem 0.45rem;
  border-bottom: 1px solid rgba(213, 222, 232, 0.7);
  vertical-align: middle;
}

.md-mq-title {
  font-weight: 600;
  max-width: 220px;
}

.md-mq-pill {
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
}

.md-mq-pill-overdue { background: rgba(225, 29, 72, 0.12); color: #e11d48; }
.md-mq-pill-soon { background: rgba(180, 83, 9, 0.12); color: #b45309; }

.md-mq-table .is-danger { color: #e11d48; font-weight: 700; }
.md-mq-table .is-warn { color: #b45309; font-weight: 700; }

.md-newsroom-frame-shell {
  height: 100vh;
  min-height: 640px;
}

.md-mq-main .md-newsroom-in-shell {
  min-height: 100vh;
}

@media (max-width: 1100px) {
  .md-mq-kpi-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md-mq-grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .md-mq-app { grid-template-columns: 1fr; }
  .md-mq-sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--md-line);
  }
  .md-mq-nav { flex-direction: row; flex-wrap: wrap; }
  .md-mq-nav-item { flex: 1 1 auto; }
}

@media (max-width: 560px) {
  .md-mq-kpi-row,
  .md-mq-kpi-row-3 { grid-template-columns: 1fr; }
  .md-mq-title { max-width: 140px; }
}

/* —— Hệ khuyến nghị (Recommend) —— */
.md-rec-page {
  width: 100%;
  padding-bottom: 2.5rem;
}

.md-rec-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  margin-bottom: 1.25rem;
}

.md-rec-head h1 {
  margin: 0.35rem 0 0.4rem;
}

.md-rec-role {
  margin: 0.5rem 0 0;
  color: var(--md-accent-deep);
  font-size: 0.92rem;
  max-width: 52rem;
}

.md-rec-status {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--md-line);
  background: var(--md-panel);
  max-width: 28rem;
  font-size: 0.88rem;
}

.md-rec-status.is-ok { border-color: rgba(15, 118, 110, 0.35); }
.md-rec-status.is-warn { border-color: rgba(180, 83, 9, 0.4); background: #fffbeb; }

.md-rec-flags {
  display: flex;
  gap: 0.4rem;
}

.md-rec-flags em {
  font-style: normal;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: #e2e8f0;
  color: #64748b;
}

.md-rec-flags em.on {
  background: var(--md-accent-soft);
  color: var(--md-accent-deep);
}

.md-rec-form {
  background: var(--md-panel);
  border: 1px solid var(--md-line);
  border-radius: var(--md-radius);
  box-shadow: var(--md-shadow);
  padding: 1rem clamp(0.9rem, 2vw, 1.35rem) 1.2rem;
  margin-bottom: 1.25rem;
}

.md-rec-modes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.md-rec-mode {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--md-line);
  border-radius: 14px;
  cursor: pointer;
  background: #f8fafc;
  transition: border-color .15s, background .15s;
}

.md-rec-mode input { position: absolute; opacity: 0; pointer-events: none; }

.md-rec-mode strong {
  font-family: var(--md-font-display);
  font-size: 0.95rem;
}

.md-rec-mode span {
  color: var(--md-muted);
  font-size: 0.8rem;
}

.md-rec-mode.is-active {
  border-color: var(--md-accent);
  background: var(--md-accent-soft);
}

.md-rec-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem 1rem;
  margin-bottom: 1rem;
}

.md-rec-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--md-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}

.md-rec-field input[type="text"],
.md-rec-field input:not([type]),
.md-rec-field select {
  width: 100%;
  border: 1px solid var(--md-line);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  font: inherit;
  background: #fff;
}

.md-rec-seed { grid-column: 1 / -1; }

.md-rec-interests { grid-column: 1 / -1; }

.md-rec-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.md-rec-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--md-line);
  font-size: 0.82rem;
  cursor: pointer;
  background: #fff;
}

.md-rec-chip input { margin: 0; }

.md-rec-chip.is-on {
  border-color: var(--md-accent);
  background: var(--md-accent-soft);
  color: var(--md-accent-deep);
  font-weight: 600;
}

.md-rec-hint { margin: 0.45rem 0 0; font-size: 0.82rem; }

.md-rec-check label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.9rem;
  color: var(--md-ink);
  font-weight: 600;
  margin: 1.4rem 0 0;
}

.md-rec-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.md-btn-primary {
  appearance: none;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--md-accent) 0%, var(--md-accent-deep) 100%);
  color: #fff;
  font-weight: 700;
  padding: 0.65rem 1.15rem;
  cursor: pointer;
}

.md-btn-ghost {
  display: inline-flex;
  align-items: center;
  padding: 0.6rem 0.95rem;
  border-radius: 12px;
  border: 1px solid var(--md-line);
  color: var(--md-ink);
  text-decoration: none;
  font-weight: 600;
  background: #fff;
}

.md-rec-algo {
  background: var(--md-panel);
  border: 1px solid var(--md-line);
  border-radius: var(--md-radius);
  padding: 1rem 1.15rem;
  margin-bottom: 1.25rem;
}

.md-rec-algo h2 {
  font-family: var(--md-font-display);
  font-size: 1.05rem;
  margin: 0 0 0.45rem;
}

.md-rec-algo p { margin: 0 0 0.65rem; color: var(--md-muted); font-size: 0.92rem; }

.md-rec-algo ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--md-ink);
  font-size: 0.9rem;
}

.md-rec-algo li { margin-bottom: 0.35rem; }

.md-rec-results-head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}

.md-rec-results-head h2 {
  font-family: var(--md-font-display);
  font-size: 1.2rem;
  margin: 0;
}

.md-rec-results-head span {
  font-size: 0.85rem;
  color: var(--md-muted);
  font-weight: 600;
}

.md-rec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
  gap: 0.9rem;
}

.md-rec-card {
  background: var(--md-panel);
  border: 1px solid var(--md-line);
  border-radius: 16px;
  padding: 0.95rem 1rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
}

.md-rec-card-top {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.md-rec-score {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--md-accent-deep);
  background: var(--md-accent-soft);
  padding: 0.15rem 0.45rem;
  border-radius: 8px;
}

.md-rec-cat {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--md-sky);
  background: rgba(2, 132, 199, 0.1);
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 70%;
}

.md-rec-card h3 {
  font-family: var(--md-font-display);
  font-size: 1rem;
  margin: 0;
  line-height: 1.35;
}

.md-rec-card h3 a {
  color: inherit;
  text-decoration: none;
}

.md-rec-card h3 a:hover { color: var(--md-accent-deep); }

.md-rec-sapo {
  margin: 0;
  font-size: 0.86rem;
  color: var(--md-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.md-rec-reason {
  margin: 0;
  font-size: 0.84rem;
  color: var(--md-ink);
  background: #f1f5f9;
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
}

.md-rec-signals {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.md-rec-signals span {
  font-size: 0.72rem;
  font-weight: 600;
  color: #475569;
  background: #e2e8f0;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
}

.md-rec-meters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.35rem;
  margin-top: 0.15rem;
}

.md-rec-meters span {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--md-muted);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.md-rec-meters i {
  display: block;
  height: 4px;
  border-radius: 99px;
  background: #e2e8f0;
  position: relative;
  overflow: hidden;
}

.md-rec-meters i::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--v, 0%);
  background: var(--md-accent);
  border-radius: inherit;
}

.md-rec-card footer {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.35rem;
  border-top: 1px solid var(--md-line);
  font-size: 0.78rem;
  color: var(--md-muted);
}

.md-rec-card-actions {
  gap: 0.4rem;
}

.md-rec-card-actions .md-btn {
  font-size: 0.78rem;
  padding: 0.4rem 0.65rem;
  flex: 1 1 auto;
  justify-content: center;
  text-align: center;
  min-width: 0;
}

.md-rec-gaps { margin-top: 1.75rem; }

.md-rec-gaps h2 {
  font-family: var(--md-font-display);
  font-size: 1.15rem;
  margin: 0 0 0.35rem;
}

.md-rec-gap-table { margin-top: 0.75rem; }

.md-tool-rec .md-tool-icon { color: var(--md-amber); }

@media (max-width: 1024px) {
  .md-rec-modes { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .md-rec-modes { grid-template-columns: 1fr; }
  .md-rec-head { flex-direction: column; }
  .md-rec-status { max-width: none; width: 100%; }
  .md-rec-seed { grid-column: auto; }
}

@media (max-width: 500px) {
  .md-rec-meters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .md-rec-actions { flex-direction: column; align-items: stretch; }
  .md-btn-primary, .md-btn-ghost { justify-content: center; width: 100%; }
}

/* ---- Viết bài hoàn chỉnh: xem trước trực tiếp khi AI đang stream ---- */
.md-stream-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.75rem;
  color: var(--md-accent-deep);
  font-weight: 600;
}
.md-stream-status::before {
  content: "";
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--md-accent);
  animation: md-stream-pulse 1.1s ease-in-out infinite;
}
.md-stream-status-error {
  color: var(--md-rose);
}
.md-stream-status-error::before {
  background: var(--md-rose);
  animation: none;
}
.md-stream-image {
  color: var(--md-muted);
  font-style: italic;
}
.md-stream-caret {
  display: inline-block;
  width: 0.5em;
  height: 1.05em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--md-accent);
  animation: md-stream-blink 0.9s steps(1) infinite;
}
@keyframes md-stream-pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1); }
}
@keyframes md-stream-blink {
  50% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .md-stream-status::before,
  .md-stream-caret { animation: none; }
}

/* ---- Ảnh minh họa AI đang tạo nền: khung chờ ---- */
img.md-img-pending {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  min-height: 160px;
  border-radius: 12px;
  color: transparent;
  background:
    url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='40'%3E%3Ctext x='110' y='26' text-anchor='middle' font-family='Segoe UI,sans-serif' font-size='15' fill='%235b6b7c'%3EĐang tạo ảnh minh họa…%3C/text%3E%3C/svg%3E") center / 220px 40px no-repeat,
    linear-gradient(100deg, var(--md-paper) 30%, #f8fbfd 50%, var(--md-paper) 70%) 0 0 / 300% 100%;
  animation: md-img-shimmer 1.4s linear infinite;
}
@keyframes md-img-shimmer {
  from { background-position: center, 100% 0; }
  to { background-position: center, 0 0; }
}
@media (prefers-reduced-motion: reduce) {
  img.md-img-pending { animation: none; }
}
