/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #FFFFFF;
  --morado: #3F0724;
  --rosa: #FF97FA;
  --verde: #B6F23A;
  --verde-botella: #222A13;
  --texto: #0F0F0F;
  --texto-sec: #6B6B6B;
  --borde: #E5E5E5;
  --borde-light: #F0F0F0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 16px rgba(63,7,36,0.06);
  --shadow-lg: 0 8px 32px rgba(63,7,36,0.12);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --sidebar-w: 250px;
  --transition: 0.2s ease;
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 15px;
  color: var(--texto);
  background: #FAFAFA;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
  font-family: 'Bricolage Grotesque', sans-serif;
  letter-spacing: -0.02em;
}

h1 { font-size: 28px; font-weight: 700; margin-bottom: 1.5rem; color: var(--morado); letter-spacing: -0.03em; }
h2 { font-size: 20px; font-weight: 600; margin-bottom: 1rem; color: var(--texto); }
h3 { font-size: 16px; font-weight: 600; margin: 1.25rem 0 0.5rem; color: var(--texto); }
h4 { font-size: 14px; font-weight: 600; color: var(--texto-sec); }

a { color: var(--morado); text-decoration: none; }
a:hover { color: var(--rosa); }

::selection { background: rgba(182,242,58,0.3); color: var(--verde-botella); }

/* === LOGIN SCREEN === */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(180deg, #FAFAFA 0%, #F0EEF2 50%, #FFFFFF 100%);
}

.login-card {
  background: #FFFFFF;
  border: 1px solid #E8E8E8;
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(63,7,36,0.15), 0 4px 16px rgba(63,7,36,0.08);
}

.login-logo {
  display: block;
  max-width: 180px;
  width: 100%;
  height: auto;
  margin: 0 auto 0.75rem auto;
}

.login-logo img {
  display: block;
  max-width: 180px;
  width: 100%;
  height: auto;
}

.login-subtitle {
  text-align: center;
  color: #999999;
  margin-bottom: 2rem;
  font-size: 13px;
  font-weight: 500;
}

#login-form label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: #666666;
  text-transform: uppercase;
  letter-spacing: 1px;
}

#login-form input {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid #E5E5E5;
  border-radius: 10px;
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  margin-bottom: 1.25rem;
  transition: all var(--transition);
  background: #F8F8F8;
  color: var(--texto);
}

#login-form input::placeholder {
  color: #aaaaaa;
}

#login-form input:focus {
  outline: none;
  border-color: #FF97FA;
  box-shadow: 0 0 0 3px rgba(255,151,250,0.15);
  background: #fff;
}

#login-form .btn-primary {
  width: 100%;
  margin-top: 0.25rem;
  background: linear-gradient(135deg, #3F0724 0%, #6b1040 100%);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  padding: 13px;
  border-radius: 10px;
  letter-spacing: 0.01em;
}

#login-form .btn-primary:hover {
  background: #B6F23A;
  color: #3F0724;
  transform: translateY(-1px);
}

.error-msg {
  background: #FFF0F0;
  color: #CC0000;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 1rem;
  border: 1px solid rgba(204,0,0,0.1);
}

.login-footer {
  text-align: center;
  color: #999999;
  font-size: 12px;
  margin-top: 1.25rem;
  font-weight: 400;
}

/* === LAYOUT PRINCIPAL === */
#app-screen {
  display: flex;
  min-height: 100vh;
}

/* === MOBILE MENU BUTTON === */
.mobile-menu-btn {
  display: none;
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 110;
  background: var(--morado);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  width: 44px;
  height: 44px;
  font-size: 20px;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: transform var(--transition);
}

.mobile-menu-btn:active { transform: scale(0.95); }

/* === SIDEBAR OVERLAY === */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

/* === SIDEBAR — Liquid Glass === */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: #3F0724;
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-right: 1px solid rgba(255,255,255,0.08);
}

.sidebar-header {
  padding: 1.75rem 1.5rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.sidebar-header > div:first-child { flex: 1; }

.sidebar-logo {
  display: block;
  max-width: 135px;
  width: 100%;
  height: auto;
}

.sidebar-subtitle {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  display: block;
  margin-top: 4px;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.sidebar-close {
  display: none;
  background: none;
  border: none;
  color: #FF97FA;
  font-size: 22px;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  line-height: 1;
  opacity: 0.8;
  transition: opacity var(--transition);
}

.sidebar-close:hover { opacity: 1; }

#sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

/* Sidebar sections with subtle separators */
.nav-section {
  padding: 0.5rem 0;
  margin-top: 0;
  border-top: 1px solid rgba(255,255,255,0.04);
}

.nav-section:first-child {
  border-top: none;
  padding-top: 0;
}

.nav-section-title {
  display: block;
  padding: 0.5rem 1.5rem 0.3rem;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.35);
}

.nav-item {
  display: block;
  padding: 0.5rem 1.25rem;
  margin: 1px 0.75rem;
  color: rgba(255,255,255,0.72);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;
  border-left: 3px solid transparent;
  border-radius: 8px;
  text-decoration: none;
}

.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.92);
  border-radius: 8px;
}

.nav-item.active {
  background: rgba(182,242,58,0.15);
  color: #FFFFFF;
  border-left: 3px solid #B6F23A;
  border-radius: 0 8px 8px 0;
  font-weight: 600;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: inset 0 1px 0 rgba(182,242,58,0.3), inset 0 0 20px rgba(182,242,58,0.06);
}

.nav-bottom {
  margin-top: auto;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 0.5rem;
}

.logout-item:hover {
  color: #ff6b6b !important;
  background: rgba(255,107,107,0.1) !important;
  border-radius: 8px !important;
}

/* === MAIN CONTENT === */
#main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  padding: 2.5rem 2.5rem 3rem;
  max-width: 1200px;
  width: 100%;
}

/* === CARDS === */
.card {
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  border: 1px solid var(--borde-light);
  transition: box-shadow var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.form-card {
  padding: 2rem;
}

/* === FORMS === */
.form-group {
  margin-bottom: 1.15rem;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--texto);
  letter-spacing: 0.01em;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--borde);
  border-radius: var(--radius);
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  color: var(--texto);
  background: #FAFAFA;
  transition: all var(--transition);
  -webkit-appearance: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--verde);
  box-shadow: 0 0 0 3px rgba(182,242,58,0.15);
  background: #fff;
}

.form-group input[type="file"] {
  padding: 8px;
  background: transparent;
  border: 1.5px dashed var(--borde);
  cursor: pointer;
}

.form-group input[type="file"]:hover {
  border-color: var(--verde);
  background: rgba(182,242,58,0.04);
}

.form-row {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
}

.form-row .form-group {
  flex: 1;
}

.form-row .form-group.flex-2 {
  flex: 2;
}

.calculated-field {
  padding: 11px 14px;
  background: #F7F7F7;
  border-radius: var(--radius);
  font-size: 20px;
  font-weight: 700;
  font-family: 'Bricolage Grotesque', sans-serif;
  color: var(--morado);
  text-align: right;
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.form-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

/* === BUTTONS === */
.btn-primary {
  background: var(--morado);
  color: #fff;
  border: none;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.01em;
}

.btn-primary:hover {
  background: var(--rosa);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(255,151,250,0.3);
}

.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: transparent;
  color: var(--morado);
  border: 1.5px solid var(--morado);
  padding: 10px 22px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-secondary:hover {
  background: var(--morado);
  color: #fff;
}

.btn-small {
  padding: 6px 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.btn-danger { background: #CC0000; border-color: #CC0000; color: #fff; }
.btn-danger:hover { background: #E50000; border-color: #E50000; }

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  color: var(--texto-sec);
  transition: all var(--transition);
  line-height: 1;
}

.btn-icon:hover { background: #F5F5F5; color: var(--morado); }
.btn-icon.delete:hover { background: #FFF0F0; color: #CC0000; }

.btn-success {
  background: var(--verde-botella);
  color: var(--verde);
  border: none;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
}

.btn-success:hover {
  background: #2A3518;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(182,242,58,0.2);
}

/* === TOOLBAR === */
.toolbar {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  align-items: center;
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 10px 14px;
  border: 1.5px solid var(--borde);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  background: #FAFAFA;
  transition: all var(--transition);
}

.search-input:focus {
  outline: none;
  border-color: var(--verde);
  box-shadow: 0 0 0 3px rgba(182,242,58,0.15);
  background: #fff;
}

/* === TABLES === */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--borde-light);
}

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

thead th {
  background: transparent;
  padding: 12px 14px 10px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #999999;
  border-bottom: 1px solid var(--verde);
  white-space: nowrap;
}

tbody td {
  padding: 12px 14px;
  font-size: 14px;
  border-bottom: 1px solid var(--borde-light);
  color: var(--texto);
}

tbody tr { transition: background var(--transition); cursor: default; }
tbody tr:hover { background: rgba(182,242,58,0.04); }

/* Clickable rows */
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: rgba(182,242,58,0.1); }

.actions-cell {
  display: flex;
  gap: 4px;
  white-space: nowrap;
  opacity: 0.6;
  transition: opacity var(--transition);
}

tr:hover .actions-cell { opacity: 1; }

.empty-state {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--texto-sec);
  font-size: 14px;
}

/* === SUMMARY CARDS === */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
}

.summary-card {
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--borde-light);
  padding: 1.25rem 1.5rem;
  text-align: center;
  min-height: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  transition: all var(--transition);
}

.summary-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(63,7,36,0.12);
  transition: 0.2s ease;
}

.summary-card .card-icon {
  font-size: 24px;
  line-height: 1;
  opacity: 0.8;
}

.summary-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--texto-sec);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  order: 2;
}

.summary-value {
  display: block;
  font-size: 36px;
  font-weight: 800;
  font-family: 'Bricolage Grotesque', sans-serif;
  color: var(--morado);
  letter-spacing: -0.02em;
  line-height: 1.1;
  order: 3;
}

.summary-value.positive { color: var(--verde-botella); }
.summary-value.negative { color: #CC0000; }

/* === WELCOME === */
.welcome {
  margin-bottom: 2rem;
}

.welcome h1 {
  margin-bottom: 0.25rem;
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.welcome-date {
  font-size: 14px;
  color: var(--texto-sec);
  text-transform: capitalize;
  font-weight: 500;
}

/* === QUICK ACTIONS === */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin: 1.75rem 0 2rem;
}

.quick-btn {
  background: linear-gradient(135deg, #3F0724 0%, #5a1035 100%);
  color: #FFFFFF;
  border: none;
  border-radius: var(--radius-lg);
  padding: 1.25rem 1rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Inter', sans-serif;
  transition: 0.2s ease;
}

.quick-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(63,7,36,0.5);
}

.quick-btn:active { transform: translateY(-1px); }

.quick-icon {
  font-size: 28px;
  line-height: 1;
}

.quick-label {
  font-size: 14px;
  font-weight: 600;
}

/* === DETAIL DRAWER === */
.drawer-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.3);
  z-index: 190;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  max-width: 90vw;
  height: 100vh;
  background: #FFFFFF;
  box-shadow: -8px 0 40px rgba(0,0,0,0.15);
  z-index: 195;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 1.75rem;
  border-bottom: 1px solid #F0F0F0;
  flex-shrink: 0;
}

.drawer-title {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #3F0724;
}

.drawer-close {
  background: none;
  border: none;
  font-size: 20px;
  color: #999;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.drawer-close:hover {
  background: #F5F5F5;
  color: #3F0724;
}

.drawer-body {
  padding: 1.5rem 1.75rem;
  flex: 1;
}

.drawer-field {
  margin-bottom: 1rem;
}

.drawer-field-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #999;
  margin-bottom: 0.2rem;
}

.drawer-field-value {
  font-size: 14px;
  color: #0F0F0F;
}

.drawer-field-value strong {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-size: 20px;
}

.drawer-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid #F0F0F0;
}

@media (max-width: 768px) {
  .drawer {
    width: 100vw;
    max-width: 100vw;
  }
}

/* === MODAL === */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.modal-card {
  background: var(--bg);
  border-radius: var(--radius-xl);
  padding: 2rem;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

.modal-card p {
  margin-bottom: 1.5rem;
  font-size: 15px;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* === CONFIRMATION SCREEN === */
.confirmation-screen {
  text-align: center;
  padding: 2rem 0;
}

.confirmation-screen .check-icon {
  font-size: 56px;
  display: block;
  margin-bottom: 1rem;
}

.confirmation-screen h2 {
  color: var(--verde-botella);
  margin-bottom: 0.5rem;
}

.confirmation-screen .conf-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 2rem;
}

/* === UPLOAD AREA === */
.upload-area {
  border: 2px dashed var(--borde);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  text-align: center;
  transition: all var(--transition);
  cursor: pointer;
  background: #FAFAFA;
}

.upload-area:hover {
  border-color: var(--verde);
  background: rgba(182,242,58,0.04);
}

.upload-area.dragging {
  border-color: var(--verde);
  background: rgba(182,242,58,0.08);
}

.upload-icon {
  font-size: 32px;
  display: block;
  margin-bottom: 0.5rem;
}

.upload-text {
  font-size: 14px;
  color: var(--texto-sec);
  font-weight: 500;
}

.upload-hint {
  font-size: 12px;
  color: var(--texto-sec);
  margin-top: 0.5rem;
  opacity: 0.7;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2.5px solid var(--borde);
  border-top-color: var(--morado);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.spinner-text {
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  color: var(--texto-sec);
  padding: 0.75rem;
}

/* === STATUS BADGES === */
.estado-badge {
  border: 1px solid transparent;
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all var(--transition);
  letter-spacing: 0.01em;
  background: transparent;
}

.estado-badge:hover { transform: scale(1.04); }
.estado-badge.pendiente {
  background: rgba(245,158,11,0.1);
  color: #d97706;
  border-color: rgba(245,158,11,0.2);
}
.estado-badge.cobrada {
  background: rgba(34,197,94,0.1);
  color: #16a34a;
  border-color: rgba(34,197,94,0.2);
}
.estado-badge.parcial {
  background: rgba(59,130,246,0.1);
  color: #2563eb;
  border-color: rgba(59,130,246,0.2);
}

/* === MARGIN COLORS === */
.margen-positivo { color: var(--verde-botella); font-weight: 600; }
.margen-negativo { color: #CC0000; font-weight: 600; }

/* === TRIMESTRES === */
.trim-card {
  background: var(--bg);
  border: 1px solid var(--borde-light);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
  transition: all var(--transition);
}

.trim-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.trim-card.accent-green { border-left: 3px solid var(--verde); }
.trim-card.accent-pink { border-left: 3px solid var(--rosa); }
.trim-card.accent-stress { border-left: 3px solid #FF9800; }

.trim-label {
  display: block;
  font-size: 11px;
  color: var(--texto-sec);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.trim-value {
  font-size: 24px;
  font-weight: 800;
  font-family: 'Bricolage Grotesque', sans-serif;
  color: var(--texto);
  white-space: nowrap;
  letter-spacing: -0.02em;
}

/* === ATTACHMENT ICON === */
.attach-icon {
  cursor: pointer;
  font-size: 16px;
  color: var(--texto-sec);
  transition: color var(--transition);
}

.attach-icon:hover {
  color: var(--morado);
}

.attach-icon.has-file {
  color: var(--verde-botella);
}

.attach-icon.has-file:hover {
  color: var(--verde);
}

/* === PRINT IFrame === */
.factura-iframe-container {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #fff;
  z-index: 300;
}

.factura-iframe-container iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.factura-iframe-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 310;
  background: var(--morado);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--transition);
}

.factura-iframe-close:hover { background: var(--rosa); }

.factura-iframe-print {
  position: absolute;
  top: 1rem;
  right: 7rem;
  z-index: 310;
  background: var(--verde);
  color: var(--verde-botella);
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  transition: all var(--transition);
}

.factura-iframe-print:hover { background: #C8FF4A; }

/* === TYPE SELECTOR (gasto) === */
.type-selector {
  display: flex;
  gap: 0;
  background: #F5F5F5;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1.5px solid var(--borde);
}

.type-option {
  flex: 1;
  padding: 10px 16px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: transparent;
  font-family: 'Inter', sans-serif;
  color: var(--texto-sec);
  transition: all var(--transition);
}

.type-option.active {
  background: var(--morado);
  color: #fff;
}

.type-option:not(.active):hover {
  background: rgba(63,7,36,0.05);
  color: var(--morado);
}

.type-option:first-child { border-right: 1.5px solid var(--borde); }

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .mobile-menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar-overlay {
    display: block;
  }

  .sidebar-close {
    display: block;
  }

  #sidebar {
    transform: translateX(-100%);
    box-shadow: 4px 0 20px rgba(0,0,0,0.3);
    background: #3F0724;
  }

  #sidebar.open {
    transform: translateX(0);
  }

  #main-content {
    margin-left: 0;
    padding: 3.5rem 1rem 1.5rem 1rem;
  }

  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .cards-grid {
    grid-template-columns: 1fr 1fr;
  }

  .summary-value {
    font-size: 26px;
  }

  table { font-size: 12px; }
  thead th, tbody td { padding: 10px 8px; }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .form-card {
    padding: 1.25rem;
  }

  .form-card input, .form-card select, .form-card textarea {
    font-size: 16px; /* evita zoom en iOS */
    max-width: 100%;
  }

  .login-card {
    padding: 2rem 1.5rem;
    margin: 0 1rem;
  }

  .login-logo {
    max-width: 150px;
  }

  .sidebar-logo {
    max-width: 110px;
  }

  .quick-actions {
    grid-template-columns: 1fr 1fr;
  }

  .confirmation-screen .conf-actions {
    flex-direction: column;
  }

  .type-selector {
    flex-direction: column;
  }

  .type-option:first-child {
    border-right: none;
    border-bottom: 1.5px solid var(--borde);
  }
}

/* Print: ocultar todo excepto la factura */
@media print {
  #sidebar, .toolbar, .form-actions, .btn-icon, nav, .sidebar-toggle-mobile, #main-content > h1 {
    display: none !important;
  }
  #main-content {
    margin: 0 !important;
    padding: 0 !important;
  }
}
