:root {
    color-scheme: light;
    --ink: #15201c;
    --muted: #66736f;
    --line: #dfe7e2;
    --paper: #f7faf8;
    --panel: #ffffff;
    --brand: #0f6f5c;
    --brand-strong: #0a4f42;
    --accent: #c69a2d;
    --danger: #b42318;
    --ok: #146c43;
    --shadow: 0 18px 50px rgba(22, 42, 34, .08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--ink);
    background: linear-gradient(180deg, #edf5f1 0, var(--paper) 280px);
}

a {
    color: var(--brand-strong);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 14px clamp(18px, 3vw, 36px);
    border-bottom: 1px solid rgba(15, 111, 92, .16);
    background: rgba(247, 250, 248, .92);
    backdrop-filter: blur(14px);
}

.brand {
    flex: 0 0 auto;
    font-weight: 800;
    letter-spacing: 0;
    color: var(--ink);
}

.nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.nav a,
.user-menu a,
.button {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 12px;
    background: var(--panel);
    color: var(--ink);
    font-weight: 650;
    text-decoration: none;
}

.nav a {
    min-height: 34px;
    padding: 6px 10px;
    font-size: .9rem;
}

.nav a.active {
    border-color: rgba(15, 111, 92, .35);
    background: #e6f3ef;
    color: var(--brand-strong);
}

.user-menu {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--muted);
    font-size: .92rem;
    white-space: nowrap;
}

.shell {
    width: min(1180px, calc(100% - 32px));
    margin: 28px auto 64px;
}

.panel,
.hero-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.panel {
    padding: clamp(18px, 3vw, 30px);
}

.panel + .panel,
.stats + .panel {
    margin-top: 20px;
}

.narrow {
    max-width: 560px;
    margin-inline: auto;
}

.hero-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: clamp(22px, 4vw, 38px);
    overflow: hidden;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 8px;
    font-size: clamp(1.8rem, 2.6vw, 2.5rem);
    line-height: 1.1;
    letter-spacing: 0;
}

h2 {
    margin: 24px 0 12px;
    font-size: 1.25rem;
}

h3 {
    font-size: 1.05rem;
}

p {
    color: var(--muted);
}

.button {
    cursor: pointer;
}

.button.primary {
    border-color: var(--brand);
    background: var(--brand);
    color: #fff;
}

.button:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.actions,
.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.actions {
    flex-wrap: wrap;
}

.actions form {
    margin: 0;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin: 18px 0;
}

.stats article {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 18px;
    background: var(--panel);
}

.stats strong {
    display: block;
    font-size: 2rem;
    color: var(--brand-strong);
}

.stats span {
    color: var(--muted);
}

.table-wrap {
    width: 100%;
    overflow: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

th,
td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: .86rem;
    text-transform: uppercase;
}

.badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 4px 9px;
    background: #eef3f0;
    color: var(--ink);
    font-size: .85rem;
    font-weight: 750;
}

.badge.entregue,
.badge.utilizado-e-publicado {
    background: #e6f4ee;
    color: var(--ok);
}

.badge.por-entregar {
    background: #fff6df;
    color: #8a5f05;
}

.badge.em-preparacao {
    background: #edf1f7;
    color: #36506b;
}

.form {
    display: grid;
    gap: 14px;
}

.grid-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.wide,
fieldset.wide {
    grid-column: 1 / -1;
}

label,
legend {
    color: var(--ink);
    font-weight: 720;
}

input,
select,
textarea {
    width: 100%;
    min-height: 42px;
    margin-top: 6px;
    border: 1px solid #cfd9d4;
    border-radius: 8px;
    padding: 10px 11px;
    background: #fff;
    color: var(--ink);
    font: inherit;
}

textarea {
    min-height: 130px;
    resize: vertical;
}

select[multiple] {
    min-height: 136px;
}

fieldset {
    display: grid;
    gap: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
}

.check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.check input {
    width: auto;
    min-height: auto;
    margin: 0;
}

.file-meta-grid,
.admin-grid,
.file-grid,
.meta {
    display: grid;
    gap: 12px;
}

.file-meta-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-grid a,
.file-card,
.version-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfdfc;
}

.admin-grid a {
    padding: 18px;
    font-weight: 760;
}

.version-card {
    padding: 18px;
    margin-top: 12px;
}

.file-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.file-card {
    padding: 12px;
}

.file-card img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 6px;
    margin-bottom: 8px;
}

.file-card small {
    display: block;
    color: var(--muted);
}

.meta {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    margin: 16px 0;
}

.meta div {
    border-left: 3px solid var(--accent);
    padding-left: 12px;
}

.meta dt {
    color: var(--muted);
    font-size: .85rem;
    font-weight: 750;
}

.meta dd {
    margin: 0;
    font-weight: 720;
}

.checklist {
    display: grid;
    gap: 8px;
    padding: 0;
    list-style: none;
}

.checklist li {
    display: flex;
    gap: 10px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
}

.checklist span {
    min-width: 112px;
    color: var(--muted);
    font-weight: 750;
}

.checklist .done span {
    color: var(--ok);
}

.flash {
    margin-bottom: 16px;
    border-radius: 8px;
    padding: 12px 14px;
    background: #e6f4ee;
    color: var(--ok);
    font-weight: 700;
}

.flash.error {
    background: #fff0ed;
    color: var(--danger);
}

.prose {
    white-space: normal;
}

@media (max-width: 920px) {
    .topbar,
    .hero-panel,
    .section-head {
        align-items: stretch;
        flex-direction: column;
    }

    .user-menu {
        margin-left: 0;
    }

    .stats,
    .grid-form,
    .admin-grid,
    .file-meta-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .shell {
        width: min(100% - 20px, 1180px);
        margin-top: 16px;
    }

    .topbar {
        padding: 12px;
    }

    .nav a,
    .button {
        width: 100%;
    }
}
