/* Estilos de la aplicación (procesar, historial, logos, cuenta). Requiere theme.css. */

.app { padding: clamp(2rem, 5vw, 3.5rem) 0 4rem; }
.app__head { max-width: 640px; margin-bottom: 2rem; }
.app__head h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
.app__head p { font-size: 1.05rem; }

.app__grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 1.5rem; align-items: start; }
.app__grid--narrow { grid-template-columns: 1fr; max-width: 720px; }

.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: clamp(1.3rem, 3vw, 2rem); }
.panel + .panel { margin-top: 1.5rem; }
.panel__title { font-size: 1.3rem; font-weight: 700; margin-bottom: 1.2rem; }
.panel--auth { max-width: 440px; margin: 0 auto; }

.btn--google {
  background: #fff; color: var(--ink); border-color: var(--line);
  box-shadow: var(--shadow-sm);
}
.btn--google:hover { background: var(--bg-alt); color: var(--ink); transform: translateY(-1px); }

.separador {
  display: flex; align-items: center; gap: .8rem;
  margin: 1.3rem 0; color: var(--ink-muted); font-size: .85rem;
}
.separador::before, .separador::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}

.aside { display: grid; gap: 1.2rem; position: sticky; top: 90px; }
.aside__card { background: var(--bg-alt); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; }
.aside__card h2 { font-size: 1.05rem; font-weight: 650; margin-bottom: .6rem; }
.aside__card p { font-size: .92rem; margin-bottom: 0; }
.aside__card .checks { margin-top: .9rem; flex-direction: column; gap: .5rem; }
.aside__card .checks li { font-size: .9rem; }

/* Formularios */
.field { margin-bottom: 1.1rem; }
.field > label, .form label { display: block; margin-bottom: .35rem; font-size: .92rem; font-weight: 600; color: var(--ink); }
.field__help { margin: .35rem 0 0; font-size: .84rem; line-height: 1.5; color: var(--ink-muted); }
.field__help ul, .field__help ol { margin: .2rem 0 0; padding-left: 1.1rem; }
.field__help li { margin-bottom: .2rem; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="file"], select, textarea {
  width: 100%; padding: .65rem .8rem; font-family: inherit; font-size: .95rem;
  color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 12px;
  transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: #cfd5e6; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(47, 91, 255, .14);
}
input[type="file"] { padding: .55rem .6rem; background: var(--bg-alt); cursor: pointer; }
input[type="file"]::file-selector-button {
  margin-right: .8rem; padding: .45rem .8rem; font-family: inherit; font-weight: 600; font-size: .85rem;
  color: var(--brand-dark); background: var(--brand-soft);
  border: 1px solid #dfe5ff; border-radius: 9px; cursor: pointer;
}
input[type="file"]::file-selector-button:hover { background: #e3e9ff; }

.field--check { display: flex; align-items: center; gap: .6rem; }
.field--check label { margin: 0; font-weight: 500; color: var(--ink-soft); }
input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--brand); flex: none; }

.errorlist { list-style: none; margin: .4rem 0 0; padding: 0; color: var(--danger); font-size: .86rem; }
.form__errors { margin-bottom: 1rem; }

/* Mensajes */
.messages { list-style: none; margin: 0 0 1.5rem; padding: 0; display: grid; gap: .6rem; }
.messages li {
  padding: .8rem 1rem; border-radius: 12px; font-size: .93rem;
  background: var(--brand-soft); color: var(--ink); border: 1px solid #dfe5ff;
}
.messages li.success { background: #e9faf3; border-color: #b9ecd8; color: #04664a; }
.messages li.error { background: #fdf2f1; border-color: #f5cdc8; color: #b42318; }
.messages li.warning { background: #fff8e8; border-color: #f6e0ae; color: #93610b; }

/* Tablas */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .93rem; }
.table th {
  text-align: left; padding: .7rem .6rem; color: var(--ink-muted);
  font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
.table td { padding: .85rem .6rem; border-bottom: 1px solid var(--line); color: var(--ink-soft); }
.table tbody tr:hover { background: var(--bg-alt); }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; white-space: nowrap; }

.dl { display: grid; grid-template-columns: minmax(9rem, auto) 1fr; gap: .1rem 1.5rem; margin: 0; }
.dl dt { padding: .7rem 0; color: var(--ink-muted); font-size: .88rem; border-bottom: 1px solid var(--line); }
.dl dd { padding: .7rem 0; margin: 0; color: var(--ink); border-bottom: 1px solid var(--line); }
.dl > *:nth-last-child(-n+2) { border-bottom: 0; }

/* KPIs del historial */
.kpi-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.kpi-box { background: var(--bg-alt); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.kpi-box span { display: block; font-size: .84rem; color: var(--ink-muted); }
.kpi-box strong { display: block; font-size: 1.6rem; font-weight: 750; letter-spacing: -.02em; }
.kpi-box .up { color: #059669; font-weight: 600; }
.kpi-box .down { color: var(--danger); font-weight: 600; }

.aviso {
  padding: .9rem 1.1rem; margin-bottom: 1.5rem;
  background: #fff8e8; border: 1px solid #f6e0ae; border-radius: 12px;
  color: #93610b; font-size: .93rem;
}

/* Gráfico de facturación mensual */
.grafico { display: flex; align-items: flex-end; gap: 1rem; min-height: 200px; }
.grafico__col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .35rem; }
.grafico__barra {
  width: 100%; max-width: 74px; height: calc(var(--h) * 1.7px); min-height: 4px;
  border-radius: 10px 10px 4px 4px;
  background: linear-gradient(180deg, var(--brand), #7b5bff);
  order: 2;
}
.grafico__monto { order: 1; font-size: .82rem; font-weight: 650; color: var(--ink); }
.grafico__mes { order: 3; font-size: .82rem; color: var(--ink); text-transform: capitalize; }
.grafico__cantidad { order: 4; font-size: .75rem; color: var(--ink-muted); }

/* Estados */
.badge {
  display: inline-block; padding: .2rem .6rem; border-radius: 999px;
  font-size: .78rem; font-weight: 600; background: var(--bg-alt); color: var(--ink-soft);
}
.badge--ok { background: rgba(0, 196, 140, .14); color: #04664a; }
.badge--error { background: #fdf2f1; color: #b42318; }

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--ink-muted); }
.empty p { margin-bottom: 1.2rem; }

/* Galería de logos */
.logo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 1.2rem; }
.logo-item { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.logo-item__img { display: grid; place-items: center; height: 130px; padding: 1rem; background: var(--bg-alt); }
.logo-item__img img { max-height: 100%; object-fit: contain; }
.logo-item__body { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .8rem .9rem; }
.logo-item__body strong { font-size: .93rem; }

.actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.5rem; }
.breadcrumb { margin-bottom: 1rem; font-size: .88rem; color: var(--ink-muted); }
.breadcrumb a { color: var(--ink-muted); }
.breadcrumb a:hover { color: var(--brand-dark); }

/* Páginas legales */
.legal { max-width: 760px; margin: 0 auto; }
.legal h1 { font-size: clamp(1.9rem, 4vw, 2.4rem); margin-bottom: .3rem; }
.legal h2 { font-size: 1.25rem; font-weight: 700; margin: 2.2rem 0 .6rem; }
.legal h3 { font-size: 1.02rem; margin: 1.4rem 0 .4rem; }
.legal ul { padding-left: 1.2rem; color: var(--ink-soft); }
.legal li { margin-bottom: .4rem; }

/* Aclaración de que el servicio no es ARCA */
.disclaimer {
  margin-top: 1.2rem; padding: .8rem 1rem;
  background: var(--bg-alt); border: 1px solid var(--line); border-radius: 12px;
  font-size: .86rem; color: var(--ink-muted);
}

@media (max-width: 960px) {
  .app__grid { grid-template-columns: 1fr; }
  .aside { position: static; }
}

@media (max-width: 560px) {
  .kpi-row { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; }
  .dl dt { padding-bottom: 0; border-bottom: 0; }
  .actions .btn { width: 100%; }
}
