/* Prototipo visual del dashboard de Facturas — sin conexión.
   Marca: #0C493C, #D8F0E5 y blanco. Sin frameworks ni recursos externos. */

:root {
  --forest: #0C493C;
  --forest-strong: #08372D;
  --mint: #D8F0E5;
  --mint-soft: #EFF8F3;
  --white: #FFFFFF;
  --bg: #F5F8F6;
  --text: #111816;
  --text-2: #586561;
  --border: #E8ECE9;
  --border-strong: #D5DDD8;
  --warn-bg: #FFF6E5;
  --warn-border: #E8C77A;
  --warn-text: #6B4A00;
  --ok-bg: #E7F5EE;
  --ok-text: #134F3E;
  --danger-bg: #FBEDED;
  --danger-text: #8C2F2F;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(17, 24, 22, 0.04);
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-title: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .font-title {
  font-family: var(--font-title);
  line-height: 1.22;
  letter-spacing: -0.015em;
  text-wrap: balance;
  margin: 0 0 0.5rem;
}

p, .view__lead, .hint, li {
  text-wrap: pretty;
}

p {
  margin: 0 0 0.75rem;
}

a {
  color: var(--forest);
}

:focus-visible {
  outline: 3px solid var(--forest);
  outline-offset: 2px;
  border-radius: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 10;
  padding: 10px 14px;
  background: var(--forest);
  color: var(--white);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
}

.skip-link:focus {
  top: 0;
}

/* Aviso global del prototipo */
.proto-banner {
  background: var(--mint);
  border-bottom: 1px solid var(--border-strong);
  color: var(--forest);
  padding: 10px 20px;
  font-size: 0.86rem;
}

.proto-banner p {
  margin: 0;
  max-width: 1100px;
  margin-inline: auto;
}

.proto-banner em {
  font-style: normal;
  font-weight: 700;
}

/* Cabecera de marca */
.app-header {
  background: var(--forest);
  color: var(--white);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.app-header__brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.app-header__brand img {
  height: 34px;
  width: auto;
  display: block;
}

.app-header__divider {
  width: 1px;
  height: 26px;
  background: rgba(255, 255, 255, 0.35);
}

.app-header__product {
  font-family: var(--font-title);
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Estructura */
.shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

/* Navegador del prototipo: deliberadamente fuera del producto */
.navigator {
  position: sticky;
  top: 16px;
  background: var(--white);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 16px;
}

.navigator__eyebrow {
  margin: 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--text-2);
}

.navigator__title {
  margin: 2px 0 10px;
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.02rem;
}

.navigator__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.navigator__list a {
  display: block;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  border: 1px solid transparent;
}

.navigator__list a:hover {
  background: var(--mint-soft);
}

.navigator__list a[aria-current="page"] {
  background: var(--forest);
  color: var(--white);
  font-weight: 600;
}

.navigator__note {
  margin: 12px 0 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--text-2);
}

.content {
  min-width: 0;
}

/* Vistas */
.view__kicker {
  margin: 0 0 4px;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--forest);
}

.view__title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin-bottom: 8px;
}

.view__lead {
  color: var(--text-2);
  max-width: 70ch;
  margin-bottom: 20px;
}

.card {
  background: var(--white);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}

.card + .card {
  margin-top: 20px;
}

.card__title {
  font-size: 1.22rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  margin-bottom: 12px;
}

/* Pasos */
.steps {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  padding: 0;
  margin: 0 0 18px;
}

.steps__item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: var(--text-2);
}

.steps__dot {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.76rem;
  font-weight: 700;
  background: var(--white);
}

.steps__item.is-current {
  color: var(--forest);
  font-weight: 700;
}

.steps__item.is-current .steps__dot {
  background: var(--forest);
  border-color: var(--forest);
  color: var(--white);
}

.steps__item.is-done {
  color: var(--ok-text);
}

.steps__item.is-done .steps__dot {
  background: var(--mint);
  border-color: var(--forest);
  color: var(--forest);
}

/* Campos y acciones */
.field {
  margin-bottom: 14px;
}

.field label {
  display: block;
  font-weight: 600;
  font-size: 0.88rem;
  margin-bottom: 6px;
}

.field input,
.field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--white);
  color: var(--text);
}

.field input[type="file"] {
  padding: 8px 10px;
  cursor: pointer;
}

.field .hint {
  margin: 5px 0 0;
}

.field--inline {
  margin-bottom: 0;
  min-width: 180px;
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.actions--wrap {
  margin-top: 14px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
}

.btn--primary {
  background: var(--forest);
  color: var(--white);
}

.btn--primary:hover {
  background: var(--forest-strong);
}

.btn--secondary {
  background: var(--mint);
  color: var(--forest);
  border-color: var(--mint);
}

.btn--secondary:hover {
  background: #CDEADD;
}

.btn--ghost {
  background: var(--white);
  color: var(--text);
  border-color: var(--border-strong);
}

.btn--ghost:hover {
  background: var(--bg);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 6px;
  border: 0;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.tag--sim {
  background: var(--warn-bg);
  color: var(--warn-text);
}

.tag--on-dark {
  background: rgba(255, 255, 255, 0.16);
  color: var(--white);
}

.tag--ok {
  background: var(--ok-bg);
  color: var(--ok-text);
}

.tag--muted {
  background: var(--bg);
  color: var(--text-2);
}

.tag--danger {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.tag--warn {
  background: var(--warn-bg);
  color: var(--warn-text);
}

.hint {
  font-size: 0.84rem;
  line-height: 1.45;
  color: var(--text-2);
}

.status {
  margin: 12px 0 0;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--forest);
  min-height: 1.2em;
}

.status--danger,
.text-danger {
  color: var(--danger-text);
}

/* Subpaneles planos dentro de tarjetas (sin bordes anidados competitivos) */
.subpanel {
  margin-top: 16px;
  padding: 16px 0 0;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
}

.subpanel--ok {
  padding: 14px 16px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--ok-bg);
}

.subpanel--warn {
  padding: 14px 16px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--warn-bg);
}

.subpanel + .subpanel,
.card form + .subpanel {
  margin-top: 16px;
}

.subpanel__title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

/* Avisos y listas */
.notice {
  margin-top: 16px;
  padding: 14px 16px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--mint-soft);
}

.notice--inline {
  margin-top: 14px;
  margin-bottom: 16px;
}

.notice__title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.list {
  margin: 0;
  padding-left: 20px;
}

.list--tight {
  margin: 0;
}

.list li {
  margin-bottom: 4px;
}

/* Espaciado semántico de formularios y bloques para evitar estilos inline */
#registro-verify-form,
#personal-alta-form,
#suscripcion-form,
#fiscal-upload-form {
  margin-top: 16px;
}

#fiscal-version-box {
  margin-top: 8px;
  margin-bottom: 12px;
}

#fiscal-upload-result {
  margin-top: 16px;
}

#fiscal-upload-result > .hint:last-child {
  margin-top: 8px;
  margin-bottom: 0;
}

#sunat-api-panel {
  margin-top: 20px;
}

#fiscal-auth-gate .btn {
  margin-left: 8px;
}

/* Línea de tiempo */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}

.timeline__item {
  display: flex;
  gap: 12px;
  padding-bottom: 16px;
  border-left: 2px solid var(--border);
  margin-left: 7px;
  padding-left: 18px;
  position: relative;
}

.timeline__item:last-child {
  border-left-color: transparent;
  padding-bottom: 0;
}

.timeline__marker {
  position: absolute;
  left: -7px;
  top: 4px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--border-strong);
  border: 2px solid var(--white);
}

.timeline__item.is-done .timeline__marker {
  background: var(--forest);
}

.timeline__item.is-current .timeline__marker {
  background: var(--warn-border);
}

.timeline__title {
  font-weight: 700;
  margin: 0;
}

.timeline__text {
  margin: 0;
  font-size: 0.86rem;
  color: var(--text-2);
}

/* Filtros */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
  margin-bottom: 16px;
}

/* Tablas */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  font-size: 0.88rem;
}

.table th,
.table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table thead th {
  background: var(--bg);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-2);
}

.table tbody tr:last-child td {
  border-bottom: 0;
}

.table .num {
  font-family: var(--font-mono);
  white-space: nowrap;
}

.empty {
  color: var(--text-2);
  text-align: center;
  padding: 26px 14px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.btn--small {
  padding: 6px 10px;
  font-size: 0.8rem;
  border-radius: 6px;
}

/* Plan y Yape */
.plan {
  background: var(--forest);
  color: var(--white);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
}

.plan__head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  align-items: flex-start;
}

.plan__name {
  font-family: var(--font-title);
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0;
}

.plan__desc {
  margin: 2px 0 0;
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
}

.plan__price {
  margin: 0;
  font-size: 0.9rem;
  text-align: right;
}

.plan__price span:first-child {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 700;
}

.plan__currency {
  display: block;
  font-size: 0.76rem;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.75);
}

.plan__state {
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 0.9rem;
}

.yape {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.qr-placeholder {
  width: 180px;
  min-height: 180px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-2);
  font-size: 0.82rem;
  text-align: center;
  padding: 12px;
  background: var(--bg);
}

.qr-placeholder__box {
  width: 74px;
  height: 74px;
  border: 2px solid var(--border-strong);
  border-radius: 6px;
  background:
    linear-gradient(var(--border-strong), var(--border-strong)) 8px 8px / 14px 14px no-repeat,
    linear-gradient(var(--border-strong), var(--border-strong)) calc(100% - 22px) 8px / 14px 14px no-repeat,
    linear-gradient(var(--border-strong), var(--border-strong)) 8px calc(100% - 22px) / 14px 14px no-repeat;
}

.yape__info p {
  margin: 0 0 6px;
}

/* Pie */
.app-footer {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px 20px 34px;
  border-top: 1px solid var(--border);
  color: var(--text-2);
  font-size: 0.84rem;
}

.card__header-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.card__header-flex .card__title {
  margin: 0;
}

/* Video de Onboarding Fiscal */
.card--video {
  background: var(--white);
}

.video-container {
  margin: 16px 0 12px;
}

.video-player-box {
  background: #000000;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.video-player {
  display: block;
  width: 100%;
  max-height: 480px;
  background: #000000;
  outline: none;
}

.video-tracks-info {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--bg);
  border-top: 1px solid var(--border);
  font-size: 0.84rem;
}

.video-empty-state {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: var(--mint-soft);
  border: 0;
  border-radius: var(--radius-sm);
  padding: 20px;
}

.video-empty-state__icon {
  color: var(--forest);
  flex-shrink: 0;
  padding-top: 2px;
}

.video-empty-state__body {
  min-width: 0;
  flex: 1;
}

.video-empty-state__title {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--forest-strong);
  margin: 0 0 6px;
}

.video-empty-state__msg {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 0.92rem;
}

.video-empty-state__note {
  margin: 0 0 12px;
  font-size: 0.88rem;
  color: var(--text-2);
}

.video-empty-state__actions {
  margin-top: 8px;
}

.video-disclaimer {
  font-size: 0.84rem;
  color: var(--text-2);
  margin-top: 14px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}

.btn--sm {
  padding: 6px 12px;
  font-size: 0.85rem;
  border-radius: 6px;
}

/* Ejemplo práctico ilustrativo con datos ficticios */
.card--example {
  background: #FAFCFB;
}

.example-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px 24px;
  margin: 16px 0;
}

.example-box {
  background: transparent;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
  padding: 12px 0 4px;
}

.example-box__title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--forest);
  margin: 0 0 6px;
  font-family: var(--font-title);
}

.example-handles-box {
  background: transparent;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
  padding: 12px 0 4px;
  margin-top: 12px;
}

.code-preview {
  background: #111816;
  color: #7ce7b4;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  overflow-x: auto;
  margin-top: 8px;
}

.code-preview code {
  color: inherit;
  background: transparent;
  font-family: inherit;
  font-size: inherit;
}

/* Canal seguro de carga */
.card--secure-channel {
  background: var(--white);
}

/* Responsive */
@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
    padding-top: 16px;
  }

  .navigator {
    position: static;
  }

  .navigator__list {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .navigator__list a {
    border: 1px solid var(--border);
  }

  .view__title {
    font-size: 1.5rem;
  }

  .plan__price {
    text-align: left;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
