/* Burever · Registro de presiones · Interfaz corporativa independiente.
   No depende de OAuth ni modifica el flujo del formulario. */
:root {
  color-scheme: light;
  --bv-bg:#f6f7f9;
  --bv-white:#fff;
  --bv-ink:#182230;
  --bv-muted:#667085;
  --bv-line:#dce2e9;
  --bv-line-soft:#edf0f3;
  --bv-primary:#2563eb;
  --bv-primary-hover:#1d4ed8;
  --bv-yellow:#f5b900;
  --bv-danger:#c73541;
  --bv-success:#08734c;
  --bv-radius:10px;
  font-family:"Segoe UI", Inter, system-ui, -apple-system, sans-serif;
}
*, *::before, *::after { box-sizing:border-box; }
html { min-height:100%; }
body { min-height:100dvh; margin:0; background:var(--bv-bg); color:var(--bv-ink); -webkit-font-smoothing:antialiased; overflow-x:hidden; }
button, input { font:inherit; }
button { -webkit-tap-highlight-color:transparent; }
button:focus-visible, input:focus-visible { outline:2px solid var(--bv-primary); outline-offset:2px; }

/* Encabezado compatible con la familia Burever */
.bv-topbar { height:65px; background:#fff; border-bottom:1px solid var(--bv-line-soft); }
.bv-topbar-inner { max-width:1180px; height:100%; margin:auto; padding:0 20px; display:flex; align-items:center; }
.bv-brand { display:flex; align-items:center; gap:11px; }
.bv-brand-mark { display:grid; place-items:center; width:35px; height:35px; border-radius:9px; background:var(--bv-yellow); color:#142033; font-size:17px; }
.bv-brand-copy { display:flex; flex-direction:column; line-height:1.25; }
.bv-brand-copy strong { font-weight:700; font-size:15px; letter-spacing:-.015em; }
.bv-brand-copy small { color:var(--bv-muted); font-size:11px; margin-top:3px; }

/* Formulario */
.app-container { width:min(100%,750px); margin:0 auto; padding:26px 20px max(30px,env(safe-area-inset-bottom)); }
.page-heading { margin-bottom:20px; }
.page-heading h1 { font-size:clamp(23px, 3.5vw, 27px); font-weight:700; letter-spacing:-.035em; line-height:1.2; margin:0; }
.page-heading p { margin:6px 0 0; font-size:13px; color:var(--bv-muted); }
.form-panel { border:1px solid var(--bv-line); background:#fff; border-radius:12px; padding:24px 28px 0; }
.form-section { padding:0 0 22px; margin:0 0 24px; border-bottom:1px solid var(--bv-line-soft); }
.form-section-last { border-bottom:0; margin-bottom:0; padding-bottom:20px; }
.section-heading { margin-bottom:17px; }
.section-heading h2 { display:flex; align-items:center; gap:10px; margin:0; font-size:14px; font-weight:700; letter-spacing:-.01em; color:#243247; }
.section-number { display:inline-grid; place-items:center; flex:0 0 29px; height:29px; border-radius:7px; border:1px solid #d9e0e8; color:#64748b; font-weight:750; font-size:11px; letter-spacing:0; }
.form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:15px; }
.field { display:flex; flex-direction:column; gap:7px; min-width:0; margin:0; }
.field > span:first-child, .field > label, .tolva-fieldset legend { font-size:12px; font-weight:650; color:#425166; margin:0; }
.field-full { grid-column:1 / -1; }
.tolva-fieldset { border:0; padding:0; min-width:0; }
.tolva-fieldset legend { float:none; width:auto; display:block; padding:0; margin:0 0 10px; }
.input-frame { position:relative; display:block; }
.input-affordance { pointer-events:none; position:absolute; top:50%; right:14px; transform:translateY(-50%); color:#8390a2; font-size:17px; }
.form-control { width:100%; min-height:46px; padding:10px 40px 10px 13px; border:1px solid #d5dde8; border-radius:9px; background:#fff; color:var(--bv-ink); font-size:14px; font-weight:600; }
.form-control:focus { border-color:#7ba3f6; box-shadow:0 0 0 3px rgba(37,99,235,.12); }
.form-control[readonly] { cursor:default; background:#f9fafc; }
.form-control::placeholder { color:#a3adba; font-weight:500; }
#matricula { text-align:left; letter-spacing:.03em; }
#presion { text-align:left; font-weight:700; }

/* Selectores de tolva y fechas */
.tolva-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.btn-tolva { min-width:0; min-height:47px; border-radius:9px; font-size:13px; font-weight:650; }
.btn.btn-outline-danger.btn-tolva { border:1px solid #d5dde8; color:#3e4d62; background:#fff; }
.btn.btn-outline-danger.btn-tolva:hover { border-color:#9db4ea; color:var(--bv-primary); background:#f7faff; }
.btn.btn-danger.btn-tolva, .btn-tolva.activa { border-color:var(--bv-primary) !important; background:var(--bv-primary) !important; color:#fff !important; }
.period-block { padding:0 0 15px; }
.period-block-end { padding:15px 0 0; border-top:1px solid var(--bv-line-soft); }
.period-heading { display:flex; align-items:center; gap:8px; font-size:12px; font-weight:700; color:#334155; margin-bottom:11px; }
.period-heading i { color:#7b899b; font-size:15px; }
.date-time-grid { display:grid; grid-template-columns:minmax(0,1.2fr) minmax(0,.8fr); gap:12px; }
.selector-btn { position:relative; min-width:0; width:100%; min-height:46px; padding:10px 28px 10px 12px; border:1px solid #d5dde8; border-radius:9px; background:#fff; color:var(--bv-ink); font-weight:600; font-size:13px; text-align:left; font-variant-numeric:tabular-nums; }
.selector-btn::after { content:"\f282"; font-family:"bootstrap-icons"; position:absolute; top:50%; right:11px; transform:translateY(-50%); font-weight:normal; color:#8795a5; font-size:12px; }
.selector-btn:hover { border-color:#a0b8e9; background:#f9fbff; }
.selector-btn:active { background:#f1f5fc; }
.field-note { display:flex; align-items:start; gap:7px; margin:14px 0 0; color:#667085; font-size:11.5px; line-height:1.5; }
.field-note i { margin-top:1px; }

/* Acciones */
.form-actions { display:grid; grid-template-columns: minmax(0,1fr) minmax(0,1.45fr); gap:10px; padding:19px 0 24px; border-top:1px solid var(--bv-line-soft); }
.btn { display:inline-flex; justify-content:center; align-items:center; gap:7px; font-size:13px; min-height:44px; border-radius:9px; font-weight:650; transition:background-color .15s,border-color .15s; }
.btn:focus { box-shadow:none; }
.btn.btn-danger:not(.btn-tolva) { background:var(--bv-primary); border-color:var(--bv-primary); color:#fff; }
.btn.btn-danger:not(.btn-tolva):hover { background:var(--bv-primary-hover); border-color:var(--bv-primary-hover); }
.btn.btn-outline-secondary { background:#fff; border:1px solid #d5dde8; color:#475467; }
.btn.btn-outline-secondary:hover { background:#f7f9fb; color:#243247; }
.resultado-box { display:none; padding:14px 16px; background:#fff; border:1px solid var(--bv-line); border-radius:10px; font-size:13px; color:#374151; white-space:pre-wrap; }

/* Selector inferior (fecha, hora, matrícula, presión y coincidencias) */
.picker-overlay { display:none; position:fixed; inset:0; z-index:2000; background:rgba(15,23,42,.49); }
.picker-overlay.visible { display:block; }
.picker-panel { position:fixed; z-index:2001; left:0; right:0; bottom:0; display:flex; flex-direction:column; width:min(100%,540px); margin:0 auto; max-height:min(86dvh,760px); background:#fff; border:1px solid var(--bv-line); border-bottom:0; border-radius:16px 16px 0 0; box-shadow:0 -12px 38px rgba(20,32,53,.15); padding:19px 19px max(16px,env(safe-area-inset-bottom)); transform:translateY(calc(100% + 12px)); visibility:hidden; pointer-events:none; transition:transform .22s ease,visibility .22s; }
.picker-panel.visible { transform:translateY(0); visibility:visible; pointer-events:auto; }
.picker-header { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; padding-bottom:14px; margin-bottom:15px; border-bottom:1px solid var(--bv-line-soft); }
.picker-title { margin:0; font-size:16px; font-weight:700; color:var(--bv-ink); }
.picker-subtitle { margin:5px 0 0; font-size:12px; color:var(--bv-muted); line-height:1.45; }
.picker-close { display:grid; place-items:center; width:38px; height:38px; flex:none; border:1px solid #e1e7ee; border-radius:9px; color:#435268; background:#fff; }
.picker-close:hover { background:#f3f5f8; }
.picker-content { overflow-y:auto; min-height:0; overscroll-behavior:contain; padding:0 0 5px; }
.fecha-grid { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:7px; }
.fecha-option { min-width:0; min-height:70px; border:1px solid #d9e0e8; border-radius:9px; padding:9px 3px; background:#fff; color:var(--bv-ink); font-weight:650; text-align:center; line-height:1.2; }
.fecha-option:hover { background:#f8faff; }
.fecha-option.activa { background:var(--bv-primary); color:#fff; border-color:var(--bv-primary); }
.fecha-dia { display:block; font-size:20px; font-weight:750; }
.fecha-mes-anio { display:block; margin-top:3px; font-size:10px; opacity:.85; }
.time-step-label, .campo-keypad-label { margin-bottom:10px; font-size:13px; font-weight:700; color:#3e4b60; }
.time-display, .campo-keypad-display { background:#f5f7fa; border:1px solid #e0e6ec; border-radius:10px; text-align:center; padding:17px 10px; margin-bottom:12px; min-height:80px; }
.time-display-main, .campo-keypad-display { font-size:36px; font-weight:750; letter-spacing:.12em; color:var(--bv-ink); font-variant-numeric:tabular-nums; }
.time-display-main { line-height:1.2; }
.time-display-sub, .time-help { margin-top:6px; font-size:11px; color:var(--bv-muted); }
.time-error, .campo-keypad-error { min-height:17px; font-size:12px; font-weight:650; color:var(--bv-danger); text-align:center; margin-bottom:9px; }
.numeric-grid, .campo-numeros-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:9px; }
.numeric-key, .campo-numero-btn { min-height:55px; border:1px solid #e1e7ef; border-radius:10px; background:#f7f8fa; color:#243247; font-size:21px; font-weight:650; }
.numeric-key:hover, .campo-numero-btn:hover { background:#eef2f8; }
.numeric-key:active, .campo-numero-btn:active { background:#e3eaf7; }
.numeric-key.action, .campo-accion-btn { background:#e9edf3; font-size:17px; }
.numeric-key.danger-action { color:var(--bv-danger); }
.numeric-key.empty { visibility:hidden; }
.campo-numero-btn.campo-ok-btn, .campo-ok-btn { color:#fff; background:var(--bv-primary); border-color:var(--bv-primary); font-size:16px; }
.campo-numero-btn.campo-ok-btn:hover { background:var(--bv-primary-hover); }
.campo-limpiar-btn { width:100%; min-height:42px; margin-top:10px; border:1px solid #d8e0e8; border-radius:9px; background:#fff; color:var(--bv-danger); font-weight:650; }

/* Confirmación del envío que ya implementa la aplicación */
.envio-overlay { display:none; position:fixed; inset:0; z-index:3000; padding:16px; align-items:center; justify-content:center; background:rgba(15,23,42,.52); }
.envio-overlay.visible { display:flex; }
.envio-card { width:min(100%,335px); padding:25px 22px 22px; background:#fff; border:1px solid var(--bv-line); border-radius:12px; text-align:center; box-shadow:0 16px 60px rgba(17,24,39,.19); }
.envio-loader { width:40px; height:40px; margin:0 auto 18px; border:3px solid #e5ebf3; border-top-color:var(--bv-primary); border-radius:50%; animation:envioGirar .8s linear infinite; }
.envio-icono { display:none; width:48px; height:48px; align-items:center; justify-content:center; border-radius:50%; margin:0 auto 16px; font-size:27px; font-weight:700; }
.envio-overlay.exito .envio-loader, .envio-overlay.error .envio-loader { display:none; }
.envio-overlay.exito .envio-icono, .envio-overlay.error .envio-icono { display:flex; }
.envio-overlay.exito .envio-icono { color:var(--bv-success); background:#eaf8f1; }
.envio-overlay.error .envio-icono { color:var(--bv-danger); background:#fff0f1; }
.envio-titulo { margin:0; font-size:17px; font-weight:700; color:var(--bv-ink); }
.envio-texto { margin:8px 0 0; font-size:13px; color:var(--bv-muted); line-height:1.5; }
.envio-ok-btn { display:none; justify-content:center; align-items:center; width:100%; min-height:42px; margin-top:20px; background:var(--bv-primary); border:1px solid var(--bv-primary); border-radius:9px; color:#fff; font-size:13px; font-weight:650; }
@keyframes envioGirar { to { transform:rotate(360deg); } }

@media (max-width:600px) {
 .bv-topbar-inner { padding:0 14px; }
 .app-container { padding:20px 13px max(24px,env(safe-area-inset-bottom)); }
 .page-heading { margin-bottom:17px; }
 .form-panel { padding:21px 16px 0; }
 .form-section { margin-bottom:21px; padding-bottom:19px; }
 .form-section-last { margin-bottom:0; }
 .form-grid { grid-template-columns:1fr; gap:13px; }
 .date-time-grid { gap:9px; }
 .selector-btn { padding-left:10px; padding-right:23px; font-size:12px; }
 .section-heading { margin-bottom:15px; }
 .tolva-grid { gap:7px; }
 .btn-tolva { min-height:45px; font-size:12px; }
 .form-actions { gap:8px; padding:16px 0 20px; }
 .form-actions .btn { font-size:12px; }
 .picker-panel { padding:17px 14px max(16px,env(safe-area-inset-bottom)); }
}
@media (max-width:350px) {
 .app-container { padding-inline:9px; }
 .form-panel { padding-inline:12px; }
 .date-time-grid { gap:7px; }
 .fecha-grid { gap:4px; }
 .fecha-option { padding:7px 2px; font-size:11px; }
 .fecha-dia { font-size:17px; }
 .fecha-mes-anio { font-size:9px; }
 .numeric-key, .campo-numero-btn { min-height:50px; }
}
@media (prefers-reduced-motion:reduce) { *,*::before,*::after { scroll-behavior:auto!important; animation-duration:.01ms!important; transition-duration:.01ms!important; } }

/* Coincidencias de embarcaciones: selección coherente con Burever */
.picker-content .btn.btn-outline-danger { width:100%; justify-content:flex-start; text-align:left; background:#fff; border:1px solid #d5dde8; color:#334155; padding:12px 14px; font-size:13px; line-height:1.55; }
.picker-content .btn.btn-outline-danger:hover { background:#f7faff; border-color:#a0b8e9; color:var(--bv-primary); }
.picker-content .btn.btn-outline-danger span { color:var(--bv-muted); font-size:11px; }


/* ERP/Presiones · Listado de miniaturas y formularios por capas */
.records-heading {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  margin-bottom:28px;
}
.records-heading h1 { margin:0; font-size:26px; }
.records-new.btn {
  flex:none;
  min-height:43px;
  padding:9px 16px;
  border:1px solid var(--bv-primary);
  background:var(--bv-primary);
  color:#fff;
  font-weight:650;
  border-radius:9px;
}
.records-new.btn:hover { background:var(--bv-primary-hover); border-color:var(--bv-primary-hover); color:#fff; }
.records-label-row {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin:0 0 4px;
}
.records-label-row h2 { margin:0; font-size:15px; font-weight:700; }
.records-count { color:var(--bv-muted); font-size:12px; white-space:nowrap; font-variant-numeric:tabular-nums; }
.records-source { font-size:12px; color:var(--bv-muted); margin:0 0 15px; }
.records-list { display:grid; gap:10px; }
.presion-miniatura {
  width:100%;
  display:flex;
  align-items:center;
  gap:14px;
  min-height:103px;
  background:#fff;
  text-align:left;
  padding:15px;
  border:1px solid var(--bv-line);
  border-radius:11px;
  color:var(--bv-ink);
  transition:border-color .15s, background-color .15s, transform .15s;
}
.presion-miniatura:hover { border-color:#b0c0d5; background:#fcfdff; }
.presion-miniatura:active { transform:scale(.996); }
.miniatura-icon {
  display:grid;
  place-items:center;
  width:46px;
  height:46px;
  flex:0 0 46px;
  border:1px solid #e1e6ed;
  border-radius:10px;
  background:#f7f8fa;
  font-size:21px;
  color:#334155;
}
.miniatura-copy { display:flex; flex:1; min-width:0; flex-direction:column; gap:3px; }
.miniatura-titulo { font-size:15px; font-weight:700; overflow-wrap:anywhere; }
.miniatura-meta { font-size:12px; font-weight:600; color:#475569; }
.miniatura-fecha { font-size:11px; color:#748094; font-variant-numeric:tabular-nums; }
.miniatura-trailing { display:flex; flex-direction:column; align-items:flex-end; justify-content:center; gap:9px; flex:none; }
.miniatura-trailing .bi { color:#9aa5b5; font-size:13px; }
.miniatura-status { color:#08734c; font-size:11px; font-weight:700; }
.records-empty {
  display:flex;
  flex-direction:column;
  align-items:center;
  text-align:center;
  justify-content:center;
  gap:9px;
  padding:38px 20px;
  min-height:215px;
  border:1px dashed #cfd6e0;
  background:#fff;
  border-radius:11px;
}
.records-empty[hidden] { display:none; }
.records-empty i { color:#8a96a8; font-size:25px; }
.records-empty strong { font-size:14px; font-weight:700; }
.records-empty span { font-size:12px; color:var(--bv-muted); }

/* Modal de registro: por debajo del selector de fecha y del aviso de envío */
.presiones-ventana-abierta { overflow:hidden; }
.editor-layer,.detalle-layer { position:fixed; inset:0; z-index:1050; display:flex; align-items:center; justify-content:center; padding:20px; }
.editor-layer[hidden],.detalle-layer[hidden] { display:none!important; }
.editor-backdrop,.detalle-backdrop { position:absolute; inset:0; background:rgba(15,23,42,.42); }
.editor-panel,.detalle-panel {
  position:relative;
  display:flex;
  flex-direction:column;
  width:min(100%,760px);
  max-height:min(93dvh,980px);
  min-height:0;
  background:#fff;
  border-radius:14px;
  border:1px solid #e2e6eb;
  overflow:hidden;
  box-shadow:0 20px 60px rgba(12,22,38,.22);
}
.editor-header {
  flex:0 0 auto;
  min-height:66px;
  padding:13px 20px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  border-bottom:1px solid var(--bv-line-soft);
  background:#fff;
}
.editor-header h2 { margin:0; font-weight:700; font-size:17px; color:var(--bv-ink); }
.editor-close {
  display:grid;
  place-items:center;
  width:39px;
  height:39px;
  flex:0 0 39px;
  border-radius:9px;
  border:1px solid #dce2e9;
  background:#fff;
  color:#334155;
  font-size:17px;
}
.editor-close:hover { background:#f5f7fa; }
.editor-content,.detalle-content { overflow-y:auto; min-height:0; padding:20px; overscroll-behavior:contain; }
.editor-content .form-panel { padding:23px 25px 0; }
.detalle-panel { width:min(100%,475px); }
.detalle-content { padding:22px; }
.detalle-titulo { display:flex; flex-direction:column; gap:7px; padding-bottom:17px; }
.detalle-label { color:var(--bv-muted); font-size:12px; font-weight:650; }
.detalle-titulo strong { font-size:22px; letter-spacing:-.02em; }
.detalle-status { display:flex; align-items:center; gap:6px; color:var(--bv-success); font-size:12px; font-weight:700; }
.detalle-datos { margin:0; padding:0; border-top:1px solid var(--bv-line-soft); }
.detalle-datos>div { display:flex; align-items:flex-start; justify-content:space-between; gap:15px; padding:13px 0; border-bottom:1px solid var(--bv-line-soft); }
.detalle-datos dt { color:var(--bv-muted); font-size:12px; font-weight:600; }
.detalle-datos dd { margin:0; font-size:13px; font-weight:700; text-align:right; font-variant-numeric:tabular-nums; }
.detalle-nota { font-size:11px; line-height:1.5; color:var(--bv-muted); margin:18px 0; }
.detalle-volver { width:100%; min-height:44px; }

@media (max-width:600px) {
  .records-heading { margin-bottom:26px; align-items:center; }
  .records-heading h1 { font-size:24px; }
  .records-new.btn { padding:9px 12px; font-size:12px; }
  .presion-miniatura { padding:13px 12px; gap:11px; min-height:96px; }
  .miniatura-icon { flex-basis:41px; width:41px; height:41px; font-size:19px; }
  .miniatura-titulo { font-size:13px; }
  .miniatura-meta { font-size:11px; }
  .miniatura-fecha { font-size:10px; }
  .editor-layer,.detalle-layer { padding:0; }
  .editor-panel,.detalle-panel { width:100%; max-height:100dvh; height:100dvh; border:0; border-radius:0; }
  .editor-header { min-height:64px; padding:12px 16px; }
  .editor-content,.detalle-content { padding:15px 13px max(18px,env(safe-area-inset-bottom)); }
  .editor-content .form-panel { padding:20px 15px 0; }
}
@media (max-width:350px) {
  .records-heading h1 { font-size:21px; }
  .records-new.btn { padding-inline:10px; }
  .miniatura-trailing { gap:6px; }
  .miniatura-status { font-size:10px; }
}

/* ERP/Presiones · digitación estándar Burever (DDMM y HHMM). */
.erp-rapido { font-variant-numeric:tabular-nums; letter-spacing:.025em; padding-right:12px; }
#matricula, #presion { padding-right:12px; }
.erp-rapido:focus, #matricula:focus, #presion:focus { outline:0; }

/* ERP/Presiones v11: edición puntual de presión, mismo patrón AFID/PMO. */
.erp-presion-edicion { display:flex; align-items:center; gap:8px; min-width:0; }
.erp-presion-edicion #presion { min-width:0; flex:1 1 auto; }
.erp-presion-editar {
  display:grid; place-items:center; flex:0 0 44px; width:44px; height:44px;
  border:1px solid #ccd6e3; border-radius:9px; color:#53667f;
  background:#fff; font-size:18px; cursor:pointer;
}
.erp-presion-editar:hover:not(:disabled) { background:#edf3f7; }
.erp-presion-editar.guardando-presion { color:#1d4ed8; border-color:#93b4eb; background:#eff6ff; }
.erp-presion-editar:disabled { opacity:.45; cursor:not-allowed; }
.erp-presion-edicion #presion[readonly] { background:#f9fafc; }
