/*
 * Tema del sistema interno de Ohana, alineado con la landing pública.
 * Se carga DESPUÉS de /app.css y solo pisa estilos: no cambia el funcionamiento.
 * Para volver al diseño anterior alcanza con quitar el <link> a este archivo en sistema/index.html.
 */

:root {
  --bg: #F4FBF9;
  --bg-soft: #E9F7F4;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --line: rgba(82, 160, 100, 0.16);
  --text: #184640;
  --muted: #557A73;
  --primary: #D76A31;          /* acción principal: el naranja de la landing */
  --primary-strong: #C25E2B;
  --primary-deep: #2C8074;     /* etiquetas y detalles */
  --green: #52A064;
  --accent: #D76A31;
  --accent-deep: #B8561F;
  --danger: #C0392B;
  --success: #2E8B57;
  --shadow: 0 1px 2px rgba(24, 70, 64, 0.04), 0 12px 32px -12px rgba(24, 70, 64, 0.14);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --font: "Plus Jakarta Sans", ui-sans-serif, system-ui, sans-serif;
  --font-heading: "Lora", ui-serif, Georgia, serif;
}

body {
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(28rem 28rem at 100% -4rem, rgba(123, 210, 197, 0.22), transparent 70%),
    radial-gradient(24rem 24rem at -6rem 16rem, rgba(82, 160, 100, 0.10), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
:focus-visible { outline: 3px solid rgba(215, 106, 49, 0.45); outline-offset: 2px; }

/* Vidrio esmerilado fuera: tarjetas blancas limpias como en la landing */
.public-header, .app-header, .panel, .hero-panel, .feature-card, .module-shell, .glass-card,
.login-card, .card, .data-card, .document-card, .metric-card, .empty-state, .form-shell, .tabs {
  backdrop-filter: none;
}

/* ── Títulos ─────────────────────────────────────────── */
.public-header h1, .app-header h2, .hero-copy h1, .hero-copy h2, .panel h2, .module-shell h2,
.module-shell h3, .card-title-row h3, .data-card h3, .document-card h3, .metric-card h3,
.feature-card h3, .modal-header h3 {
  font-family: var(--font-heading);
  font-weight: 500;
  color: var(--text);
  letter-spacing: 0;
}
.module-shell h2 { font-size: clamp(1.6rem, 2.4vw, 2rem); line-height: 1.15; }
.module-shell h3, .card-title-row h3, .data-card h3 { font-size: 1.2rem; line-height: 1.3; }
.brand-kicker, .section-kicker, .stat-label {
  font-family: var(--font);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .18em;
  color: var(--primary-deep);
}

/* ── Encabezado: barra compacta como la del sitio ─────── */
.site-shell, .app-shell { width: min(calc(100% - 32px), 1152px); margin: 0 auto 32px; }
.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  margin: 0 -16px;
  padding: 10px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: rgba(244, 251, 249, 0.9);
  backdrop-filter: blur(12px);
  box-shadow: none;
}
.app-header .logo-ohana {
  height: 56px;
  width: auto;
  max-width: none;
  margin: 0;
  mix-blend-mode: normal;
  filter: none;
}
.app-top-actions { gap: 10px; align-items: center; }

/* ── Pestañas ─────────────────────────────────────────── */
.tabs {
  margin-top: 20px;
  padding: 6px;
  gap: 4px;
  background: #ffffff;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.tab-button {
  padding: 10px 16px;
  font-weight: 600;
  font-size: .95rem;
  color: rgba(24, 70, 64, 0.72);
  transition: color .18s ease, background-color .18s ease;
}
.tab-button:hover { color: var(--primary); }
.tab-button.active,
.tab-button.active:hover {
  background: #184640;
  color: #ffffff;
  box-shadow: none;
}
.tab-button-utility { background: transparent; border-color: var(--line); }

/* Computadora: todas las pestañas a la vista (antes se cortaban a la derecha sin aviso).
   Si no entran en una fila, pasan a una segunda; la Papelera queda aparte, al final. */
@media (min-width: 761px) {
  .tabs {
    flex-wrap: wrap;
    overflow: visible;
    border-radius: 22px;
    row-gap: 4px;
  }
  .tab-button { padding: 9px 13px; font-size: .92rem; }
  .tab-button-utility { margin-left: auto; }
}

/* Celular: la barra se desliza; un desvanecido en el borde avisa que hay más pestañas */
@media (max-width: 760px) {
  .tabs {
    -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 44px), transparent 100%);
            mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 44px), transparent 100%);
    padding-right: 40px;
    scroll-padding-inline: 12px;
  }
}

/* ── Botones: mismas formas que la landing ────────────── */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  font-weight: 600;
  border-radius: 999px;
  box-shadow: none;
}
.button:hover { transform: translateY(-1px); }
.button.primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 10px 20px -8px rgba(215, 106, 49, 0.45);
}
.button.primary:hover { background: var(--primary-strong); }
.button.ghost {
  background: #ffffff;
  color: var(--text);
  border: 2px solid rgba(82, 160, 100, 0.25);
}
.button.ghost:hover { border-color: var(--green); background: var(--bg); }
.button.secondary {
  background: rgba(82, 160, 100, 0.12);
  color: #1F5E36;
}
.button.secondary:hover { background: rgba(82, 160, 100, 0.2); }
.button.orange {
  background: rgba(215, 106, 49, 0.12);
  color: #8A3F14;
}
/* Acciones destructivas: discretas, no un botón rojo lleno */
.button.danger {
  background: transparent;
  color: var(--danger);
  border: 2px solid rgba(192, 57, 43, 0.22);
}
.button.danger:hover { background: rgba(192, 57, 43, 0.07); border-color: rgba(192, 57, 43, 0.45); }
.button.small { padding: 8px 14px; font-size: .88rem; }

/* ── Tarjetas y módulos ───────────────────────────────── */
.app-main, .public-main { margin-top: 20px; gap: 20px; }
.glass-card, .feature-card, .panel, .module-shell, .empty-state, .card, .data-card,
.document-card, .metric-card, .hero-panel {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.module-shell { padding: clamp(18px, 3vw, 32px); background: rgba(255, 255, 255, 0.72); }
.module-shell .data-card, .module-shell .card, .module-shell .panel, .module-shell .metric-card,
.module-shell .document-card {
  background: #ffffff;
  transition: box-shadow .2s ease, transform .2s ease;
}
.module-shell .data-card:hover, .module-shell .card:hover { box-shadow: 0 16px 36px -14px rgba(24, 70, 64, 0.22); }
.module-header { margin-bottom: 22px; align-items: center; }

.metric-card { padding: 20px 22px; }
.metric-card h3 { font-size: 1.05rem; }
.metric-card strong {
  font-family: var(--font-heading);
  font-weight: 500;
  font-size: clamp(2rem, 3.4vw, 2.75rem);
  line-height: 1;
  color: var(--text);
}
.metric-card p { color: var(--muted); }

/* ── Etiquetas de estado ──────────────────────────────── */
.badge { padding: 5px 12px; font-weight: 600; font-size: .8rem; background: rgba(82, 160, 100, 0.12); color: #1F5E36; }
.badge.warn { background: rgba(215, 106, 49, 0.12); color: #8A3F14; }
.badge.danger { background: rgba(192, 57, 43, 0.1); color: #922B21; }
.badge.ok { background: rgba(46, 139, 87, 0.12); color: #1D6B43; }

/* ── Formularios ──────────────────────────────────────── */
.input, .textarea, .select {
  border-radius: 14px;
  border: 1.5px solid rgba(82, 160, 100, 0.22);
  background: #ffffff;
  padding: 12px 14px;
}
.input:hover, .textarea:hover, .select:hover { border-color: rgba(82, 160, 100, 0.4); }
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--primary-deep);
  box-shadow: 0 0 0 4px rgba(44, 128, 116, 0.14);
}
.field label { font-weight: 600; font-size: .9rem; color: var(--text); }
.details-panel { background: var(--bg); border-color: var(--line); }

/* ── Ventanas (modales) ───────────────────────────────── */
.overlay { background: rgba(24, 70, 64, 0.38); backdrop-filter: blur(3px); }
.modal {
  border-radius: 24px;
  border: 1px solid var(--line);
  background: #ffffff;
  box-shadow: 0 30px 80px -20px rgba(24, 70, 64, 0.4);
}
.modal-header { border-bottom: 1px solid var(--line); }
.modal-header h3 { font-size: 1.35rem; }
.icon-button {
  border: 2px solid rgba(82, 160, 100, 0.2);
  background: #ffffff;
  color: var(--text);
}
.icon-button:hover { border-color: var(--green); }
/* La cruz de cerrar: se dibuja con dos líneas en vez de usar el carácter «×»,
   que en esta tipografía queda más abajo del centro del círculo. */
.icon-button {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 0;
  color: transparent;
}
.icon-button::before,
.icon-button::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 15px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  transform: translate(-50%, -50%) rotate(45deg);
}
.icon-button::after { transform: translate(-50%, -50%) rotate(-45deg); }
.icon-button:hover::before, .icon-button:hover::after { background: var(--primary); }

/* ── Avisos ───────────────────────────────────────────── */
.notice { border-radius: 16px; box-shadow: var(--shadow); background: #ffffff; }

/* ── Pantalla de ingreso ──────────────────────────────── */
.hero-panel {
  grid-template-columns: 1fr;
  max-width: 560px;
  margin: clamp(32px, 10vh, 96px) auto 0;
  padding: clamp(28px, 5vw, 48px);
  text-align: center;
}
.hero-copy { justify-items: center; gap: 14px; }
.hero-copy .logo-ohana { height: 120px; margin: 0 auto 8px; mix-blend-mode: normal; }
.hero-copy h1 { font-size: clamp(2rem, 4vw, 2.6rem); margin: 0; line-height: 1.1; }
.hero-actions { justify-content: center; }
.back-to-site {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 6px; font-size: .95rem; font-weight: 600;
  color: var(--primary-deep); text-decoration: none;
}
.back-to-site:hover { color: var(--primary); }

/* ── Celular ──────────────────────────────────────────── */
@media (max-width: 760px) {
  .app-shell { width: min(calc(100% - 24px), 1152px); margin-top: 0; }
  .app-header {
    flex-direction: row; align-items: center; justify-content: space-between; gap: 12px;
    margin: 0 -12px; padding: 8px 12px; border-radius: 0;
  }
  .app-brand { width: auto; justify-content: flex-start; flex: 0 0 auto; }
  .app-header .logo-ohana { height: 48px; max-width: none; margin: 0; }
  .app-top-actions { width: auto; display: flex; flex-wrap: nowrap; gap: 8px; margin: 0; }
  .app-top-actions .button { width: auto; min-height: 0; padding: 8px 14px; font-size: .88rem; white-space: nowrap; }
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .metric-card { padding: 16px; }
  .metric-card h3 { font-size: .98rem; }
  .metric-card p { font-size: .86rem; }
  .tabs { border-radius: 999px; }
  .tab-button { padding: 9px 14px; font-size: .92rem; }
}

@media (prefers-reduced-motion: reduce) {
  .button, .button:hover, .module-shell, .module-shell .data-card { transition: none; transform: none; animation: none; }
}
