/* Fontes do Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&family=Plus+Jakarta+Sans:wght@300;400;500;600;700&display=swap');

:root {
    /* Cores Premium Inspiradas na Identidade Linx (Roxo e Verde) */
    --primary-color: #5D00A5;      /* Roxo Linx */
    --primary-hover: #45007A;
    --secondary-color: #9CC300;    /* Verde Linx */
    --secondary-hover: #82A300;
    
    /* Cores de Fundo (Tema Escuro Glassmorphism) */
    --bg-dark: #0f0a18;
    --bg-panel: rgba(30, 22, 45, 0.65);
    --bg-card: rgba(45, 34, 65, 0.45);
    --bg-input: rgba(255, 255, 255, 0.07);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-focus: rgba(156, 195, 0, 0.5);
    
    /* Feedback */
    --success: #2ec4b6;
    --error: #e71d36;
    --warning: #ff9f1c;
    --info: #00b4d8;
    
    /* Texto */
    --text-primary: #f3f0f7;
    --text-secondary: #c2b9d2;
    --text-muted: #8d81a3;
    
    /* Layout */
    --sidebar-width: 260px;
    --border-radius: 16px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset Geral */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(at 10% 20%, rgba(93, 0, 165, 0.15) 0px, transparent 50%),
        radial-gradient(at 90% 80%, rgba(156, 195, 0, 0.08) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Layout Principal */
.app-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Barra Lateral (Sidebar) */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(15, 10, 24, 0.85);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 36px;
    padding-left: 8px;
}

.logo-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    font-size: 20px;
}

.logo-title {
    font-family: 'Outfit', sans-serif;
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
    background: linear-gradient(to right, #ffffff, var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-sub {
    font-size: 11px;
    color: var(--secondary-color);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: -4px;
}

.menu-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.menu-item a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    transition: var(--transition);
}

.menu-item a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.menu-item.active a {
    background: linear-gradient(135deg, rgba(93, 0, 165, 0.3), rgba(156, 195, 0, 0.1));
    border-left: 3px solid var(--secondary-color);
    color: var(--text-primary);
}

.menu-item i {
    font-size: 18px;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
}

/* Área de Conteúdo Principal */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 40px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Topo / Cabeçalho */
.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.page-title h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 28px;
    font-weight: 600;
    color: white;
}

.page-title p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 4px;
}

/* Ações Globais */
.action-buttons {
    display: flex;
    gap: 12px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--secondary-color);
    color: #1a2200;
}

.btn-secondary:hover {
    background: var(--secondary-hover);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
}

.btn-danger {
    background: rgba(231, 29, 54, 0.14);
    border: 1px solid rgba(231, 29, 54, 0.35);
    color: #ffb3bd;
}

.btn-danger:hover {
    background: rgba(231, 29, 54, 0.22);
}

.shutdown-btn {
    width: 100%;
    justify-content: center;
    padding: 9px 10px;
    margin-bottom: 12px;
    font-size: 12px;
}

/* Grid de Resumos (Dashboard Stats) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: rgba(156, 195, 0, 0.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.stat-info h3 {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-info .value {
    font-size: 28px;
    font-weight: 700;
    margin-top: 8px;
    color: white;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--secondary-color);
}

/* Barra de Busca Inteligente */
.search-container {
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    margin-bottom: 32px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px 20px 16px 52px;
    color: white;
    font-size: 16px;
    transition: var(--transition);
    outline: none;
}

.search-input:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 15px var(--border-focus);
    background: rgba(255, 255, 255, 0.1);
}

.search-wrapper i {
    position: absolute;
    left: 20px;
    font-size: 20px;
    color: var(--text-muted);
}

/* Painéis de Resultados */
.panel {
    background: var(--bg-panel);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    margin-bottom: 32px;
    flex: 1;
    min-width: 0;
    width: 100%;
}

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

.panel-header h2 {
    font-size: 18px;
    font-weight: 600;
}

/* Tabelas */
.table-wrapper {
    width: 100%;
    max-height: calc(100vh - 320px);
    overflow-x: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

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

.custom-table th {
    padding: 14px 16px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.sortable-th {
    cursor: pointer;
    user-select: none;
    position: relative;
}

.sortable-th::after {
    content: "\f0dc";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 10px;
    opacity: 0.35;
    margin-left: 8px;
}

.sortable-th.sort-asc::after {
    content: "\f0de";
    opacity: 0.9;
}

.sortable-th.sort-desc::after {
    content: "\f0dd";
    opacity: 0.9;
}

.custom-table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    color: var(--text-secondary);
}

.custom-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
    color: white;
}

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

/* Pills / Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success {
    background: rgba(46, 196, 182, 0.15);
    color: var(--success);
}

.badge-error {
    background: rgba(230, 29, 54, 0.15);
    color: var(--error);
}

.badge-warning {
    background: rgba(255, 159, 28, 0.15);
    color: var(--warning);
}

.badge-info {
    background: rgba(0, 180, 216, 0.15);
    color: var(--info);
}

/* Estilos de Formulários */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.form-control {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px 16px;
    color: white;
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 10px var(--border-focus);
}

/* Área de Drop de Arquivo (Upload Zone) */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius);
    padding: 48px;
    text-align: center;
    background: var(--bg-card);
    cursor: pointer;
    transition: var(--transition);
}

.upload-zone:hover {
    border-color: var(--secondary-color);
    background: rgba(156, 195, 0, 0.05);
}

.upload-zone i {
    font-size: 48px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* Histórico / Linha do Tempo (Logs) */
.log-item {
    display: flex;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
}

.log-item:last-child {
    border-bottom: none;
}

.log-time {
    font-size: 13px;
    color: var(--text-muted);
    min-width: 140px;
}

.log-desc {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Preço Sugerido e Formação */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.pricing-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
}

.price-card {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    border: 1px solid var(--border-color);
}

.price-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--secondary-color);
    margin-top: 8px;
}

/* Utilitários */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-bold { font-weight: 600; }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.mt-4 { margin-top: 16px; }

/* Detalhe do Produto */
.product-info-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

.info-card {
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 16px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    color: var(--text-muted);
}

.info-val {
    color: var(--text-primary);
    font-weight: 500;
}

/* Tema claro operacional, inspirado no Silo Digital */
:root {
    --primary-color: #2c82c9;
    --primary-hover: #1f6fad;
    --secondary-color: #2fa7df;
    --secondary-hover: #188ec4;
    --bg-dark: #f4f7fb;
    --bg-panel: #ffffff;
    --bg-card: #f8fafc;
    --bg-input: #ffffff;
    --border-color: #cfd9e6;
    --border-focus: rgba(47, 167, 223, 0.25);
    --success: #178f5d;
    --error: #c73737;
    --warning: #b36b00;
    --info: #1976b8;
    --text-primary: #1f2d3d;
    --text-secondary: #45566a;
    --text-muted: #718096;
    --sidebar-width: 0px;
    --border-radius: 4px;
    --transition: all 0.15s ease;
}

body {
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    background: #eef4fb;
    color: var(--text-primary);
    display: block;
}

.app-container {
    display: block;
    min-height: 100vh;
    padding: 6px;
}

.sidebar {
    position: static;
    width: 100%;
    height: auto;
    min-height: 72px;
    padding: 6px;
    background: linear-gradient(#ffffff, #f1f5fa);
    border: 1px solid #b9c9db;
    border-radius: 4px;
    box-shadow: none;
    backdrop-filter: none;
    flex-direction: row;
    align-items: center;
    gap: 6px;
}

.logo-container {
    width: 132px;
    min-width: 132px;
    height: 56px;
    margin: 0;
    padding: 4px;
    border: 1px solid #cdd8e4;
    border-radius: 4px;
    background: #ffffff;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.logo-icon {
    width: 30px;
    height: 30px;
    border-radius: 4px;
    background: linear-gradient(135deg, #9ea7ad 0%, #9ea7ad 46%, #2c82c9 47%, #2fa7df 100%);
    font-size: 14px;
}

.logo-title {
    font-size: 13px;
    color: #1f76bb;
    background: none;
    -webkit-text-fill-color: initial;
    letter-spacing: 0;
}

.logo-sub {
    display: none;
}

.menu-list {
    flex-direction: row;
    gap: 4px;
    align-items: stretch;
}

.menu-item a {
    min-width: 76px;
    height: 56px;
    padding: 6px 8px;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    border: 1px solid #cdd8e4;
    border-radius: 4px;
    background: linear-gradient(#ffffff, #edf3f9);
    color: #1f2d3d;
    font-size: 12px;
    font-weight: 500;
}

.menu-item a:hover,
.menu-item.active a {
    background: linear-gradient(#eaf6ff, #d9ecfa);
    border-left: 1px solid #8abce2;
    border-color: #8abce2;
    color: #064d7f;
}

.menu-item i {
    font-size: 22px;
    color: #247fbd;
}

.sidebar-footer {
    margin-left: auto;
    margin-top: 0;
    height: 56px;
    padding: 6px 8px;
    border: 1px solid #cdd8e4;
    border-radius: 4px;
    background: linear-gradient(#ffffff, #f6f9fc);
    min-width: 250px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    color: #617081;
}

.sidebar-footer .shutdown-btn {
    width: auto;
    height: 34px;
    padding: 0 12px;
    border-color: #f0b6b6;
    background: #fff4f4;
    color: #b52929;
    white-space: nowrap;
}

.sidebar-footer p {
    margin: 0;
    font-size: 11px;
    line-height: 1.2;
    white-space: nowrap;
}

.sidebar-footer .shutdown-btn:hover {
    background: #ffe7e7;
    border-color: #e28c8c;
}

.portal-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
    line-height: 1.2;
    font-size: 11px;
    color: #617081;
    white-space: nowrap;
}

.main-content {
    margin-left: 0;
    padding: 8px 0 0;
    min-height: calc(100vh - 86px);
}

.header-bar,
.panel,
.search-container,
.stat-card,
.pricing-panel,
.price-card,
.info-card {
    background: #ffffff;
    border: 1px solid #b9c9db;
    border-radius: 4px;
    box-shadow: none;
    backdrop-filter: none;
}

.header-bar {
    margin-bottom: 6px;
    padding: 10px 14px;
}

.page-title h1 {
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    font-size: 18px;
    color: #203040;
    font-weight: 600;
}

.page-title p {
    color: #66798e;
    font-size: 12px;
}

.btn {
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 12px;
    border: 1px solid #b9c9db;
    box-shadow: none;
    text-decoration: none;
}

.btn:hover {
    transform: none;
}

.btn-primary,
.btn-secondary {
    background: linear-gradient(#fefefe, #e9f1f8);
    color: #1f2d3d;
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-outline:hover {
    background: linear-gradient(#eaf6ff, #d9ecfa);
    border-color: #8abce2;
}

.btn-outline {
    background: #ffffff;
    color: #1f2d3d;
}

.stats-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    margin-bottom: 6px;
}

.stat-card {
    padding: 10px 12px;
}

.stat-card:hover {
    transform: none;
    box-shadow: none;
    border-color: #8abce2;
}

.stat-info h3 {
    color: #66798e;
    font-size: 11px;
    letter-spacing: 0;
}

.stat-info .value {
    color: #1f2d3d;
    font-size: 22px;
}

.stat-icon {
    width: 34px;
    height: 34px;
    border-radius: 4px;
    background: #eef6fc;
    color: #247fbd;
}

.search-container {
    padding: 12px;
    margin-bottom: 6px;
}

.search-container h3 {
    color: #203040;
    font-size: 14px;
}

.search-input,
.form-control {
    background: #ffffff;
    border: 1px solid #b9c9db;
    border-radius: 4px;
    color: #1f2d3d;
    padding: 10px 12px;
}

.search-input {
    padding-left: 38px;
    font-size: 14px;
}

.search-input:focus,
.form-control:focus {
    border-color: #2fa7df;
    box-shadow: 0 0 0 2px var(--border-focus);
    background: #ffffff;
}

.search-wrapper i {
    left: 13px;
    font-size: 16px;
}

.panel {
    padding: 12px;
    margin-bottom: 6px;
}

.panel-header {
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e1e8f0;
}

.panel-header h2 {
    font-size: 15px;
    color: #203040;
}

.custom-table th {
    background: #f3f7fb;
    color: #40546a;
    font-size: 11px;
    text-transform: none;
    padding: 6px 8px;
    border: 1px solid #d7e1ec;
    position: sticky;
    top: 0;
    z-index: 10;
    text-align: left;
}

.custom-table td {
    color: #2f3f50;
    padding: 5px 8px;
    border: 1px solid #e1e8f0;
    font-size: 12px;
}

.custom-table tr:hover td {
    background: #f7fbff;
    color: #1f2d3d;
}

.page-invoices {
    overflow: hidden;
}

.page-invoices .app-container {
    min-height: 100vh;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.page-invoices .main-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding-bottom: 6px;
}

.page-invoices .header-bar {
    flex: 0 0 auto;
}

.page-invoices .panel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
}

.page-invoices .panel-header {
    flex: 0 0 auto;
}

.page-invoices .table-wrapper {
    flex: 1;
    min-height: 0;
    max-height: none;
    overflow: auto;
    border: 1px solid #d7e1ec;
    border-radius: 4px 4px 0 0;
    background: #ffffff;
}

.page-invoices .custom-table th {
    top: 0;
    box-shadow: 0 1px 0 #d7e1ec;
}

.page-invoices .custom-table tr:last-child td {
    border-bottom: 1px solid #e1e8f0;
}

/* Detalhe NF-e — blocos com altura uniforme */
.page-invoice-detail .stat-card {
    min-height: 72px;
    display: block;
}
.page-invoice-detail .stat-info .value {
    font-size: 15px;
}
.page-invoice-detail .stat-info h3 {
    font-size: 10px;
    margin-bottom: 2px;
}

.panel-footer {
    border-top: 1px solid #d7e1ec;
    background: linear-gradient(#f9fbfe, #eef4fa);
    color: #53677c;
    font-size: 12px;
}

.invoices-panel-footer {
    flex: 0 0 auto;
    min-height: 34px;
    padding: 8px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid #d7e1ec;
    border-top: none;
    border-radius: 0 0 4px 4px;
}

.invoices-panel-footer span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap;
}

.invoices-panel-footer i {
    color: #247fbd;
}

.badge {
    border-radius: 3px;
    padding: 3px 7px;
    font-size: 11px;
    white-space: nowrap;
}

.badge-success {
    background: #e8f6ef;
}

.badge-error {
    background: #fdecec;
}

.badge-warning {
    background: #fff5df;
}

.badge-info {
    background: #e8f4fb;
}

.upload-zone {
    background: #fbfdff;
    border-color: #b9c9db;
    border-radius: 4px;
    padding: 32px;
}

.upload-zone:hover {
    background: #f3f9ff;
    border-color: #2fa7df;
}

.upload-zone i {
    color: #247fbd;
}

.log-item,
.info-row {
    border-color: #e1e8f0;
}

.price-value {
    color: #1f76bb;
}

a {
    color: #1f76bb;
}

@media (max-width: 800px) {
    .page-invoices {
        overflow: auto;
    }

    .page-invoices .app-container {
        height: auto;
        min-height: 100vh;
    }

    .page-invoices .panel {
        min-height: 520px;
    }

    .page-invoices .table-wrapper {
        max-height: 62vh;
    }

    .invoices-panel-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .sidebar {
        overflow-x: auto;
    }

    .logo-container {
        min-width: 112px;
        width: 112px;
    }

    .menu-item a {
        min-width: 70px;
    }

    .header-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .action-buttons {
        flex-wrap: wrap;
    }
}

.invoice-items-table {
    min-width: 1300px;
    font-size: 13px;
}

.invoice-items-table th:nth-child(1) { min-width: 35px; }   /* # */
.invoice-items-table th:nth-child(2) { min-width: 120px; }  /* EAN / Código */
.invoice-items-table th:nth-child(3) { min-width: 200px; }  /* Produto */
.invoice-items-table th:nth-child(4) { min-width: 50px; }   /* CFOP */
.invoice-items-table th:nth-child(5) { min-width: 70px; }   /* NCM */
.invoice-items-table th:nth-child(6) { min-width: 75px; }   /* Qtd Compra */
.invoice-items-table th:nth-child(7) { min-width: 40px; }   /* Un */
.invoice-items-table th:nth-child(8) { min-width: 80px; }   /* Custo Compra */
.invoice-items-table th:nth-child(9) { min-width: 80px; }   /* Qtd Unid. */
.invoice-items-table th:nth-child(10) { min-width: 80px; }  /* Custo Unit. */
.invoice-items-table th:nth-child(11) { min-width: 90px; }  /* Total */
.invoice-items-table th:nth-child(12) { min-width: 70px; }  /* Desc. */
.invoice-items-table th:nth-child(13) { min-width: 120px; } /* Impostos */
.invoice-items-table th:nth-child(14) { min-width: 100px; } /* Fator */
.invoice-items-table th:nth-child(15) { min-width: 90px; }  /* Hist. */

.invoice-items-table td {
    vertical-align: middle;
}

.item-code-cell {
    line-height: 1.45;
}

.ean-value {
    color: #005fa8;
    font-weight: 700;
    font-size: 13px;
}

.ean-link {
    border: 0;
    background: transparent;
    padding: 0;
    color: #005fa8;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    text-align: left;
    text-decoration: underline;
}

.ean-link:hover {
    color: #003f70;
}

.ean-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.icon-copy-btn {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    font-size: 13px;
    transition: color 0.15s, background 0.15s;
}

.icon-copy-btn:hover {
    background: rgba(255,255,255,0.08);
    color: var(--text-primary);
}

.supplier-code,
.item-extra {
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 3px;
}

.tax-detail {
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 3px;
    white-space: nowrap;
}

.product-name-cell {
    color: #102a43;
    line-height: 1.35;
}

.money-strong {
    color: #172b4d;
    font-weight: 700;
    white-space: nowrap;
}

.tax-cell {
    line-height: 1.35;
}

.compact-btn {
    padding: 4px 10px;
    font-size: 11px;
    min-width: 44px;
    justify-content: center;
}

.smart-pricing {
    display: grid;
    gap: 12px;
}

.cost-breakdown,
.cost-summary {
    border: 1px solid #d7e1ec;
    border-radius: 4px;
    background: #fbfdff;
}

.cost-breakdown div,
.cost-summary div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 7px 10px;
    border-bottom: 1px solid #e1e8f0;
    font-size: 12px;
}

.cost-breakdown div:last-child,
.cost-summary div:last-child {
    border-bottom: 0;
}

.cost-breakdown span,
.cost-summary span {
    color: var(--text-muted);
}

.breakdown-total {
    background: #eef6fc;
    font-weight: 700;
}

.price-profit {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 8px;
}

.warning-box {
    border: 1px solid #f1c36d;
    background: #fff8e7;
    color: #7a4b00;
    border-radius: 4px;
    padding: 10px 12px;
    font-size: 13px;
}

.tax-note {
    border: 1px solid #d7e1ec;
    background: #f7fbff;
    border-radius: 4px;
    color: #45566a;
    font-size: 12px;
    line-height: 1.45;
    padding: 9px 10px;
}

.xml-detail-table-row td {
    background: #f8fbff !important;
    padding: 10px 14px !important;
}

.xml-detail-panel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 10px;
}

.xml-detail-group {
    border: 1px solid #d7e1ec;
    border-radius: 4px;
    background: #ffffff;
    padding: 8px;
    min-width: 0;
}

.xml-detail-group > strong {
    display: block;
    color: #7a4b00;
    margin-bottom: 6px;
}

.xml-detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

.xml-detail-row {
    display: grid;
    grid-template-columns: minmax(145px, 45%) minmax(120px, 55%);
    gap: 8px;
    border-bottom: 1px solid #e8eef5;
    padding: 4px 0;
    font-size: 12px;
}

.xml-detail-row span {
    color: #66798e;
    overflow-wrap: anywhere;
}

.xml-detail-row b {
    color: #1f2d3d;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.app-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.38);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 24px;
}

.app-modal {
    width: min(620px, 100%);
    background: #ffffff;
    border: 1px solid #b9c9db;
    border-radius: 6px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.22);
}

.app-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #d7e1ec;
    background: #f3f7fb;
}

.app-modal-header h3 {
    font-size: 16px;
    margin: 0;
}

.modal-close-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #b9c9db;
    border-radius: 4px;
    background: #ffffff;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.app-modal-body {
    padding: 16px;
}

.modal-product-name {
    font-weight: 700;
    color: #102a43;
    margin-bottom: 12px;
    line-height: 1.35;
}

.ean-detail-list {
    display: grid;
    gap: 6px;
}

.ean-detail-list div {
    display: grid;
    grid-template-columns: 190px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 8px 10px;
    border: 1px solid #e1e8f0;
    border-radius: 4px;
    background: #fbfdff;
}

.ean-detail-list span {
    color: var(--text-muted);
}

.ean-detail-list strong {
    color: #1f2d3d;
    overflow-wrap: anywhere;
}

.ean-actions {
    display: inline-flex !important;
    grid-template-columns: none !important;
    gap: 6px !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
}

/* Price Comparison Grid & Cards */
.competitor-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.competitor-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 16px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: var(--transition);
}

.competitor-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(44, 130, 201, 0.12);
}

.competitor-name {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

.competitor-prod-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 32px;
    line-height: 16px;
}

.competitor-price-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
}

.competitor-price {
    font-size: 16px;
    font-weight: 700;
    color: var(--success);
}

.competitor-status-notfound {
    color: var(--text-muted);
    font-style: italic;
    font-size: 12px;
    margin: 8px 0;
}

.competitor-status-error {
    color: var(--error);
    font-size: 11px;
    margin: 8px 0;
}

.py-4 {
    padding-top: 16px;
    padding-bottom: 16px;
}

.mb-2 {
    margin-bottom: 8px;
}

/* Custom styling for compact purchase history table */
.history-table th {
    font-size: 11px !important;
    padding: 6px 8px !important;
}

.history-table td {
    font-size: 11px !important;
    padding: 6px 8px !important;
}

/* Container de ações na tabela */
.actions-container {
    display: flex;
    gap: 6px;
    justify-content: flex-start;
    align-items: center;
    white-space: nowrap;
}

/* Botões de ação compactos e elegantes */
.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 7px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 3px;
    text-decoration: none;
    transition: all 0.15s ease;
    cursor: pointer;
    line-height: 1.2;
}

/* Botão Detalhes (Visualizar) - tom azul suave */
.btn-action-view {
    background-color: #eef6fc;
    color: #1f76bb;
    border: 1px solid #bdd1e4;
}

.btn-action-view:hover {
    background-color: #d9ecfa;
    color: #064d7f;
    border-color: #8abce2;
    text-decoration: none;
}

/* Botão DANFE (Imprimir) - tom cinza/azul sóbrio */
.btn-action-print {
    background-color: #f5f8fa;
    color: #4a5568;
    border: 1px solid #d1dbe5;
}

.btn-action-print:hover {
    background-color: #eaf0f6;
    color: #1a202c;
    border-color: #b9c5d0;
    text-decoration: none;
}

/* Info Card Compacto para Lateral de Precificação */
.info-card-compact {
    padding: 10px 12px;
    background: #ffffff;
    border: 1px solid #b9c9db;
    border-radius: 4px;
    margin-bottom: 12px;
}

.info-card-compact .info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 0;
    font-size: 11.5px;
    border-bottom: 1px solid #eef2f6;
}

.info-card-compact .info-row:last-child {
    border-bottom: none;
}

.info-card-compact .info-label {
    color: #66798e;
    font-weight: 500;
}

.info-card-compact .info-val {
    color: #203040;
    font-weight: 600;
    max-width: 70%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: right;
}

/* Select dropdown (nativo Windows, sem customização agressiva) */
select.form-control {
    cursor: pointer;
    min-height: 34px;
}

/* Custom Picker (InfoPrice-style searchable dropdown) */
.custom-picker {
    position: relative;
    width: 100%;
}

.custom-picker-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.custom-picker-input-wrap input {
    width: 100%;
    min-height: 34px;
    padding: 6px 30px 6px 10px;
    background: #ffffff;
    border: 1px solid #b9c9db;
    border-radius: 4px;
    font-size: 13px;
    color: #1f2d3d;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s ease;
}

.custom-picker-input-wrap input:focus {
    border-color: #2fa7df;
    box-shadow: 0 0 0 2px rgba(47, 167, 223, 0.25);
}

.custom-picker-input-wrap input::placeholder {
    color: #94a3b8;
}

.custom-picker-input-wrap i {
    position: absolute;
    right: 10px;
    font-size: 11px;
    color: #718096;
    pointer-events: none;
    transition: transform 0.2s ease;
}

.custom-picker-input-wrap.open i {
    transform: rotate(180deg);
}

.custom-picker-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 200;
    margin-top: 3px;
    background: #ffffff;
    border: 1px solid #b9c9db;
    border-radius: 4px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12);
    display: none;
    max-height: 280px;
    overflow: hidden;
    flex-direction: column;
}

.custom-picker-dropdown.open {
    display: flex;
}

.custom-picker-options {
    overflow-y: auto;
    max-height: 240px;
    flex: 1;
}

.custom-picker-option {
    padding: 7px 12px;
    font-size: 12px;
    color: #2f3f50;
    cursor: pointer;
    transition: background 0.1s ease;
}

.custom-picker-option:hover {
    background: #f3f7fb;
    color: #064d7f;
}

.custom-picker-option.selected {
    background: #e8f4fb;
    color: #064d7f;
    font-weight: 600;
}

.custom-picker-empty {
    padding: 16px;
    text-align: center;
    font-size: 12px;
    color: #94a3b8;
}

/* Dropdown de ações nas tabelas */
.dropdown-container {
    position: relative;
    display: inline-flex;
}

.dropdown-trigger {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
    border: 1px solid #b9c9db;
    background: #f5f8fa;
    color: #2f3f50;
    cursor: pointer;
    transition: all 0.15s ease;
    line-height: 1.3;
    white-space: nowrap;
    font-family: inherit;
}

.dropdown-trigger:hover {
    background: #eaf0f6;
    border-color: #8abce2;
}

.dropdown-trigger::after {
    content: "\f0d7";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 10px;
    margin-left: 2px;
    color: #718096;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 100;
    min-width: 150px;
    margin-top: 3px;
    padding: 4px 0;
    background: #ffffff;
    border: 1px solid #b9c9db;
    border-radius: 4px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, 0.12);
    display: none;
}

.dropdown-menu.open {
    display: block;
}

.dropdown-menu a,
.dropdown-menu button {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 7px 12px;
    font-size: 12px;
    color: #2f3f50;
    text-decoration: none;
    border: none;
    background: none;
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    white-space: nowrap;
    line-height: 1.3;
}

.dropdown-menu a:hover,
.dropdown-menu button:hover {
    background: #f3f7fb;
    color: #064d7f;
}

.dropdown-menu a i,
.dropdown-menu button i {
    width: 16px;
    text-align: center;
    color: #247fbd;
}
