:root {
  /* Tokens espelhados do app/word-web para manter a mesma identidade. */
  --ink: #2a2f35;
  --muted: #737373;
  --line: #e5e5e5;
  --soft: #f5f5f5;
  --gold: #ffe450;
  --gold-strong: #f9d000;
  --gold-dark: #6b5900;
  --green: #287253;
  --red: #a93b35;
  --white: #fff;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .05);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .08), 0 1px 2px rgba(0, 0, 0, .04);
  --shadow: 0 12px 32px rgba(42, 47, 53, .12);
}

* { box-sizing: border-box; }
html { font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); }
body { margin: 0; background: #f5f5f5; }
button, input, textarea, select { font: inherit; }
button, select { cursor: pointer; }
[hidden] { display: none !important; }
:where(button, a, input, textarea, select, [tabindex]):focus-visible {
  outline: 3px solid var(--gold-strong);
  outline-offset: 2px;
}

.eyebrow { color: var(--gold-dark); font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.primary-button, .secondary-button, .danger-button, .add-button {
  border: 0; border-radius: 6px; min-height: 36px; padding: 0 16px; font-weight: 650;
}
.primary-button { color: #171717; background: linear-gradient(135deg, var(--gold), var(--gold-strong)); box-shadow: 0 2px 8px rgba(0, 0, 0, .16); }
.primary-button:hover { filter: brightness(1.02); }
.secondary-button, .add-button { color: var(--ink); background: var(--white); border: 1px solid var(--line); box-shadow: var(--shadow-xs); }
.secondary-button:hover, .add-button:hover { background: var(--soft); }
.danger-button { color: var(--red); background: #fff1f0; margin-right: auto; }

.setup-screen, .login-screen { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.setup-card, .login-card {
  width: min(100%, 460px); background: var(--white); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-sm); padding: 42px;
}
.setup-card img { display: block; width: 150px; margin-bottom: 44px; }
.setup-card .eyebrow { display: block; }
.setup-card h1, .login-card h1 { margin: 8px 0 10px; line-height: 1.15; font-size: 31px; }
.setup-card p, .login-card p { color: var(--muted); }
.setup-card a { color: var(--gold-dark); font-weight: 750; }
.login-brand { display: flex; align-items: center; gap: 13px; text-decoration: none; margin-bottom: 48px; }
.login-brand img { width: 122px; }
.login-brand span { border-left: 1px solid var(--line); padding-left: 13px; color: var(--muted); font-size: 14px; }
.login-card form { display: grid; gap: 16px; margin: 30px 0 22px; }
label { display: grid; gap: 7px; font-size: 13px; font-weight: 650; color: #404040; }
input, textarea, select {
  width: 100%; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: var(--white);
  padding: 9px 12px; outline: none; font-weight: 500; box-shadow: var(--shadow-xs);
}
input:focus, textarea:focus, select:focus { border-color: #a3a3a3; box-shadow: 0 0 0 3px rgba(163, 163, 163, .26); }
textarea { resize: vertical; line-height: 1.5; }
label small { color: var(--muted); font-weight: 500; }
.form-error { color: var(--red) !important; background: #fff1f0; border-radius: 8px; padding: 10px 12px; margin: 0 !important; font-size: 13px; }
.back-link { color: var(--muted); font-size: 13px; text-decoration: none; }

.admin-shell { min-height: 100vh; padding-left: 248px; }
.admin-sidebar {
  width: 248px; position: fixed; inset: 0 auto 0 0; background: #2a2f35; color: #fff; padding: 28px 18px 20px;
  display: flex; flex-direction: column; z-index: 5;
}
.admin-brand { display: grid; gap: 15px; color: #c9cdd0; text-decoration: none; padding: 0 10px 32px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.admin-brand img { width: 134px; }
.admin-sidebar nav { display: grid; gap: 5px; }
.side-link {
  width: 100%; display: flex; align-items: center; gap: 12px; border: 0; color: #bdc2c5; background: transparent;
  border-radius: 9px; padding: 12px; text-align: left; text-decoration: none; font-size: 14px; font-weight: 650;
}
.side-link span { font-size: 18px; width: 20px; text-align: center; }
.side-link:hover { color: #fff; background: rgba(255,255,255,.08); }
.side-link.is-active { color: #171717; background: var(--gold); }
.sidebar-user { margin-top: auto; border-top: 1px solid rgba(255,255,255,.12); padding: 20px 5px 0; display: grid; grid-template-columns: 34px 1fr 30px; align-items: center; gap: 9px; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--gold); color: var(--ink); font-weight: 850; }
.sidebar-user strong, .sidebar-user small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 120px; }
.sidebar-user strong { font-size: 12px; }.sidebar-user small { color: #989fa4; font-size: 10px; }
.sidebar-user button { color: #fff; background: transparent; border: 0; font-size: 18px; }

.admin-main { padding: 38px clamp(24px, 4vw, 64px) 70px; }
.admin-topbar { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 30px; }
.admin-topbar h1 { margin: 5px 0 0; font-size: clamp(26px, 3vw, 36px); line-height: 1.1; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stats article { background: var(--white); border: 1px solid var(--line); border-radius: 12px; padding: 19px 22px; box-shadow: var(--shadow-xs); }
.stats span { display: block; color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.stats strong { display: block; margin-top: 7px; font-size: 25px; }
.content-card { background: var(--white); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-xs); }
.toolbar { display: flex; align-items: center; gap: 10px; padding: 16px; border-bottom: 1px solid var(--line); }
.admin-search { position: relative; flex: 1; display: block; }
.admin-search span { position: absolute; left: 12px; top: 8px; font-size: 22px; color: var(--muted); }
.admin-search input { padding-left: 39px; }
.toolbar select { width: 170px; }
#category-filter { width: 190px; }
.article-table { display: grid; }
.content-state {
  min-height: 210px; display: grid; place-items: center; align-content: center; gap: 10px;
  padding: 32px; color: var(--muted); text-align: center;
}
.content-state > span {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%;
  color: var(--gold-dark); background: var(--gold); font-size: 18px; font-weight: 850;
}
.content-state strong { color: var(--ink-soft); font-size: 14px; }
.content-state.is-error > span { color: var(--red); background: #fff1f0; }
.content-state .secondary-button { margin-top: 4px; }
.article-row {
  display: grid; grid-template-columns: 56px minmax(230px, 1fr) 180px 105px 70px; gap: 14px; align-items: center;
  padding: 16px 18px; border-bottom: 1px solid #ebe9e3; cursor: pointer;
}
.article-row:last-child { border-bottom: 0; }
.article-row:hover { background: #fafafa; }
.article-order { width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; background: var(--soft); font-size: 12px; font-weight: 800; }
.article-copy strong, .article-copy span { display: block; }
.article-copy strong { font-size: 14px; }.article-copy span { color: var(--muted); font-size: 12px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 620px; }
.article-category { color: var(--muted); font-size: 12px; }
.status-badge { width: max-content; padding: 5px 9px; border-radius: 999px; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.status-badge.published { color: var(--green); background: #e8f5ee; }
.status-badge.draft { color: #7a6920; background: #faf2cf; }
.status-badge.hidden { color: #595959; background: #ededed; }
.edit-row { border: 0; background: transparent; font-size: 18px; color: var(--muted); }
.empty-state { text-align: center; padding: 70px 24px; }
.empty-state > span { font-size: 42px; color: #c7c3b8; }.empty-state h2 { margin: 12px 0 4px; }.empty-state p { color: var(--muted); margin: 0; }

dialog { border: 0; padding: 0; color: var(--ink); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(22, 27, 30, .7); backdrop-filter: blur(4px); }
.editor-dialog { width: min(960px, calc(100% - 28px)); max-height: calc(100vh - 28px); border-radius: 12px; }
.editor-dialog form { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; max-height: calc(100vh - 28px); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 22px 26px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 4px 0 0; font-size: 24px; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: #fff; font-size: 23px; }
.editor-body { overflow: auto; padding: 0 27px 30px; }
.form-section { padding: 28px 0; border-bottom: 1px solid var(--line); }
.form-section:last-child { border: 0; }
.section-title { display: flex; gap: 13px; margin-bottom: 22px; }
.section-title > span { width: 29px; height: 29px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 10px; font-weight: 800; }
.section-title h3 { margin: 0; font-size: 17px; }.section-title p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.span-2 { grid-column: span 2; }
.repeat-list { display: grid; gap: 12px; }
.repeat-row { border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: #fafafa; }
.repeat-row-head { display: flex; align-items: center; gap: 10px; margin-bottom: 11px; }
.drag-handle { color: #aaa69b; font-size: 18px; cursor: grab; }
.repeat-number { font-size: 11px; font-weight: 800; color: var(--gold-dark); text-transform: uppercase; letter-spacing: .07em; }
.repeat-actions { margin-left: auto; display: flex; gap: 4px; }
.repeat-actions button { border: 0; border-radius: 6px; background: #efede7; color: var(--muted); padding: 4px 8px; font-size: 12px; }
.repeat-actions button:last-child { color: var(--red); }
.step-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
.step-grid .image-field { grid-column: span 2; }
.step-video-visibility {
  min-height: 58px;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  position: relative;
  background: #fff;
  cursor: pointer;
}
.step-video-visibility input {
  width: 1px;
  height: 1px;
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.admin-switch {
  width: 38px;
  height: 22px;
  border-radius: 999px;
  position: relative;
  background: #d4d4d4;
  box-shadow: inset 0 0 0 1px rgba(42, 47, 53, .1);
  transition: background 160ms ease;
}
.admin-switch::after {
  content: "";
  width: 16px;
  height: 16px;
  border-radius: 50%;
  position: absolute;
  top: 3px;
  left: 3px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(42, 47, 53, .28);
  transition: transform 160ms ease;
}
.step-video-visibility input:checked + .admin-switch { background: var(--gold-strong); }
.step-video-visibility input:checked + .admin-switch::after { transform: translateX(16px); }
.step-video-visibility input:focus-visible + .admin-switch {
  outline: 3px solid var(--gold-strong);
  outline-offset: 2px;
}
.step-video-visibility-copy strong,
.step-video-visibility-copy small { display: block; }
.step-video-visibility-copy strong { color: var(--ink); font-size: 12px; }
.step-video-visibility-copy small { margin-top: 3px; }
.admin-switch-state {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
}
.step-video-visibility:has(input:checked) .admin-switch-state { color: var(--gold-dark); }
.hover-inserter {
  display: grid; grid-template-columns: minmax(150px, .75fr) minmax(170px, 1fr) auto;
  gap: 7px; margin-top: 3px; padding: 9px; border: 1px dashed #d2c982; border-radius: 8px;
  background: #fffdf2;
}
.hover-inserter select, .hover-inserter input { min-width: 0; background: #fff; }
.hover-inserter button {
  border: 1px solid #d5bd25; border-radius: 6px; padding: 0 12px;
  background: var(--gold); color: var(--ink); font-size: 12px; font-weight: 750; white-space: nowrap;
}
.hover-admin-preview {
  padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft);
}
.hover-admin-preview::before {
  content: "Prévia desktop";
  display: block;
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.hover-admin-preview.is-mobile::before { content: "Prévia mobile"; }
.hover-admin-preview img, .hover-admin-preview video {
  width: 100%; max-height: 210px; display: block; border-radius: 7px; object-fit: contain; background: #fff;
}
.hover-admin-preview.is-mobile img, .hover-admin-preview.is-mobile video { max-height: 360px; }
.category-form code { color: var(--gold-dark); font-size: 11px; }
.repeat-list.compact .repeat-row { display: grid; grid-template-columns: 24px 1fr 34px; align-items: center; gap: 9px; padding: 9px 12px; }
.repeat-list.compact button { border: 0; color: var(--red); background: transparent; font-size: 18px; }
.add-button { margin-top: 12px; min-height: 40px; color: var(--gold-dark); }
.upload-field { display: flex; gap: 7px; }
.upload-field input { flex: 1; }
.upload-field button { border: 1px solid var(--line); border-radius: 8px; background: var(--soft); padding: 0 13px; font-size: 12px; font-weight: 750; white-space: nowrap; }
.toggle-row { display: flex; align-items: center; gap: 9px; align-self: end; min-height: 43px; }
.toggle-row input { width: 18px; height: 18px; }
.dialog-footer { display: flex; align-items: center; gap: 9px; padding: 16px 26px; border-top: 1px solid var(--line); background: #fafafa; }
.save-status { color: var(--muted); font-size: 12px; margin-left: auto; }

.category-dialog { width: min(820px, calc(100% - 28px)); max-height: calc(100dvh - 28px); border-radius: 12px; overflow: hidden; }
.category-body { display: grid; grid-template-columns: 1fr 1fr; min-height: 450px; max-height: calc(100dvh - 108px); }
.category-list { padding: 20px; border-right: 1px solid var(--line); background: #fafafa; overflow: auto; }
.category-item { width: 100%; display: grid; grid-template-columns: 38px 1fr; gap: 10px; text-align: left; padding: 12px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.category-item > span { display: grid; place-items: center; border-radius: 8px; background: var(--soft); font-size: 18px; }
.category-item strong, .category-item small { display: block; }.category-item small { color: var(--muted); margin-top: 2px; }
.category-form { padding: 23px; display: flex; flex-direction: column; gap: 13px; overflow: auto; }
.category-form h3 { margin: 0 0 5px; }
.category-form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; margin-top: auto; padding-top: 8px; }
.category-form-actions .danger-button { margin-right: auto; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 100; color: #fff; background: var(--ink); border-radius: 10px; padding: 13px 18px; box-shadow: var(--shadow); opacity: 0; transform: translateY(12px); pointer-events: none; transition: .2s; }
.toast.is-visible { opacity: 1; transform: none; }

@media (max-width: 820px) {
  .admin-shell { padding-left: 0; padding-bottom: 74px; }
  .admin-sidebar { width: 100%; height: 68px; inset: auto 0 0; padding: 8px 12px; flex-direction: row; align-items: center; }
  .admin-brand, .sidebar-user { display: none; }
  .admin-sidebar nav { width: 100%; display: flex; justify-content: space-around; }
  .side-link { width: auto; flex-direction: column; gap: 1px; padding: 5px 9px; font-size: 10px; }
  .side-link span { font-size: 17px; }
  .admin-main { padding: 25px 15px 50px; }
  .toolbar { flex-wrap: wrap; }.admin-search { flex-basis: 100%; }.toolbar select, #category-filter { flex: 1; width: auto; }
  .article-row { grid-template-columns: 45px 1fr 26px; }.article-category, .status-badge { display: none; }
  .form-grid, .step-grid, .category-body { grid-template-columns: 1fr; }
  .span-2, .step-grid .image-field { grid-column: auto; }
  .hover-inserter { grid-template-columns: 1fr; }
  .hover-inserter button { min-height: 38px; }
  .category-list { border: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 520px) {
  .login-card, .setup-card { padding: 28px 23px; }
  .admin-topbar { align-items: start; flex-direction: column; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }.stats article { padding: 13px; }.stats strong { font-size: 20px; }
  .toolbar .secondary-button { width: 100%; }
  .dialog-footer { flex-wrap: wrap; }.save-status { display: none; }
}
