:root {
    color-scheme: light;
    --bg: #f6f7fb;
    --surface: #ffffff;
    --border: #e4e7ef;
    --text: #1f2430;
    --muted: #6b7280;
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #d97706;
    --code-bg: #f1f3f9;
    --radius: 12px;
    --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 1px 2px rgba(16, 24, 40, .04);
    --shadow-lg: 0 10px 25px rgba(16, 24, 40, .12);
    --flash-success-bg: #dcfce7; --flash-success-fg: #166534; --flash-success-border: #bbf7d0;
    --flash-danger-bg: #fee2e2; --flash-danger-fg: #991b1b; --flash-danger-border: #fecaca;
    --flash-warning-bg: #fef3c7; --flash-warning-fg: #92400e; --flash-warning-border: #fde68a;
    --flash-info-bg: #dbeafe; --flash-info-fg: #1e40af; --flash-info-border: #bfdbfe;
    --pill-ok-bg: #dcfce7; --pill-ok-fg: #166534;
    --pill-warn-bg: #fef3c7; --pill-warn-fg: #92400e;
    --pill-bad-bg: #fee2e2; --pill-bad-fg: #991b1b;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0f1419;
    --surface: #161d27;
    --border: #263041;
    --text: #e4e7ec;
    --muted: #8b95a7;
    --primary: #818cf8;
    --primary-dark: #6d78f4;
    --success: #34d399;
    --danger: #f87171;
    --warning: #fbbf24;
    --code-bg: #1c2530;
    --shadow: 0 1px 3px rgba(0, 0, 0, .45), 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, .55);
    --flash-success-bg: #0f2e1d; --flash-success-fg: #86efac; --flash-success-border: #14532d;
    --flash-danger-bg: #3b1216; --flash-danger-fg: #fca5a5; --flash-danger-border: #7f1d1d;
    --flash-warning-bg: #3a2a09; --flash-warning-fg: #fcd34d; --flash-warning-border: #713f12;
    --flash-info-bg: #12263f; --flash-info-fg: #93c5fd; --flash-info-border: #1e3a8a;
    --pill-ok-bg: #0f2e1d; --pill-ok-fg: #86efac;
    --pill-warn-bg: #3a2a09; --pill-warn-fg: #fcd34d;
    --pill-bad-bg: #3b1216; --pill-bad-fg: #fca5a5;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    transition: background-color .2s ease, color .2s ease;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}
.header-inner { display: flex; align-items: center; gap: 24px; padding: 14px 20px; }

.brand { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
    background: var(--primary); color: #fff; font-weight: 700;
    border-radius: 8px; padding: 4px 8px; font-size: .85rem;
}
.brand-name b { color: var(--primary); }

.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav-link {
    color: var(--text); padding: 8px 12px; border-radius: 8px; font-weight: 500; font-size: .95rem;
}
.nav-link:hover { background: var(--code-bg); text-decoration: none; }
.nav-admin { color: var(--primary); }

.header-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }
.user-chip { font-weight: 600; font-size: .9rem; display: inline-flex; align-items: center; gap: 8px; }

.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease, color .15s ease;
}
.theme-toggle:hover { border-color: var(--primary); color: var(--primary); }
.theme-toggle:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .25);
}
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.role-pill {
    background: var(--primary); color: #fff; font-size: .68rem; font-weight: 700;
    padding: 2px 7px; border-radius: 999px; text-transform: uppercase; letter-spacing: .03em;
}

.badge {
    display: inline-block; min-width: 18px; text-align: center;
    background: var(--danger); color: #fff; font-size: .7rem; font-weight: 700;
    border-radius: 999px; padding: 1px 6px;
}

/* Buttons */
.btn {
    display: inline-block; border: 1px solid transparent; cursor: pointer;
    padding: 9px 16px; border-radius: 8px; font-size: .92rem; font-weight: 600;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
    text-align: center;
}
.btn:hover { text-decoration: none; }
.btn-sm { padding: 6px 12px; font-size: .84rem; }
.btn-block { display: block; width: 100%; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--code-bg); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.92); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { filter: brightness(.92); }

.inline-form { display: inline-block; margin: 0; }

/* Main */
.main { padding: 32px 20px 56px; min-height: calc(100vh - 170px); }

/* Hero */
.hero { text-align: center; padding: 20px 0 32px; }
.hero h1 { font-size: 2.1rem; margin: 0 0 8px; }
.lead { color: var(--muted); font-size: 1.1rem; margin: 0 0 24px; }

.search-form { display: flex; gap: 10px; justify-content: center; max-width: 520px; margin: 0 auto; }
.search-form input {
    flex: 1; padding: 11px 16px; border: 1px solid var(--border); border-radius: 8px;
    font-size: .95rem; background: var(--surface);
}

/* Layout columns */
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
.side-col { position: sticky; top: 84px; }
@media (max-width: 900px) {
    .two-col { grid-template-columns: 1fr; }
    .side-col { position: static; }
}

.filter-info { color: var(--muted); }
.filter-info strong { color: var(--text); }

/* Cards */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 22px; margin-bottom: 20px;
}
.card h3 { margin: 0 0 12px; font-size: 1.05rem; }

/* Post cards */
.post-card { margin-bottom: 20px; }
.post-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: .85rem; }
.author { color: var(--primary); font-weight: 600; }
.dot { opacity: .5; }
.comments-count { font-size: .85rem; }

.post-title { margin: 10px 0 8px; font-size: 1.45rem; line-height: 1.3; }
.post-title a { color: var(--text); }
.post-title a:hover { color: var(--primary); }

.post-excerpt { color: var(--muted); margin: 0 0 12px; }

.read-more { font-weight: 600; font-size: .92rem; }

/* Tags */
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.tag-chip {
    background: var(--code-bg); color: var(--primary); border-radius: 999px;
    padding: 4px 12px; font-size: .8rem; font-weight: 600;
}
.tag-chip:hover { background: var(--primary); color: #fff; text-decoration: none; }
.tag-chip small { font-weight: 400; opacity: .7; }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 24px; }
.page-indicator { color: var(--muted); font-size: .9rem; }

/* Aside */
.about-card { text-align: center; }
.avatar {
    width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 12px;
    background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 1.3rem;
}

/* Article */
.article { padding: 32px; }
.article-title { margin: 10px 0 14px; font-size: 2rem; line-height: 1.25; }
.article-content { font-size: 1.03rem; }
.article-content h1, .article-content h2, .article-content h3 { margin: 1.4em 0 .5em; line-height: 1.3; }
.article-content h2 { border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.article-content pre {
    background: #161b22; color: #e6edf3; padding: 16px; border-radius: 10px;
    overflow-x: auto; font-size: .9rem; line-height: 1.5;
}
.article-content code {
    background: var(--code-bg); padding: 2px 6px; border-radius: 5px; font-size: .88em;
    font-family: "Cascadia Code", Consolas, monospace;
}
.article-content pre code { background: none; padding: 0; }
.article-content blockquote {
    margin: 1em 0; padding: 8px 18px; border-left: 4px solid var(--primary);
    background: var(--code-bg); border-radius: 0 8px 8px 0; color: var(--muted);
}

.article-actions { display: flex; gap: 10px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--border); }
.status-pill {
    font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    padding: 2px 9px; border-radius: 999px;
}
.status-published, .status-approved { background: var(--pill-ok-bg); color: var(--pill-ok-fg); }
.status-draft, .status-pending { background: var(--pill-warn-bg); color: var(--pill-warn-fg); }
.status-rejected { background: var(--pill-bad-bg); color: var(--pill-bad-fg); }

/* Comments */
.comments { margin-top: 32px; }
.comments h2 { font-size: 1.3rem; }
.comment { margin-bottom: 12px; }
.comment-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.comment-avatar {
    width: 40px; height: 40px; border-radius: 50%; background: var(--code-bg);
    color: var(--primary); display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700;
}
.comment-author { font-weight: 600; display: block; }
.comment-date { color: var(--muted); font-size: .82rem; }
.comment-body { margin: 0; white-space: pre-wrap; }

.comment-form h3 { margin-top: 0; }
.comment-form textarea {
    width: 100%; padding: 12px 14px; border: 1px solid var(--border); border-radius: 8px;
    font: inherit; font-size: .95rem; resize: vertical; background: var(--surface);
    color: var(--text);
}
.hint { color: var(--muted); font-size: .82rem; margin: 6px 0 12px; }
.muted { color: var(--muted); }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px;
    font: inherit; font-size: .95rem; background: var(--surface); color: var(--text);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus,
.search-form input:focus, .comment-form textarea:focus {
    outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
.form-row { display: grid; grid-template-columns: 1fr 200px; gap: 16px; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }
.editor-form textarea { font-family: "Cascadia Code", Consolas, monospace; font-size: .92rem; line-height: 1.6; }

.auth-wrap { display: flex; justify-content: center; padding: 40px 0; }
.auth-card { width: 100%; max-width: 420px; padding: 32px; }
.auth-card h1 { margin-top: 0; }
.auth-switch { margin: 18px 0 0; text-align: center; color: var(--muted); font-size: .92rem; }

/* Flash */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-weight: 500; }
.flash-success { background: var(--flash-success-bg); color: var(--flash-success-fg); border: 1px solid var(--flash-success-border); }
.flash-danger { background: var(--flash-danger-bg); color: var(--flash-danger-fg); border: 1px solid var(--flash-danger-border); }
.flash-warning { background: var(--flash-warning-bg); color: var(--flash-warning-fg); border: 1px solid var(--flash-warning-border); }
.flash-info { background: var(--flash-info-bg); color: var(--flash-info-fg); border: 1px solid var(--flash-info-border); }

/* Page head */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 1.6rem; }

/* Admin */
.admin-nav { display: flex; gap: 6px; margin-bottom: 24px; flex-wrap: wrap; }
.admin-link {
    padding: 8px 14px; border-radius: 8px; color: var(--text); font-weight: 600; font-size: .92rem;
}
.admin-link:hover { background: var(--code-bg); text-decoration: none; }
.admin-link-active { background: var(--primary); color: #fff; }
.admin-link-active:hover { background: var(--primary-dark); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat { text-align: center; margin-bottom: 0; }
.stat-value { display: block; font-size: 1.8rem; font-weight: 700; color: var(--primary); }
.stat-alert { color: var(--danger); }
.stat-label { color: var(--muted); font-size: .85rem; }

.tabs { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.tab { padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab-active { color: var(--primary); border-bottom-color: var(--primary); }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th, .table td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.table th { background: var(--code-bg); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.table tr:last-child td { border-bottom: none; }
.row-actions { display: flex; gap: 6px; align-items: center; }
.role-form { display: flex; gap: 6px; align-items: center; }
.role-form select { padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; font: inherit; background: var(--surface); color: var(--text); }
.meta-inline { color: var(--muted); font-size: .82rem; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: 10px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: none; }

/* Empty / error */
.empty-state { text-align: center; color: var(--muted); padding: 48px 16px; }
.error-state h1 { font-size: 4rem; color: var(--primary); margin: 0; }
.error-state p { margin: 8px 0 20px; font-size: 1.1rem; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

/* Footer */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 18px 20px; color: var(--muted); font-size: .88rem; }
.footer-inner p { margin: 0; }

@media (max-width: 720px) {
    .header-inner { flex-wrap: wrap; gap: 10px; }
    .nav { order: 3; width: 100%; overflow-x: auto; }
    .nav-link { white-space: nowrap; }
    .form-row { grid-template-columns: 1fr; }
    .article { padding: 20px; }
    .hero h1 { font-size: 1.6rem; }
    .footer-inner { justify-content: center; text-align: center; }
}

/* Editor de artigos */
.editor {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    overflow: hidden;
}
.editor:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}

.editor-toolbar {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-wrap: wrap;
    padding: 6px 8px;
    background: var(--code-bg);
    border-bottom: 1px solid var(--border);
}
.tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 8px;
    min-width: 32px;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 7px;
    color: var(--text);
    cursor: pointer;
    font: inherit;
    font-size: .82rem;
    font-weight: 600;
    line-height: 1;
}
.tool-btn:hover { background: var(--surface); border-color: var(--border); }
.tool-btn:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, .25);
}
.tool-btn-label { font-size: .78rem; letter-spacing: .02em; }
.tool-btn-preview { color: var(--primary); }
.tool-btn-active { background: var(--primary); color: #fff; }
.tool-btn-active:hover { background: var(--primary-dark); }
.tool-sep {
    width: 1px;
    height: 20px;
    background: var(--border);
    margin: 0 6px;
    flex: 0 0 auto;
}

.editor-textarea {
    display: block;
    width: 100%;
    min-height: 380px;
    padding: 16px;
    border: 0;
    outline: 0;
    resize: vertical;
    background: var(--surface);
    color: var(--text);
    font: .92rem/1.7 "Cascadia Code", Consolas, monospace;
}

.editor-preview {
    min-height: 380px;
    padding: 16px 20px;
    background: var(--surface);
    font-size: 1rem;
    line-height: 1.7;
    overflow-wrap: break-word;
}
.editor-preview h1, .editor-preview h2, .editor-preview h3 { line-height: 1.3; }
.editor-preview h2 { border-bottom: 1px solid var(--border); padding-bottom: 6px; }
.editor-preview pre {
    background: #161b22; color: #e6edf3; padding: 14px; border-radius: 8px;
    overflow-x: auto; font-size: .88rem; line-height: 1.5;
}
.editor-preview code {
    background: var(--code-bg); padding: 2px 6px; border-radius: 5px; font-size: .88em;
    font-family: "Cascadia Code", Consolas, monospace;
}
.editor-preview pre code { background: none; padding: 0; }
.editor-preview blockquote {
    margin: 1em 0; padding: 6px 16px; border-left: 4px solid var(--primary);
    background: var(--code-bg); border-radius: 0 8px 8px 0; color: var(--muted);
}
.editor-preview ul, .editor-preview ol { padding-left: 1.6em; }
.editor-preview img { max-width: 100%; border-radius: 8px; }
.editor-preview hr { border: 0; border-top: 2px solid var(--border); margin: 1.2em 0; }

.editor-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 8px 14px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: .8rem;
    background: var(--surface);
}
.editor-status { font-style: italic; }

.editor-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 10px 14px;
    background: var(--flash-warning-bg);
    border-top: 1px solid var(--flash-warning-border);
    color: var(--flash-warning-fg);
    font-size: .88rem;
}
.editor-banner[hidden] { display: none; }
.editor-banner-actions { display: flex; gap: 8px; }

/* Modal */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 100;
}
.modal-backdrop[hidden] { display: none; }
.modal {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 24px;
    width: 100%;
    max-width: 440px;
}
.modal h3 { margin: 0 0 16px; }
.modal .form-group { margin-bottom: 14px; }
.modal input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    font-size: .95rem;
    background: var(--surface);
    color: var(--text);
}
.modal input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

/* Language switcher */
.lang-switcher {
    display: flex;
    align-items: center;
    gap: 2px;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 2px;
    background: var(--surface);
}
.lang-link {
    font-size: .72rem;
    font-weight: 700;
    letter-spacing: .04em;
    padding: 4px 8px;
    border-radius: 999px;
    color: var(--muted);
    text-decoration: none;
}
.lang-link:hover { color: var(--text); text-decoration: none; }
.lang-link-active {
    background: var(--primary);
    color: #fff;
}
.lang-link-active:hover { color: #fff; }

/* Material complementar */
.material-section {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}
.material-title {
    margin: 0 0 16px;
    font-size: 1.25rem;
}
.material-grid {
    display: grid;
    gap: 12px;
}
.material-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 14px;
    align-items: center;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    color: inherit;
    text-decoration: none;
    transition: border-color .15s, box-shadow .15s, transform .15s;
}
.material-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 16px rgba(79, 70, 229, .1);
    transform: translateY(-1px);
    text-decoration: none;
}
.material-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--code-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--primary);
    overflow: hidden;
    flex-shrink: 0;
}
.material-icon img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}
.material-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}
.material-host {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--primary);
}
.material-card-title {
    font-size: 1rem;
    line-height: 1.3;
}
.material-desc {
    font-size: .88rem;
    color: var(--muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.material-url {
    font-size: .78rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.material-arrow {
    color: var(--muted);
    font-size: 1.1rem;
}

/* Editor de links complementares */
.links-section { margin-top: 8px; }
.links-section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.links-section-head label {
    display: block;
    font-weight: 600;
    font-size: .95rem;
    margin-bottom: 4px;
}
.links-editor { display: flex; flex-direction: column; gap: 14px; }
.link-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--code-bg);
}
.link-row-fields .form-group { margin-bottom: 12px; }
.link-row-fields .form-group:last-of-type { margin-bottom: 10px; }
.link-preview-card {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: start;
    padding: 14px;
    border: 1px dashed var(--border);
    border-radius: 10px;
    background: var(--surface);
    opacity: .55;
    align-self: stretch;
}
.link-preview-card.is-ready {
    opacity: 1;
    border-style: solid;
    border-color: var(--primary);
}
.link-preview-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--code-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--primary);
    flex-shrink: 0;
}
.link-preview-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}
.link-preview-host {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--primary);
}
.link-preview-title {
    font-size: .95rem;
    line-height: 1.3;
    word-break: break-word;
}
.link-preview-desc,
.link-preview-url {
    font-size: .8rem;
    word-break: break-all;
}
.links-empty { margin: 0; }

@media (max-width: 720px) {
    .link-row { grid-template-columns: 1fr; }
    .material-card { grid-template-columns: auto 1fr; }
    .material-arrow { display: none; }
}
