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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f4f6f8;
    color: #333;
}

.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-container {
    background: #fff;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 400px;
}

.login-container h1 {
    margin-bottom: 1.5rem;
    text-align: center;
    font-size: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

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

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1rem;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
    text-align: center;
}

.btn-primary {
    width: 100%;
    background-color: #2563eb;
    color: #fff;
}

.btn-primary:hover {
    background-color: #1d4ed8;
}

.btn-secondary {
    background-color: #6b7280;
    color: #fff;
}

.btn-secondary:hover {
    background-color: #4b5563;
}

.alert {
    padding: 0.75rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

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

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
}

.main-header {
    background: #1f2937;
    color: #fff;
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.header-actions form {
    margin: 0;
}

.company-nav {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.company-btn {
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    text-decoration: none;
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
    border: 2px solid transparent;
}

.company-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.company-btn.active {
    border-color: #fff;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.megafantasy { background: linear-gradient(135deg, #7c3aed, #4f46e5); }
.bluestar { background: linear-gradient(135deg, #0ea5e9, #2563eb); }
.nexus { background: linear-gradient(135deg, #10b981, #059669); }
.megaworld { background: linear-gradient(135deg, #f59e0b, #d97706); }
.elitech { background: linear-gradient(135deg, #ef4444, #dc2626); }

.company-content {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.company-title {
    font-size: 1.75rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
}

.submenu {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0.75rem;
}

.submenu-btn {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    text-decoration: none;
    background: #e5e7eb;
    color: #374151;
    font-weight: 600;
    transition: background 0.2s, color 0.2s;
}

.submenu-btn:hover {
    background: #d1d5db;
}

.submenu-btn.active {
    background: #2563eb;
    color: #fff;
}

.resumen-section {
    background: #fff;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.options-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.options-content {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.options-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
}

.options-header h2 {
    font-size: 1.25rem;
}

.close-options {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6b7280;
}

.options-body {
    padding: 1.25rem;
}

.alias-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.alias-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.alias-item label {
    font-weight: 600;
    font-size: 0.9rem;
    color: #374151;
}

.alias-item input {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95rem;
}

.url-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid #e5e7eb;
}

.url-section h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: #111827;
}

.options-tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid #e5e7eb;
    margin-bottom: 1.25rem;
}

.options-tab {
    padding: 0.6rem 1rem;
    border: none;
    background: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: 600;
    color: #6b7280;
}

.options-tab.active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.options-tab:hover {
    color: #374151;
}

.tab-panel h3 {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: #111827;
}

.tab-description {
    color: #6b7280;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.form-item {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-item label,
.form-item-inline label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #374151;
}

.form-item input,
.form-item-inline select {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95rem;
}

.form-item-inline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-item-inline input,
.form-item-inline select {
    flex: 1;
}

.alias-table-name {
    font-weight: 700;
    color: #111827;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.alias-item {
    background: #f9fafb;
    padding: 0.75rem;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    margin-bottom: 0.75rem;
}

.tab-desc {
    color: #6b7280;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.checkbox-wrap {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.checkbox-wrap input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    flex: none;
}

.checkbox-wrap label {
    cursor: pointer;
}

.category-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.category-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.category-row input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0.25rem;
}

.empty-msg {
    color: #6b7280;
    font-style: italic;
    font-size: 0.9rem;
}

.alias-section {
    margin-top: 1rem;
}

.alias-section h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: #111827;
}

.options-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}

.loading-text {
    color: #6b7280;
    text-align: center;
}

.resumen-filters {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    min-width: 160px;
}

.filter-item label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #374151;
}

.filter-item select {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.95rem;
    background-color: white;
}

.resumen-category-title {
    font-size: 1.1rem;
    color: #1f2937;
    margin: 1.25rem 0 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 2px solid #2563eb;
}

.resumen-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.resumen-table th,
.resumen-table td {
    border: 1px solid #e5e7eb;
    padding: 0.6rem;
    text-align: left;
}

.resumen-table th {
    background: #1f2937;
    color: #fff;
    font-weight: 600;
}

.resumen-table tr:nth-child(even) {
    background: #f9fafb;
}

.resumen-sum {
    text-align: right;
    font-weight: 600;
    color: #047857;
}

.resumen-table-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.resumen-table-card h5 {
    font-size: 0.95rem;
    color: #1f2937;
    margin-bottom: 0.5rem;
    padding-bottom: 0.25rem;
    border-bottom: 1px solid #e5e7eb;
}

.resumen-total-row td {
    border-top: 2px solid #d1d5db;
    background: #f3f4f6;
}

.resumen-single-total {
    font-size: 0.95rem;
    color: #374151;
    padding: 0.5rem 0;
}

.resumen-category-total {
    font-size: 1rem;
    color: #1f2937;
    margin: 0.5rem 0 1rem;
    padding: 0.5rem;
    background: #eff6ff;
    border-radius: 6px;
}

.resumen-config-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.resumen-config-table th,
.resumen-config-table td {
    border: 1px solid #e5e7eb;
    padding: 0.6rem;
    text-align: left;
}

.resumen-config-table th {
    background: #f3f4f6;
    font-weight: 600;
    color: #374151;
}

.resumen-config-table td {
    vertical-align: middle;
}

.resumen-config-table input[type="checkbox"] {
    width: 1.2rem;
    height: 1.2rem;
    cursor: pointer;
}

.resumen-config-table input[type="checkbox"]:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.resumen-table-name {
    font-weight: 600;
    color: #111827;
}

.home-content {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
}

.home-title {
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

.tables-section {
    margin-bottom: 2rem;
}

.tables-section h2 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

.table-category {
    margin-bottom: 1.5rem;
}

.category-title {
    font-size: 1.1rem;
    color: #1f2937;
    margin-bottom: 0.75rem;
    padding-bottom: 0.25rem;
    border-bottom: 2px solid #2563eb;
    display: inline-block;
}

.tables-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.table-btn {
    padding: 0.6rem 1rem;
    border: 1px solid #2563eb;
    background: #fff;
    color: #2563eb;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s, color 0.2s;
}

.table-btn:hover {
    background: #2563eb;
    color: #fff;
}

.no-tables {
    color: #6b7280;
    font-style: italic;
}

.data-section {
    background: #fff;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.data-section h2 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
}

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

#dataTable {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

#dataTable th,
#dataTable td {
    border: 1px solid #e5e7eb;
    padding: 0.6rem;
    text-align: left;
}

#dataTable th {
    background: #1f2937;
    color: #fff;
    font-weight: 600;
    white-space: nowrap;
}

#dataTable tr:nth-child(even) {
    background: #f9fafb;
}
