* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f3f4f6;
    color: #111827;
}

a {
    text-decoration: none;
}

.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(135deg, #061127, #13233f);
}

/* Login em tela cheia: usar templates/layouts/auth.php (não aninhar .login-card aqui). */
.login-container {
    width: 100%;
    max-width: 460px;
}

.auth-login-shell .login-subtitle {
    text-align: left;
}

.login-subtitle {
    margin: 0 0 24px;
    color: #6b7280;
    text-align: center;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    height: 44px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 0 12px;
    font-size: 14px;
}

.form-group input:focus {
    outline: none;
    border-color: #111827;
}

.btn-logout,
.btn-logout-outline {
    border-radius: 10px;
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 600;
    transition: .2s;
}

/* Botão primário no app: largura automática (Bootstrap). Login usa .login-form abaixo. */
.btn.btn-primary {
    background: #08142c;
    color: #ffffff;
    border-color: #08142c;
}

.btn.btn-primary:hover {
    background: #0d1d3c;
    border-color: #0d1d3c;
    color: #ffffff;
}

.login-form .btn-primary {
    width: 100%;
    border-radius: 10px;
    padding: 12px 16px;
    font-weight: 600;
    cursor: pointer;
    background: #08142c;
    color: #ffffff;
    border: 0;
}

.login-form .btn-primary:hover {
    background: #0d1d3c;
}

.btn-logout-outline {
    width: 100%;
    background: transparent;
    color: #ffffff;
    border: 1px solid rgba(255,255,255,.7);
}

.btn-logout-outline:hover {
    background: rgba(255,255,255,.08);
    border-color: #ffffff;
}

.alert {
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 18px;
    font-size: 14px;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
}

.app-body {
    background: #f3f4f6;
}

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

.sidebar {
    width: 260px;
    background: linear-gradient(180deg, #08142c, #061127);
    color: #ffffff;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
}

.sidebar-main {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-brand {
    flex-shrink: 0;
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 90px;
}

.sidebar-brand a {
    text-decoration: none;
}

.sidebar-brand-mark {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 72px;
}

.sidebar-brand-fallback {
    display: none;
    align-items: center;
    justify-content: center;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.sidebar-brand-fallback.is-visible {
    display: flex;
}

.sidebar-brand-fallback svg {
    max-width: 100%;
    height: auto;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.form-actions-end {
    justify-content: flex-end;
}

.form-actions-split {
    justify-content: space-between;
}

.sidebar-logo {
    max-width: 180px;
    max-height: 100px;
    object-fit: contain;
}

.sidebar-nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 4px;
    scrollbar-gutter: stable;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.22);
    border-radius: 6px;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.32);
}

.sidebar-nav a {
    display: block;
    color: #e5e7eb;
    padding: 12px 14px;
    border-radius: 12px;
    transition: .2s;
}

.sidebar-nav a:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.sidebar-nav a.active {
    background: rgba(255,255,255,.10);
    color: #ffffff;
    font-weight: 700;
}

.sidebar-group {
    margin: 0;
}

.sidebar-group-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: #e5e7eb;
    padding: 12px 14px;
    border-radius: 12px;
    transition: .2s;
    cursor: pointer;
    user-select: none;
    list-style: none;
}

.sidebar-group-summary::-webkit-details-marker {
    display: none;
}

.sidebar-group-summary:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.sidebar-group-summary.is-active {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    font-weight: 600;
}

.sidebar-group[open] .sidebar-group-summary {
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-group-chevron {
    flex-shrink: 0;
    opacity: 0.75;
    transition: transform .2s;
    font-size: 0.75rem;
}

.sidebar-group[open] .sidebar-group-chevron {
    transform: rotate(180deg);
}

.sidebar-sub {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 4px 0 6px 10px;
    margin: 0 0 2px 10px;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-sub a {
    padding: 8px 10px 8px 12px;
    font-size: 0.92rem;
    border-radius: 10px;
}

.sidebar-footer {
    flex-shrink: 0;
    margin-top: 16px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.app-content {
    margin-left: 260px;
    width: calc(100% - 260px);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    padding: 20px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar-title {
    margin: 0;
    font-size: 24px;
}

.topbar-subtitle {
    margin: 4px 0 0;
    color: #6b7280;
    font-size: 14px;
}

.topbar-user {
    font-weight: 700;
    color: #111827;
}

.content-area {
    padding: 18px 24px 28px;
    flex: 1;
}

.page-header {
    margin-bottom: 24px;
}

.page-header h2 {
    margin: 0 0 8px;
    font-size: 36px;
}

.page-header p {
    margin: 0;
    color: #4b5563;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(220px, 1fr));
    gap: 20px;
}

.card {
    background: #ffffff;
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.card h3 {
    margin-top: 0;
    margin-bottom: 18px;
    font-size: 18px;
}

.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 14px 12px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    font-size: 14px;
}

.table th {
    background: #f9fafb;
    font-weight: 700;
}

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

@media (max-width: 768px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        position: relative;
        width: 100%;
        min-height: auto;
    }

    .app-content {
        margin-left: 0;
        width: 100%;
    }

    .topbar {
        padding: 16px 20px;
    }

    .content-area {
        padding: 20px;
    }

    .page-header h2 {
        font-size: 28px;
    }
}

/* Precificação (produto): alinha ao tema da empresa em app.php (:root --app-theme-*) */
.dekibeer-precificacao {
    border-color: color-mix(in srgb, var(--app-theme-secundaria) 42%, #ced4da) !important;
    background: linear-gradient(
        165deg,
        color-mix(in srgb, var(--app-theme-primaria) 9%, #fff) 0%,
        var(--bs-body-bg, #fff) 55%,
        var(--bs-tertiary-bg, #f8f9fa) 100%
    );
}

.dekibeer-precificacao__accent {
    color: var(--app-theme-secundaria);
}

.dekibeer-precificacao__accent-secondary {
    color: color-mix(in srgb, var(--app-theme-secundaria) 88%, #198754);
}

.dekibeer-precificacao__accent-tertiary {
    color: color-mix(in srgb, var(--app-theme-primaria) 55%, #b45309);
}

.dekibeer-precificacao__value {
    color: var(--app-theme-secundaria) !important;
}

.dekibeer-precificacao__value-secondary {
    color: color-mix(in srgb, var(--app-theme-secundaria) 88%, #198754) !important;
}

.dekibeer-precificacao__value-tertiary {
    color: color-mix(in srgb, var(--app-theme-primaria) 50%, #92400e) !important;
}

.dekibeer-precificacao__badge-pill {
    background: #fff;
    color: var(--app-theme-primaria);
    border: 1px solid color-mix(in srgb, var(--app-theme-secundaria) 35%, #dee2e6);
    font-weight: 600;
}

.dekibeer-precificacao__badge-pill--soft {
    background: color-mix(in srgb, var(--app-theme-secundaria) 12%, #fff);
    color: var(--app-theme-primaria);
    border: 1px solid color-mix(in srgb, var(--app-theme-secundaria) 28%, #dee2e6);
}

.dekibeer-precificacao-card--custo {
    border-color: color-mix(in srgb, var(--app-theme-secundaria) 45%, #e9ecef) !important;
}

.dekibeer-precificacao-card--preco {
    border-color: color-mix(in srgb, var(--app-theme-secundaria) 40%, #a3cfbb) !important;
}

.dekibeer-precificacao-card--lucro {
    border-color: color-mix(in srgb, var(--app-theme-primaria) 35%, #f5d0a8) !important;
}