:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  color: #172033;
  background: #f3f6fb;
  --page: #f3f6fb;
  --surface: #fff;
  --surface-soft: #eef1f7;
  --text: #172033;
  --muted: #59647b;
  --border: #e1e7f0;
  --input-border: #cfd7e6;
  --secondary: #e8ecf8;
  --secondary-text: #24305a;
  --accent-soft: #edf0ff;
  --error: #b4233b;
  --success: #18794e;
  --shadow: rgba(31, 45, 77, .07);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  color: #e7ebf5;
  background: #0d1220;
  --page: #0d1220;
  --surface: #151c2d;
  --surface-soft: #20293d;
  --text: #e7ebf5;
  --muted: #aeb8cb;
  --border: #2b3650;
  --input-border: #43506c;
  --secondary: #263149;
  --secondary-text: #e3e8f4;
  --accent-soft: #252f58;
  --error: #ff8796;
  --success: #63d6a0;
  --shadow: rgba(0, 0, 0, .28);
}
* { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; }
body { margin: 0; color: var(--text); background: var(--page); transition: color .2s, background .2s; }
html { scroll-behavior: smooth; }
button, input, select, textarea { font: inherit; }
.container { width: min(1180px, calc(100% - 32px)); margin: 32px auto 64px; }
.page-header, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.theme-toggle { white-space: nowrap; }
.ui-language-label { margin: 0; font-size: .85rem; color: var(--muted); }
.ui-language {
  width: auto;
  min-width: 68px;
  min-height: 42px;
  padding: 10px 30px 10px 14px;
  border: 0;
  border-radius: 10px;
  color: var(--secondary-text);
  background-color: var(--secondary);
  cursor: pointer;
}
.ui-language:hover, .theme-toggle:hover { filter: brightness(.97); }
:root[data-theme="dark"] .ui-language:hover,
:root[data-theme="dark"] .theme-toggle:hover { filter: brightness(1.1); }
.eyebrow { color: #5b6ef5; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: .75rem; }
h1 { margin: 4px 0 24px; font-size: clamp(2rem, 5vw, 3.5rem); }
h2 { margin-top: 0; }
.panel, .post-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 12px 35px var(--shadow); }
.panel { padding: 24px; }
.narrow { max-width: 440px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; margin-bottom: 22px; background: var(--surface-soft); border-radius: 12px; }
.auth-tab { border: 0; border-radius: 8px; padding: 10px; background: transparent; color: var(--muted); cursor: pointer; }
.auth-tab.active { background: var(--surface); color: var(--text); box-shadow: 0 2px 8px var(--shadow); font-weight: 700; }
.auth-form h2 { margin-bottom: 8px; }
.text-button {
  display: block;
  width: fit-content;
  margin: 8px 0 14px;
  padding: 0;
  border: 0;
  color: var(--primary);
  background: transparent;
  cursor: pointer;
  font: inherit;
}
.text-button:hover { text-decoration: underline; }
.grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr); gap: 20px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
label { display: block; margin: 14px 0 6px; font-weight: 650; }
input, select, textarea { width: 100%; padding: 11px 12px; color: var(--text); border: 1px solid var(--input-border); border-radius: 10px; background: var(--surface); }
textarea { resize: vertical; line-height: 1.55; }
input:focus, select:focus { outline: 3px solid rgba(91, 110, 245, .18); border-color: #5b6ef5; }
.checkbox { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.checkbox input { width: auto; }
.muted-field { opacity: .55; }
.form-message { min-height: 1.4em; color: var(--error); }
.button { border: 0; border-radius: 10px; padding: 11px 17px; background: #3448d8; color: #fff; cursor: pointer; margin-top: 16px; }
.button:disabled { opacity: .55; cursor: wait; }
.button.secondary { background: var(--secondary); color: var(--secondary-text); margin-top: 0; }
.status-panel { background: linear-gradient(145deg, #202d64, #4258dc); color: #fff; }
.pro-dashboard { margin-bottom: 32px; }
.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(120px, 1fr)); gap: 12px; margin: 16px 0 20px; }
.metric-card { padding: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.metric-card strong { display: block; margin-top: 6px; font-size: 1.7rem; color: var(--text); }
.metric-card span { color: var(--muted); font-size: .82rem; }
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
.activity-chart { min-height: 180px; display: flex; align-items: flex-end; gap: 6px; padding-top: 20px; }
.chart-column { flex: 1; display: grid; align-content: end; gap: 5px; text-align: center; color: var(--muted); font-size: .68rem; }
.chart-bar { min-height: 3px; background: linear-gradient(#6e7eff, #3448d8); border-radius: 5px 5px 2px 2px; }
.integration-list, .log-list { display: grid; gap: 8px; max-height: 320px; overflow: auto; }
.integration-row, .log-row { padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; }
.integration-row { display: flex; justify-content: space-between; }
.monitor-ok { color: var(--success); }.monitor-error { color: var(--error); }
.log-row small { display: block; color: var(--muted); margin-top: 3px; }
.posts-section { margin-top: 32px; }
.generation-status { min-height: 1.5em; margin: 14px 0 0; }
.preview-section {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
}
.preview-help { margin: -8px 0 20px; color: var(--muted); }
.preview-section .post-card { border-color: #2867ed; }
.transform-section { margin-top: 30px; }
.format-fieldset { margin: 20px 0; padding: 0; border: 0; }
.format-fieldset legend { margin-bottom: 10px; font-weight: 700; }
.format-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 8px 16px; }
.format-grid .checkbox { margin: 0; padding: 9px 10px; border: 1px solid var(--border); border-radius: 10px; }
.transformed-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; margin-top: 24px; }
.transformed-card { border-color: #2867ed; }
.transformed-card h3 { margin: 10px 0; }
.transformed-card label { margin-top: 12px; }
.transformed-card-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.transformed-extras { margin: 12px 0 0; color: var(--muted); white-space: pre-wrap; }
.transformed-card-actions .compact-select { width: auto; min-width: 145px; }
.transformed-card .badge { margin: 0 6px 6px 0; }
.platform-badge { color: #fff; background: #2867ed; }
.channel-integration-note { flex-basis: 100%; color: var(--muted); font-size: .9rem; }
.admin-panel { margin-top: 32px; }
.admin-users-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 32px;
  border-top: 1px solid var(--border);
  padding-top: 24px;
}
.admin-users-heading h3 { margin: 0; }
.admin-users-table-wrap { margin-top: 16px; overflow-x: auto; }
.admin-users-table { width: 100%; border-collapse: collapse; }
.admin-users-table th,
.admin-users-table td { padding: 10px 8px; border-bottom: 1px solid var(--border); text-align: left; }
.admin-users-table th { color: var(--muted); font-size: .82rem; }
.admin-users-table input,
.admin-users-table select { min-width: 150px; }
.admin-user-actions { display: flex; gap: 8px; }
.admin-user-actions .button { margin: 0; padding: 9px 12px; }
.button.danger { background: #b4233b; }
.button.danger:hover { background: #d52f4c; }
.scheduler-panel { margin-top: 32px; }
.schedule-list { display: grid; gap: 12px; margin-top: 20px; }
.scheduler-panel,
.schedule-list,
.schedule-item { max-width: 100%; min-width: 0; }
.scheduler-panel > .button {
  max-width: 100%;
  white-space: normal;
}
.schedule-item { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 14px; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.schedule-item > div:first-child { min-width: 0; max-width: 100%; }
.schedule-item strong,
.schedule-item p { overflow-wrap: anywhere; word-break: break-word; }
.schedule-item p { margin: 4px 0 0; font-size: .9rem; }
.schedule-actions { display: flex; gap: 8px; }
.schedule-actions .button { margin: 0; padding: 8px 11px; }
.posts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }
.post-card { max-width: 100%; overflow: hidden; }
.post-card > img { display: block; width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.post-body { min-width: 0; padding: 20px; overflow-wrap: anywhere; }
.post-body h3 { margin: 10px 0; }
#saved-posts .posts-grid {
  grid-template-columns: 1fr;
  gap: 10px;
}
#saved-posts .post-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: stretch;
  border-radius: 12px;
  box-shadow: 0 6px 18px var(--shadow);
}
#saved-posts .post-card > img {
  width: 100%;
  height: 100%;
  min-height: 112px;
  aspect-ratio: auto;
}
#saved-posts .post-body {
  display: grid;
  align-content: start;
  min-width: 0;
  padding: 12px 16px;
}
#saved-posts .saved-post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
#saved-posts .post-body h3 {
  margin: 8px 0 6px;
  font-size: 1rem;
  line-height: 1.35;
}
#saved-posts .post-body > p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}
#saved-posts .saved-post-summary > p {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
#saved-posts dl {
  grid-template-columns: max-content minmax(0, 1fr);
  margin: 4px 0 0;
}
#saved-posts details {
  margin-top: 10px;
}
#saved-posts .saved-post-details {
  margin-top: 8px;
  border-top: 0;
  padding-top: 0;
}
#saved-posts .saved-post-details > summary {
  width: fit-content;
  color: #2867ed;
  font-size: .92rem;
}
#saved-posts .article-actions,
#saved-posts .publish-actions {
  margin-top: 12px;
}
.saved-posts-pagination {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 0 0;
}
.saved-posts-page {
  min-width: 36px;
  min-height: 36px;
  padding: 7px 11px;
  border: 0;
  border-radius: 999px;
  color: #3448d8;
  background: transparent;
  cursor: pointer;
}
.saved-posts-page:hover,
.saved-posts-page.active {
  color: #fff;
  background: #2867ed;
}
.saved-posts-page:disabled {
  opacity: .45;
  cursor: default;
}
.saved-posts-page:disabled:hover {
  color: #3448d8;
  background: transparent;
}
.badge { display: inline-block; padding: 4px 8px; border-radius: 999px; background: var(--accent-soft); color: #7080ff; font-size: .8rem; font-weight: 700; }
.ready-badge { color: #073d23; background: #6ee7a8; }
.warning-badge { color: #66420a; background: #f9d77c; }
.publish-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 16px; }
.publish-actions > span { width: 100%; color: var(--muted); font-size: .82rem; font-weight: 700; }
.publish-actions .button { margin: 0; padding: 9px 12px; }
dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; font-size: .9rem; }
dt { font-weight: 700; }
dd { margin: 0; }
details { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 12px; }
summary { cursor: pointer; font-weight: 700; }
.article { white-space: pre-wrap; margin-top: 12px; line-height: 1.65; }
.article-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.article-actions .button { margin: 0; }
.post-edit-form {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.post-edit-form textarea { min-height: 110px; }
.post-edit-form textarea[name="conteudo"] { min-height: 320px; }
.hidden { display: none !important; }

.dashboard-shell {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 0;
  margin-top: 28px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: 0 20px 60px var(--shadow);
}
.app-sidebar {
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
  color: #e7ebf5;
  background: #07101f;
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 24px; }
.sidebar-brand strong, .sidebar-brand small { display: block; }
.sidebar-brand-logo { width:40px; height:40px; border-radius:10px; object-fit:contain; background:#fff; }
.sidebar-brand small { margin-top: 2px; color: #8390a7; font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; }
.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(145deg, #5570ff, #3046d6);
  font-weight: 800;
}
.sidebar-menu { display: grid; gap: 6px; position: sticky; top: 20px; }
.sidebar-menu a {
  padding: 11px 13px;
  border-radius: 10px;
  color: #aeb8cb;
  text-decoration: none;
  transition: color .15s, background .15s;
}
.sidebar-menu a:hover, .sidebar-menu a.active { color: #fff; background: #1c2940; }
.sidebar-logout {
  width: 100%;
  margin-top: auto;
  background: #b4233b;
}
.sidebar-logout:hover { background: #d52f4c; }
.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 11px 16px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px;
  color: #fff;
  background: #2867ed;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .35);
  cursor: pointer;
}
.back-to-top:hover { background: #1f56c9; }
.back-to-top:focus-visible { outline: 3px solid #9dbaff; outline-offset: 3px; }
.dashboard-main { min-width: 0; max-width: 100%; overflow-x: clip; padding: 28px; background: var(--page); }
.dashboard-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.dashboard-header h2 { margin: 4px 0; font-size: 2rem; }
.dashboard-header p { margin: 0; color: var(--muted); }
.dashboard-header .button { margin-top: 0; white-space: nowrap; }
.dashboard-actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.overview-section { margin-top: 24px; }
.overview-card-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.overview-card {
  min-height: 140px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--page);
}
.overview-card h3 { margin: 0 0 12px; font-size: 1rem; }
.overview-card p { min-height: 38px; margin: 0 0 16px; color: var(--muted); font-size: .9rem; }
.connection-badge {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 999px;
  color: #c8d1e1;
  background: #344159;
  font-size: .75rem;
}
.connection-badge.connected { color: #062817; background: #25cf73; }

body.dashboard-open {
  color: var(--text);
  background: var(--page);
}
body.dashboard-open .container { width: 100%; margin: 0; }
body.dashboard-open .page-header { display: none; }
body.dashboard-open .dashboard-shell {
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  min-height: 100vh;
  margin: 0;
  border: 0;
  border-radius: 0;
  grid-template-columns: 292px minmax(0, 1fr);
  box-shadow: none;
}
body.dashboard-open .app-sidebar { padding: 36px 24px; background: #020817; }
body.dashboard-open .app-sidebar { padding-bottom: 108px; }
body.dashboard-open .sidebar-logout {
  position: fixed;
  z-index: 90;
  bottom: 24px;
  left: 24px;
  width: 244px;
  margin: 0;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .35);
}
body.dashboard-open .sidebar-brand { padding-bottom: 30px; font-size: 1.1rem; }
body.dashboard-open .sidebar-menu { gap: 10px; }
body.dashboard-open .sidebar-menu a { padding: 14px 13px; }
body.dashboard-open .dashboard-main {
  display: flex;
  flex-direction: column;
  max-width: 100vw;
  padding: 46px 32px 60px;
  background: var(--page);
}
body.dashboard-open .dashboard-header { order: 1; }
body.dashboard-open .pro-dashboard { display: contents; }
body.dashboard-open .pro-dashboard > .section-heading { display: none; }
body.dashboard-open .metric-grid { order: 2; grid-template-columns: repeat(4, minmax(150px, 1fr)); margin: 18px 0 30px; }
body.dashboard-open .metric-card { min-height: 112px; padding: 22px; background: var(--surface); border-color: var(--border); }
body.dashboard-open .metric-card strong { margin-top: 14px; color: var(--text); font-size: 1.9rem; }
body.dashboard-open .metric-card span { color: var(--text); font-weight: 700; }
body.dashboard-open #new-content { order: 3; grid-template-columns: 1fr; }
body.dashboard-open #new-content > .panel { padding: 24px; }
body.dashboard-open #new-content > .panel > h2 { font-size: 1.2rem; }
body.dashboard-open #post-preview { order: 4; }
body.dashboard-open #transform-content { order: 5; }
body.dashboard-open #research-sources { order: 6; }
body.dashboard-open #publishing-overview { order: 7; }
body.dashboard-open .pro-dashboard > .dashboard-grid { order: 8; }
body.dashboard-open #scheduling { order: 9; }
body.dashboard-open #saved-posts { order: 10; }
body.dashboard-open #admin-panel { order: 11; }
body.dashboard-open input,
body.dashboard-open select,
body.dashboard-open textarea { background: var(--page); }
body.dashboard-open .button { background: #2867ed; }
body.dashboard-open .button.secondary { color: var(--secondary-text); background: var(--secondary); }

@media (max-width: 1180px) {
  body.dashboard-open .dashboard-shell { grid-template-columns: 248px minmax(0, 1fr); }
  body.dashboard-open .dashboard-main { padding: 34px 24px 54px; }
  body.dashboard-open .sidebar-logout { width: 200px; }
  body.dashboard-open .metric-grid { grid-template-columns: repeat(3, minmax(150px, 1fr)); }
  .overview-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .transformed-results { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
  body.dashboard-open .dashboard-shell,
  .dashboard-shell {
    grid-template-columns: 1fr;
  }
  body.dashboard-open .app-sidebar {
    padding: 18px 18px 14px;
  }
  body.dashboard-open .sidebar-brand {
    padding-bottom: 14px;
  }
  body.dashboard-open .sidebar-menu,
  .sidebar-menu {
    position: static;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: thin;
  }
  body.dashboard-open .sidebar-menu a,
  .sidebar-menu a {
    flex: 0 0 auto;
    white-space: nowrap;
  }
  body.dashboard-open .sidebar-logout {
    position: static;
    width: 100%;
    margin-top: 12px;
  }
  body.dashboard-open .dashboard-main,
  .dashboard-main {
    padding: 28px 20px 52px;
  }
  .dashboard-header {
    align-items: flex-start;
    flex-direction: column;
  }
  .dashboard-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
  .dashboard-grid,
  .grid {
    grid-template-columns: 1fr;
  }
  #saved-posts .post-card {
    grid-template-columns: 96px minmax(0, 1fr);
  }
  #saved-posts .post-card > img {
    min-height: 104px;
  }
}

@media (max-width: 760px) {
  .grid, .form-grid, .dashboard-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .container { width: min(100% - 20px, 1180px); margin-top: 18px; }
  .panel,
  .preview-section { padding: 18px; border-radius: 14px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .section-heading .button { width: 100%; }
  .schedule-item { align-items: flex-start; flex-direction: column; }
  .scheduler-panel > .button {
    width: 100%;
    margin-right: 0;
  }
  .page-header { align-items: flex-start; }
  .header-actions { flex-wrap: wrap; justify-content: flex-end; }
  .ui-language-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .dashboard-shell { grid-template-columns: 1fr; border-radius: 14px; }
  .app-sidebar { padding: 14px; overflow: hidden; }
  .sidebar-brand { padding-bottom: 12px; }
  .sidebar-menu {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
    padding-bottom: 0;
  }
  .sidebar-menu a {
    min-width: 0;
    padding: 10px 11px;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .dashboard-main { padding: 18px 14px; }
  .dashboard-header { align-items: flex-start; flex-direction: column; }
  .dashboard-actions { width: 100%; flex-wrap: wrap; justify-content: flex-start; }
  .overview-card-grid { grid-template-columns: 1fr; }
  body.dashboard-open .dashboard-shell { grid-template-columns: 1fr; }
  body.dashboard-open .dashboard-main { padding: 24px 14px 48px; }
  body.dashboard-open .metric-grid { grid-template-columns: repeat(2, 1fr); }
  body.dashboard-open .metric-card {
    min-height: 96px;
    padding: 16px;
  }
  body.dashboard-open .metric-card strong {
    margin-top: 8px;
    font-size: 1.65rem;
  }
  body.dashboard-open .app-sidebar { padding-bottom: 14px; }
  body.dashboard-open .sidebar-logout {
    position: static;
    width: 100%;
    margin-top: 14px;
  }
  #saved-posts .post-card {
    grid-template-columns: 1fr;
  }
  #saved-posts .post-card > img {
    display: block;
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 16/9;
  }
  #saved-posts .post-body {
    padding: 14px;
  }
  .posts-grid,
  .transformed-results {
    width: 100%;
    min-width: 0;
    grid-template-columns: 1fr;
  }
  .admin-users-heading {
    align-items: flex-start;
    flex-direction: column;
  }
  .admin-user-actions,
  .schedule-actions,
  .article-actions,
  .publish-actions {
    width: 100%;
  }
  .admin-user-actions .button,
  .schedule-actions .button,
  .article-actions .button,
  .publish-actions .button,
  .transformed-card-actions .button {
    flex: 1 1 140px;
  }
  .back-to-top { right: 14px; bottom: 14px; }
}

@media (max-width: 520px) {
  h1 { font-size: 2rem; }
  .container { width: min(100% - 16px, 1180px); margin-top: 12px; }
  .container { width: 100%; padding-inline: 8px; }
  body.dashboard-open .dashboard-main { width: 100%; padding: 18px 8px 44px; }
  .panel,
  .preview-section {
    padding: 14px 12px;
  }
  body.dashboard-open .metric-grid,
  .metric-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  body.dashboard-open .metric-card,
  .metric-card {
    min-height: 88px;
    padding: 14px;
  }
  body.dashboard-open .metric-card strong,
  .metric-card strong {
    margin-top: 6px;
    font-size: 1.45rem;
  }
  .sidebar-brand {
    gap: 9px;
    padding-inline: 0;
  }
  .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }
  .sidebar-brand strong {
    font-size: .95rem;
  }
  .sidebar-menu {
    grid-template-columns: 1fr 1fr;
  }
  .sidebar-menu a {
    font-size: .9rem;
  }
  .dashboard-header h2 { font-size: 1.55rem; }
  .dashboard-actions .button,
  .dashboard-actions select,
  .header-actions .button,
  .header-actions select {
    width: 100%;
  }
  .post-body h3,
  #saved-posts .post-body h3 {
    font-size: 1rem;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .post-body,
  #saved-posts .post-body {
    padding: 14px 12px;
  }
  .article,
  details,
  summary,
  #saved-posts dl,
  #saved-posts .saved-post-summary {
    max-width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
  }
  .saved-posts-pagination {
    flex-wrap: wrap;
  }
  dl {
    grid-template-columns: 1fr;
  }
  dd + dt {
    margin-top: 4px;
  }
  .back-to-top {
    right: 10px;
    bottom: 10px;
    max-width: calc(100vw - 20px);
    justify-content: center;
  }
}
.connected-sites-settings { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--border); }
.brand-logo-settings { margin:18px 0; padding:16px; border:1px solid var(--border); border-radius:12px; }
.brand-logo-control { display:flex; gap:14px; align-items:center; margin-bottom:12px; }
.brand-logo-preview { display:grid; place-items:center; flex:0 0 64px; width:64px; height:64px; overflow:hidden; border:1px solid var(--border); border-radius:12px; background:var(--surface-soft); font-weight:800; }
.brand-logo-preview img { width:100%; height:100%; object-fit:contain; }
.brand-logo-control input { padding:8px; }
.brand-logo-control small { display:block; margin-top:5px; color:var(--muted); }
.tutorial-admin-form { margin:20px 0 28px; padding:18px; border:1px solid var(--border); border-radius:14px; background:var(--surface-soft); }
.tutorial-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(320px,1fr)); gap:20px; margin-top:20px; }
.tutorial-card { overflow:hidden; border:1px solid var(--border); border-radius:14px; background:var(--surface); }
.tutorial-player { position:relative; aspect-ratio:16/9; background:#000; }
.tutorial-player iframe { position:absolute; inset:0; width:100%; height:100%; border:0; }
.tutorial-content { padding:16px; }
.tutorial-content h3 { margin:0 0 8px; }
.tutorial-content p { color:var(--muted); white-space:pre-wrap; }
.tutorial-actions { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin-top:14px; }
.tutorial-actions .button { display:inline-flex; flex:0 0 82px; align-items:center; justify-content:center; width:82px; height:44px; margin:0; padding:0 12px; box-sizing:border-box; }
.tutorial-provider-badge { display:inline-block; margin-bottom:8px; color:#5b6ef5; font-size:.78rem; font-weight:700; text-transform:uppercase; }
.connected-site-row { display:flex; gap:16px; align-items:center; justify-content:space-between; margin-top:12px; padding:18px; border:1px solid var(--border); border-radius:14px; background:var(--surface); }
.connected-site-row .site-main { display:flex; gap:12px; align-items:center; }
.site-provider-icon { display:grid; place-items:center; width:44px; height:44px; border-radius:12px; background:rgba(91,110,245,.12); color:#5b6ef5; font-weight:800; }
.site-status { display:inline-flex; align-items:center; gap:6px; margin-top:5px; font-size:.82rem; color:var(--muted); }
.site-status::before { content:''; width:8px; height:8px; border-radius:50%; background:#ef4444; }
.site-status.connected::before { background:#22c55e; }
.connected-site-row .site-actions { display:flex; flex-wrap:wrap; gap:8px; }

.site-wizard { width:min(720px,calc(100vw - 28px)); max-height:90vh; padding:0; border:0; border-radius:20px; color:var(--text); background:var(--surface); box-shadow:0 30px 80px rgba(0,0,0,.35); }
.site-wizard::backdrop { background:rgba(12,18,35,.72); backdrop-filter:blur(4px); }
.site-wizard form { padding:26px; }
.wizard-header { display:flex; align-items:flex-start; justify-content:space-between; gap:20px; }
.wizard-header h2 { margin:5px 0 0; }
.icon-button { border:0; background:transparent; color:var(--muted); font-size:2rem; cursor:pointer; }
.wizard-progress { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; margin:24px 0 28px; padding:0; list-style:none; }
.wizard-progress li { display:flex; align-items:center; gap:7px; padding:9px; border-radius:10px; color:var(--muted); background:var(--surface); font-size:.8rem; }
.wizard-progress li.active { color:#fff; background:#5b6ef5; }
.platform-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; margin-top:18px; }
.platform-option { display:flex; flex-direction:column; gap:7px; min-height:110px; padding:20px; text-align:left; color:var(--text); border:1px solid var(--border); border-radius:14px; background:var(--surface); cursor:pointer; }
.platform-option:hover:not(:disabled) { border-color:#5b6ef5; transform:translateY(-1px); }
.platform-option:disabled { opacity:.55; cursor:not-allowed; }
.platform-option span,.security-note { color:var(--muted); font-size:.86rem; }
.blogger-blogs-list { display:grid; gap:10px; margin:14px 0; }
.blogger-blog-option { display:flex; gap:10px; align-items:flex-start; padding:13px; border:1px solid var(--border); border-radius:12px; cursor:pointer; }
.blogger-blog-option input { width:auto; margin-top:3px; }
.blogger-blog-option small { display:block; color:var(--muted); margin-top:3px; }
.wizard-actions { display:flex; justify-content:space-between; gap:12px; margin-top:22px; }
.wizard-center { min-height:260px; text-align:center; align-content:center; }
.wizard-spinner { width:52px; height:52px; margin:0 auto 18px; border:5px solid var(--border); border-top-color:#5b6ef5; border-radius:50%; animation:wizard-spin .8s linear infinite; }
.wizard-success { display:grid; place-items:center; width:64px; height:64px; margin:0 auto 18px; border-radius:50%; color:#fff; background:#22c55e; font-size:2rem; }
.error-message { color:#dc2626; }
@keyframes wizard-spin { to { transform:rotate(360deg); } }
@media (max-width:640px) { .platform-grid { grid-template-columns:1fr; } .wizard-progress span { display:none; } .connected-site-row { align-items:flex-start; flex-direction:column; } }
