:root {
      --bg-deep: #f0f4f8;
      --bg-mid: #e8eef4;
      --surface: #ffffff;
      --surface-hover: #f8fafc;
      --border: rgba(15, 23, 42, 0.1);
      --text: #0f172a;
      --text-muted: #64748b;
      --accent: #16a34a;
      --accent-dim: rgba(22, 163, 74, 0.12);
      --accent-glow: rgba(0, 93, 172, 0.12);
      --danger: #dc2626;
      --radius: 14px;
      --font-display: "Lexend", system-ui, sans-serif;
      --font-body: "IBM Plex Sans", system-ui, sans-serif;
    }

    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
    }

    html {
      -webkit-font-smoothing: antialiased;
    }

    body {
      min-height: 100dvh;
      font-family: var(--font-body);
      color: var(--text);
      background: var(--bg-deep);
      background-image:
        radial-gradient(ellipse 120% 80% at 50% -20%, rgba(0, 93, 172, 0.08), transparent 55%),
        radial-gradient(ellipse 90% 60% at 100% 40%, rgba(22, 163, 74, 0.06), transparent 45%),
        radial-gradient(ellipse 70% 50% at 0% 90%, rgba(0, 93, 172, 0.05), transparent 42%),
        linear-gradient(180deg, var(--bg-deep) 0%, var(--bg-mid) 100%);
      padding: clamp(1.25rem, 4vw, 2rem);
      padding-bottom: max(2rem, env(safe-area-inset-bottom));
    }

    .shell {
      max-width: 420px;
      margin: 0 auto;
    }

    header {
      text-align: center;
      margin-bottom: 1.75rem;
    }

    .logo-mark {
      width: 72px;
      height: 72px;
      margin: 0 auto 1rem;
      border-radius: 18px;
      background: #ffffff;
      border: 1px solid var(--border);
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 8px 28px var(--accent-glow), 0 1px 3px rgba(15, 23, 42, 0.06);
      overflow: hidden;
    }

    .logo-mark img {
      width: 48px;
      height: 48px;
      display: block;
      object-fit: contain;
    }

    .logo-mark img.is-branch {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

    h1 {
      font-family: var(--font-display);
      font-weight: 600;
      font-size: clamp(1.25rem, 4vw, 1.5rem);
      letter-spacing: -0.03em;
      line-height: 1.2;
      margin-bottom: 0.35rem;
    }

    .subtitle {
      color: var(--text-muted);
      font-size: 0.9375rem;
      line-height: 1.45;
    }

    .doc-pill {
      display: inline-flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 0.25rem;
      margin-top: 0.85rem;
      padding: 0.55rem 1rem;
      border-radius: 12px;
      background: var(--accent-dim);
      border: 1px solid rgba(22, 163, 74, 0.22);
      color: #15803d;
      max-width: 100%;
      text-align: center;
      box-sizing: border-box;
    }

    .doc-pill-label {
      font-size: 0.75rem;
      font-weight: 600;
      letter-spacing: 0.02em;
    }

    .doc-pill-value {
      font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
      font-size: 0.8125rem;
      font-weight: 500;
      font-variant-numeric: tabular-nums;
      letter-spacing: 0.02em;
      line-height: 1.35;
      word-break: break-all;
      max-width: min(100%, 22rem);
    }

    .nav-list {
      list-style: none;
      display: flex;
      flex-direction: column;
      gap: 0.75rem;
    }

    .link-card {
      display: flex;
      align-items: center;
      gap: 1rem;
      padding: 1rem 1.1rem;
      border-radius: var(--radius);
      background: var(--surface);
      border: 1px solid var(--border);
      text-decoration: none;
      color: inherit;
      box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
      transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
    }

    .link-card:hover {
      background: var(--surface-hover);
      border-color: rgba(0, 93, 172, 0.2);
      box-shadow: 0 6px 20px rgba(15, 23, 42, 0.07);
      transform: translateY(-1px);
    }

    .link-card:focus-visible {
      outline: 2px solid var(--accent);
      outline-offset: 2px;
    }

    .link-icon {
      width: 44px;
      height: 44px;
      border-radius: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      font-size: 1.25rem;
    }

    .link-icon.tienda {
      background: rgba(37, 99, 235, 0.12);
    }

    .link-icon.factura {
      background: var(--accent-dim);
    }

    .link-text {
      flex: 1;
      min-width: 0;
      display: flex;
      flex-direction: column;
      align-items: flex-start;
      gap: 0.4rem;
    }

    .link-title {
      display: block;
      font-family: var(--font-display);
      font-weight: 600;
      font-size: 1rem;
      line-height: 1.3;
    }

    .link-desc {
      display: block;
      font-size: 0.8125rem;
      color: var(--text-muted);
      line-height: 1.45;
    }

    .chevron {
      flex-shrink: 0;
      color: var(--text-muted);
      opacity: 0.7;
    }

    .empty {
      text-align: center;
      padding: 2rem 1rem;
      border-radius: var(--radius);
      border: 1px dashed var(--border);
      color: var(--text-muted);
      font-size: 0.9375rem;
      line-height: 1.5;
    }

    .footer-note {
      margin-top: 1.75rem;
      text-align: center;
      font-size: 0.75rem;
      color: var(--text-muted);
      opacity: 0.85;
    }

    .state-message {
      text-align: center;
      padding: 1.5rem 1rem;
      border-radius: var(--radius);
      color: var(--text-muted);
      font-size: 0.9375rem;
      line-height: 1.5;
    }

    .state-message.is-error {
      color: #b91c1c;
      border: 1px solid rgba(220, 38, 38, 0.25);
      background: rgba(254, 226, 226, 0.45);
    }

    .retry-btn {
      display: inline-flex;
      margin-top: 0.85rem;
      padding: 0.45rem 1rem;
      border-radius: 999px;
      border: 1px solid rgba(0, 93, 172, 0.35);
      background: #fff;
      color: #005dac;
      font-family: var(--font-display);
      font-weight: 600;
      font-size: 0.8125rem;
      cursor: pointer;
    }

    .retry-btn:hover {
      background: #f0f7fc;
    }

    .fatal-error {
      text-align: center;
      padding: 0.5rem 0 1rem;
    }

    .fatal-error h1 {
      font-family: var(--font-display);
      font-size: clamp(1.35rem, 4.5vw, 1.65rem);
      font-weight: 600;
      color: var(--text);
      margin-bottom: 0.75rem;
      line-height: 1.25;
    }

    .fatal-error .fatal-copy {
      color: var(--text-muted);
      font-size: 0.9375rem;
      line-height: 1.55;
      margin-bottom: 1.35rem;
      max-width: 26rem;
      margin-left: auto;
      margin-right: auto;
    }

    .fatal-error .cta-sicar {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 0.65rem 1.35rem;
      border-radius: 999px;
      font-family: var(--font-display);
      font-weight: 600;
      font-size: 0.9375rem;
      text-decoration: none;
      background: #005dac;
      color: #ffffff;
      border: none;
      box-shadow: 0 4px 14px rgba(0, 93, 172, 0.35);
      transition: background 0.18s ease, transform 0.18s ease;
    }

    .fatal-error .cta-sicar:hover {
      background: #004a8c;
      transform: translateY(-1px);
    }

    .fatal-error .cta-sicar:focus-visible {
      outline: 2px solid #005dac;
      outline-offset: 3px;
    }

    .fatal-error .fatal-foot {
      margin-top: 1.75rem;
      font-size: 0.75rem;
      color: var(--text-muted);
      opacity: 0.9;
    }
