:root {
    --ink: #14201c;
    --ink-soft: #3d4f48;
    --muted: #6b7c74;
    --line: #d5ddd8;
    --paper: #f3f6f4;
    --surface: #ffffff;
    --forest: #1f4d3a;
    --forest-deep: #143328;
    --moss: #2f6b52;
    --amber: #c47a1a;
    --amber-soft: #f6e7cf;
    --danger: #b42318;
    --danger-soft: #fdecea;
    --ok: #1f6b45;
    --ok-soft: #e6f5ec;
    --shadow: 0 18px 40px rgba(20, 32, 28, 0.08);
    --radius: 18px;
    --sidebar: 270px;
    --font: "Outfit", sans-serif;
    --serif: "Source Serif 4", Georgia, serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: var(--font);
    color: var(--ink);
    background:
        radial-gradient(1200px 600px at 100% -10%, rgba(196, 122, 26, 0.12), transparent 55%),
        radial-gradient(900px 500px at -10% 20%, rgba(47, 107, 82, 0.14), transparent 50%),
        linear-gradient(160deg, #eef3f0 0%, var(--paper) 45%, #e8efe9 100%);
}

a {
    color: var(--moss);
    text-decoration: none;
}

a:hover {
    color: var(--forest);
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: var(--sidebar) 1fr;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 1.5rem 1.15rem;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 40%),
        linear-gradient(165deg, var(--forest-deep), var(--forest) 70%, #245743);
    color: #edf5f0;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    z-index: 40;
}

.brand {
    display: flex;
    gap: 0.85rem;
    align-items: center;
    padding: 0.35rem 0.4rem;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background:
        linear-gradient(135deg, #e2b56a, var(--amber)),
        repeating-linear-gradient(90deg, transparent, transparent 6px, rgba(255, 255, 255, 0.12) 6px, rgba(255, 255, 255, 0.12) 7px);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.brand strong {
    display: block;
    font-size: 1.15rem;
    letter-spacing: 0.01em;
}

.brand small {
    color: rgba(237, 245, 240, 0.72);
    font-size: 0.82rem;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.nav a {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.85rem 0.95rem;
    border-radius: 14px;
    color: rgba(237, 245, 240, 0.86);
    transition: background 0.2s ease, transform 0.2s ease;
}

.nav a:hover,
.nav a.active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    transform: translateX(2px);
}

.nav a.active {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.nav-icon {
    width: 1.4rem;
    text-align: center;
    opacity: 0.9;
}

.sidebar-foot {
    margin-top: auto;
    padding: 1rem;
    border-radius: 16px;
    background: rgba(0, 0, 0, 0.18);
    font-size: 0.88rem;
    line-height: 1.45;
    color: rgba(237, 245, 240, 0.78);
}

.main-wrap {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.6rem 2rem 0.4rem;
}

.topbar h1 {
    margin: 0;
    font-family: var(--serif);
    font-size: clamp(1.6rem, 2.4vw, 2.15rem);
    font-weight: 600;
    letter-spacing: -0.02em;
}

.subtitle {
    margin: 0.35rem 0 0;
    color: var(--muted);
}

.topbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    align-items: center;
}

.menu-toggle {
    display: none;
    border: 0;
    background: var(--surface);
    width: 42px;
    height: 42px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    cursor: pointer;
    font-size: 1.1rem;
}

.content {
    padding: 1rem 2rem 2.5rem;
    animation: rise 0.45s ease both;
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.site-footer {
    margin-top: auto;
    padding: 1rem 2rem 1.5rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.4rem;
}

.stat {
    position: relative;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid rgba(213, 221, 216, 0.85);
    border-radius: var(--radius);
    padding: 1.25rem 1.3rem;
    box-shadow: var(--shadow);
}

.stat::after {
    content: "";
    position: absolute;
    right: -20px;
    top: -20px;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(47, 107, 82, 0.14), transparent 70%);
}

.stat span {
    display: block;
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 0.45rem;
}

.stat strong {
    font-family: var(--serif);
    font-size: 2rem;
    font-weight: 600;
}

.panel {
    background: var(--surface);
    border: 1px solid rgba(213, 221, 216, 0.9);
    border-radius: calc(var(--radius) + 4px);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.15rem 1.35rem;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, #fbfcfb, #f5f8f6);
}

.panel-head h2,
.panel-head h3 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
}

.panel-body {
    padding: 1.25rem 1.35rem;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 1.2rem;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 0.9rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}

th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    background: #f8faf9;
}

tr:last-child td {
    border-bottom: 0;
}

tbody tr {
    transition: background 0.15s ease;
}

tbody tr:hover {
    background: #f7faf8;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    background: #e8f1ec;
    color: var(--forest);
}

.badge-amber {
    background: var(--amber-soft);
    color: #8a5410;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border: 0;
    border-radius: 12px;
    padding: 0.72rem 1.05rem;
    font: inherit;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: linear-gradient(180deg, #34785c, var(--forest));
    color: #fff;
    box-shadow: 0 10px 20px rgba(31, 77, 58, 0.22);
}

.btn-primary:hover {
    color: #fff;
}

.btn-secondary {
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--line);
}

.btn-secondary:hover {
    color: var(--ink);
    background: #f7faf8;
}

.btn-amber {
    background: linear-gradient(180deg, #d5922f, var(--amber));
    color: #fff;
}

.btn-amber:hover {
    color: #fff;
}

.btn-danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.btn-sm {
    padding: 0.45rem 0.7rem;
    font-size: 0.82rem;
    border-radius: 10px;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.form {
    display: grid;
    gap: 1rem;
    max-width: 720px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

label {
    display: grid;
    gap: 0.45rem;
    font-weight: 500;
    color: var(--ink-soft);
}

input[type="text"],
input[type="search"],
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 0.8rem 0.95rem;
    font: inherit;
    color: var(--ink);
    background: #fff;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #7aa892;
    box-shadow: 0 0 0 4px rgba(47, 107, 82, 0.12);
}

textarea {
    min-height: 110px;
    resize: vertical;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-top: 0.4rem;
}

.alert {
    padding: 0.95rem 1.1rem;
    border-radius: 14px;
    margin-bottom: 1rem;
    font-weight: 500;
}

.alert-success {
    background: var(--ok-soft);
    color: var(--ok);
    border: 1px solid #b9e0c8;
}

.alert-error {
    background: var(--danger-soft);
    color: var(--danger);
    border: 1px solid #f3c2bd;
}

.empty {
    padding: 2rem 1rem;
    text-align: center;
    color: var(--muted);
}

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-bottom: 1rem;
}

.filters form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    max-width: none;
    width: 100%;
}

.filters input,
.filters select {
    min-width: 220px;
}

.breadcrumb {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    color: var(--muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.breadcrumb a {
    color: var(--moss);
}

.meta-list {
    display: grid;
    gap: 0.85rem;
}

.meta-item {
    display: grid;
    gap: 0.2rem;
    padding-bottom: 0.85rem;
    border-bottom: 1px dashed var(--line);
}

.meta-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.meta-item span {
    color: var(--muted);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.meta-item strong {
    font-size: 1.05rem;
}

.qr-box {
    display: grid;
    place-items: center;
    gap: 0.9rem;
    text-align: center;
    padding: 1rem;
}

.qr-box img {
    width: min(260px, 100%);
    aspect-ratio: 1;
    border-radius: 18px;
    background: #fff;
    padding: 0.8rem;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.qr-url {
    word-break: break-all;
    font-size: 0.82rem;
    color: var(--muted);
    max-width: 320px;
}

.hero-home {
    position: relative;
    overflow: hidden;
    border-radius: calc(var(--radius) + 6px);
    padding: 2rem;
    margin-bottom: 1.4rem;
    color: #f4f8f5;
    background:
        linear-gradient(120deg, rgba(20, 51, 40, 0.92), rgba(31, 77, 58, 0.88)),
        url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    box-shadow: var(--shadow);
}

.hero-home h2 {
    margin: 0 0 0.55rem;
    font-family: var(--serif);
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 600;
}

.hero-home p {
    margin: 0;
    max-width: 52ch;
    color: rgba(244, 248, 245, 0.86);
    line-height: 1.5;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-top: 1.3rem;
}

.confirm-box {
    max-width: 560px;
}

.confirm-box p {
    color: var(--ink-soft);
    line-height: 1.5;
}

.sidebar-backdrop {
    display: none;
}

/* Página pública do QR */
.public-body {
    min-height: 100vh;
    margin: 0;
    font-family: var(--font);
    color: var(--ink);
    background:
        radial-gradient(900px 420px at 90% 0%, rgba(196, 122, 26, 0.16), transparent 55%),
        linear-gradient(165deg, #e9f0eb, #f4f7f5 50%, #e7efe9);
}

.public-wrap {
    width: min(860px, calc(100% - 2rem));
    margin: 2rem auto 3rem;
    animation: rise 0.5s ease both;
}

.public-card {
    background: var(--surface);
    border-radius: 28px;
    border: 1px solid rgba(213, 221, 216, 0.95);
    box-shadow: 0 24px 50px rgba(20, 32, 28, 0.1);
    overflow: hidden;
}

.public-hero {
    padding: 1.8rem 1.8rem 1.4rem;
    background:
        linear-gradient(135deg, rgba(20, 51, 40, 0.96), rgba(47, 107, 82, 0.9)),
        repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.03) 0 8px, transparent 8px 16px);
    color: #f3f8f5;
}

.public-hero .eyebrow {
    display: inline-block;
    margin-bottom: 0.7rem;
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.public-hero h1 {
    margin: 0;
    font-family: var(--serif);
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    font-weight: 600;
}

.public-hero p {
    margin: 0.55rem 0 0;
    color: rgba(243, 248, 245, 0.82);
}

.public-body-inner {
    padding: 1.5rem 1.8rem 1.8rem;
}

.public-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.4rem;
}

.info-tile {
    background: #f6f9f7;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 1rem 1.1rem;
}

.info-tile span {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.35rem;
}

.info-tile strong {
    font-size: 1.15rem;
}

.file-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.7rem;
}

.file-list li {
    display: grid;
    gap: 0.25rem;
    padding: 0.95rem 1rem;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: linear-gradient(180deg, #fff, #f9fbfa);
}

.file-list .file-name {
    font-weight: 600;
}

.file-list .file-meta {
    color: var(--muted);
    font-size: 0.88rem;
}

.public-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--muted);
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: min(86vw, 300px);
        transform: translateX(-105%);
        transition: transform 0.25s ease;
    }

    body.nav-open .sidebar {
        transform: translateX(0);
    }

    .menu-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-right: 0.4rem;
    }

    .topbar {
        align-items: center;
        padding: 1.1rem 1rem 0.2rem;
    }

    .topbar > div:nth-child(2) {
        flex: 1;
    }

    .content,
    .site-footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .stats,
    .grid-2,
    .form-row,
    .public-grid {
        grid-template-columns: 1fr;
    }

    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 24, 20, 0.45);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
        z-index: 30;
    }

    body.nav-open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }
}

@media print {
    .sidebar,
    .topbar-actions,
    .menu-toggle,
    .site-footer,
    .alert {
        display: none !important;
    }

    .app-shell {
        display: block;
    }

    .content,
    .topbar {
        padding: 0;
    }

    .panel {
        box-shadow: none;
        border: 1px solid #ccc;
    }
}
