:root {
    --bg: #eceafb;
    --bg-2: #f6f4ff;
    --surface: #ffffff;
    --surface-soft: #f7f6fe;
    --sidebar: #5a4bc8;
    --sidebar-2: #6a56d8;
    --brand: #6354d8;
    --brand-ink: #4a3bb4;
    --brand-soft: #eeebff;
    --ink: #2f2a5c;
    --ink-2: #4a4573;
    --muted: #8d89ab;
    --line: #ebe9f6;
    --ok: #2a9d6e;
    --ok-soft: #e4f6ee;
    --warn: #c9860d;
    --warn-soft: #fdf3e0;
    --danger: #d6455c;
    --danger-soft: #fdeaed;
    --radius-lg: 26px;
    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 18px 40px -24px rgba(58, 44, 130, .45);
    --shadow-soft: 0 8px 24px -18px rgba(58, 44, 130, .5);
    --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;

    /* Tokens de densidade: os breakpoints redefinem estes valores em vez de
       reescrever as regras dos componentes. */
    --shell-pad: 18px;
    --gutter: 32px;
    --topbar-pad-y: 24px;
    --card-pad: 20px;
    --row-pad: 16px 18px;
    --stack-gap: 18px;
    --thumb: 52px;
    --row-basis: 180px;
    --sidebar-w: 232px;
    --side-col: 320px;
    --title-size: 27px;
    --nav-pad-y: 11px;
}

* { box-sizing: border-box; }

html, body {
    height: 100%;
    margin: 0;
}

body {
    font-family: var(--font);
    background: linear-gradient(140deg, #e9e5fb 0%, #f1eefc 45%, #f7edf6 100%);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-ink); }
h1, h2, h3, h4 { margin: 0; color: var(--ink); line-height: 1.25; }
p { margin: 0 0 .7em; }
p:last-child { margin-bottom: 0; }
img { max-width: 100%; }
.icon { flex: none; }

/* ------------------------------------------------------------------ shell */

.shell {
    display: flex;
    height: 100vh;
    height: 100dvh;
    max-width: 1500px;
    margin: 0 auto;
    padding: var(--shell-pad);
}

.sidebar {
    width: var(--sidebar-w);
    flex: none;
    background: linear-gradient(170deg, var(--sidebar-2), var(--sidebar));
    border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    padding: 26px 0;
    display: flex;
    flex-direction: column;
    color: #fff;
    /* Em telas baixas a barra rola em vez de cortar os últimos itens. */
    overflow-y: auto;
    scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { width: 0; }

.brand {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 22px 30px;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -.02em;
    color: #fff;
}
.brand:hover { color: #fff; }
.brand-mark {
    width: 30px; height: 30px;
    border-radius: 10px;
    display: grid; place-items: center;
    background: rgba(255, 255, 255, .18);
    flex: none;
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-title {
    padding: 16px 22px 6px;
    font-size: 10.5px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .5);
}
.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 13px;
    padding: var(--nav-pad-y) 22px;
    color: rgba(255, 255, 255, .72);
    font-weight: 500;
    transition: color .15s, background .15s;
}
.nav-item:hover { color: #fff; background: rgba(255, 255, 255, .07); }
.nav-item.is-active { color: #fff; font-weight: 650; background: rgba(255, 255, 255, .1); }
.nav-item.is-active::before {
    content: "";
    position: absolute;
    left: 0; top: 50%;
    transform: translateY(-50%);
    width: 4px; height: 26px;
    border-radius: 0 4px 4px 0;
    background: #fff;
}
.nav-badge {
    margin-left: auto;
    background: #fff;
    color: var(--brand-ink);
    border-radius: 999px;
    padding: 1px 8px;
    font-size: 11px;
    font-weight: 700;
}
.nav-foot { margin-top: auto; padding-top: 18px; }
.nav-logout {
    width: 100%;
    background: none;
    border: 0;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.main {
    flex: 1;
    min-width: 0;
    background: var(--surface);
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.topbar {
    display: flex;
    align-items: center;
    gap: 18px;
    padding: var(--topbar-pad-y) var(--gutter) 18px;
    flex: none;
}
.topbar h1 {
    font-size: var(--title-size);
    color: var(--brand-ink);
    letter-spacing: -.02em;
    overflow-wrap: anywhere;
}
.topbar-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }

.user-chip { display: flex; align-items: center; gap: 11px; min-width: 0; }
.user-chip .meta { text-align: right; line-height: 1.3; min-width: 0; }
.user-chip .meta strong { font-size: 13.5px; display: block; }
.user-chip .meta span { font-size: 11.5px; color: var(--muted); }

.avatar {
    border-radius: 50%;
    object-fit: cover;
    background: var(--brand-soft);
    flex: none;
}
.avatar-40 { width: 40px; height: 40px; }
.avatar-34 { width: 34px; height: 34px; }
.avatar-96 { width: 96px; height: 96px; }

.content {
    flex: 1;
    overflow-y: auto;
    padding: 6px var(--gutter) 34px;
    scrollbar-width: thin;
    scrollbar-color: #d8d4ee transparent;
}
.content::-webkit-scrollbar { width: 8px; }
.content::-webkit-scrollbar-thumb { background: #ddd9f0; border-radius: 8px; }

/* ------------------------------------------------------------------- layout */

.stack { display: flex; flex-direction: column; gap: var(--stack-gap); }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
/* Quebra por padrão: itens com flex-basis 0 (o caso comum aqui) nunca quebram,
   então isto só age quando algo realmente não cabe. */
.row { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; min-width: 0; }
.row-wrap { flex-wrap: wrap; }
.spacer { margin-left: auto; }
/* minmax(0, …) em vez de 1fr: sem isso o mínimo automático do grid é o
   min-content do item, e um campo largo empurra a coluna inteira. */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--stack-gap); }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) var(--side-col); gap: 20px; align-items: start; }

.section-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    margin: 6px 0 2px;
}
.section-head h2 { font-size: 17px; }
.section-head .hint { color: var(--muted); font-size: 12.5px; }

/* -------------------------------------------------------------------- cards */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: var(--card-pad);
}
.card-soft { background: var(--surface-soft); border-color: transparent; }
.card-pad-sm { padding: 15px 17px; }

.tint-indigo { background: #f0efff; }
.tint-violet { background: #f9effd; }
.tint-rose   { background: #fdeff3; }
.tint-amber  { background: #fdf5e8; }
.tint-teal   { background: #e9f7f5; }

.stat {
    background: var(--surface-soft);
    border-radius: var(--radius);
    padding: 16px 18px;
    min-width: 0;
}
.stat .label { color: var(--muted); font-size: 12px; font-weight: 500; }
.stat .value { font-size: 26px; font-weight: 700; color: var(--brand-ink); letter-spacing: -.02em; margin-top: 2px; }
.stat .foot { font-size: 11.5px; color: var(--muted); }

/* --------------------------------------------------------------------- list */

.list { display: flex; flex-direction: column; gap: 10px; }

.list-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 14px;
    background: var(--surface-soft);
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: var(--row-pad);
    transition: transform .15s, box-shadow .15s, border-color .15s;
}
a.list-row:hover, .list-row.is-link:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-soft);
    border-color: #e2defa;
}
/* A base define onde a linha quebra: os controles do fim descem quando o
   corpo não cabe mais, em vez de estourarem a largura da tela. */
.list-row .body { flex: 1 1 var(--row-basis); min-width: 0; color: var(--ink); }
.list-row .title { font-size: 15.5px; font-weight: 650; letter-spacing: -.01em; overflow-wrap: anywhere; }
.list-row .desc { color: var(--ink-2); font-size: 13px; margin-top: 3px; overflow-wrap: anywhere; }
.list-row .meta { color: var(--muted); font-size: 12px; margin-top: 7px; display: flex; flex-wrap: wrap; gap: 6px 12px; }
.list-row .meta span { display: inline-flex; align-items: center; gap: 5px; overflow-wrap: anywhere; }
/* Cada form de ação vira um item direto da linha, para quebrar botão a botão. */
.list-row > form { display: contents; }

.thumb {
    width: var(--thumb); height: var(--thumb);
    border-radius: 16px;
    display: grid;
    place-items: center;
    flex: none;
    color: var(--brand-ink);
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(99, 84, 216, .12);
}
.thumb-indigo { color: #5a4bc8; }
.thumb-violet { color: #9a49c9; }
.thumb-rose   { color: #d1517a; }
.thumb-amber  { color: #c08415; }
.thumb-teal   { color: #1f9084; }

.go {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: grid; place-items: center;
    background: var(--brand);
    color: #fff;
    flex: none;
    box-shadow: 0 8px 16px -8px rgba(99, 84, 216, .9);
}
.go:hover { background: var(--brand-ink); color: #fff; }

.empty {
    text-align: center;
    padding: 38px 20px;
    color: var(--muted);
    background: var(--surface-soft);
    border-radius: var(--radius);
}
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; }

/* ------------------------------------------------------------------ progress */

.progress {
    height: 8px;
    border-radius: 999px;
    background: #e7e4f7;
    overflow: hidden;
}
.progress > span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #7a67e8, #a97ce6);
    transition: width .4s ease;
}
.progress-sm { height: 6px; }
.progress-label {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 6px;
}
.progress-label b { color: var(--brand-ink); flex: none; }

/* -------------------------------------------------------------------- pills */

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    background: var(--brand-soft);
    color: var(--brand-ink);
    white-space: nowrap;
}
.pill-muted { background: #f0eff6; color: var(--muted); }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }

.score {
    display: inline-flex;
    align-items: baseline;
    gap: 3px;
    font-weight: 700;
    color: var(--brand-ink);
    white-space: nowrap;
}
.score b { font-size: 20px; letter-spacing: -.02em; }
.score span { font-size: 12px; color: var(--muted); font-weight: 600; }

/* ------------------------------------------------------------------ buttons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 12px;
    padding: 10px 18px;
    font: inherit;
    font-weight: 600;
    font-size: 13.5px;
    cursor: pointer;
    background: var(--brand-soft);
    color: var(--brand-ink);
    transition: background .15s, transform .1s, color .15s;
}
.btn:hover { background: #e3dfff; color: var(--brand-ink); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 12px 22px -14px rgba(99, 84, 216, 1); }
.btn-primary:hover { background: var(--brand-ink); color: #fff; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-soft); color: var(--ink); }
.btn-danger { background: var(--danger-soft); color: var(--danger); }
.btn-danger:hover { background: #fbdbe0; color: var(--danger); }
.btn-sm { padding: 7px 13px; font-size: 12.5px; border-radius: 10px; }
.btn-block { width: 100%; }
.btn-icon { padding: 9px; border-radius: 10px; }

/* -------------------------------------------------------------------- forms */

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field .help { font-size: 11.5px; color: var(--muted); }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="date"], input[type="url"], input[type="file"], select, textarea {
    width: 100%;
    max-width: 100%;
    font: inherit;
    font-size: 13.5px;
    color: var(--ink);
    background: var(--surface-soft);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 10px 13px;
    transition: border-color .15s, background .15s;
}
textarea { resize: vertical; min-height: 90px; line-height: 1.55; }
textarea.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12.5px; }
input:focus, select:focus, textarea:focus {
    outline: none;
    background: #fff;
    border-color: #bdb2f2;
    box-shadow: 0 0 0 3px rgba(99, 84, 216, .12);
}
input[type="file"] { padding: 8px 10px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238d89ab' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }

.check {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    font-weight: 500;
    color: var(--ink-2);
    cursor: pointer;
}
.check input { width: 17px; height: 17px; flex: none; accent-color: var(--brand); cursor: pointer; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

/* -------------------------------------------------------------------- flash */

.flashes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.flash {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 15px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    overflow-wrap: anywhere;
}
.flash-success { background: var(--ok-soft); color: #1e7c55; }
.flash-error { background: var(--danger-soft); color: var(--danger); }
.flash-info { background: var(--brand-soft); color: var(--brand-ink); }

/* ------------------------------------------------------------------- videos */

.video-frame {
    position: relative;
    padding-top: 56.25%;
    border-radius: var(--radius);
    overflow: hidden;
    background: #1b1738;
}
.video-frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}
.video-caption {
    font-size: 12.5px;
    color: var(--muted);
    margin-top: 8px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    overflow-wrap: anywhere;
}
.video-caption .video-title { flex: 0 1 auto; min-width: 0; }

.video-block { border-radius: var(--radius); }
/* Assistido recua visualmente; o próximo pendente ganha destaque. */
.video-block.is-watched .video-frame { opacity: .62; }
.video-block.is-watched:hover .video-frame { opacity: 1; }
/* outline não entra no fluxo, então destacar não empurra os blocos vizinhos. */
.video-block.is-resume {
    outline: 2px solid #ecc98e;
    outline-offset: 6px;
}

.list-row .meta span.is-complete { color: var(--ok); font-weight: 600; }

/* ------------------------------------------------------------------- prose */

.prose { color: var(--ink-2); font-size: 14px; line-height: 1.65; overflow-wrap: anywhere; }
.prose p { margin: 0 0 .8em; }

/* Hierarquia do texto rico: h2 abre seção, h3 subdivide, h4 é o nível mais fino. */
.prose-rich > :first-child { margin-top: 0; }
.prose-rich h2 {
    font-size: 19px;
    letter-spacing: -.02em;
    margin: 1.5em 0 .5em;
    padding-bottom: .3em;
    border-bottom: 1px solid var(--line);
}
.prose-rich h3 { font-size: 16px; margin: 1.3em 0 .4em; }
.prose-rich h4 { font-size: 14px; margin: 1.15em 0 .35em; color: var(--brand-ink); }
.prose-rich ul, .prose-rich ol { margin: 0 0 .9em; padding-left: 1.35em; }
.prose-rich li { margin-bottom: .3em; }
.prose-rich li::marker { color: var(--brand); }
.prose-rich blockquote {
    margin: 0 0 .9em;
    padding: 2px 0 2px 14px;
    border-left: 3px solid #cfc7f5;
    color: var(--muted);
}
.prose-rich code {
    background: var(--brand-soft);
    color: var(--brand-ink);
    padding: 1px 6px;
    border-radius: 6px;
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    font-size: .88em;
}
.prose-rich pre {
    background: #2b2550;
    color: #ddd7ff;
    border-radius: var(--radius-sm);
    padding: 14px;
    overflow-x: auto;
    margin: 0 0 .9em;
}
.prose-rich pre code { background: none; color: inherit; padding: 0; font-size: 12.5px; }
.prose-rich hr { border: 0; border-top: 1px solid var(--line); margin: 1.4em 0; }
.prose-rich a { font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* ------------------------------------------------------------------ editor */

.editor-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px;
    background: var(--surface-soft);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.editor-bar button {
    border: 0;
    background: transparent;
    color: var(--ink-2);
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1;
    padding: 6px 9px;
    min-width: 30px;
    border-radius: 8px;
    cursor: pointer;
}
.editor-bar button:hover { background: #fff; color: var(--brand-ink); }
.editor-bar button span { font-size: 9.5px; vertical-align: super; }
.editor-sep { width: 1px; height: 18px; background: var(--line); margin: 0 3px; }
.editor-preview-toggle { background: #fff !important; color: var(--brand-ink) !important; }

.editor .editor-input { border-radius: 0 0 var(--radius-sm) var(--radius-sm); }
.editor-preview {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    padding: 14px;
    min-height: 90px;
}

/* ------------------------------------------------------------ busca no topo */

.topbar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 1 250px;
    margin-left: auto;
    padding: 0 13px;
    background: var(--surface-soft);
    border-radius: 999px;
    color: var(--muted);
}
.topbar-search input {
    background: none;
    border: 0;
    padding: 9px 0;
    border-radius: 0;
    min-width: 0;
}
.topbar-search input:focus { background: none; box-shadow: none; border-color: transparent; }

/* ------------------------------------------------------------------ filters */

.filters { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.filters .label { color: var(--muted); font-size: 12.5px; font-weight: 500; }
.chip {
    padding: 7px 15px;
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--ink-2);
    font-size: 12.5px;
    font-weight: 600;
    white-space: nowrap;
}
.chip:hover { background: var(--brand-soft); color: var(--brand-ink); }
.chip.is-active { background: var(--brand); color: #fff; }
.chip.is-active:hover { background: var(--brand-ink); color: #fff; }

/* ------------------------------------------------------------------ details */

details.block {
    background: var(--surface-soft);
    border-radius: var(--radius);
    overflow: hidden;
}
details.block > summary {
    list-style: none;
    cursor: pointer;
    padding: 15px 18px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 12px;
    font-weight: 600;
    font-size: 14.5px;
}
details.block > summary::-webkit-details-marker { display: none; }
details.block > summary > span:not(.thumb):not(.pill) { flex: 1 1 120px; min-width: 0; overflow-wrap: anywhere; }
details.block > summary::after {
    content: "";
    margin-left: auto;
    width: 8px; height: 8px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg);
    transition: transform .2s;
    flex: none;
}
details.block[open] > summary::after { transform: rotate(-135deg); }
details.block > .inner { padding: 0 18px 18px; }

/* -------------------------------------------------------------------- modal */

dialog.modal {
    border: 0;
    border-radius: var(--radius-lg);
    padding: 0;
    width: min(680px, calc(100vw - 28px));
    /* Em notebook baixo o diálogo para de crescer e rola por dentro. */
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow: hidden;
    box-shadow: 0 30px 70px -30px rgba(40, 28, 100, .6);
    color: var(--ink);
}
dialog.modal::backdrop { background: rgba(45, 34, 96, .4); backdrop-filter: blur(2px); }
dialog.modal > form {
    display: flex;
    flex-direction: column;
    max-height: inherit;
    min-height: 0;
}
.modal-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px 12px;
    flex: none;
}
.modal-head h3 { font-size: 18px; min-width: 0; overflow-wrap: anywhere; }
.modal-body {
    padding: 0 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
    min-height: 0;
}
.modal-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 16px 24px;
    background: var(--surface-soft);
    justify-content: flex-end;
    flex: none;
}
.prompt-box {
    background: #2b2550;
    color: #ddd7ff;
    border-radius: var(--radius-sm);
    padding: 14px;
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    font-size: 11.5px;
    line-height: 1.6;
    max-height: 190px;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    margin: 0;
}

/* ------------------------------------------------------------- credentials */

.creds {
    background: var(--warn-soft);
    border-radius: var(--radius);
    padding: 16px 18px;
}
.creds table { width: 100%; border-collapse: collapse; font-size: 13px; }
.creds th { text-align: left; color: var(--warn); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; padding-bottom: 6px; }
.creds td { padding: 5px 0; border-top: 1px solid rgba(201, 134, 13, .18); overflow-wrap: anywhere; }
.creds code { background: #fff; padding: 2px 8px; border-radius: 6px; font-size: 12.5px; }

/* -------------------------------------------------------------------- auth */

.auth-wrap {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: 24px;
}
.auth-card {
    width: min(920px, 100%);
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow: hidden;
}
.auth-aside {
    background: linear-gradient(170deg, var(--sidebar-2), var(--sidebar));
    color: #fff;
    padding: 44px 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 16px;
}
.auth-aside h2 { color: #fff; font-size: 25px; letter-spacing: -.02em; }
.auth-aside p { color: rgba(255, 255, 255, .78); font-size: 14px; }
.auth-aside ul { margin: 8px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.auth-aside li { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: rgba(255, 255, 255, .9); }
.auth-form { padding: 44px 40px; display: flex; flex-direction: column; gap: 16px; justify-content: center; }
.auth-form h1 { font-size: 25px; color: var(--brand-ink); }
.auth-form .sub { color: var(--muted); font-size: 13.5px; margin-top: -8px; }

/* ------------------------------------------------------------------ utility */

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.strong { font-weight: 650; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.divider { height: 1px; background: var(--line); margin: 4px 0; }
.link-out { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; word-break: break-all; }

/* ==========================================================================
   Responsivo — largura
   ========================================================================== */

/* Notebooks estreitos: a coluna lateral encolhe antes de ser empilhada. */
@media (max-width: 1240px) {
    :root { --side-col: 280px; --gutter: 26px; --sidebar-w: 212px; }
}

@media (max-width: 1080px) {
    :root { --stack-gap: 16px; }
    .split { grid-template-columns: minmax(0, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Abaixo disto a barra lateral vira cabeçalho horizontal. */
@media (max-width: 860px) {
    :root {
        --shell-pad: 12px;
        --gutter: 18px;
        --topbar-pad-y: 18px;
        --title-size: 22px;
        --card-pad: 17px;
        --row-basis: 150px;
    }

    html, body { height: auto; }
    .shell { flex-direction: column; height: auto; min-height: 100vh; min-height: 100dvh; }

    .sidebar {
        width: auto;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        padding: 18px 0 10px;
        overflow: visible;
    }
    .brand { padding: 0 18px 14px; }
    .nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px;
        padding: 0 12px;
    }
    .nav-title { display: none; }
    .nav-item { padding: 9px 14px; border-radius: 12px; }
    .nav-item.is-active::before { display: none; }
    .nav-badge { margin-left: 4px; }
    .nav-foot { margin-top: 10px; padding-top: 0; padding-left: 12px; padding-right: 12px; }
    .nav-logout { width: auto; border-radius: 12px; }

    .main { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
    .topbar { flex-wrap: wrap; }
    .topbar-search { order: 3; flex: 1 1 100%; margin-left: 0; }

    .grid-3, .form-grid { grid-template-columns: minmax(0, 1fr); }
    .auth-card { grid-template-columns: minmax(0, 1fr); }
    .auth-aside { display: none; }
    .auth-form { padding: 32px 26px; }
}

/* Celulares: some o texto do avatar no topo e os rótulos da tabela viram linhas. */
@media (max-width: 620px) {
    :root {
        --thumb: 44px;
        --row-pad: 14px 15px;
        --row-basis: 130px;
        --card-pad: 15px;
    }

    .user-chip .meta { display: none; }
    /* Libera largura para o formulário de correção, que é o mais apertado. */
    .hide-narrow { display: none; }

    .creds table, .creds thead, .creds tbody, .creds tr, .creds td { display: block; width: 100%; }
    .creds thead { display: none; }
    .creds tr { padding: 9px 0; border-top: 1px solid rgba(201, 134, 13, .18); }
    .creds tr:first-child { border-top: 0; padding-top: 0; }
    .creds td { border: 0; padding: 3px 0; display: flex; gap: 10px; align-items: baseline; }
    .creds td::before {
        content: attr(data-label);
        flex: none;
        min-width: 62px;
        font-size: 10px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .06em;
        color: var(--warn);
    }
}

/* Telas bem estreitas (até ~420px). */
@media (max-width: 420px) {
    :root {
        --shell-pad: 8px;
        --gutter: 13px;
        --radius-lg: 20px;
        --radius: 15px;
        --title-size: 20px;
        --thumb: 40px;
        --row-basis: 110px;
        --stack-gap: 13px;
        --row-pad: 13px;
        --card-pad: 14px;
    }

    body { font-size: 13.5px; }
    .brand { font-size: 18px; padding: 0 14px 12px; }
    .nav { padding: 0 8px; }
    .nav-item { flex: 1 1 auto; padding: 9px 11px; gap: 9px; font-size: 13px; }
    .nav-foot { padding-left: 8px; padding-right: 8px; }
    .nav-logout { flex: 1 1 auto; }

    .stat { padding: 13px 14px; }
    .stat .value { font-size: 21px; }
    .card-pad-sm { padding: 12px 13px; }
    .empty { padding: 28px 14px; }
    .list-row .title { font-size: 14.5px; }
    .btn { padding: 9px 14px; }
    .btn-sm { padding: 7px 11px; }
    .go { width: 32px; height: 32px; }
    .thumb { border-radius: 13px; }

    details.block > summary { padding: 13px 14px; }
    details.block > .inner { padding: 0 14px 14px; }

    /* A linha inteira já é o link; a seta só ocuparia uma linha só dela. */
    a.list-row > span.go,
    a.list-row > svg.icon:last-child { display: none; }

    /* Título longo empurraria o avatar para uma segunda linha. O perfil
       continua acessível pelo item de menu. */
    .topbar-right { display: none; }

    .modal-head { padding: 16px 16px 10px; }
    .modal-body { padding: 0 16px 16px; }
    .modal-foot { padding: 13px 16px; }
    .modal-foot .btn { flex: 1 1 auto; }
    .prompt-box { max-height: 160px; font-size: 11px; }
}

/* Piso de suporte: 280px. Aqui cada pixel horizontal conta. */
@media (max-width: 340px) {
    :root {
        --shell-pad: 5px;
        --gutter: 10px;
        --radius-lg: 16px;
        --title-size: 18px;
        --thumb: 34px;
        --row-basis: 90px;
        --row-pad: 11px;
        --card-pad: 12px;
    }

    body { font-size: 13px; }
    .brand { font-size: 16.5px; gap: 7px; }
    .brand-mark { width: 26px; height: 26px; border-radius: 8px; }
    .nav-item { font-size: 12.5px; padding: 8px 9px; gap: 7px; }

    /* Duas colunas ainda cabem nos blocos de números, mas não em cards com ícone. */
    .grid-4 { gap: 9px; }
    .grid-2 { gap: 9px; }
    .stat { padding: 11px 12px; }
    .stat .value { font-size: 19px; }
    .stat .label, .stat .foot { font-size: 11px; }

    .list-row { gap: 8px 10px; }
    .list-row .title { font-size: 14px; }
    .list-row .meta { font-size: 11.5px; gap: 4px 9px; }
    .pill { padding: 3px 9px; font-size: 11px; }
    .score b { font-size: 17px; }
    .go { width: 29px; height: 29px; }
    .avatar-96 { width: 72px; height: 72px; }

    .btn { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
    .btn-sm { padding: 6px 9px; font-size: 12px; }
    .chip { padding: 6px 11px; font-size: 12px; }

    .empty { padding: 22px 12px; }
    .auth-wrap { padding: 10px; }
    .auth-form { padding: 24px 16px; }
    .auth-form h1 { font-size: 21px; }

    dialog.modal { width: calc(100vw - 12px); }
    .prose-rich h2 { font-size: 17px; }
    .prose-rich h3 { font-size: 15px; }
    .editor-bar { gap: 2px; padding: 5px; }
    .editor-bar button { padding: 5px 7px; min-width: 26px; font-size: 12px; }

    .modal-head { padding: 13px 13px 8px; }
    .modal-head h3 { font-size: 16px; }
    .modal-body { padding: 0 13px 13px; }
    .modal-foot { padding: 11px 13px; }
    .prompt-box { max-height: 130px; padding: 11px; }

    .creds { padding: 13px 14px; }
    .creds td::before { min-width: 52px; }
}

/* ==========================================================================
   Responsivo — altura (notebooks 768p, janelas divididas, celular deitado)
   ========================================================================== */

@media (min-width: 861px) and (max-height: 860px) {
    :root {
        --shell-pad: 12px;
        --topbar-pad-y: 18px;
        --title-size: 24px;
        --card-pad: 17px;
        --stack-gap: 15px;
        --nav-pad-y: 9px;
    }
    .sidebar { padding: 20px 0; }
    .brand { padding-bottom: 20px; }
    .content { padding-bottom: 24px; }
    .nav-foot { padding-top: 12px; }
}

@media (min-width: 861px) and (max-height: 700px) {
    :root {
        --shell-pad: 8px;
        --topbar-pad-y: 13px;
        --title-size: 21px;
        --card-pad: 15px;
        --stack-gap: 13px;
        --nav-pad-y: 7px;
        --radius-lg: 20px;
    }
    .sidebar { padding: 15px 0; }
    .brand { padding-bottom: 14px; font-size: 18px; }
    .topbar { padding-bottom: 12px; }
    .nav-title { padding-top: 10px; }
    .nav-foot { padding-top: 8px; }
    .stat { padding: 12px 14px; }
    .stat .value { font-size: 22px; }
}

@media (max-height: 700px) {
    .prompt-box { max-height: 120px; }
    .modal-body textarea { min-height: 70px; }
}

@media (max-height: 560px) {
    .prompt-box { max-height: 84px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}
