/* SBrT CMS — Site Principal
   Tokens de design no :root; o modo escuro redefine só as cores. */

@font-face {
	font-family: 'Inter';
	font-style: normal;
	font-display: swap;
	font-weight: 100 900;
	src: url('/static/fonts/inter-latin-wght-normal.woff2') format('woff2-variations');
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
	font-family: 'Inter';
	font-style: normal;
	font-display: swap;
	font-weight: 100 900;
	src: url('/static/fonts/inter-latin-ext-wght-normal.woff2') format('woff2-variations');
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
	/* Marca: o azul da SBrT */
	--primary: #0b5cad;
	--primary-hover: #094c90;
	--primary-ink: #ffffff;
	--primary-soft: #e8f1fb;
	--accent: #4c9be8;

	/* Superfícies e texto */
	--bg: #f6f7f9;
	--surface: #ffffff;
	--surface-2: #f3f5f8;
	--surface-3: #eceff3;
	--text: #111827;
	--text-2: #374151;
	--muted: #6b7280;
	--border: #e5e7eb;
	--border-strong: #d1d5db;

	/* Estados */
	--danger: #c0362c;
	--danger-soft: #fdeeec;
	--ok: #13804c;
	--ok-soft: #e8f6ee;
	--warn: #a15c07;
	--warn-soft: #fdf3e2;

	/* Menu lateral (sempre escuro, nas cores do site) */
	--side-bg: #0c243c;
	--side-bg-2: #12304f;
	--side-text: #c4d3e3;
	--side-muted: #7f97b0;
	--side-active: #ffffff;

	--radius-sm: 6px;
	--radius: 10px;
	--radius-lg: 14px;
	--shadow-xs: 0 1px 2px rgb(16 24 40 / .05);
	--shadow: 0 1px 3px rgb(16 24 40 / .06), 0 1px 2px rgb(16 24 40 / .04);
	--shadow-lg: 0 12px 32px -8px rgb(16 24 40 / .18), 0 4px 8px -4px rgb(16 24 40 / .06);
	--ring: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent);
	--ease: cubic-bezier(.2, .7, .3, 1);

	font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
	font-feature-settings: 'cv11', 'ss01';
	color-scheme: light;
}

/* Tema escuro: segue o sistema, a menos que a pessoa escolha no botão do menu (data-theme em <html>) */
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--primary: #4c9be8;
		--primary-hover: #6aaef0;
		--primary-ink: #06182b;
		--primary-soft: #132a43;
		--accent: #6aaef0;
		--bg: #0b0f15;
		--surface: #121821;
		--surface-2: #18202b;
		--surface-3: #1f2834;
		--text: #e6eaf0;
		--text-2: #c3cad4;
		--muted: #8b95a3;
		--border: #232c38;
		--border-strong: #303b49;
		--danger: #f07167;
		--danger-soft: #2c1513;
		--ok: #4cc38a;
		--ok-soft: #0f2a1d;
		--warn: #e3a541;
		--warn-soft: #2b2010;
		--side-bg: #080c11;
		--side-bg-2: #121a24;
		--shadow: 0 1px 2px rgb(0 0 0 / .4);
		--shadow-lg: 0 16px 40px -8px rgb(0 0 0 / .6);
		color-scheme: dark;
	}
}
:root[data-theme="dark"] {
	--primary: #4c9be8;
	--primary-hover: #6aaef0;
	--primary-ink: #06182b;
	--primary-soft: #132a43;
	--accent: #6aaef0;
	--bg: #0b0f15;
	--surface: #121821;
	--surface-2: #18202b;
	--surface-3: #1f2834;
	--text: #e6eaf0;
	--text-2: #c3cad4;
	--muted: #8b95a3;
	--border: #232c38;
	--border-strong: #303b49;
	--danger: #f07167;
	--danger-soft: #2c1513;
	--ok: #4cc38a;
	--ok-soft: #0f2a1d;
	--warn: #e3a541;
	--warn-soft: #2b2010;
	--side-bg: #080c11;
	--side-bg-2: #121a24;
	--shadow: 0 1px 2px rgb(0 0 0 / .4);
	--shadow-lg: 0 16px 40px -8px rgb(0 0 0 / .6);
	color-scheme: dark;
}

/* --- Base ------------------------------------------------------------------- */
* { box-sizing: border-box; }
/* Garante que [hidden] vença regras como display: flex */
[hidden] { display: none !important; }
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14.5px; line-height: 1.55; }
a { color: var(--primary); text-underline-offset: 2px; }
h1 { font-size: 1.6rem; line-height: 1.2; letter-spacing: -.022em; font-weight: 650; margin: .15rem 0 0; }
h2 { font-size: 1.05rem; letter-spacing: -.01em; font-weight: 600; margin: 0; }
code { background: var(--surface-2); padding: .1rem .35rem; border-radius: 4px; font-size: .85em; }
.muted { color: var(--muted); }
small { font-size: .82em; }
.icon { flex-shrink: 0; display: block; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--primary) 25%, transparent); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; } }

/* --- Layout e menu lateral ---------------------------------------------------- */
.layout { display: grid; grid-template-columns: 256px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
	background: linear-gradient(180deg, var(--side-bg) 0%, var(--side-bg-2) 100%); color: var(--side-text);
	padding: 1.25rem .85rem 1rem; display: flex; flex-direction: column; gap: 1.25rem;
	position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgb(255 255 255 / .15) transparent;
}
.logo { display: flex; align-items: center; gap: .7rem; padding: .15rem .55rem; text-decoration: none; color: #fff; line-height: 1.2; }
.logo-mark {
	width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0;
	background: linear-gradient(135deg, #4c9be8, #0b5cad); color: #fff; font-weight: 800; font-size: 1.05rem;
	box-shadow: inset 0 1px 0 rgb(255 255 255 / .25), 0 4px 12px rgb(11 92 173 / .45);
}
.logo-text { font-size: 1rem; font-weight: 500; color: var(--side-text); letter-spacing: -.01em; }
.logo-text strong { color: #fff; font-weight: 750; }
.logo-text small { font-size: .78rem; color: var(--side-muted); font-weight: 500; letter-spacing: .01em; }

.sidebar nav { display: flex; flex-direction: column; gap: 1px; }
.sidebar nav a {
	display: flex; align-items: center; gap: .7rem; padding: .42rem .6rem; border-radius: 8px;
	text-decoration: none; color: var(--side-text); font-weight: 500; font-size: .92rem; position: relative;
	transition: background .15s var(--ease), color .15s var(--ease);
}
.sidebar nav a .icon { opacity: .75; }
.sidebar nav a:hover { background: rgb(255 255 255 / .06); color: #fff; }
.sidebar nav a[aria-current=page] { background: rgb(255 255 255 / .11); color: var(--side-active); font-weight: 600; }
.sidebar nav a[aria-current=page] .icon { opacity: 1; color: #8cc4ff; }
.sidebar nav a[aria-current=page]::before { content: ''; position: absolute; left: -.85rem; top: 22%; bottom: 22%; width: 3px; border-radius: 0 3px 3px 0; background: #8cc4ff; }
.sidebar :focus-visible { outline-color: #8cc4ff; }
.nav-group { font-size: .68rem; font-weight: 600; text-transform: uppercase; letter-spacing: .09em; color: var(--side-muted); padding: .95rem .6rem .3rem; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: .6rem; padding-top: .9rem; border-top: 1px solid rgb(255 255 255 / .08); }
.sidebar-site { display: flex; align-items: center; gap: .7rem; padding: .48rem .6rem; border-radius: 8px; color: var(--side-text); text-decoration: none; font-weight: 500; font-size: .92rem; }
.sidebar-site .icon:last-child { margin-left: auto; opacity: .6; }
.sidebar-site:hover { background: rgb(255 255 255 / .06); color: #fff; }
.who-row { display: flex; align-items: center; gap: .25rem; }
.who { flex: 1; min-width: 0; display: flex; align-items: center; gap: .65rem; padding: .4rem .5rem; border-radius: 8px; text-decoration: none; color: #fff; }
.who:hover { background: rgb(255 255 255 / .06); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; background: rgb(255 255 255 / .12); color: #fff; font-weight: 650; font-size: .85rem; }
.who-text { display: flex; flex-direction: column; min-width: 0; font-weight: 600; font-size: .86rem; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-text small { color: var(--side-muted); font-weight: 500; font-size: .76rem; }
.icon-btn { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; border: 0; background: none; color: var(--side-text); cursor: pointer; }
.icon-btn:hover { background: rgb(255 255 255 / .08); color: #fff; }
.foot-row { display: flex; align-items: center; gap: .25rem; }
.foot-row .sidebar-site { flex: 1; }
.foot-row .theme-toggle { margin-left: auto; }
.theme-toggle .to-light, :root[data-theme="dark"] .theme-toggle .to-dark { display: none; }
.theme-toggle > span, :root[data-theme="dark"] .theme-toggle .to-light { display: contents; }
:root:not([data-theme]) .theme-toggle { display: none; }

.content { padding: 2rem 2.5rem 5rem; max-width: 1180px; width: 100%; min-width: 0; }

@media (max-width: 860px) {
	.layout { grid-template-columns: minmax(0, 1fr); }
	.sidebar { position: static; height: auto; gap: .75rem; padding: .85rem 16px; }
	.sidebar nav { flex-direction: row; flex-wrap: wrap; gap: 2px; }
	.sidebar nav a { padding: .4rem .55rem; font-size: .86rem; }
	.sidebar nav a[aria-current=page]::before { display: none; }
	.nav-group { width: 100%; padding: .6rem .4rem .1rem; }
	.sidebar-foot { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
	.content { padding: 1.25rem 16px 3rem; }
}

/* --- Cabeçalho das telas ---------------------------------------------------- */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.5rem; flex-wrap: wrap; }
.page-head p.muted { margin: .35rem 0 0; max-width: 62ch; }
.page-head.sticky {
	position: sticky; top: 0; z-index: 5; padding: 1rem 0 .9rem; margin-top: -1rem;
	background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
	border-bottom: 1px solid var(--border);
}
.page-head a.muted { display: inline-flex; align-items: center; gap: .2rem; text-decoration: none; font-size: .85rem; font-weight: 500; }
.page-head a.muted:hover { color: var(--primary); }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* --- Cartões ---------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: 1.4rem 1.5rem; margin-bottom: 1.25rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.card-head .link { text-decoration: none; font-weight: 500; font-size: .9rem; }

/* --- Botões ----------------------------------------------------------------- */
.btn {
	display: inline-flex; align-items: center; justify-content: center; gap: .4rem; height: 36px; padding: 0 .95rem;
	border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
	font: inherit; font-size: .9rem; font-weight: 550; cursor: pointer; text-decoration: none; white-space: nowrap;
	box-shadow: var(--shadow-xs); transition: background .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease), transform .05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); box-shadow: 0 1px 2px rgb(11 92 173 / .25), inset 0 1px 0 rgb(255 255 255 / .12); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); }
.page-head .btn-ghost { border-color: var(--border); background: var(--surface); box-shadow: var(--shadow-xs); }
.page-head .btn-ghost:hover { background: var(--surface-2); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, transparent); background: transparent; box-shadow: none; }
.btn-danger:hover { background: var(--danger-soft); }
.btn-small { height: 30px; padding: 0 .7rem; font-size: .84rem; }
.btn-block { width: 100%; }
.link { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; cursor: pointer; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px; }
.link:hover { text-decoration-color: currentColor; }
.link.danger, .danger { color: var(--danger); }

/* --- Formulários ------------------------------------------------------------ */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.15rem 1.5rem; }
.field { grid-column: 1 / -1; display: flex; flex-direction: column; gap: .4rem; min-width: 0; }
.field.half { grid-column: span 1; }
@media (max-width: 640px) { .field.half { grid-column: 1 / -1; } }
.label, .field > span:first-child { font-weight: 550; font-size: .86rem; color: var(--text-2); }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=date], input:not([type]), select, textarea {
	width: 100%; min-height: 38px; padding: .5rem .75rem; border: 1px solid var(--border-strong); border-radius: 8px;
	background: var(--surface); color: var(--text); font: inherit; font-size: .93rem; box-shadow: var(--shadow-xs);
	transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--border-strong) 60%, var(--muted)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
select { appearance: none; padding-right: 2.2rem; cursor: pointer;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236b7280' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
	background-repeat: no-repeat; background-position: right .7rem center; }
input[type=date] { font-variant-numeric: tabular-nums; }
textarea { resize: vertical; line-height: 1.55; }
textarea.code, .code { font-family: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, monospace; font-size: .84rem; }
textarea.markdown { font-family: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, monospace; font-size: .86rem; line-height: 1.65; }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); }
.check { flex-direction: row; align-items: center; gap: .55rem; font-weight: 500; color: var(--text-2); cursor: pointer; }
.check input { width: 1.05rem; height: 1.05rem; margin: 0; }
.prefix { display: flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow-xs); transition: border-color .15s, box-shadow .15s; }
.prefix:focus-within { border-color: var(--primary); box-shadow: var(--ring); }
.prefix > span { padding-left: .75rem; color: var(--muted); font-size: .9rem; white-space: nowrap; }
.prefix input { border: 0; box-shadow: none !important; padding-left: .15rem; background: transparent; }
.help { margin: 0 0 1rem; color: var(--muted); font-size: .84rem; line-height: 1.5; }
.field .help { margin: .1rem 0 0; }
.inline { display: inline-flex; gap: .35rem; align-items: center; }
input.filter { max-width: 340px; padding-left: 2.2rem;
	background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%239ca3af' stroke-width='1.75' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='4.5'/%3E%3Cpath d='M10.5 10.5L14 14'/%3E%3C/svg%3E") no-repeat .75rem center; }
.card > .filter { margin-bottom: 1rem; }

/* Controle segmentado (status) */
.segmented { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; background: var(--surface-3); border-radius: 10px; align-self: flex-start; }
.segmented label, .segmented a {
	display: flex; gap: .4rem; align-items: center; padding: .38rem .8rem; border-radius: 7px; cursor: pointer;
	font-size: .88rem; font-weight: 500; color: var(--text-2); text-decoration: none; transition: background .15s, color .15s;
}
.segmented label input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label:hover, .segmented a:hover { color: var(--text); }
.segmented label:has(input:checked), .segmented a[aria-current=true] { background: var(--surface); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.segmented label:has(input:focus-visible) { box-shadow: var(--ring); }
.segmented label:has(input[value=published]:checked)::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.segmented label:has(input[value=draft]:checked)::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.segmented label:has(input[value=archived]:checked)::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }

/* --- Mensagens e selos ------------------------------------------------------ */
.flash {
	display: flex; align-items: flex-start; gap: .6rem; padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1.1rem;
	border: 1px solid; font-size: .92rem; font-weight: 500; animation: flash-in .25s var(--ease);
}
.flash .icon { margin-top: .1rem; }
@keyframes flash-in { from { opacity: 0; transform: translateY(-4px); } }
.flash-ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); background: var(--ok-soft); }
.flash-error { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); background: var(--danger-soft); }
.flash-info { color: var(--text-2); border-color: var(--border); background: var(--surface-2); }
.badge {
	display: inline-flex; align-items: center; gap: .35rem; padding: .12rem .55rem; border-radius: 999px;
	font-size: .76rem; font-weight: 550; background: var(--surface-3); color: var(--text-2); white-space: nowrap; text-decoration: none;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }
.badge-ok { color: var(--ok); background: var(--ok-soft); }
.badge-ok::before { background: var(--ok); }
.badge-info { color: var(--primary); background: var(--primary-soft); }
.badge-info::before { background: var(--primary); }
.badge-warn { color: var(--warn); background: var(--warn-soft); }
.badge-archived { color: var(--muted); }
.badge-archived::before { background: var(--muted); }

/* --- Tabelas ---------------------------------------------------------------- */
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .92rem; }
.table th, .table td { text-align: left; padding: .7rem .75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table th { font-size: .74rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; background: var(--surface-2); border-bottom-color: var(--border); }
.table th:first-child { border-top-left-radius: 8px; }
.table th:last-child { border-top-right-radius: 8px; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: color-mix(in srgb, var(--primary) 4%, transparent); }
.table tbody tr:last-child td { border-bottom: 0; }
.table td:first-child a { font-weight: 550; color: var(--text); text-decoration: none; }
.table td:first-child a:hover { color: var(--primary); text-decoration: underline; }
.table td small.muted { display: block; font-size: .78rem; }
.table th a { color: inherit; text-decoration: none; }
.table th a:hover { color: var(--text); }
.table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text-2); }
.table tr.inactive td { opacity: .5; }
.card:has(> .table) { overflow-x: auto; }
.list-tools { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-bottom: 1.1rem; }
.list-tools .filter { flex: 1 1 260px; margin: 0; }
.list-tools > .muted { font-size: .86rem; margin-left: auto; }
.changed-list { font-size: .84rem; color: var(--muted); }

/* --- Início ----------------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat {
	display: flex; align-items: center; gap: .9rem; text-decoration: none; color: var(--text); margin: 0; padding: 1.1rem 1.2rem;
	transition: border-color .15s var(--ease), box-shadow .2s var(--ease), transform .2s var(--ease);
}
a.stat:hover { border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.stat-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex-shrink: 0; }
.stat-body { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.stat strong { font-size: 1.55rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .86rem; }
.stat span small { color: var(--warn); font-weight: 500; }
.stat .ok, .stat .err, .stat .spin { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 1.1rem; flex-shrink: 0; }
.stat .ok { color: var(--ok); background: var(--ok-soft); }
.stat .err { color: var(--danger); background: var(--danger-soft); }
.stat .spin { color: var(--primary); background: var(--primary-soft); }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.greeting { color: var(--muted); font-size: .92rem; margin: 0 0 .1rem; font-weight: 500; }

/* --- Listas repetíveis ------------------------------------------------------ */
.repeater { display: flex; flex-direction: column; gap: .6rem; }
.repeater-row {
	display: grid; grid-template-columns: auto 1fr auto; gap: .85rem; align-items: start; padding: 1rem;
	border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); transition: border-color .15s, box-shadow .15s;
}
.repeater-row:hover { border-color: var(--border-strong); }
.repeater-row:focus-within { border-color: color-mix(in srgb, var(--primary) 40%, var(--border)); }
.repeater-row .handle { padding-top: 1.85rem; }
.repeater-row [data-remove-row] { margin-top: 1.7rem; width: 28px; height: 28px; border-radius: 6px; text-decoration: none; display: grid; place-items: center; color: var(--muted); }
.repeater-row [data-remove-row]:hover { background: var(--danger-soft); color: var(--danger); }
.repeater + .btn { align-self: flex-start; border-style: dashed; box-shadow: none; color: var(--text-2); }
.repeater + .btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-soft); }
.repeater-help { margin: 0 0 .5rem; }
.handle { cursor: grab; color: var(--muted); user-select: none; font-size: 1.05rem; line-height: 1; }
.handle:active { cursor: grabbing; }
.sortable-ghost { opacity: .35; }
.sortable-chosen { box-shadow: var(--shadow-lg); }

/* --- Campos de mídia, arquivo e referência ---------------------------------- */
.media-field, .file-field { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.media-preview img {
	height: 64px; width: auto; max-width: 180px; object-fit: contain; border: 1px solid var(--border); border-radius: 8px; padding: 4px;
	background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0 / 12px 12px;
}
.media-preview:empty { display: none; }
.file-field .file-name { font-size: .9rem; }
.ref-field select { width: 100%; }

/* --- Editor de texto -------------------------------------------------------- */
.rte { border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-xs); transition: border-color .15s, box-shadow .15s; }
.rte:focus-within { border-color: var(--primary); box-shadow: var(--ring); }
.rte-toolbar, .rte-subbar {
	display: flex; flex-wrap: wrap; gap: 2px; padding: .4rem; border-bottom: 1px solid var(--border);
	background: color-mix(in srgb, var(--surface-2) 92%, transparent); backdrop-filter: blur(8px);
	border-radius: var(--radius) var(--radius) 0 0; position: sticky; top: 74px; z-index: 2;
}
.rte-subbar { top: auto; position: static; border-radius: 0; background: var(--primary-soft); }
.rte-subbar::before { content: attr(data-label); font-size: .78rem; font-weight: 600; color: var(--primary); align-self: center; margin: 0 .45rem; }
.rte-toolbar button, .rte-subbar button {
	min-width: 30px; height: 30px; padding: 0 .45rem; border: 1px solid transparent; border-radius: 6px; background: none;
	color: var(--text-2); font: inherit; font-size: .88rem; font-weight: 650; cursor: pointer; transition: background .12s, color .12s;
}
.rte-subbar button { font-weight: 500; font-size: .82rem; border-color: var(--border); background: var(--surface); }
.rte-toolbar button:hover, .rte-subbar button:hover { background: var(--surface); color: var(--text); border-color: var(--border); }
.rte-subbar button.active, .rte-toolbar button.active { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.rte-toolbar button:disabled { opacity: .3; cursor: default; }
.rte-toolbar button svg { vertical-align: middle; }
.rte-toolbar .sep, .rte-subbar .sep { width: 1px; background: var(--border-strong); margin: 6px 4px; }
.rte-area .ProseMirror { min-height: 200px; padding: 1rem 1.15rem; outline: none; font-size: .97rem; line-height: 1.7; }
.rte-area .ProseMirror > :first-child { margin-top: 0; }
.rte-area .ProseMirror h2 { font-size: 1.3rem; letter-spacing: -.015em; margin: 1.4rem 0 .5rem; }
.rte-area .ProseMirror h3 { font-size: 1.1rem; margin: 1.2rem 0 .4rem; }
.rte-html { width: 100%; min-height: 280px; border: 0 !important; box-shadow: none !important; border-radius: 0 0 var(--radius) var(--radius); padding: 1rem 1.15rem; }
.ProseMirror table { border-collapse: collapse; width: 100%; margin: .75rem 0; table-layout: fixed; }
.ProseMirror th, .ProseMirror td { border: 1px solid var(--border-strong); padding: .4rem .55rem; vertical-align: top; position: relative; }
.ProseMirror th { background: var(--surface-2); font-weight: 600; }
.ProseMirror td p, .ProseMirror th p { margin: 0; }
.ProseMirror .selectedCell::after { content: ''; position: absolute; inset: 0; background: color-mix(in srgb, var(--accent) 25%, transparent); pointer-events: none; }
.ProseMirror img { max-width: 100%; height: auto; display: block; margin: .75rem auto; border-radius: 6px; }
.ProseMirror img[data-align=left] { float: left; margin: .25rem 1.25rem .75rem 0; max-width: 50%; }
.ProseMirror img[data-align=right] { float: right; margin: .25rem 0 .75rem 1.25rem; max-width: 50%; }
.ProseMirror img[data-align=full] { width: 100%; }
.ProseMirror img[data-size=s] { width: 30%; }
.ProseMirror img[data-size=m] { width: 50%; }
.ProseMirror img[data-size=l] { width: 75%; max-width: 75%; }
.ProseMirror::after { content: ''; display: table; clear: both; }
.ProseMirror img.ProseMirror-selectednode { outline: 3px solid var(--accent); }
.ProseMirror blockquote { border-left: 3px solid var(--primary); margin: .9rem 0; padding: .3rem 1rem; background: var(--surface-2); border-radius: 0 6px 6px 0; }
.ProseMirror a { color: var(--primary); }

/* --- Zona de exclusão ------------------------------------------------------- */
.danger-zone { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: space-between; margin-top: 2rem; padding-top: 1.25rem; border-top: 1px solid var(--border); }

/* --- Mídia ------------------------------------------------------------------ */
.upload { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.dropzone {
	flex: 1; min-width: min(240px, 100%); display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; padding: 1.25rem;
	border: 1.5px dashed var(--border-strong); border-radius: var(--radius); cursor: pointer; background: var(--surface-2); transition: border-color .15s, background .15s;
}
.dropzone:hover { border-color: var(--primary); background: var(--primary-soft); }
.dropzone input[type=file] { max-width: 100%; font: inherit; font-size: .88rem; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 1.1rem; }
.media-card { padding: .75rem; margin: 0; display: flex; flex-direction: column; gap: .75rem; transition: box-shadow .2s var(--ease), border-color .2s; }
.media-card:hover { box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.media-card img, .file-icon { width: 100%; height: 180px; object-fit: contain; background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0 / 16px 16px; border-radius: 8px; }
.file-icon { display: grid; place-items: center; font-weight: 800; letter-spacing: .05em; color: var(--danger); }
.media-card figcaption { display: flex; flex-direction: column; gap: .5rem; padding: 0 .25rem .25rem; }
.media-card figcaption .inline { display: flex; }
.media-card figcaption .inline input { flex: 1; min-width: 0; }
.media-card small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-card .row { display: flex; justify-content: space-between; gap: .75rem; flex-wrap: wrap; padding-top: .6rem; border-top: 1px solid var(--border); font-size: .88rem; }
.media-card input { min-height: 32px; padding: .3rem .6rem; font-size: .88rem; }
.media-card .badge { align-self: flex-start; }
.credit-line { color: var(--ok); }

/* --- Diálogo de imagens ----------------------------------------------------- */
.dialog { width: min(920px, 94vw); max-height: 86vh; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.dialog[open] { animation: dialog-in .2s var(--ease); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.dialog::backdrop { background: rgb(8 15 25 / .5); backdrop-filter: blur(3px); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.dialog-body { padding: 1rem 1.25rem 1.25rem; }
.picker-upload { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.picker-upload .filter { margin-left: auto; flex: 0 1 260px; }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .75rem; }
.picker-item { display: flex; flex-direction: column; gap: .4rem; padding: .5rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); cursor: pointer; font: inherit; font-size: .8rem; text-align: left; transition: border-color .15s, box-shadow .15s; }
.picker-item:hover, .picker-item:focus-visible { border-color: var(--primary); box-shadow: var(--ring); outline: none; }
.picker-item img, .picker-item .file-icon { width: 100%; height: 92px; object-fit: contain; border-radius: 6px; }
.picker-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Login ------------------------------------------------------------------ */
.login {
	min-height: 100vh; display: grid; place-items: center; padding: 16px;
	background:
		radial-gradient(60rem 30rem at 15% -10%, color-mix(in srgb, var(--primary) 18%, transparent), transparent 60%),
		radial-gradient(50rem 30rem at 110% 110%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%),
		var(--bg);
}
.login-card { width: min(400px, 100%); display: flex; flex-direction: column; gap: 1.1rem; padding: 2rem; box-shadow: var(--shadow-lg); }
.login-brand { display: flex; align-items: center; gap: .8rem; margin-bottom: .25rem; }
.login-brand .logo-mark { width: 44px; height: 44px; border-radius: 12px; font-size: 1.25rem; }
.login-card h1 { font-size: 1.3rem; letter-spacing: -.02em; }
.login-card h1 span { color: var(--muted); font-weight: 500; }
.login-card p { margin: 0; font-size: .9rem; }
.login-card .btn { height: 40px; margin-top: .25rem; }

/* --- Edição de imagem ------------------------------------------------------- */
.editor-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1.25rem; align-items: start; }
@media (max-width: 1000px) { .editor-layout { grid-template-columns: 1fr; } }
.aspect-buttons { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .75rem; }
.cropper-box { max-height: 60vh; background: var(--surface-2); border-radius: var(--radius); overflow: hidden; }
.cropper-box img { display: block; max-width: 100%; }
.focal-box { position: relative; cursor: crosshair; line-height: 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.focal-box canvas { width: 100%; height: auto; }
.focal-marker { position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border: 3px solid #fff; border-radius: 50%; box-shadow: 0 0 0 2px var(--primary), 0 2px 6px rgb(0 0 0 / .5); pointer-events: none; transition: left .1s, top .1s; }
.previews-title { font-size: .92rem; margin: 1.25rem 0 .5rem; }
.previews { display: grid; grid-template-columns: 2.4fr 1fr .7fr; gap: .75rem; align-items: end; }
.previews figure { margin: 0; }
.previews figcaption { font-size: .78rem; color: var(--muted); margin-top: .3rem; }
.frame { overflow: hidden; border-radius: 8px; background: var(--surface-2); }
.frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.frame-wide { aspect-ratio: 16 / 6; }
.frame-square { aspect-ratio: 1; }
.frame-tall { aspect-ratio: 9 / 16; }
.small { font-size: .85rem; }
.credit-card { margin-top: 1.25rem; }
.credit-preview { margin-top: 1rem; padding: .65rem .85rem; background: var(--surface-2); border-radius: 8px; font-size: .88rem; }
.segmented label { position: relative; }
.danger-zone .btn-ghost { border-color: var(--border-strong); background: var(--surface); box-shadow: var(--shadow-xs); }
.danger-zone .btn-ghost:hover { background: var(--surface-2); }
input[type=file]::file-selector-button {
	margin-right: .75rem; height: 32px; padding: 0 .85rem; border: 1px solid var(--border-strong); border-radius: 7px;
	background: var(--surface); color: var(--text); font: inherit; font-size: .86rem; font-weight: 550; cursor: pointer;
}
input[type=file]::file-selector-button:hover { background: var(--surface-3); }
