:root {
    --bg: #08111f;
    --panel: #0f1c2e;
    --panel-2: #14243a;
    --line: #243750;
    --text: #edf3fa;
    --muted: #9fb0c4;
    --accent: #2f7df4;
    --surface: #f5f8fc;
    --danger: #8f2f2a;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Inter, system-ui, sans-serif;
    background: var(--surface);
    color: #142033;
    line-height: 1.5;
}

a {
    color: inherit;
}

button,
input {
    font: inherit;
}

.container {
    width: min(1180px, calc(100% - 36px));
    margin: auto;
}

.site-header {
    background: var(--bg);
    color: var(--text);
}

.header-row {
    min-height: 74px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.brand {
    display: flex;
    gap: 12px;
    text-decoration: none;
    align-items: baseline;
}

.brand strong {
    font-size: 1.4rem;
}

.brand span,
.meta {
    color: var(--muted);
}

.hero {
    background:
        radial-gradient(circle at 80% 20%, rgba(47, 125, 244, .25), transparent 35%),
        var(--bg);
    color: var(--text);
    padding: 70px 0;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 4rem);
    max-width: 850px;
    line-height: 1.05;
    margin: 0;
}

.hero p {
    max-width: 700px;
    color: #b9c9db;
}

.eyebrow {
    color: #6da4f7;
    text-transform: uppercase;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .12em;
    margin: 0 0 8px;
}

.search-form {
    display: flex;
    gap: 10px;
    max-width: 750px;
    margin-top: 28px;
}

.search-form input,
.stack input {
    width: 100%;
    min-width: 0;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--line);
}

button,
.btn,
.secondary,
.danger {
    border: 0;
    border-radius: 10px;
    padding: 11px 15px;
    font-weight: 800;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn,
.search-form button {
    background: var(--accent);
    color: white;
}

.catalog {
    padding: 50px 0;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 20px;
}

.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.card,
.panel,
.auth-card,
.admin-card {
    border: 1px solid #dbe4ee;
    border-radius: 16px;
    background: white;
    padding: 20px;
}

.card {
    display: flex;
    flex-direction: column;
    min-height: 270px;
}

.card .btn {
    margin-top: auto;
}

.badges {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.pdf,
.cat,
.active,
.inactive {
    padding: 4px 8px;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 800;
}

.pdf {
    background: #fce8e6;
    color: #9e2a22;
}

.cat {
    background: #eaf2fe;
    color: #235fae;
}

.active {
    background: #dff4e9;
    color: #14623e;
}

.inactive {
    background: #e7ebef;
    color: #5c6776;
}

.file {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: .82rem;
    color: #3d6da7;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.empty {
    padding: 35px;
    text-align: center;
    background: white;
    border: 1px dashed #c9d4df;
    border-radius: 16px;
}

.footer {
    padding: 25px 0;
    color: #68788b;
}

.admin {
    background: #091321;
    color: var(--text);
    min-height: 100vh;
}

.admin .container {
    width: min(1320px, calc(100% - 40px));
}

.auth {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 30px;
}

.auth-card {
    width: min(480px, 100%);
    background: var(--panel);
    border-color: var(--line);
}

.stack {
    display: grid;
    gap: 14px;
    margin-top: 20px;
}

.stack label {
    display: grid;
    gap: 6px;
}

.file-input {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    color: #dbe7f5;
    background: #0c1727;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 7px;
    overflow: hidden;
}

.file-input::file-selector-button {
    margin-right: 10px;
    border: 0;
    border-radius: 7px;
    padding: 8px 10px;
    background: #263b56;
    color: white;
    font-weight: 700;
    cursor: pointer;
}

.compact-file-input {
    font-size: .78rem;
    padding: 6px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

.compact-file-input::file-selector-button {
    padding: 7px 9px;
    font-size: .78rem;
}

.alert {
    padding: 11px 13px;
    border-radius: 10px;
    margin: 14px 0;
}

.err {
    background: #491e1e;
    color: #ffd6d2;
}

.ok {
    background: #123c2b;
    color: #cdf6df;
}

.info {
    background: #153152;
    color: #d7e9ff;
}

.admin-main {
    padding: 30px 0 60px;
}

.admin-grid {
    display: grid;
    grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
    gap: 22px;
    align-items: start;
}

.panel {
    background: var(--panel);
    border-color: var(--line);
    color: var(--text);
    min-width: 0;
}

.publish-panel {
    position: sticky;
    top: 20px;
}

.library-panel {
    min-width: 0;
}

.document-count {
    flex: 0 0 auto;
    white-space: nowrap;
    color: #d5e2f1;
    font-size: .92rem;
}

.admin-list {
    display: grid;
    gap: 14px;
}

.admin-card {
    background: var(--panel-2);
    border-color: var(--line);
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 18px;
    align-items: start;
    overflow: hidden;
    padding-right: 32px;
}

.manual-info,
.actions,
.actions form {
    min-width: 0;
}

.manual-info h3 {
    margin: 16px 0 8px;
    font-size: 1.15rem;
}

.manual-info .meta {
    margin-bottom: 0;
}

.actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 220px;
    max-width: 100%;
    justify-self: end;
}

.actions > *,
.actions form,
.actions button,
.actions .secondary,
.actions .danger {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.actions form {
    display: grid;
    gap: 7px;
    margin: 0;
}

.action-wide,
.replace-form {
    grid-column: 1 / -1;
}

.secondary {
    background: #263b56;
    color: white;
    border: 1px solid #395271;
}

.danger {
    background: #4c2020;
    color: #ffd9d5;
    border: 1px solid #6d3030;
}

.user {
    display: flex;
    gap: 12px;
    align-items: center;
}

.user form {
    margin: 0;
}

.linkbtn {
    background: transparent;
    color: white;
    padding: 4px;
}

.admin-empty {
    background: #101d2f;
    border-color: #314760;
    color: var(--text);
}

@media (max-width: 1080px) {
    .admin-grid {
        grid-template-columns: 1fr;
    }

    .publish-panel {
        position: static;
    }

    .admin-card {
        grid-template-columns: minmax(0, 1fr) 220px;
        padding-right: 28px;
    }
}

@media (max-width: 900px) {
    .grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 700px) {
    .admin .container,
    .container {
        width: min(100% - 24px, 1320px);
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .search-form,
    .section-head {
        display: grid;
    }

    .admin-card {
        grid-template-columns: 1fr;
    }

    .actions {
        grid-template-columns: 1fr;
        width: 100%;
        justify-self: stretch;
    }

    .action-wide,
    .replace-form {
        grid-column: auto;
    }

    .brand span {
        display: none;
    }

    .header-row {
        gap: 12px;
    }

    .user {
        gap: 8px;
    }
}


/* Gestao de usuarios */
button,
input,
select {
    font: inherit;
}

.stack select,
.readonly-link {
    width: 100%;
    min-width: 0;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fff;
    color: #142033;
}

.admin-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.admin-nav a {
    color: #aebfd3;
    text-decoration: none;
    font-weight: 750;
    font-size: .9rem;
    padding: 9px 12px;
    border-radius: 9px;
}

.admin-nav a:hover,
.admin-nav a.is-active {
    background: #14243a;
    color: #fff;
}

.page-title-row {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 20px;
    margin-bottom: 22px;
}

.page-title-row h1,
.panel h2 {
    margin: 0;
}

.page-title-row .meta {
    max-width: 760px;
    margin: 8px 0 0;
}

.user-create-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
    margin-bottom: 22px;
}

.invite-link-panel {
    margin-bottom: 22px;
}

.readonly-link {
    margin-top: 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.users-panel {
    margin-top: 22px;
}

.users-table-wrap {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.users-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
}

.users-table th,
.users-table td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.users-table th {
    color: #9fb0c4;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    background: #0c1727;
}

.users-table td {
    color: #e7eef7;
    background: #101d2f;
}

.users-table tbody tr:last-child td {
    border-bottom: 0;
}

.table-action {
    width: 1%;
    white-space: nowrap;
}

.table-action form {
    margin: 0;
}

.small-button {
    padding: 8px 11px;
    font-size: .82rem;
}

.full-button {
    width: 100%;
    margin-top: 12px;
}

@media (max-width: 900px) {
    .header-row {
        flex-wrap: wrap;
        padding: 12px 0;
    }

    .admin-nav {
        order: 3;
        width: 100%;
        margin-left: 0;
    }

    .user-create-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 700px) {
    .admin-nav {
        overflow-x: auto;
    }

    .page-title-row {
        align-items: stretch;
        flex-direction: column;
    }
}


/* Niveis de acesso dos manuais */
.form-help {
    margin: -4px 0 2px;
    color: var(--muted);
    font-size: .8rem;
    line-height: 1.45;
}

.manual-status {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 800;
}

.status-public {
    background: #dff4e9;
    color: #14623e;
}

.status-internal {
    background: #fff0cf;
    color: #805400;
}

.status-hidden {
    background: #e7ebef;
    color: #536171;
}

.internal-file {
    color: #d4a74a;
}

.visibility-form select {
    width: 100%;
    min-width: 0;
    border: 1px solid #395271;
    border-radius: 10px;
    background: #0c1727;
    color: #edf3fa;
    padding: 10px 11px;
}

.visibility-form select:focus {
    outline: 2px solid rgba(47, 125, 244, .35);
    outline-offset: 1px;
}
