:root {
      --primary: #153152;
      --primary-light: #2c486a;
      --bg: #f4f6f9;
      --card: #ffffff;
      --text: #1a2332;
      --muted: #64748b;
      --border: #e2e8f0;
      --success: #0d9488;
      --warning: #d97706;
      --error: #b91c1c;
      --radius: 12px;
      --shadow: 0 4px 20px rgba(21, 49, 82, 0.08);
    }

    * { box-sizing: border-box; }

    body {
      margin: 0;
      font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
      background: var(--bg);
      color: var(--text);
      line-height: 1.45;
      min-height: 100vh;
    }

    .page {
      max-width: 520px;
      margin: 0 auto;
      padding: 16px 16px 32px;
    }

    .header {
      display: flex;
      align-items: center;
      gap: 12px;
      margin-bottom: 20px;
    }

    .header__icon {
      width: 44px;
      height: 44px;
      border-radius: 10px;
      background: linear-gradient(135deg, var(--primary), var(--primary-light));
      color: #fff;
      display: grid;
      place-items: center;
      font-size: 1.25rem;
    }

    .header__title {
      margin: 0;
      font-size: 1.25rem;
      font-weight: 700;
    }

    .header__sub {
      margin: 2px 0 0;
      font-size: 0.875rem;
      color: var(--muted);
    }

    .card {
      background: var(--card);
      border-radius: var(--radius);
      box-shadow: var(--shadow);
      padding: 18px;
      margin-bottom: 14px;
    }

    .card__label {
      font-size: 0.75rem;
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.04em;
      color: var(--muted);
      margin-bottom: 6px;
    }

    .account-pill {
      display: inline-flex;
      align-items: center;
      gap: 8px;
      padding: 8px 12px;
      background: #eef2f7;
      border-radius: 999px;
      font-size: 0.9rem;
      font-weight: 600;
    }

    .account-pill span {
      color: var(--muted);
      font-weight: 500;
    }

    label.field {
      display: block;
      margin-bottom: 14px;
    }

    .field__label {
      display: block;
      font-size: 0.875rem;
      font-weight: 600;
      margin-bottom: 6px;
    }

    .field__hint {
      font-size: 0.8125rem;
      color: var(--muted);
      margin-top: 4px;
    }

    select, input[type="date"], input[type="number"] {
      width: 100%;
      padding: 12px 14px;
      border: 1px solid var(--border);
      border-radius: 10px;
      font-size: 1rem;
      background: #fff;
      color: var(--text);
    }

    select:focus, input:focus {
      outline: 2px solid rgba(21, 49, 82, 0.25);
      border-color: var(--primary);
    }

    .segment {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 8px;
      margin-bottom: 14px;
    }

    .segment--tri {
      grid-template-columns: 1fr 1fr 1fr;
    }

    .segment button {
      padding: 10px 12px;
      border: 1px solid var(--border);
      border-radius: 10px;
      background: #fff;
      font-size: 0.875rem;
      font-weight: 600;
      cursor: pointer;
      color: var(--muted);
    }

    .segment button.active {
      background: var(--primary);
      border-color: var(--primary);
      color: #fff;
    }

    .badge {
      display: inline-block;
      padding: 4px 10px;
      border-radius: 999px;
      font-size: 0.75rem;
      font-weight: 600;
      background: rgba(217, 119, 6, 0.12);
      color: var(--warning);
      margin-top: 6px;
    }

    .emision-inline {
      display: flex;
      align-items: baseline;
      justify-content: space-between;
      gap: 8px;
      margin-bottom: 8px;
      padding-bottom: 10px;
      border-bottom: 1px solid var(--border);
    }

    .emision-inline__label {
      font-size: 0.8125rem;
      font-weight: 600;
      color: var(--muted);
    }

    .emision-inline__date {
      font-size: 0.875rem;
      font-weight: 700;
      color: var(--primary);
    }

    .emision-alert {
      display: flex;
      gap: 8px;
      align-items: flex-start;
      padding: 10px 12px;
      border-radius: 10px;
      background: rgba(217, 119, 6, 0.1);
      border: 1px solid rgba(217, 119, 6, 0.35);
      color: #92400e;
      font-size: 0.8125rem;
      line-height: 1.4;
      margin-bottom: 14px;
    }

    .emision-alert::before {
      content: '⚠️';
      flex-shrink: 0;
    }

    .field__label-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      margin-bottom: 6px;
    }

    .link-btn {
      border: none;
      background: none;
      color: var(--primary);
      font-size: 0.8125rem;
      font-weight: 600;
      cursor: pointer;
      padding: 0;
    }

    .signature-pad {
      position: relative;
      border: 1px dashed var(--border);
      border-radius: 10px;
      background: #fff;
      overflow: hidden;
      touch-action: none;
      -webkit-user-select: none;
      user-select: none;
    }

    .signature-pad canvas {
      display: block;
      width: 100%;
      height: 168px;
      cursor: crosshair;
      touch-action: none;
      background: #fff;
    }

    .confirm-summary {
      display: grid;
      gap: 10px;
      margin-bottom: 16px;
    }

    .confirm-row {
      display: flex;
      justify-content: space-between;
      gap: 12px;
      padding-bottom: 10px;
      border-bottom: 1px solid var(--border);
      font-size: 0.9375rem;
    }

    .confirm-row:last-child {
      border-bottom: 0;
      padding-bottom: 0;
    }

    .confirm-row__label {
      color: var(--muted);
      font-size: 0.8125rem;
      font-weight: 600;
      flex-shrink: 0;
    }

    .confirm-row__value {
      text-align: right;
      font-weight: 600;
      color: var(--text);
    }

    .confirm-cosechas {
      margin-top: 4px;
      font-size: 0.8125rem;
      font-weight: 500;
      color: var(--muted);
      line-height: 1.45;
    }

    .confirm-cosechas span {
      display: block;
    }

    .confirm-title {
      margin: 0 0 4px;
      font-size: 1.05rem;
      font-weight: 700;
    }

    .confirm-subtitle {
      margin: 0 0 16px;
      color: var(--muted);
      font-size: 0.875rem;
    }

    .signature-pad__hint {
      position: absolute;
      inset: 0;
      display: grid;
      place-items: center;
      color: var(--muted);
      font-size: 0.875rem;
      pointer-events: none;
      user-select: none;
    }

    .signature-pad.has-ink .signature-pad__hint {
      display: none;
    }

    .legal-block {
      margin-bottom: 16px;
      padding: 14px;
      border-radius: 10px;
      background: rgba(21, 49, 82, 0.04);
      border: 1px solid var(--border);
    }

    .legal-block__title {
      margin: 0 0 8px;
      font-size: 0.875rem;
      font-weight: 700;
      color: var(--primary);
    }

    .legal-block__text,
    .legal-block__resumen {
      margin: 0 0 10px;
      font-size: 0.8125rem;
      line-height: 1.45;
      color: var(--text);
    }

    .legal-block__resumen {
      font-weight: 600;
      color: var(--primary);
    }

    .legal-block__check {
      display: flex;
      align-items: flex-start;
      gap: 10px;
      font-size: 0.8125rem;
      line-height: 1.4;
      cursor: pointer;
    }

    .legal-block__check input {
      margin-top: 3px;
      flex-shrink: 0;
    }

    .actions {
      display: grid;
      gap: 10px;
      margin-top: 8px;
    }

    .btn {
      border: none;
      border-radius: 10px;
      padding: 14px 18px;
      font-size: 1rem;
      font-weight: 600;
      cursor: pointer;
    }

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

    .btn--primary {
      background: var(--primary);
      color: #fff;
    }

    .btn--ghost {
      background: transparent;
      color: var(--primary);
      border: 1px solid var(--border);
    }

    .state {
      text-align: center;
      padding: 40px 20px;
    }

    .state__icon {
      font-size: 2.5rem;
      margin-bottom: 12px;
    }

    .state__title {
      margin: 0 0 8px;
      font-size: 1.125rem;
    }

    .state__text {
      margin: 0;
      color: var(--muted);
      font-size: 0.9375rem;
    }

    .loader {
      width: 36px;
      height: 36px;
      border: 3px solid var(--border);
      border-top-color: var(--primary);
      border-radius: 50%;
      animation: spin 0.8s linear infinite;
      margin: 0 auto 16px;
    }

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

    .hidden { display: none !important; }

    .toast {
      position: fixed;
      left: 16px;
      right: 16px;
      bottom: 16px;
      padding: 12px 16px;
      border-radius: 10px;
      background: #1a2332;
      color: #fff;
      font-size: 0.875rem;
      box-shadow: var(--shadow);
      z-index: 100;
      animation: fadeIn 0.2s ease;
    }

    @keyframes fadeIn {
      from { opacity: 0; transform: translateY(8px); }
      to { opacity: 1; transform: translateY(0); }
    }
