
  :root{
    --bg:#ffffff;
    --surface:#f4f7f5;
    --surface-2:#eaf0ec;
    --border:#d8e1dc;
    --text:#17201b;
    --text-muted:#5b6b62;
    --brand-dark:#00543c;
    --brand-dark-2:#00432f;
    --brand-light:#4cb648;
    --on-brand:#ffffff;
    --focus:#2f7dd1;

    --st-pendiente:#5b708c;
    --st-pendiente-bg:#e9edf3;
    --st-revision:#8a6a1e;
    --st-revision-bg:#f6ecd3;
    --st-observada:#a6531b;
    --st-observada-bg:#f7e4d5;
    --st-aprobada:#1b7a76;
    --st-aprobada-bg:#dcf0ee;
    --st-finalizada:#2e7d4f;
    --st-finalizada-bg:#dff2e5;
    --st-rechazada:#a8332b;
    --st-rechazada-bg:#f7dfdd;
    --st-notapendiente:#7a4f1e;
    --st-notapendiente-bg:#f4e6d2;

    --shadow: 0 1px 2px rgba(15,30,22,.06), 0 8px 24px -12px rgba(15,30,22,.18);
    --radius: 10px;
  }

  @media (prefers-color-scheme: dark){
    :root:not([data-theme="light"]){
      --bg:#0b1512;
      --surface:#101f19;
      --surface-2:#16281f;
      --border:#25392e;
      --text:#eaf3ee;
      --text-muted:#9db3a7;
      --brand-dark:#0a5d43;
      --brand-dark-2:#063c2a;
      --brand-light:#63c96a;
      --on-brand:#eafff1;
      --focus:#6fb1f2;

      --st-pendiente:#a9bdd6;
      --st-pendiente-bg:#1b2636;
      --st-revision:#e0c27f;
      --st-revision-bg:#332a15;
      --st-observada:#eda06e;
      --st-observada-bg:#3a2415;
      --st-aprobada:#7fd6cf;
      --st-aprobada-bg:#123330;
      --st-finalizada:#8fe0ac;
      --st-finalizada-bg:#0f2e1c;
      --st-rechazada:#f0958d;
      --st-rechazada-bg:#3a1715;
      --st-notapendiente:#e0b378;
      --st-notapendiente-bg:#3a2c15;

      --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 28px -12px rgba(0,0,0,.6);
    }
  }
  :root[data-theme="dark"]{
    --bg:#0b1512;
    --surface:#101f19;
    --surface-2:#16281f;
    --border:#25392e;
    --text:#eaf3ee;
    --text-muted:#9db3a7;
    --brand-dark:#0a5d43;
    --brand-dark-2:#063c2a;
    --brand-light:#63c96a;
    --on-brand:#eafff1;
    --focus:#6fb1f2;

    --st-pendiente:#a9bdd6;
    --st-pendiente-bg:#1b2636;
    --st-revision:#e0c27f;
    --st-revision-bg:#332a15;
    --st-observada:#eda06e;
    --st-observada-bg:#3a2415;
    --st-aprobada:#7fd6cf;
    --st-aprobada-bg:#123330;
    --st-finalizada:#8fe0ac;
    --st-finalizada-bg:#0f2e1c;
    --st-rechazada:#f0958d;
    --st-rechazada-bg:#3a1715;
    --st-notapendiente:#e0b378;
    --st-notapendiente-bg:#3a2c15;

    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 28px -12px rgba(0,0,0,.6);
  }

  *{box-sizing:border-box;}
  html,body{margin:0;padding:0;}
  body{
    background:var(--bg);
    color:var(--text);
    font-family:'Inter',Helvetica,Arial,sans-serif;
    font-size:15px;
    line-height:1.5;
    -webkit-font-smoothing:antialiased;
  }
  h1,h2,h3,h4{text-wrap:balance; margin:0; font-family:'Inter',Helvetica,Arial,sans-serif;}
  button{font-family:inherit;}
  .tnum{font-variant-numeric:tabular-nums;}

  a{color:var(--brand-dark);}
  :is(a,button,input,select,textarea,[tabindex]):focus-visible{
    outline:2px solid var(--focus);
    outline-offset:2px;
    border-radius:4px;
  }

  /* ---------- shell (navegación lateral) ---------- */
  .app-shell{display:flex; align-items:stretch; min-height:100vh;}

  .sidebar{
    width:222px; flex-shrink:0;
    background:linear-gradient(180deg,var(--brand-dark),var(--brand-dark-2));
    color:var(--on-brand);
    display:flex; flex-direction:column;
    padding:20px 14px 16px;
    position:sticky; top:0; height:100vh;
    z-index:40;
  }
  .sidebar .brand{display:flex; flex-direction:column; line-height:1.2; padding:2px 10px 20px;}
  .sidebar .brand .word{font-weight:800; font-size:18px; letter-spacing:.02em;}
  .sidebar .brand .sub{font-size:11px; opacity:.8; font-weight:500; margin-top:3px;}

  .side-nav-label{
    text-transform:uppercase; letter-spacing:.08em; font-size:10.5px; font-weight:700;
    color:rgba(255,255,255,.55); padding:0 10px 8px;
  }
  .side-nav{display:flex; flex-direction:column; gap:3px;}
  .side-nav button{
    display:flex; align-items:center; gap:10px; width:100%; text-align:left;
    background:transparent; border:1px solid transparent; color:rgba(255,255,255,.88);
    padding:10px 12px; border-radius:8px; font-size:13.5px; font-weight:600;
    cursor:pointer; transition:background .15s ease;
  }
  .side-nav button svg{opacity:.85; flex-shrink:0;}
  .side-nav button:hover{background:rgba(255,255,255,.1);}
  .side-nav button[aria-current="page"]{background:var(--brand-light); color:#0c2417;}
  .side-nav button[aria-current="page"] svg{opacity:1;}

  .side-nav-footer{margin-top:auto; padding-top:14px; border-top:1px solid rgba(255,255,255,.14);}
  .side-nav-footer button{
    display:flex; align-items:center; gap:10px; width:100%; text-align:left;
    background:transparent; border:none; color:rgba(255,255,255,.72);
    padding:9px 12px; border-radius:8px; font-size:13px; font-weight:600; cursor:pointer;
  }
  .side-nav-footer button:hover{background:rgba(255,255,255,.1); color:var(--on-brand);}

  .main-wrap{flex:1; min-width:0; display:flex; flex-direction:column;}

  .mobile-topbar{
    display:none; align-items:center; gap:12px;
    background:linear-gradient(180deg,var(--brand-dark),var(--brand-dark-2));
    color:var(--on-brand); padding:12px 16px; position:sticky; top:0; z-index:45;
  }
  .mobile-topbar .word{font-weight:800; font-size:16px;}
  .sidebar-toggle{
    background:rgba(255,255,255,.1); border:1px solid rgba(255,255,255,.25); color:var(--on-brand);
    width:34px; height:34px; border-radius:8px; display:flex; align-items:center; justify-content:center;
    cursor:pointer; flex-shrink:0; padding:0;
  }
  .sidebar-backdrop{display:none;}

  @media (max-width:860px){
    .sidebar{
      position:fixed; left:0; top:0; height:100%; width:250px;
      transform:translateX(-100%); transition:transform .2s ease; box-shadow:var(--shadow);
    }
    .sidebar.open{transform:translateX(0);}
    .sidebar-backdrop{
      display:none; position:fixed; inset:0; background:rgba(10,20,15,.45); z-index:39;
    }
    .sidebar-backdrop.show{display:block;}
    .mobile-topbar{display:flex;}
  }

  main{max-width:1080px; margin:0; padding:28px 28px 80px;}
  .view{display:none;}
  .view.active{display:block;}

  .page-head{margin-bottom:22px;}
  .page-head h1{font-size:24px; font-weight:800;}
  .page-head p{color:var(--text-muted); margin-top:6px; max-width:62ch;}
  .eyebrow{
    text-transform:uppercase; letter-spacing:.08em; font-size:11.5px;
    font-weight:700; color:var(--brand-dark); display:block; margin-bottom:6px;
  }
  @media (prefers-color-scheme: dark){ :root:not([data-theme="light"]) .eyebrow{color:var(--brand-light);} }
  :root[data-theme="dark"] .eyebrow{color:var(--brand-light);}

  .card{
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:var(--radius);
    padding:22px;
  }

  /* ---------- perfil picker ---------- */
  .steps{display:flex; gap:8px; margin-bottom:22px; flex-wrap:wrap;}
  .step-chip{
    display:flex; align-items:center; gap:8px;
    font-size:12.5px; font-weight:600; color:var(--text-muted);
    padding:6px 12px; border-radius:999px; background:var(--surface-2); border:1px solid var(--border);
  }
  .step-chip.on{color:var(--on-brand); background:var(--brand-dark); border-color:transparent;}
  .step-chip b{font-variant-numeric:tabular-nums;}

  .profile-grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(190px,1fr)); gap:12px;}
  .profile-card{
    text-align:left; cursor:pointer;
    background:var(--surface); border:1.5px solid var(--border); border-radius:var(--radius);
    padding:16px; display:flex; flex-direction:column; gap:6px;
    transition:border-color .15s ease, transform .1s ease;
  }
  .profile-card:hover{border-color:var(--brand-light); transform:translateY(-1px);}
  .profile-card.selected{border-color:var(--brand-dark); background:var(--surface-2); box-shadow:0 0 0 1px var(--brand-dark) inset;}
  .profile-card .ico{
    width:34px; height:34px; border-radius:8px; background:var(--brand-dark); color:var(--on-brand);
    display:flex; align-items:center; justify-content:center; font-weight:800; font-size:14px;
  }
  .profile-card .name{font-weight:700; font-size:14.5px;}
  .profile-card .hint{font-size:12px; color:var(--text-muted);}

  .segmented{display:inline-flex; border:1px solid var(--border); border-radius:999px; padding:3px; background:var(--surface);}
  .segmented button{
    border:none; background:transparent; padding:7px 16px; border-radius:999px; font-size:13px; font-weight:600;
    color:var(--text-muted); cursor:pointer;
  }
  .segmented button.on{background:var(--brand-dark); color:var(--on-brand);}

  .field-row{display:grid; grid-template-columns:1fr 1fr; gap:14px; margin-bottom:14px;}
  .field-row.single{grid-template-columns:1fr;}
  @media (max-width:640px){ .field-row{grid-template-columns:1fr;} }
  label.field{display:flex; flex-direction:column; gap:6px; font-size:12.5px; font-weight:600; color:var(--text-muted);}
  label.field input[type="text"], label.field input[type="email"], label.field input[type="tel"], label.field select, label.field textarea{
    font:inherit; font-size:14px; color:var(--text); background:var(--bg);
    border:1px solid var(--border); border-radius:8px; padding:9px 11px;
  }
  label.field textarea{resize:vertical; min-height:64px;}
  label.field input.invalid{border-color:var(--st-rechazada);}
  .field-error{color:var(--st-rechazada); font-size:12px; font-weight:600;}
  .check-line{display:flex; align-items:flex-start; gap:9px; font-size:13.5px; color:var(--text);}
  .check-line input{margin-top:3px;}

  .alert{
    display:flex; gap:10px; align-items:flex-start;
    border-radius:8px; padding:12px 14px; font-size:13.5px; margin:14px 0;
    border:1px solid transparent;
  }
  .alert.danger{background:var(--st-rechazada-bg); color:var(--st-rechazada); border-color:var(--st-rechazada);}
  .alert.info{background:var(--surface-2); color:var(--text-muted); border-color:var(--border);}

  .doclist{display:flex; flex-direction:column; gap:8px; margin-top:6px;}
  .doc-row{
    display:flex; align-items:center; gap:10px; padding:10px 12px;
    border:1px solid var(--border); border-radius:8px; background:var(--bg);
    font-size:13.5px;
  }
  .doc-row .name{flex:1;}
  .doc-row .name .hint{display:block; font-size:11.5px; color:var(--text-muted); font-weight:400; margin-top:2px;}
  .doc-row .name a.hint{color:var(--focus); text-decoration:underline; cursor:pointer;}
  .doc-row .name .filename{display:block; font-size:11.5px; color:var(--st-finalizada); font-weight:600; margin-top:2px;}
  .doc-row .tag{font-size:11px; color:var(--text-muted); border:1px solid var(--border); border-radius:999px; padding:1px 8px; white-space:nowrap;}
  .doc-row .tag.obligatorio{color:var(--text); border-color:var(--text); font-weight:700;}
  .doc-row button{
    border:1px solid var(--border); background:var(--surface); color:var(--text);
    border-radius:6px; padding:6px 12px; font-size:12.5px; font-weight:600; cursor:pointer;
  }
  .doc-row .btn-quitar{padding:6px 9px; color:var(--text-muted);}
  .doc-row.done{border-color:var(--st-finalizada); background:var(--st-finalizada-bg);}
  .doc-row.done .btn-adjuntar{background:var(--st-finalizada); color:#fff; border-color:transparent;}

  .actions-bar{display:flex; justify-content:flex-end; gap:10px; margin-top:20px;}
  .btn{
    border:none; border-radius:8px; padding:10px 18px; font-size:13.5px; font-weight:700; cursor:pointer;
    transition:filter .12s ease;
  }
  .btn:hover{filter:brightness(1.06);}
  .btn:disabled{opacity:.45; cursor:not-allowed;}
  .btn-primary{background:var(--brand-dark); color:var(--on-brand);}
  .btn-ghost{background:transparent; color:var(--text); border:1px solid var(--border);}
  .btn-danger{background:var(--st-rechazada); color:#fff;}
  .btn-warn{background:var(--st-observada); color:#fff;}
  .btn-ok{background:var(--st-finalizada); color:#fff;}
  .btn-ghost-danger{background:transparent; color:var(--st-rechazada); border:1px solid var(--st-rechazada);}
  .danger-zone{border-top:1px dashed var(--border); margin-top:6px; padding-top:14px; display:flex; justify-content:flex-start;}

  /* ---------- confirmation ---------- */
  .confirm{
    text-align:center; padding:40px 20px; display:flex; flex-direction:column; align-items:center; gap:10px;
  }
  .confirm .mark{
    width:56px; height:56px; border-radius:50%; background:var(--st-finalizada-bg); color:var(--st-finalizada);
    display:flex; align-items:center; justify-content:center; font-size:26px; font-weight:800; margin-bottom:6px;
  }
  .ticket-no{
    font-size:26px; font-weight:800; letter-spacing:.02em; color:var(--brand-dark); font-variant-numeric:tabular-nums;
  }
  @media (prefers-color-scheme: dark){ :root:not([data-theme="light"]) .ticket-no{color:var(--brand-light);} }
  :root[data-theme="dark"] .ticket-no{color:var(--brand-light);}

  .gestor-card{
    display:flex; align-items:center; gap:12px; text-align:left;
    background:var(--surface-2); border:1px solid var(--border); border-radius:var(--radius);
    padding:12px 16px; margin-top:8px; max-width:360px;
  }
  .gestor-card .ico{
    flex:none; width:36px; height:36px; border-radius:50%; background:var(--brand-dark); color:var(--on-brand);
    display:flex; align-items:center; justify-content:center; font-weight:800; font-size:13px;
  }
  .gestor-card .txt{display:flex; flex-direction:column; font-size:13px;}
  .gestor-card .txt span{color:var(--text-muted); font-size:12px;}

  /* ---------- panel interno ---------- */
  .toolbar{display:flex; gap:10px; flex-wrap:wrap; margin-bottom:16px; align-items:center;}
  .toolbar select, .toolbar input[type="search"]{
    font:inherit; font-size:13px; border:1px solid var(--border); border-radius:8px; padding:8px 11px;
    background:var(--bg); color:var(--text);
  }
  .toolbar input[type="search"]{min-width:220px; flex:1;}
  .kpis{display:grid; grid-template-columns:repeat(auto-fit,minmax(130px,1fr)); gap:10px; margin-bottom:18px;}
  .kpi{background:var(--surface); border:1px solid var(--border); border-radius:var(--radius); padding:12px 14px;}
  .kpi .n{font-size:22px; font-weight:800; font-variant-numeric:tabular-nums;}
  .kpi .l{font-size:11.5px; color:var(--text-muted); text-transform:uppercase; letter-spacing:.04em;}

  .table-wrap{overflow-x:auto; border:1px solid var(--border); border-radius:var(--radius); background:var(--surface);}
  table{width:100%; border-collapse:collapse; font-size:13.5px; min-width:760px;}
  thead th{
    text-align:left; font-size:11px; text-transform:uppercase; letter-spacing:.05em; color:var(--text-muted);
    padding:11px 14px; border-bottom:1px solid var(--border); background:var(--surface-2); white-space:nowrap;
  }
  tbody td{padding:12px 14px; border-bottom:1px solid var(--border); vertical-align:middle;}
  tbody tr:last-child td{border-bottom:none;}
  tbody tr{cursor:pointer;}
  tbody tr:hover{background:var(--surface-2);}
  .pill{
    display:inline-flex; align-items:center; gap:6px; padding:3px 10px; border-radius:999px;
    font-size:11.5px; font-weight:700; white-space:nowrap;
  }
  .pill .dot{width:6px; height:6px; border-radius:50%; background:currentColor;}
  .muted{color:var(--text-muted);}
  .empty{padding:40px; text-align:center; color:var(--text-muted);}

  /* ---------- ayuda ---------- */
  .help-grid{display:grid; grid-template-columns:1.3fr 1fr; gap:16px; align-items:start;}
  @media (max-width:760px){ .help-grid{grid-template-columns:1fr;} }
  .help-steps{list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:14px;}
  .help-steps li{display:flex; gap:12px;}
  .help-steps .num{
    flex:none; width:26px; height:26px; border-radius:50%; background:var(--brand-dark); color:var(--on-brand);
    display:flex; align-items:center; justify-content:center; font-size:12.5px; font-weight:800;
  }
  .help-steps .txt b{display:block; font-size:13.5px; margin-bottom:2px;}
  .help-steps .txt span{font-size:13px; color:var(--text-muted);}
  .legend-list{display:flex; flex-direction:column; gap:9px; margin-top:8px;}
  .legend-list .row{display:flex; align-items:center; gap:10px; font-size:13px;}
  .legend-list .row span.desc{color:var(--text-muted); font-size:12.5px;}
  .help-faq dt{font-weight:700; font-size:13.5px; margin-top:14px;}
  .help-faq dd{margin:4px 0 0; font-size:13px; color:var(--text-muted);}
  .help-faq dt:first-child{margin-top:0;}

  /* ---------- drawer ---------- */
  .scrim{
    position:fixed; inset:0; background:rgba(10,20,15,.42); backdrop-filter:blur(1px);
    display:none; z-index:60;
  }
  .scrim.open{display:block;}
  .drawer{
    position:fixed; top:0; right:0; height:100%; width:min(480px,92vw);
    background:var(--bg); border-left:1px solid var(--border); z-index:61;
    transform:translateX(100%); transition:transform .22s ease; overflow-y:auto;
    box-shadow:var(--shadow);
  }
  .drawer.open{transform:translateX(0);}
  @media (prefers-reduced-motion:reduce){ .drawer{transition:none;} }
  .drawer-head{
    padding:18px 20px; border-bottom:1px solid var(--border); display:flex; justify-content:space-between; align-items:flex-start;
    background:var(--surface); position:sticky; top:0;
  }
  .drawer-body{padding:18px 20px; display:flex; flex-direction:column; gap:18px;}
  .drawer-close{background:none; border:none; font-size:20px; cursor:pointer; color:var(--text-muted); line-height:1;}
  .kv{display:grid; grid-template-columns:1fr 1fr; gap:8px 14px; font-size:13.5px;}
  .kv div span{display:block; font-size:11px; color:var(--text-muted); text-transform:uppercase; letter-spacing:.04em;}
  .section-title{font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; color:var(--text-muted); margin-bottom:8px;}
  .timeline{display:flex; flex-direction:column; gap:10px;}
  .tl-item{display:flex; gap:10px; font-size:13px;}
  .tl-item .dot{width:8px; height:8px; border-radius:50%; background:var(--brand-light); margin-top:5px; flex:none;}
  .tl-item .when{color:var(--text-muted); font-size:11.5px; font-variant-numeric:tabular-nums;}

  .toast-wrap{position:fixed; bottom:18px; right:18px; display:flex; flex-direction:column; gap:8px; z-index:80;}
  .toast{
    background:var(--brand-dark); color:var(--on-brand); padding:11px 16px; border-radius:8px;
    font-size:13px; box-shadow:var(--shadow); max-width:320px; opacity:0; transform:translateY(6px);
    animation:toast-in .18s ease forwards;
  }
  @keyframes toast-in{ to{opacity:1; transform:none;} }
  @media (prefers-reduced-motion:reduce){ .toast{animation:none; opacity:1; transform:none;} }

  /* ---------- v2: login / registro / verificacion ---------- */
  .auth-wrap{max-width:460px; margin:24px auto;}
  .auth-tabs{display:flex; gap:6px; margin-bottom:16px; background:var(--surface); padding:4px; border-radius:10px; border:1px solid var(--border);}
  .auth-tabs button{flex:1; border:none; background:none; padding:9px 10px; border-radius:7px; font:inherit; font-weight:600; font-size:13.5px; color:var(--text-muted); cursor:pointer;}
  .auth-tabs button.on{background:var(--bg); color:var(--brand-dark); box-shadow:var(--shadow);}
  .auth-form{display:flex; flex-direction:column; gap:12px;}
  .auth-form .field{display:flex; flex-direction:column; gap:5px;}
  .form-error{background:var(--st-rechazada-bg); color:var(--st-rechazada); border-radius:8px; padding:9px 12px; font-size:13px;}
  .form-ok{background:var(--st-finalizada-bg); color:var(--st-finalizada); border-radius:8px; padding:9px 12px; font-size:13px;}
  .otp-input{font-size:26px !important; letter-spacing:.45em; text-align:center; font-variant-numeric:tabular-nums; padding:12px !important;}
  .countdown{font-variant-numeric:tabular-nums; font-weight:700;}
  .countdown.expired{color:var(--st-rechazada);}
  .linklike{background:none; border:none; padding:0; color:var(--brand-dark); font:inherit; font-size:13px; text-decoration:underline; cursor:pointer;}
  .linklike:disabled{color:var(--text-muted); cursor:default; text-decoration:none;}
  .pw-meter{height:5px; border-radius:3px; background:var(--surface-2); overflow:hidden;}
  .pw-meter > span{display:block; height:100%; width:0; transition:width .2s; background:var(--st-rechazada);}
  .inherited{background:var(--surface) !important; color:var(--text-muted) !important; cursor:not-allowed;}
  .user-chip{font-size:12px; opacity:.85; padding:8px 10px 0; word-break:break-all;}
  .sol-list{display:flex; flex-direction:column; gap:10px;}
  .sol-item{display:flex; justify-content:space-between; align-items:center; gap:12px; padding:14px 16px; border:1px solid var(--border); border-radius:var(--radius); background:var(--bg); cursor:pointer; text-align:left; font:inherit; color:inherit; width:100%;}
  .sol-item:hover{border-color:var(--brand-light);}
  .hidden{display:none !important;}
  .note-box{width:100%; font:inherit; font-size:13.5px; padding:8px 10px; border-radius:8px; border:1px solid var(--border); background:var(--bg); color:var(--text);}
  label.field input[type="password"], label.field input[type="search"], label.field input[type="number"]{
    font:inherit; font-size:14px; color:var(--text); background:var(--bg);
    border:1px solid var(--border); border-radius:8px; padding:9px 11px;
  }
