/* WEIK CREDIT SYSTEM */
* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; }

body { background-color: #f5f6fa; color: #2f3542; height: 100vh; overflow: hidden; }

.app-container { display: flex; height: 100vh; width: 100vw; }

/* SIDEBAR */
.sidebar { width: 220px; background-color: #1e2022; color: #fff; display: flex; flex-direction: column; padding: 25px 15px; justify-content: space-between; flex-shrink: 0; }
.logo-area { text-align: center; margin-bottom: 35px; }
.logo-img { width: 130px; max-width: 100%; height: auto; display: block; margin: 0 auto; }
.nav-menu { display: flex; flex-direction: column; gap: 10px; flex-grow: 1; }
.nav-btn { background-color: #fff; color: #1e2022; border: none; padding: 11px 16px; font-size: 14px; font-weight: 600; border-radius: 8px; cursor: pointer; text-align: left; transition: all 0.2s; }
.nav-btn:hover { background-color: #f1f2f6; }
.nav-btn.active { background-color: #00b0ff; color: #fff; }
.sidebar-footer { font-size: 14px; font-weight: 600; line-height: 1.4; color: #a4b0be; margin-top: 20px; }

/* MAIN */
.main-content { display: flex; flex-grow: 1; height: 100%; overflow: hidden; }

/* LEFT PANE */
.left-pane { width: 300px; border-right: 2px solid #e4e7eb; background: #fff; display: flex; flex-direction: column; padding: 18px; flex-shrink: 0; }
.pane-title { font-size: 15px; font-weight: bold; margin-bottom: 12px; color: #2f3542; }
.table-container { flex-grow: 1; overflow-y: auto; margin-bottom: 15px; }

table { width: 100%; border-collapse: collapse; }
th { background-color: #00b0ff; color: #fff; padding: 7px 9px; font-size: 12px; font-weight: 600; text-align: left; }
td { padding: 9px 9px; font-size: 13px; color: #333; vertical-align: top; }
#table-clients-list tbody tr { border-bottom: 1px solid #e4e7eb; cursor: pointer; }
#table-clients-list tbody tr:hover { background-color: #f0f8ff; }
#table-clients-list tbody tr.selected-row { background-color: #e0f4ff; }

.client-row-meta { display: flex; gap: 6px; margin-top: 5px; }

/* RIGHT PANE */
.right-pane { flex-grow: 1; background: #fff; padding: 20px; overflow-y: auto; }
.empty-state { display: flex; align-items: center; justify-content: center; height: 100%; color: #a4b0be; font-style: italic; }

/* WORKSPACE */
.workspace-title { font-size: 18px; font-weight: bold; color: #1e2022; margin-bottom: 10px; }
.workspace-title span { color: #00b0ff; }

/* DETALLE COLAPSABLE */
.detail-collapse-toggle {
    display: flex; align-items: center; justify-content: space-between;
    background: #f1f2f6; border: 1px solid #dde3ea; border-radius: 7px;
    padding: 9px 14px; cursor: pointer; margin-bottom: 12px;
    font-size: 12px; font-weight: 700; color: #57606f;
    text-transform: uppercase; letter-spacing: 0.4px;
    user-select: none; transition: background 0.2s;
}
.detail-collapse-toggle:hover { background: #e8eaf0; }
.detail-collapse-toggle.open { background: #d0eeff; color: #005a8e; border-color: #a8d8f0; }
.detail-collapse-body { margin-bottom: 6px; }

/* DETALLE CLIENTE */
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 18px; }
.detail-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 18px; }
.field-group { display: flex; flex-direction: column; gap: 4px; }
.field-group label { font-size: 11px; color: #57606f; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; }
input[type="text"], input[type="number"], input[type="date"], input[type="email"], select {
    width: 100%; padding: 7px 10px; border: 1px solid #ccc; border-radius: 5px; font-size: 13px; background-color: #f8f9fa;
}
.switch-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.switch-row label { font-size: 11px; color: #57606f; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase; margin-bottom: 0; }

/* REGIONES */
.region-collapse-card { border: 1px solid #dde3ea; border-radius: 7px; margin-bottom: 10px; overflow: hidden; }
.region-header { background: #f1f2f6; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; user-select: none; }
.region-header:hover { background: #e8eaf0; }
.region-header.open { background: #d0eeff; }
.region-header-left { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.region-name { font-weight: 700; font-size: 13px; }
.region-meta { font-size: 12px; color: #555; display: flex; gap: 12px; flex-wrap: wrap; }
.region-meta span { background: #e4e7eb; padding: 2px 8px; border-radius: 4px; }
.region-body { background: #f8f9fa; border-top: 1px solid #dde3ea; padding: 14px; }

/* TABLAS INTERNAS — gris para no confundir con botones azules */
.nested-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.nested-table thead tr { background: #57606f; }
.nested-table th { background-color: #57606f; color: #fff; padding: 7px 9px; font-size: 12px; font-weight: 600; text-align: left; }
.nested-table td { padding: 8px 9px; border-bottom: 1px solid #e4e7eb; vertical-align: middle; }
.nested-table tbody tr:hover { background: #f0f8ff; }

.table-input-number { width: 80px; padding: 4px 7px; border: 1px solid #ccc; border-radius: 4px; font-size: 13px; text-align: center; }
.input-consumo { border: 2px solid #e74c3c !important; background: #fff !important; }

/* ESTADO BADGE */
.badge { padding: 2px 9px; border-radius: 12px; font-size: 11px; font-weight: 700; display: inline-block; }
.badge-enviado { background: #d4f5e2; color: #1a7a45; }
.badge-pendiente { background: #ffecd4; color: #b85c00; }
.badge-region { background: #d0eeff; color: #005a8e; padding: 2px 9px; border-radius: 12px; font-size: 11px; font-weight: 700; }

/* RESUMEN CREDITOS */
.credits-summary { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.credit-chip { background: #f1f2f6; border-radius: 7px; padding: 8px 14px; text-align: center; }
.credit-chip .chip-label { font-size: 10px; color: #777; text-transform: uppercase; letter-spacing: 0.4px; }
.credit-chip .chip-value { font-size: 18px; font-weight: 800; color: #1e2022; }
.credit-chip.chip-disponible .chip-value { color: #1a7a45; }
.credit-chip.chip-consumido .chip-value { color: #c0392b; }

/* BUSCADOR */
.search-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.search-row input { flex: 1; }

/* BOTONES */
.btn { padding: 6px 12px; border: none; border-radius: 5px; cursor: pointer; font-weight: 600; font-size: 12px; transition: opacity 0.15s; }
.btn:hover { opacity: 0.85; }
.btn-blue { background: #00b0ff; color: #fff; }
.btn-red { background: #e74c3c; color: #fff; }
.btn-green { background: #27ae60; color: #fff; }
.btn-yellow { background: #f39c12; color: #fff; }
.btn-grey { background: #747d8c; color: #fff; }
.btn-small { padding: 4px 9px; font-size: 11px; }
.btn-full { width: 100%; }
.btn-margin-top { margin-top: 8px; }
.btn-acceso-enviado { background: #95a5a6; color: #fff; cursor: default; }
.btn-acceso-enviado:hover { opacity: 1; }

.pane-form-box { background: #f8f9fa; border: 1px solid #e4e7eb; padding: 12px; border-radius: 7px; }
.form-title { font-size: 12px; margin-bottom: 8px; color: #57606f; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; }
.inline-fields { display: flex; gap: 8px; }
.inline-fields input, .inline-fields select { flex: 1; min-width: 0; }

.section-header { font-size: 13px; font-weight: 700; color: #2f3542; margin: 16px 0 8px; text-transform: uppercase; letter-spacing: 0.4px; border-bottom: 2px solid #e4e7eb; padding-bottom: 5px; }

/* MODAL */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-box { background: #fff; border-radius: 10px; padding: 28px 32px; min-width: 300px; text-align: center; box-shadow: 0 8px 32px rgba(0,0,0,0.18); }
.modal-box p { font-size: 15px; color: #2f3542; margin-bottom: 4px; }

/* LOADING */
.loading-row td { text-align: center; color: #a4b0be; font-style: italic; padding: 20px; }

/* LOGIN */
#login-screen {
    position: fixed; inset: 0; background: #1e2022;
    display: flex; align-items: center; justify-content: center; z-index: 9999;
}
.login-box {
    background: #fff; border-radius: 14px; padding: 40px 36px;
    width: 320px; text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}
.login-logo { width: 120px; margin-bottom: 16px; }
.login-subtitle { font-size: 10px; color: #a4b0be; letter-spacing: 1px; margin-bottom: 24px; text-transform: uppercase; }
#login-password { width: 100%; padding: 10px 14px; border: 1px solid #ccc; border-radius: 6px; font-size: 14px; text-align: center; letter-spacing: 3px; }

/* NAV SECTION LABELS */
.nav-section-label {
    font-size: 9px; font-weight: 800; letter-spacing: 1.5px;
    color: #a4b0be; text-transform: uppercase;
    padding: 4px 4px 2px; margin-top: 4px;
}

/* TOOLS WORKSPACE */
#tools-workspace { background: #f5f6fa; }

.tool-card {
    background: #fff; border: 1px solid #e4e7eb; border-radius: 10px;
    padding: 28px; max-width: 620px; margin: 0 auto;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.tool-card h2 {
    font-size: 16px; font-weight: 800; text-transform: uppercase;
    letter-spacing: 1px; border-bottom: 3px solid #000;
    padding-bottom: 8px; margin-bottom: 20px; text-align: center;
}
.tool-card textarea {
    width: 100%; padding: 12px; border: 1px solid #ccc;
    border-radius: 6px; font-size: 14px; resize: vertical;
    font-family: 'Segoe UI', sans-serif; background: #f8f9fa;
}
.tool-result-box {
    background: #000; color: #fff; border-radius: 10px;
    padding: 20px; text-align: center; margin-top: 20px;
}
.tool-result-box .result-number { font-size: 48px; font-weight: 800; }
.tool-result-box .result-label { font-size: 14px; opacity: 0.7; margin-top: 4px; }
