:root {
    --accent: #2563eb;
    --accent-dark: #1d4ed8;
    --accent-soft: #eff6ff;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-text-active: #ffffff;
    --bg: #f4f6f9;
    --card: #ffffff;
    --border: #e6e9ef;
    --border-strong: #d7dbe3;
    --text: #101828;
    --text-muted: #667085;
    --radius: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
    --shadow-md: 0 4px 16px rgba(16, 24, 40, 0.08);
    --shadow-lg: 0 20px 50px rgba(2, 6, 23, 0.35);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ---------- Login ---------- */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at 15% 20%, rgba(255,255,255,0.06), transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(255,255,255,0.05), transparent 45%),
        linear-gradient(160deg, #0b1224 0%, #0f172a 45%, #16264a 100%);
}
.login-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 40px 38px 34px;
    width: 100%;
    max-width: 388px;
    box-shadow: var(--shadow-lg);
}
.login-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}
.login-mark, .brand-mark {
    width: 34px; height: 34px;
    border-radius: 9px;
    background: var(--accent);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.login-mark svg, .brand-mark svg { width: 18px; height: 18px; }
.login-brand-name {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.tagline { color: var(--text-muted); font-size: 13.5px; margin: 0 0 26px; }

.field { margin-bottom: 16px; }
.field label {
    display: block;
    font-size: 12.5px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
    letter-spacing: 0.01em;
}
.field input[type=text],
.field input[type=email],
.field input[type=password],
.field input[type=number] {
    width: 100%;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1.5px solid var(--border-strong);
    font-size: 14px;
    outline: none;
    background: #fff;
    transition: border-color .12s, box-shadow .12s;
}
.field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.field-checkbox {
    display: flex; align-items: center; gap: 8px;
    margin-bottom: 18px; font-size: 13px; color: var(--text-muted);
}
.field-error-summary {
    color: #b42318;
    background: #fef3f2;
    border: 1px solid #fda29b;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 13px;
    margin-bottom: 14px;
}
.field span.field-validation-error { color: #b42318; font-size: 12px; display: block; margin-top: 4px; }

.login-btn, .btn-primario {
    width: 100%;
    padding: 11px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .12s;
}
.login-btn:hover, .btn-primario:hover { background: var(--accent-dark); }

.demo-hint {
    margin-top: 22px;
    padding: 10px 12px;
    background: var(--accent-soft);
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    font-size: 12px;
    color: #1e40af;
    line-height: 1.5;
}

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 232px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 18px 14px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}
.sidebar .brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 18px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar .brand span {
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--sidebar-text);
    text-decoration: none;
    margin-bottom: 2px;
    transition: background .12s, color .12s;
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.85; }
.nav-item:hover { background: rgba(255,255,255,0.06); color: var(--sidebar-text-active); }
.nav-item:hover svg { opacity: 1; }
.nav-item.logout {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.main { flex: 1; min-width: 0; }
.content { padding: 30px 36px; max-width: 1100px; }

.view-title { font-size: 20px; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.01em; }
.view-sub { font-size: 13.5px; color: var(--text-muted); margin: 0 0 22px; }

.breadcrumb {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; color: var(--text-muted);
    margin-bottom: 20px;
}
.breadcrumb a { color: var(--text-muted); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb svg { width: 14px; height: 14px; }

/* ---------- Cards / grid ---------- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    gap: 12px;
}
.item-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 15px;
    display: block;
    text-decoration: none;
    color: inherit;
    transition: border-color .12s, box-shadow .12s, transform .08s;
}
.item-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}
.icon-wrap {
    width: 36px; height: 36px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 12px;
}
.icon-wrap svg { width: 18px; height: 18px; }
.icon-pasta { background: var(--accent-soft); color: var(--accent); }
.icon-pdf { background: #fef3f2; color: #d92d20; }
.icon-xlsx { background: #ecfdf3; color: #12866f; }
.icon-doc { background: #eff8ff; color: #175cd3; }
.icon-img { background: #fef6ee; color: #b93815; }
.icon-generico { background: #f2f4f7; color: #475467; }

.item-name {
    font-size: 13px; font-weight: 600;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.item-meta { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.download-link {
    display: inline-flex; align-items: center; gap: 4px;
    margin-top: 10px; font-size: 12px; font-weight: 600;
    color: var(--accent); text-decoration: none;
}
.download-link svg { width: 13px; height: 13px; }
.download-link:hover { text-decoration: underline; }

.empty-state {
    color: var(--text-muted); font-size: 13.5px;
    background: var(--card); border: 1px dashed var(--border-strong);
    border-radius: var(--radius); padding: 30px; text-align: center;
}

/* ---------- Admin ---------- */
.acao-topo { margin: -12px 0 22px; }
.btn-link-criar {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 13px; font-weight: 600; color: var(--accent);
    text-decoration: none; padding: 8px 4px;
}
.btn-link-criar svg { width: 14px; height: 14px; }
.btn-link-criar:hover { text-decoration: underline; }

.admin-aviso {
    background: #ecfdf3; border: 1px solid #abefc6; color: #067647;
    border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-bottom: 18px;
}

.badge {
    display: inline-flex; align-items: center;
    font-size: 11px; font-weight: 600;
    padding: 3px 8px; border-radius: 100px;
    margin-top: 6px;
}
.badge-ativo { background: #ecfdf3; color: #067647; }
.badge-inativo { background: #f2f4f7; color: #475467; }

.form-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 26px 28px;
    max-width: 460px;
    box-shadow: var(--shadow-sm);
}
