/* ==========================================================================
 *  1. CONFIGURAÇÕES GLOBAIS E VARIÁVEIS
 *  ================================================================---------- */
:root {
    /* Cores Principais */
    --bg-sidebar: #1a373d;
    --bg-main: #f4f6f8;
    --bg-card: #ffffff;
    --accent: #11a88c;
    --accent-dark: #0e937d;
    --active-menu: #2b4950;
    --profile-bg: #e2954a;

    /* Cores de Texto */
    --text-sidebar: #a3acae;
    --text-dark: #2b303b;
    --text-medium: #576171;
    --text-light: #8a9497;
    --text-on-accent: #ffffff;

    /* Cores de Alerta e Vencimento */
    --alert-bg: #fffced;
    --alert-text: #b45309;
    --vencimento-red: #dc2626;
    --vencimento-yellow: #d97706;
    --vencimento-blue: #2563eb;

    /* Badges de Status (Tabelas) */
    --badge-registrado-bg: #e6f6f4;
    --badge-registrado-text: #118a76;
    --badge-rascunho-bg: #f3f4f6;
    --badge-rascunho-text: #4b5563;
    --badge-cancelado-bg: #fef2f2;
    --badge-cancelado-text: #dc2626;

    --badge-regular-bg: #e6f6f4;
    --badge-regular-text: #118a76;
    --badge-baixo-bg: #fffbeb;
    --badge-baixo-text: #b45309;
    --badge-sem-bg: #fef2f2;
    --badge-sem-text: #dc2626;

    /* Gráfico de Estoque */
    --bar-1: #0f766e;
    --bar-2: #55c8bc;
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    display: flex;
    min-height: 100vh;
    background-color: var(--bg-main);
}

/* ==========================================================================
 *  2. SIDEBAR UNIFICADA
 *  ================================================================---------- */
.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    color: var(--text-sidebar);
    display: flex;
    flex-direction: column;
    padding: 30px 0;
    box-sizing: border-box;
    flex-shrink: 0;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px;
    margin-bottom: 30px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background-color: #55c8bc;
    color: #16363a;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 20px;
}

.logo-text {
    color: #ffffff;
    font-size: 18px;
    font-weight: 600;
}

.menu {
    flex-grow: 1;
}

.menu-title {
    text-transform: uppercase;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-sidebar);
    padding: 20px 24px 8px;
    letter-spacing: 0.5px;
    margin: 0;
}

.menu-subtitle {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-sidebar);
    padding: 0 24px 16px;
    margin: 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: var(--text-sidebar);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s;
    margin: 0 10px;
    border-radius: 8px;
}

.menu-item:hover {
    color: #ffffff;
}

.menu-item.active {
    color: #ffffff;
    background-color: var(--active-menu);
}

.menu-item svg {
    width: 20px;
    height: 20px;
    color: inherit;
}

.profile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid #2a4c52;
    margin-top: 20px;
}

.avatar {
    width: 40px;
    height: 40px;
    background-color: var(--profile-bg);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 15px;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
}

.user-role {
    font-size: 11px;
    color: var(--text-sidebar);
}

/* ==========================================================================
 *  3. CONTEÚDO PRINCIPAL E CABEÇALHOS
 *  ================================================================---------- */
.main-content {
    flex-grow: 1;
    padding: 40px;
    box-sizing: border-box;
    max-width: calc(100vw - 260px);
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 40px;
}

.title-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.main-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
}

.subtitle {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-medium);
    margin: 0;
}

/* Botões de Ação Principais */
.btn-register, .btn-action {
    background-color: var(--accent);
    color: var(--text-on-accent);
    border: none;
    padding: 11px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
    text-decoration: none;
}

.btn-register:hover, .btn-action:hover {
    background-color: var(--accent-dark);
}

.btn-register svg {
    width: 14px;
    height: 14px;
}

/* ==========================================================================
 *  4. CARDS DE KPI (MÉTRICAS)
 *  ================================================================---------- */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

.kpi-card {
    background-color: var(--bg-card);
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
}

.kpi-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 16px;
}

.kpi-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.kpi-subtext {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-light);
}

.kpi-subtext.warning {
    color: #d97706;
}

/* ==========================================================================
 *  5. SEÇÃO DE ATIVIDADE RECENTE & ALERTAS
 *  ================================================================---------- */
.activity-section {
    background-color: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    margin-bottom: 40px;
}

.activity-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
}

.activity-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.link-view-all {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
}

.activity-list {
    padding: 0 24px;
}

.activity-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 16px;
    align-items: center;
    padding: 16px 0;
    border-top: 1px solid #f1f3f5;
}

.activity-item:first-child {
    border-top: none;
}

.activity-icon-container {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.activity-icon-container svg {
    width: 20px;
    height: 20px;
}

.activity-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.activity-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

.activity-ref {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-light);
}

.activity-time {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-light);
    text-align: right;
}

.alert-box {
    background-color: var(--alert-bg);
    border-left: 5px solid #d97706;
    border-radius: 8px;
    padding: 16px 20px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    color: var(--alert-text);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
}

.alert-icon {
    width: 18px;
    height: 18px;
    color: #d97706;
    margin-top: 2px;
}

/* ==========================================================================
 *  6. TABELAS, FILTROS E BADGES
 *  ================================================================---------- */
.table-section {
    background-color: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    padding: 24px;
}

.table-filters {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.filter-input {
    flex-grow: 1;
    padding: 10px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-dark);
    outline: none;
    font-family: inherit;
}

.filter-input::placeholder {
    color: #9ca3af;
}

.filter-select {
    padding: 10px 36px 10px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-medium);
    background-color: #fff;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
    outline: none;
    font-family: inherit;
    cursor: pointer;
}

.btn-filter {
    padding: 10px 20px;
    border: 1px solid #e5e7eb;
    background-color: #fff;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-dark);
    cursor: pointer;
    font-family: inherit;
}

.table-responsive {
    overflow-x: auto;
    padding-bottom: 8px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 16px 0;
    border-bottom: 1px solid #f1f3f5;
}

.data-table td {
    padding: 20px 0;
    border-bottom: 1px solid #f1f3f5;
    vertical-align: middle;
    font-size: 13px;
    color: var(--text-medium);
    font-weight: 500;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.col-documento {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.doc-id {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-dark);
}

.doc-type {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 500;
}

.col-vencimento {
    font-size: 13px;
    font-weight: 700;
}

.venc-red { color: var(--vencimento-red); }
.venc-yellow { color: var(--vencimento-yellow); }
.venc-blue { color: var(--vencimento-blue); }

.td-produto {
    font-weight: 700 !important;
    color: var(--text-dark) !important;
}

/* Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.status-registrado { background-color: var(--badge-registrado-bg); color: var(--badge-registrado-text); }
.status-rascunho { background-color: var(--badge-rascunho-bg); color: var(--badge-rascunho-text); }
.status-cancelado { background-color: var(--badge-cancelado-bg); color: var(--badge-cancelado-text); }
.status-regular { background-color: var(--badge-regular-bg); color: var(--badge-regular-text); }
.status-baixo { background-color: var(--badge-baixo-bg); color: var(--badge-baixo-text); }
.status-sem { background-color: var(--badge-sem-bg); color: var(--badge-sem-text); }

/* Scrollbar Personalizada das Tabelas */
.custom-scrollbar-container {
    margin-top: 16px;
    height: 16px;
    background-color: #2b303b;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px;
}

.scroll-arrow {
    width: 0;
    height: 0;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
}

.scroll-arrow.left { border-right: 6px solid #8a9497; }
.scroll-arrow.right { border-left: 6px solid #8a9497; }

.scroll-thumb {
    flex-grow: 1;
    margin: 0 8px;
    height: 8px;
    background-color: #576171;
    border-radius: 4px;
}

/* ==========================================================================
 *  7. FORMULÁRIOS, STEPPER E GRÁFICOS (ESTOQUE)
 *  ================================================================---------- */
.stepper {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 32px;
}

.step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-light);
    font-weight: 500;
}

.step.active {
    color: var(--text-dark);
    font-weight: 600;
}

.step-circle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    background-color: #e5e7eb;
    color: var(--text-light);
}

.step.active .step-circle {
    background-color: var(--accent);
    color: #ffffff;
}

.form-card {
    background-color: var(--bg-card);
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    border: 1px solid #f1f3f5;
    margin-bottom: 24px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.form-grid.full-width {
    grid-template-columns: 1fr;
    margin-top: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-medium);
}

.form-input {
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-dark);
    outline: none;
    font-family: inherit;
}

.form-input::placeholder {
    color: #9ca3af;
}

.form-select {
    padding: 12px 36px 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-dark);
    background-color: #fff;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    outline: none;
    font-family: inherit;
    cursor: pointer;
}

.items-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.items-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.btn-link {
    color: var(--accent);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
}

.item-row {
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: #f8fafc;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 24px;
}

.item-input-dark {
    background-color: #3f3f46;
    color: #ffffff;
    border: none;
    padding: 12px 16px;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
    font-family: inherit;
}

.item-input-dark.name { flex-grow: 1; }
.item-input-dark.qty { width: 80px; }
.item-input-dark.price { width: 100px; }

.total-section {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

.total-label {
    font-size: 14px;
    color: var(--text-medium);
    font-weight: 500;
}

.total-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-dark);
}

.checkbox-alert {
    background-color: #fff9eb;
    border: 1px solid #fcebb8;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    margin-bottom: 32px;
}

.custom-checkbox {
    margin-top: 3px;
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

.alert-text-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.alert-title {
    font-size: 14px;
    font-weight: 600;
    color: #3f3f46;
}

.alert-subtitle {
    font-size: 13px;
    color: #71717a;
}

.action-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 16px;
}

.btn-outline {
    padding: 12px 24px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background-color: #ffffff;
    color: var(--text-dark);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
}

.btn-outline:hover {
    background-color: #f9fafb;
}

.btn-primary {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    background-color: var(--accent);
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
}

.btn-primary:hover {
    background-color: var(--accent-dark);
}

/* Gráfico de barras */
.chart-section {
    background-color: var(--bg-card);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    padding: 24px;
    margin-bottom: 24px;
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.chart-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0;
}

.chart-subtitle {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-light);
}

.chart-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.chart-label {
    width: 80px;
    font-size: 13px;
    color: var(--text-medium);
    font-weight: 500;
}

.chart-bar-bg {
    flex-grow: 1;
    height: 14px;
    background-color: #f1f3f5;
    border-radius: 8px;
    overflow: hidden;
}

.chart-bar-fill {
    height: 100%;
    border-radius: 8px;
}

.bar-1 { background-color: var(--bar-1); width: 61%; }
.bar-2 { background-color: var(--bar-2); width: 39%; }

.chart-value {
    width: 50px;
    text-align: right;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dark);
}

.chart-legend {
    display: flex;
    gap: 20px;
    margin-top: 24px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-medium);
    font-weight: 500;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}
