  * { box-sizing: border-box; margin: 0; padding: 0; }
  :root {
    /* Paleta LAS TORTILLERIAS - inspirada en MASECA + tortillería tradicional */
    --primary: #3d5230;          /* Verde olivo - principal */
    --primary-dark: #2a3a20;     /* Verde olivo oscuro */
    --primary-light: #eaf0e3;    /* Verde olivo muy claro */
    --accent: #f9d24a;           /* Amarillo MASECA */
    --accent-dark: #d4a82a;
    --accent-light: #fef5d3;
    --tortilla: #e8a020;         /* Dorado tortilla tostada */
    --bg: #fefcf3;               /* Crema papel */
    --surface: #ffffff;
    --surface-alt: #f7f4e8;
    --border: #e0d9c4;
    --border-strong: #c9c0a6;
    --text: #2a3a20;
    --text-muted: #5c6c50;
    --text-light: #8a9081;
    --success: #2d8659;
    --success-bg: #e3f5ec;
    --success-border: #a8d8be;
    --warning: #b8860b;
    --warning-bg: #fdf6e3;
    --warning-border: #e8ce8a;
    --danger: #b54141;
    --danger-bg: #fde8e8;
    --danger-border: #e5a8a8;
    --info: #2c6bb0;
    --info-bg: #e6f0fa;
    --info-border: #a8c5e3;
    --physical: #7a3eb5;
    --physical-bg: #f0e8fa;
    --physical-border: #c5a8e3;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  }
  html, body { height: 100%; }
  body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
  }
  /* ============= HEADER ============= */
  header {
    background: linear-gradient(to bottom, #fef5d3 0%, #faf0c0 100%);
    border-bottom: 2px solid #3d5230;
    padding: 14px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(61, 82, 48, 0.12);
  }
  .header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
  }
  .brand {
    display: flex;
    align-items: center;
    gap: 14px;
  }
  .brand-icon {
    width: 54px; height: 54px;
    border-radius: 0;
    background: transparent;
    color: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
  }
  .brand-icon svg { width: 54px; height: 54px; }
  .brand-text h1 {
    font-size: 18px;
    font-weight: 700;
    font-family: Georgia, 'Times New Roman', serif;
    letter-spacing: 1px;
    color: #3d5230;
    margin: 0;
  }
  .brand-text p {
    font-size: 11px;
    color: #5c6c50;
    margin: 3px 0 0;
    font-style: italic;
    letter-spacing: 0.3px;
  }
  .header-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
  }
  .lang-toggle {
    display: flex;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2px;
  }
  .lang-toggle button {
    border: none;
    background: none;
    padding: 5px 12px;
    cursor: pointer;
    font-size: 12px;
    border-radius: 18px;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-muted);
  }
  .lang-toggle button.active {
    background: var(--primary);
    color: white;
  }
  /* ============= BUTTONS ============= */
  .btn {
    padding: 8px 14px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
    font-family: inherit;
  }
  .btn:hover { background: var(--bg); border-color: var(--border-strong); }
  .btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
  .btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
  .btn-success { background: var(--success); color: white; border-color: var(--success); }
  .btn-success:hover { background: #246a47; }
  .btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
  .btn-danger:hover { background: #973434; }
  .btn-sm { padding: 5px 10px; font-size: 12px; }
  .btn-block { width: 100%; justify-content: center; }
  /* ============= LAYOUT ============= */
  .container { max-width: 1400px; margin: 0 auto; padding: 20px; }
  .tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
    overflow-x: auto;
    background: var(--bg);
    position: sticky;
    top: 70px;
    z-index: 50;
  }
  .tab {
    padding: 12px 18px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
    font-family: inherit;
  }
  .tab:hover { color: var(--text); }
  .tab.active { color: var(--primary); border-bottom-color: var(--primary); }
  .tab-content { display: none; }
  .tab-content.active { display: block; }
  /* ============= CARDS ============= */
  .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
  }
  .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    gap: 12px;
  }
  .card h3 { font-size: 16px; font-weight: 600; }
  /* ============= STATS ============= */
  .stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
  }
  .stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
  }
  .stat-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
  }
  .stat-value { font-size: 26px; font-weight: 600; }
  .stat-meta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
  .progress-bar {
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 10px;
  }
  .progress-fill { height: 100%; background: var(--primary); transition: width 0.4s; }
  /* ============= ALERTS ============= */
  .alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 12px;
    font-size: 13px;
    border-left: 4px solid;
    display: flex;
    align-items: flex-start;
    gap: 10px;
  }
  .alert-info { background: var(--info-bg); border-color: var(--info); color: var(--info); }
  .alert-warning { background: var(--warning-bg); border-color: var(--warning); color: var(--warning); }
  .alert-danger { background: var(--danger-bg); border-color: var(--danger); color: var(--danger); }
  .alert-success { background: var(--success-bg); border-color: var(--success); color: var(--success); }
  .alert-physical { background: var(--physical-bg); border-color: var(--physical); color: var(--physical); }
  /* ============= TRAMITE LIST ============= */
  .tramite-list { display: flex; flex-direction: column; gap: 10px; }
  .tramite-row {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: var(--shadow);
    display: flex;
    gap: 14px;
    align-items: center;
  }
  .tramite-row:hover { border-color: var(--primary); transform: translateY(-1px); box-shadow: var(--shadow-md); }
  .tramite-num {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
  }
  .tramite-row.completed .tramite-num { background: var(--success-bg); color: var(--success); }
  .tramite-row.completed .tramite-name { text-decoration: line-through; color: var(--text-muted); }
  .tramite-info { flex: 1; min-width: 0; }
  .tramite-name { font-size: 15px; font-weight: 600; }
  .tramite-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
  .tramite-badges {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .badge {
    padding: 3px 9px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
  }
  .badge-pendiente { background: var(--bg); color: var(--text-muted); }
  .badge-en-proceso { background: var(--warning-bg); color: var(--warning); }
  .badge-completado { background: var(--success-bg); color: var(--success); }
  .badge-bloqueado { background: var(--danger-bg); color: var(--danger); }
  .badge-docs { background: var(--info-bg); color: var(--info); }
  .badge-physical { background: var(--physical-bg); color: var(--physical); }
  .progress-mini {
    width: 80px;
    height: 5px;
    background: var(--bg);
    border-radius: 3px;
    overflow: hidden;
  }
  .progress-mini-fill { height: 100%; background: var(--primary); }
  /* ============= WORKSPACE (Detail view) ============= */
  .workspace-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 200;
    display: none;
  }
  .workspace-overlay.show { display: block; }
  .workspace {
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    width: 100%;
    max-width: 860px;
    background: var(--surface);
    z-index: 201;
    overflow-y: auto;
    display: none;
    box-shadow: -8px 0 24px rgba(0,0,0,0.1);
  }
  .workspace.show { display: block; }
  .workspace-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
  }
  .workspace-title {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
  }
  .workspace-body { padding: 20px 24px; }
  .ws-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px dashed var(--border);
  }
  .ws-section:last-child { border-bottom: none; }
  .ws-section-title {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .ws-section-title .badge { text-transform: uppercase; }
  /* ============= CHECKLIST ============= */
  .checklist { list-style: none; }
  .checklist li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px dashed var(--border);
  }
  .checklist li:last-child { border-bottom: none; }
  .checklist input[type=checkbox] {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary);
    flex-shrink: 0;
  }
  .checklist label {
    flex: 1;
    cursor: pointer;
    font-size: 14px;
  }
  .checklist label.done { text-decoration: line-through; color: var(--text-muted); }
  .checklist .item-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.15s;
  }
  .checklist li:hover .item-actions { opacity: 1; }
  /* ============= FORMS ============= */
  .form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
  }
  .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .form-group { margin-bottom: 12px; }
  .form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    color: var(--text);
  }
  .form-group .label-help {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
    margin-left: 6px;
  }
  textarea, input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=url], select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
  }
  textarea:focus, input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(201, 96, 26, 0.1);
  }
  textarea { resize: vertical; min-height: 70px; }
  /* ============= QUESTIONS ============= */
  .question {
    background: var(--surface-alt);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 10px;
  }
  .question-text {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
  }
  .question-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-style: italic;
  }
  .radio-group, .checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .radio-option, .checkbox-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
  }
  .radio-option:hover, .checkbox-option:hover { border-color: var(--primary); }
  .radio-option input[type=radio]:checked + span,
  .checkbox-option input[type=checkbox]:checked + span { font-weight: 600; }
  /* ============= DOC UPLOAD (per step) ============= */
  .doc-upload-area {
    background: var(--surface-alt);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
  }
  .doc-upload-area:hover, .doc-upload-area.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
  }
  .doc-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-top: 12px;
  }
  .doc-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-size: 12px;
    position: relative;
  }
  .doc-card.physical-required {
    border-left: 4px solid var(--physical);
  }
  .doc-icon { font-size: 24px; }
  .doc-name {
    font-size: 12px;
    font-weight: 600;
    margin: 6px 0 4px;
    word-break: break-word;
    line-height: 1.3;
  }
  .doc-meta { font-size: 10px; color: var(--text-muted); margin-bottom: 6px; }
  .doc-actions-row { display: flex; gap: 4px; flex-wrap: wrap; }
  .physical-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--physical-bg);
    color: var(--physical);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 600;
    margin-top: 4px;
  }
  /* ============= DELIVERABLES ============= */
  .deliverable {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 10px;
  }
  .deliverable-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 10px;
  }
  .deliverable-title {
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .deliverable-preview {
    background: var(--surface-alt);
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    font-family: ui-monospace, SFMono-Regular, monospace;
  }
  /* ============= NOTES ============= */
  .note-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 8px;
  }
  .note-date { font-size: 10px; color: var(--text-muted); margin-bottom: 4px; }
  .note-text { font-size: 13px; white-space: pre-wrap; }
  /* ============= WIZARD ============= */
  .wizard {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-md);
    max-width: 700px;
    margin: 20px auto;
  }
  .wizard-step { display: none; }
  .wizard-step.active { display: block; }
  .wizard-progress {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
  }
  .wizard-dot {
    flex: 1;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
  }
  .wizard-dot.active { background: var(--primary); }
  /* ============= MODAL ============= */
  .modal-bg {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
  }
  .modal-bg.show { display: flex; }
  .modal {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
    max-width: 520px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
  }
  .modal h3 { margin-bottom: 14px; font-size: 17px; }
  .modal-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 16px;
  }
  /* ============= TOAST ============= */
  .toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--text);
    color: white;
    padding: 12px 18px;
    border-radius: var(--radius);
    font-size: 13px;
    z-index: 2000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
    pointer-events: none;
    box-shadow: var(--shadow-md);
    max-width: 380px;
  }
  .toast.show { opacity: 1; transform: translateY(0); }
  .toast.success { background: var(--success); }
  .toast.error { background: var(--danger); }
  /* ============= MISC ============= */
  .empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
  }
  .empty-state-icon { font-size: 42px; margin-bottom: 10px; }
  .icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
  }
  .icon-btn:hover { background: var(--bg); color: var(--text); }
  .physical-banner {
    background: var(--physical-bg);
    border: 1px solid var(--physical-border);
    border-radius: var(--radius);
    padding: 12px 16px;
    margin-bottom: 10px;
    font-size: 13px;
  }
  .physical-banner strong { color: var(--physical); }
  .pill-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    color: var(--text-muted);
  }
  .pill-button:hover { background: var(--bg); }
  .pill-button.active { background: var(--primary); color: white; border-color: var(--primary); }
  .filter-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    align-items: center;
  }
  /* Print styles for deliverables */
  @media print {
    body * { visibility: hidden; }
    .print-area, .print-area * { visibility: visible; }
    .print-area { position: absolute; left: 0; top: 0; width: 100%; padding: 40px; }
  }
  .print-area { display: none; }
  @media (max-width: 720px) {
    .container { padding: 12px; }
    .form-row { grid-template-columns: 1fr; }
    .header-inner { flex-direction: column; align-items: flex-start; gap: 10px; }
    .tramite-row { flex-wrap: wrap; }
    .tramite-badges { width: 100%; justify-content: flex-start; }
    .workspace { max-width: 100%; }
  }
