/* =========================================================
   Controles propios — GUIA_UI §12 (nada de interfaz del navegador)
   ========================================================= */

/* Menú desplegable */
.cs { position: relative; width: 100%; }
.cs-native { display: none !important; }
.cs-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 46px; padding: 0 12px 0 14px;
  border-radius: var(--r-sm); border: 1px solid var(--border-strong); background: var(--surface-2);
  color: var(--text); font: inherit; font-size: 16px; text-align: left; cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
}
.cs-btn:hover { border-color: var(--text-3); }
.cs-btn:focus-visible, .cs-btn.is-open { outline: none; border-color: var(--accent-ink); box-shadow: 0 0 0 3px var(--accent-soft); }
.cs-btn:disabled { opacity: .5; cursor: not-allowed; }
.cs-val { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-val.is-empty { color: var(--text-3); }
.cs-btn svg { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--text-3); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.cs-btn.is-open svg { transform: rotate(180deg); }
.ed-f .cs-btn { height: 42px; font-size: 15px; }
.has-err .cs-btn { border-color: #FF6B6B; }

.cs-list {
  position: fixed; z-index: 200; margin: 0; padding: 6px; list-style: none; overflow-y: auto;
  border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--border-strong);
  box-shadow: 0 20px 50px -12px rgba(0,0,0,.6); animation: csIn .14s var(--ease);
  overscroll-behavior: contain; font-family: var(--font);
}
@keyframes csIn { from { opacity: 0; transform: translateY(-4px); } }
.cs-opt { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 8px; font-size: 15px; color: var(--text); cursor: pointer; }
.cs-opt span { flex: 1; min-width: 0; }
.cs-opt.is-empty { color: var(--text-3); }
.cs-opt.is-active, .cs-opt:hover { background: var(--surface-2); }
.cs-opt.is-sel { font-weight: 700; }
.cs-opt svg { width: 16px; height: 16px; fill: none; stroke: var(--accent-ink); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

/* Paleta de color */
.cp { position: fixed; z-index: 200; width: 264px; padding: 12px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border-strong); box-shadow: 0 20px 50px -12px rgba(0,0,0,.6); animation: csIn .14s var(--ease); font-family: var(--font); }
.cp-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.cp-sw { aspect-ratio: 1; border-radius: 50%; border: 0; background: var(--c); box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), 0 0 0 1px var(--border); cursor: pointer; }
.cp-sw:hover { transform: scale(1.12); }
.cp-sw.is-sel { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }
.cp-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.cp-prev { width: 32px; height: 32px; flex: none; border-radius: 8px; background: var(--c); box-shadow: inset 0 0 0 1px rgba(255,255,255,.15); }
.cp-hex { flex: 1; min-width: 0; height: 36px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); font: inherit; font-size: 14px; font-family: ui-monospace, Menlo, monospace; text-transform: uppercase; }
.cp-hex:focus { outline: none; border-color: var(--accent-ink); }
.cp-ok { height: 36px; padding: 0 12px; border-radius: 8px; border: 0; background: var(--accent); color: #0A0A0A; font-weight: 700; font-size: 13px; cursor: pointer; }
.cp-err { display: block; margin-top: 6px; font-size: 12px; color: #FF6B6B; }
.cp-err[hidden] { display: none; }
/* La muestra de color nunca usa el estilo del sistema */
input[type="color"] { -webkit-appearance: none; appearance: none; padding: 4px; cursor: pointer; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--r-sm); }
input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 6px; }
input[type="color"]::-moz-color-swatch { border: 0; border-radius: 6px; }

/* Confirmación */
.ui-confirm { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 16px; }
.ui-confirm-bg { position: absolute; inset: 0; background: rgba(0,0,0,.6); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: fadeIn .2s; }
.ui-confirm-box { position: relative; width: min(420px, 100%); padding: 22px; border-radius: var(--r-lg); background: var(--bg); border: 1px solid var(--border-strong); box-shadow: 0 30px 80px -20px rgba(0,0,0,.7); animation: csIn .2s var(--ease); font-family: var(--font); color: var(--text); }
.ui-confirm-box h2 { font-size: 19px; font-weight: 800; line-height: 1.25; }
.ui-confirm-box p { margin-top: 8px; font-size: 15px; color: var(--text-2); }
.ui-confirm-acts { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.ui-confirm-acts .btn { height: 44px; }
.btn-danger { background: #E5484D; color: #fff; border-color: transparent; }
.btn-danger:hover { background: #F2555A; }
@media (max-width: 600px) { .ui-confirm { align-items: end; padding: 0; } .ui-confirm-box { width: 100%; border-radius: var(--r-xl) var(--r-xl) 0 0; padding-bottom: max(22px, env(safe-area-inset-bottom)); } .ui-confirm-acts .btn { flex: 1; } }

/* Autollenado del navegador: conserva nuestro estilo (sin cuadro blanco ni amarillo) */
input:-webkit-autofill, input:-webkit-autofill:hover, input:-webkit-autofill:focus,
textarea:-webkit-autofill, select:-webkit-autofill {
  -webkit-text-fill-color: var(--text) !important;
  caret-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--surface-2) inset !important;
  box-shadow: 0 0 0 1000px var(--surface-2) inset !important;
  transition: background-color 99999s ease-out 0s;
}
.login input:-webkit-autofill, .login input:-webkit-autofill:hover, .login input:-webkit-autofill:focus {
  -webkit-text-fill-color: #fff !important; caret-color: #fff;
  -webkit-box-shadow: 0 0 0 1000px #1f1f1f inset !important; box-shadow: 0 0 0 1000px #1f1f1f inset !important;
}
input:autofill { background: var(--surface-2); color: var(--text); }

/* Sin flechas en números ni controles del sistema */
input::-webkit-outer-spin-button, input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="search"]::-webkit-search-cancel-button, input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; }
input::-webkit-calendar-picker-indicator { display: none !important; }
input::-webkit-contacts-auto-fill-button, input::-webkit-credentials-auto-fill-button { visibility: hidden; pointer-events: none; position: absolute; right: 0; }
::-ms-reveal, ::-ms-clear { display: none; }

/* Barras de desplazamiento con el estilo de la app (sin flechas del sistema) */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: var(--text-3); }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }

/* Selección de texto con la marca */
::selection { background: rgba(153, 255, 0, .35); color: inherit; }
