:root {
  --background: #f4f6f8;
  --foreground: #0f172a;
  --card: #ffffff;
  --card-foreground: #0f172a;
  --muted: #64748b;
  --muted-bg: #e8edf2;
  --border: #d0d7de;
  --input: #d0d7de;
  --ring: #b45309;
  --primary: #b45309;
  --primary-foreground: #fffbeb;
  --secondary: #1e293b;
  --secondary-foreground: #f8fafc;
  --destructive: #b91c1c;
  --success: #047857;
  --radius: 0.5rem;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.06);
  --font: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Evita que display:grid/flex anule [hidden] y apile vistas */
[hidden],
.is-hidden {
  display: none !important;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--foreground);
  background: var(--background);
}

html {
  overflow-x: auto;
  overflow-y: scroll;
}

body {
  min-height: 100vh;
  overflow: visible;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.02em;
}

p {
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--muted-bg);
  padding: 0.1rem 0.35rem;
  border-radius: 0.25rem;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.85rem;
}

.brand-mark {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
  font-weight: 500;
  margin: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  background: var(--muted-bg);
  color: var(--secondary);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}

.error {
  color: var(--destructive);
  font-size: 0.9rem;
}

.ok {
  color: var(--success);
  font-size: 0.9rem;
}

.hint {
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: 0.85rem;
}

/* Buttons — shadcn-like */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid transparent;
  padding: 0.55rem 1rem;
  font-weight: 560;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, opacity 0.15s;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-foreground);
}

.btn-primary:hover:not(:disabled) {
  background: #92400e;
}

.btn-outline {
  background: transparent;
  border-color: var(--border);
  color: var(--foreground);
}

.btn-outline:hover:not(:disabled) {
  background: var(--muted-bg);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--foreground);
  background: var(--muted-bg);
}

.btn-destructive {
  background: transparent;
  border-color: #fecaca;
  color: var(--destructive);
}

.btn-destructive:hover:not(:disabled) {
  background: #fef2f2;
}

.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.85rem;
}

.btn-icon {
  padding: 0.32rem;
  min-width: 2.15rem;
  min-height: 2.15rem;
}

.icon {
  width: 1.05rem;
  height: 1.05rem;
  flex-shrink: 0;
  display: block;
}

.btn-block {
  width: 100%;
}

/* Forms */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field label {
  font-size: 0.85rem;
  font-weight: 560;
}

.field input,
.field select,
.field textarea {
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  background: #fff;
  padding: 0.6rem 0.75rem;
  outline: none;
  color: var(--foreground);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.18);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.grid-2,
.grid-3 {
  display: grid;
  gap: 0.9rem;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}

/* Login */
.login-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 440px) 1fr;
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 2.5rem;
  background: #fff;
  border-right: 1px solid var(--border);
}

.brand-block {
  margin-bottom: 1.75rem;
}

.brand-block h1 {
  margin-top: 0.75rem;
  font-size: clamp(1.7rem, 2.5vw, 2.15rem);
}

.brand-block .muted {
  margin-top: 0.45rem;
}

.login-visual {
  background:
    linear-gradient(145deg, rgba(15, 23, 42, 0.72), rgba(180, 83, 9, 0.45)),
    radial-gradient(circle at 20% 20%, rgba(251, 191, 36, 0.35), transparent 45%),
    linear-gradient(160deg, #1e293b, #0f172a 55%, #78350f);
  position: relative;
  overflow: hidden;
}

.login-visual::after {
  content: "";
  position: absolute;
  inset: 12% 10%;
  border: 1px solid rgba(255, 251, 235, 0.18);
  border-radius: 1rem;
  background:
    repeating-linear-gradient(
      -18deg,
      transparent,
      transparent 14px,
      rgba(255, 251, 235, 0.04) 14px,
      rgba(255, 251, 235, 0.04) 15px
    );
}

/* App shell */
.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 240px 1fr;
}

.sidebar {
  background: #0f172a;
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem;
  gap: 1.25rem;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.25rem 0.35rem;
}

.sidebar .brand-mark {
  color: #fbbf24;
}

.sidebar .badge {
  align-self: flex-start;
  background: rgba(251, 191, 36, 0.12);
  border-color: rgba(251, 191, 36, 0.35);
  color: #fde68a;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.nav-item {
  text-align: left;
  background: transparent;
  border: none;
  color: #cbd5e1;
  padding: 0.65rem 0.75rem;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  font-weight: 520;
}

.nav-item:hover {
  background: rgba(248, 250, 252, 0.06);
  color: #fff;
}

.nav-item.active {
  background: rgba(180, 83, 9, 0.9);
  color: #fffbeb;
}

.sidebar-foot {
  border-top: 1px solid rgba(248, 250, 252, 0.1);
  padding-top: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.session-name {
  font-weight: 600;
  font-size: 0.92rem;
  overflow-wrap: break-word;
}

.sidebar .muted {
  color: #94a3b8;
}

.main {
  padding: 1.5rem 1.75rem 2rem;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.15rem;
}

.page-head h2 {
  font-size: 1.45rem;
}

.page-head .muted {
  margin-top: 0.3rem;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.card-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
  display: grid;
  gap: 0.55rem;
}

.card-item-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
}

.card-item h3 {
  font-size: 1.02rem;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.9rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.pill-bajo {
  background: #ecfdf5;
  color: #047857;
  border-color: #a7f3d0;
}

.pill-medio {
  background: #fffbeb;
  color: #b45309;
  border-color: #fde68a;
}

.pill-alto {
  background: #fff7ed;
  color: #c2410c;
  border-color: #fed7aa;
}

.pill-critico {
  background: #fef2f2;
  color: #b91c1c;
  border-color: #fecaca;
}

.empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  background: #fff;
}

/* Admin stats */
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.15rem;
}

.stats-row-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.company-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.85rem;
}

.company-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
  display: grid;
  gap: 0.75rem;
  align-content: start;
}

.company-logo {
  width: 100%;
  height: 72px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  padding: 0.5rem;
}

.company-logo.placeholder {
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--muted-bg);
}

.company-code {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  color: var(--primary);
  margin: 0 0 0.2rem;
}

.company-code-missing {
  color: var(--destructive);
}

.badge-southern {
  background: rgba(180, 83, 9, 0.12);
  border-color: rgba(180, 83, 9, 0.35);
  color: #92400e;
}

.check-inline {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.92rem;
  margin-top: 0.15rem;
}

.info-banner {
  background: #fffbeb;
  border-color: #fde68a;
  margin-bottom: 1rem;
}

.org-tree {
  display: grid;
  gap: 0.75rem;
}

.org-node {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  padding: 0.75rem;
}

.org-gerencia {
  box-shadow: var(--shadow);
}

.org-node-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
}

.org-node-head strong {
  display: inline-block;
  margin: 0 0.35rem;
}

.org-children {
  margin-top: 0.65rem;
  margin-left: 0.85rem;
  display: grid;
  gap: 0.55rem;
  border-left: 2px solid var(--muted-bg);
  padding-left: 0.75rem;
}

.org-super {
  background: #f8fafc;
}

.org-depto {
  background: #fff;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
}

.stat-value {
  margin-top: 0.35rem;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
}

/* ========== Selector de tema (eliminado: solo blanco) ========== */
.login-theme-row {
  display: none;
}

/* ========== Documento Permiso Izaje — formato FIJO (tipo Word) ========== */
.form-doc.op-body,
.op-body.form-doc {
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 1rem 0.75rem 6.25rem;
}

.form-doc {
  max-width: none;
  width: 100%;
  box-sizing: border-box;
  color: #0f172a;
  overflow: visible;
}

.form-doc .doc-sheet {
  width: 980px;
  min-width: 980px;
  max-width: none;
  margin: 0;
  box-sizing: border-box;
  padding: 0 0.25rem;
  transform-origin: top left;
}

.doc-zoom-port {
  width: 100%;
  overflow: visible;
}

.doc-zoom-inner {
  position: relative;
}

@media (max-width: 1023px) {
  .op-shell,
  .form-doc {
    overflow: visible;
  }

  .form-doc {
    padding: 0.5rem 0.35rem 7.25rem;
  }

  .doc-zoom-port.is-zooming {
    overflow: visible;
  }

  .doc-zoom-port.is-zooming .doc-sheet {
    position: absolute;
    top: 0;
    left: 0;
  }
}

@media (min-width: 1024px) {
  .form-doc .doc-sheet {
    margin-left: auto;
    margin-right: auto;
  }
}

.form-doc .doc-scroll {
  display: contents;
}

.form-doc .doc-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
  margin-bottom: 0.65rem;
  background: #fff;
  font-size: 0.82rem;
  table-layout: fixed;
}

.form-doc .doc-table th,
.form-doc .doc-table td {
  border: 1px solid #94a3b8;
  padding: 0.4rem 0.45rem;
  vertical-align: middle;
  color: #0f172a;
  min-width: 0;
  overflow-wrap: break-word;
  word-wrap: break-word;
  hyphens: manual;
}

.form-doc .doc-table th {
  background: #f1f5f9;
  font-weight: 650;
  text-align: left;
  white-space: normal;
  line-height: 1.25;
}

.form-doc .label-col {
  width: 23%;
  min-width: 0;
  white-space: normal;
  line-height: 1.28;
}

.form-doc .doc-header td {
  text-align: center;
  vertical-align: middle;
}

.form-doc .doc-logo-cell {
  width: 22%;
  background: #fff;
}

.form-doc .doc-logo {
  max-width: 120px;
  max-height: 56px;
  object-fit: contain;
}

.form-doc .doc-logo-ph {
  color: #dc2626;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
}

.form-doc .doc-title-cell {
  width: 56%;
}

.form-doc .doc-title-top {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
  line-height: 1.3;
  overflow-wrap: break-word;
}

.form-doc .doc-title-main {
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: 0.02em;
  line-height: 1.25;
  overflow-wrap: break-word;
}

.form-doc .doc-code-cell {
  width: 22%;
  vertical-align: middle;
  text-align: center;
}

.form-doc .doc-code-cell .doc-code-value,
.form-doc .doc-code-cell .doc-input[readonly].doc-code-value {
  background: transparent;
  border: none;
  margin: 0;
  padding: 0;
  color: #0f172a;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-align: center;
  cursor: default;
}

.form-doc .doc-input {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  border: none;
  background: transparent;
  color: #0f172a;
  padding: 0.25rem 0.2rem;
  outline: none;
  font: inherit;
  box-sizing: border-box;
}

.form-doc input[type="date"],
.form-doc input[type="time"],
.form-doc select.doc-input {
  max-width: 100%;
  min-width: 0;
}

.form-doc input[type="date"]::-webkit-datetime-edit,
.form-doc input[type="time"]::-webkit-datetime-edit {
  min-width: 0;
  overflow: hidden;
}

.form-doc .doc-input[readonly] {
  background: #f1f5f9;
  color: #334155;
  cursor: default;
}

.form-doc select.doc-input {
  background: #fff;
}

.form-doc textarea.doc-input {
  resize: vertical;
  min-height: 2.4rem;
}

.form-doc .doc-section-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.45rem;
  background: #e2e8f0;
  border: 1px solid #94a3b8;
  border-bottom: none;
  padding: 0.45rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.3;
  margin-top: 0.75rem;
  color: #0f172a;
  overflow-wrap: break-word;
}

.form-doc .doc-section-title .doc-section-label {
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: break-word;
}

.form-doc .doc-section-title .doc-section-note {
  font-weight: 500;
  color: #64748b;
  text-transform: none;
}

.form-doc .unit {
  display: block;
  font-size: 0.7rem;
  font-weight: 500;
  color: #64748b;
}

.form-doc .hl {
  background: #fff;
  color: inherit;
}

.form-doc .hl .doc-input {
  color: inherit;
  font-weight: 650;
}

.form-doc .muted-cell {
  color: #64748b;
  font-size: 0.72rem;
  text-align: center;
}

.form-doc .scheme-cell {
  text-align: center;
  width: 20%;
  min-width: 0;
  background: #fafbfc;
  vertical-align: middle;
  padding: 0.35rem 0.25rem;
}

.form-doc .doc-maneuver .man-pos { width: 24%; }
.form-doc .doc-maneuver .man-val { width: 16%; }
.form-doc .doc-maneuver .man-sch { width: 22%; }

.form-doc .doc-maneuver thead th {
  text-align: center;
  font-size: 0.75rem;
  line-height: 1.2;
  padding: 0.4rem 0.3rem;
}

.form-doc .doc-maneuver td:first-child {
  line-height: 1.28;
  padding: 0.42rem 0.5rem;
}

.form-doc .doc-maneuver td:first-child .muted.small {
  display: block;
  margin-top: 0.12rem;
  line-height: 1.25;
}

.form-doc .crane-scheme {
  width: 176px;
  height: auto;
  aspect-ratio: 1;
  max-width: 100%;
  color: #64748b;
  display: block;
  margin: 0 auto;
  cursor: crosshair;
}

.form-doc .scheme-wrap {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 0.1rem;
  min-height: 100%;
  user-select: none;
  touch-action: pan-y pinch-zoom;
  cursor: grab;
}

.form-doc .scheme-wrap.is-rotating {
  cursor: grabbing;
  touch-action: none;
}

.form-doc .scheme-caption {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.15rem 0.2rem 0.05rem;
  font-size: 0.62rem;
  color: #94a3b8;
  margin: 0;
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.25;
  text-align: center;
  overflow-wrap: anywhere;
}

.form-doc .scheme-cap-side,
.form-doc .scheme-cap-vals {
  display: block;
  max-width: 100%;
}

.boom-line.boom-pulse {
  animation: boom-pulse 0.4s ease-out;
}

@keyframes boom-pulse {
  0% { stroke-width: 3.4; opacity: 0.4; }
  100% { stroke-width: 2.2; opacity: 1; }
}

.param-chip {
  display: flex;
  flex-wrap: wrap;
  flex-direction: row;
  align-items: baseline;
  justify-content: center;
  column-gap: 0.25rem;
  row-gap: 0.05rem;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 1px dashed #94a3b8;
  background: #fff;
  border-radius: 0.35rem;
  padding: 0.35rem 0.3rem;
  cursor: pointer;
  font: inherit;
  color: #1d4ed8;
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
  overflow-wrap: anywhere;
  transition: background 0.15s, border-color 0.15s;
}

.param-chip:hover {
  background: #eff6ff;
  border-color: #3b82f6;
}

.param-chip .param-val {
  min-width: 0;
  overflow-wrap: anywhere;
}

.param-chip .param-unit {
  color: #64748b;
  font-weight: 500;
  font-size: 0.85em;
  font-style: italic;
  min-width: 0;
  overflow-wrap: anywhere;
}

.param-chip .param-unit:empty {
  display: none;
}

.param-chip .param-unit.is-avail {
  font-size: 0.78em;
}

.param-chip .param-sub {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  font-style: italic;
  color: #64748b;
}

.param-chip-ro {
  cursor: pointer;
  border-style: solid;
  border-color: #e2e8f0;
  background: #f8fafc;
  color: #334155;
}

.param-chip-view:hover {
  border-color: #3b82f6;
  background: #eff6ff;
}

.dlg-tabla-carga {
  max-width: min(920px, 96vw);
}

.load-chart-wrap {
  overflow: auto;
  max-height: 60vh;
}

.load-chart-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.78rem;
}

.load-chart-table th,
.load-chart-table td {
  border: 1px solid #cbd5e1;
  padding: 0.35rem 0.4rem;
  text-align: center;
  vertical-align: middle;
}

.load-chart-table thead th {
  background: #1e3a5f;
  color: #fff;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}

.load-chart-table tbody th {
  background: #f1f5f9;
  font-weight: 600;
  white-space: nowrap;
}

.load-cell {
  cursor: pointer;
  background: #fff;
  min-width: 5.5rem;
}

.load-cell:hover {
  background: #eff6ff;
  outline: 2px solid #3b82f6;
  outline-offset: -2px;
}

.load-cell.is-hit {
  background: #dcfce7;
  outline: 2px solid #16a34a;
  outline-offset: -2px;
}

.load-cell .lc-ang {
  display: block;
  color: #1d4ed8;
  font-weight: 650;
}

.load-cell .lc-cap {
  display: block;
  color: #166534;
  font-size: 0.72rem;
}

.load-chart-table .empty-cell {
  color: #94a3b8;
  background: #f8fafc;
}

.param-chip-ro.param-chip-cap {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #334155;
}

.bloque-maniobra.is-hidden {
  display: none !important;
}

.maneuver-lookup-msg {
  margin: 0.4rem 0;
  padding: 0.5rem 0.65rem;
  border-radius: 0.35rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
  font-size: 0.82rem;
}

.maneuver-lookup-msg.is-error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.data-table th,
.data-table td {
  border: 1px solid #e2e8f0;
  padding: 0.35rem 0.45rem;
  text-align: left;
}

.data-table th {
  background: #f1f5f9;
}

.param-chip-angle {
  flex-direction: row;
  gap: 0.15rem;
}

.maneuver-critico {
  margin: 0.4rem 0 0.6rem;
  padding: 0.55rem 0.75rem;
  background: #fef9c3;
  border: 1px solid #eab308;
  border-radius: 0.4rem;
  font-size: 0.88rem;
}

.doc-section-title .info-tip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 1.35rem;
  height: 1.35rem;
  margin-left: 0;
  border-radius: 999px;
  border: 1px solid #94a3b8;
  background: #fff;
  color: #1d4ed8;
  font-weight: 700;
  font-size: 0.75rem;
  cursor: pointer;
  vertical-align: middle;
}

.tip-label {
  cursor: help;
  border-bottom: 1px dotted #64748b;
  white-space: normal;
  overflow-wrap: break-word;
}

.tip-i {
  display: inline-flex;
  width: 0.95rem;
  height: 0.95rem;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #e2e8f0;
  color: #334155;
  font-style: normal;
  font-size: 0.65rem;
  font-weight: 700;
  margin-left: 0.15rem;
}

.tip-pop {
  position: fixed;
  z-index: 80;
  max-width: 280px;
  padding: 0.65rem 0.75rem;
  background: #0f172a;
  color: #f8fafc;
  border-radius: 0.4rem;
  font-size: 0.8rem;
  line-height: 1.35;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.25);
  pointer-events: none;
}

.tip-pop code {
  font-size: 0.75rem;
  color: #93c5fd;
}

.maneuver-help {
  margin: 0.5rem 0 0.85rem;
  padding: 0.75rem;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 0.45rem;
}

.help-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
}

.help-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.4rem;
  padding: 0.65rem 0.75rem;
  font-size: 0.8rem;
}

.help-card h4 {
  margin: 0 0 0.35rem;
  font-size: 0.82rem;
}

.help-card ul {
  margin: 0;
  padding-left: 1.1rem;
}

.help-formula {
  font-family: "IBM Plex Mono", monospace;
  background: #eff6ff;
  padding: 0.35rem 0.5rem;
  border-radius: 0.3rem;
  color: #1d4ed8;
}

.help-warn {
  background: #fef9c3;
  border-left: 3px solid #eab308;
  padding: 0.4rem 0.5rem;
  margin: 0.4rem 0 0;
}

.dlg-angulo {
  max-width: min(420px, 94vw);
}

.angle-wheel-wrap {
  display: grid;
  justify-items: center;
  gap: 0.35rem;
}

#angle-wheel {
  touch-action: none;
  cursor: crosshair;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 1px #e2e8f0;
}

.angle-readout {
  font-size: 1.5rem;
  font-weight: 700;
  color: #1d4ed8;
  margin: 0;
}

@media (max-width: 900px) {
  .help-grid {
    grid-template-columns: 1fr;
  }
}

.form-doc .doc-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.form-doc .carga-table {
  margin-top: 0.75rem;
  margin-bottom: 0.65rem;
}

.form-doc .carga-table th {
  white-space: normal;
  line-height: 1.25;
  font-size: 0.78rem;
}

.form-doc .carga-table .carga-block-title,
.form-doc .elem-config-table .carga-block-title {
  text-align: center;
  background: #e2e8f0;
  font-weight: 700;
  letter-spacing: 0.03em;
  height: auto;
  padding: 0.4rem 0.55rem;
}

.form-doc .carga-l-label { width: 28%; }
.form-doc .carga-l-val { width: 22%; }
.form-doc .carga-r-label { width: 28%; }
.form-doc .carga-r-val { width: 22%; }

.form-doc .carga-table tbody th,
.form-doc .carga-table tbody td {
  height: auto;
  min-height: 2.55rem;
  padding: 0.32rem 0.4rem;
}

.form-doc .carga-q {
  white-space: normal;
  vertical-align: middle;
  font-size: 0.74rem;
}

.form-doc .si-block {
  padding: 0;
  vertical-align: stretch;
}

.form-doc .si-mini {
  width: 100%;
  height: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.form-doc .si-mini th,
.form-doc .si-mini td {
  border: none;
  border-right: 1px solid #94a3b8;
  height: auto;
}

.form-doc .si-mini th:last-child,
.form-doc .si-mini td:last-child {
  border-right: none;
}

.form-doc .si-mini tr:first-child th {
  border-bottom: 1px solid #94a3b8;
}

.form-doc .si-head {
  text-align: center;
  font-size: 0.78rem;
  padding: 0.2rem;
}

.form-doc .si-mark {
  text-align: center;
  font-size: 1.15rem;
  font-weight: 800;
  min-height: 1.8rem;
  vertical-align: middle;
}

.form-doc .si-mark.is-on {
  background: #fff;
  color: #0f172a;
}

.form-doc .carga-table .param-chip {
  min-height: 2.1rem;
}

.form-doc .carga-table .param-chip-ro[tabindex="-1"] {
  cursor: default;
}

.form-doc .carga-table .param-chip-ro[tabindex="-1"]:hover {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.form-doc .si-no {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.form-doc .si-no label {
  display: inline-flex;
  gap: 0.3rem;
  align-items: center;
  font-weight: 700;
}

.form-doc .si-no-auto label {
  cursor: default;
  opacity: 0.95;
}

.form-doc .peso-edit,
.form-doc .peso-ro {
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.form-doc .peso-unit {
  width: 4.4rem;
  flex: 0 0 4.4rem;
  background: #f8fafc;
  font-size: 0.78rem;
  font-weight: 650;
  padding: 0.15rem 0.1rem;
}

.form-doc .unit-suffix {
  flex: 0 0 auto;
  font-size: 0.78rem;
  font-weight: 650;
  color: #475569;
}

.form-doc .carga-alerta {
  margin: 0.4rem 0 0;
  padding: 0.5rem 0.65rem;
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  font-size: 0.82rem;
  font-weight: 650;
}

.form-doc .elem-config-table {
  margin-top: 0.75rem;
  table-layout: fixed;
}

.form-doc .elem-config-table .carga-block-title span {
  font-weight: 500;
  text-transform: none;
}

.form-doc .elem-config-table thead th,
.form-doc .elem-config-table tbody th.carga-block-title {
  text-align: center;
  white-space: normal;
  font-size: 0.75rem;
  line-height: 1.2;
}

.form-doc .elem-config-table .elem-col-head,
.form-doc .elem-config-table .cfg-col-head {
  width: auto;
}

.form-doc .cfg-panel {
  vertical-align: top;
  text-align: left;
  padding: 0.5rem 0.55rem 0.6rem;
}

.form-doc .elem-panel-full {
  vertical-align: top;
  text-align: left;
  padding: 0;
}

.form-doc .elem-izaje-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  margin: 0;
}

.form-doc .elem-izaje-table th,
.form-doc .elem-izaje-table td {
  border: 1px solid #94a3b8;
  border-left: none;
  padding: 0.32rem 0.4rem;
  vertical-align: middle;
}

.form-doc .elem-izaje-table th:last-child,
.form-doc .elem-izaje-table td:last-child {
  border-right: none;
}

.form-doc .elem-izaje-table thead th {
  background: #f1f5f9;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 650;
  white-space: normal;
  line-height: 1.2;
  border-top: none;
}

.form-doc .elem-izaje-table tbody td:first-child {
  width: 24%;
  font-weight: 560;
  white-space: nowrap;
}

.form-doc .elem-izaje-table .elem-act-col {
  width: 2.4rem;
  padding: 0.2rem;
  text-align: center;
}

.form-doc .elem-izaje-table .param-chip {
  min-height: 2.05rem;
  padding: 0.28rem 0.3rem;
  font-size: 0.78rem;
}

.form-doc .elem-long-cell {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  min-width: 0;
}

.form-doc .elem-empty-hint td {
  text-align: center;
  color: #64748b;
  font-size: 0.78rem;
  padding: 0.7rem 0.5rem;
}

.form-doc .elem-inline {
  display: flex;
  align-items: stretch;
  gap: 0.22rem;
  min-width: 0;
}

.form-doc .elem-num {
  flex: 1 1 auto;
  min-width: 2.2rem;
  width: 100%;
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 4px;
  padding: 0.32rem 0.28rem;
  font: inherit;
  font-size: 0.8rem;
  color: #0f172a;
  box-sizing: border-box;
}

.form-doc .elem-num:focus,
.form-doc .elem-unit:focus {
  outline: 2px solid rgba(180, 83, 9, 0.35);
  outline-offset: 0;
  border-color: #b45309;
}

.form-doc .elem-num-sm {
  flex: 0 0 auto;
  width: 3.1rem;
  text-align: center;
}

.form-doc .elem-unit {
  flex: 0 0 auto;
  max-width: 4.4rem;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  border-radius: 4px;
  padding: 0.28rem 0.12rem;
  font: inherit;
  font-size: 0.72rem;
  color: #334155;
}

.form-doc .elem-phi {
  font-style: normal;
  font-weight: 700;
  font-size: 0.95rem;
  color: #0f172a;
  line-height: 1;
  flex: 0 0 auto;
}

.form-doc .elem-del {
  min-width: 1.7rem;
  padding: 0.1rem 0.25rem;
  font-size: 1.1rem;
  line-height: 1;
  color: #64748b;
}

.form-doc .elem-add-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  padding: 0.5rem;
}

.form-doc .elem-add-bar .btn {
  min-height: 2.55rem;
  font-weight: 650;
}

.form-doc .elem-add-bar .elem-add-grillete {
  grid-column: 1 / -1;
  min-height: 2.15rem;
  font-weight: 560;
}

.form-doc .elem-panel-full .cfg-status,
.form-doc .elem-panel-full .cfg-confirm {
  margin-left: 0.5rem;
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
}

.form-doc .cfg-cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.4rem;
}

.form-doc .cfg-card-wrap {
  position: relative;
  min-width: 0;
}

.form-doc .cfg-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.15rem;
  margin: 0;
  padding: 1.05rem 0.22rem 0.35rem;
  border: 1px dashed #94a3b8;
  border-radius: 0.4rem;
  background: #fff;
  cursor: pointer;
  min-width: 0;
  min-height: 100%;
  height: 100%;
  box-sizing: border-box;
}

.form-doc .cfg-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.form-doc .cfg-card:has(input:checked) {
  border-style: solid;
  border-color: #b45309;
  background: #fffbeb;
}

.form-doc .cfg-card-name {
  font-size: 0.64rem;
  font-weight: 650;
  text-align: center;
  line-height: 1.2;
  color: #0f172a;
}

.form-doc .cfg-card-wrap .cfg-help-btn {
  position: absolute;
  top: 0.2rem;
  right: 0.2rem;
  width: 1.15rem;
  height: 1.15rem;
  font-size: 0.68rem;
  z-index: 1;
}

.form-doc .cfg-card-selected {
  display: none;
  font-size: 0.58rem;
  font-weight: 650;
  color: #92400e;
  text-align: center;
  line-height: 1.2;
}

.form-doc .cfg-card:has(input:checked) .cfg-card-selected {
  display: block;
}

.form-doc .cfg-icon {
  width: 100%;
  height: auto;
  max-height: 3.5rem;
  object-fit: contain;
  object-position: center;
  display: block;
  background: #fff;
}

.form-doc .cfg-angulo-help {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  margin-top: 0.5rem;
  padding: 0.4rem 0.5rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.35rem;
  font-size: 0.75rem;
  color: #334155;
  line-height: 1.35;
}

.form-doc .cfg-status {
  margin: 0;
  padding: 0.4rem 0.5rem;
  font-size: 0.75rem;
  line-height: 1.35;
  border-radius: 0.3rem;
}

.form-doc .cfg-status.is-completo {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #047857;
}

.form-doc .cfg-status.is-revisar {
  background: #fffbeb;
  border: 1px solid #f59e0b;
  color: #92400e;
}

.form-doc .cfg-status.is-incompleto {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #475569;
}

.form-doc .cfg-confirm {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  margin-top: 0.45rem;
  font-size: 0.78rem;
  font-weight: 560;
}

.dlg-config-ayuda {
  max-width: min(520px, 94vw);
}

.dlg-cfg-img {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
}

.dlg-cfg-thumb {
  max-width: 160px;
  max-height: 110px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: 0.3rem;
  background: #fff;
}

@media (max-width: 1023px) {
  .form-doc .cfg-cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .form-doc .cfg-icon {
    max-height: 4.2rem;
  }

  .form-doc .cfg-card {
    padding: 1.15rem 0.3rem 0.4rem;
  }
}

@media (max-width: 560px) {
  .form-doc .cfg-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.form-doc .doc-req .w-si {
  width: 52px;
  text-align: center;
}

.form-doc .doc-req td:not(:first-child) {
  text-align: center;
}

.form-doc .doc-req td:first-child {
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.3;
}

.form-doc .doc-req {
  margin-bottom: 0;
}

.form-doc .doc-firmas {
  margin-top: 0;
}

.form-doc .doc-firmas th {
  text-align: center;
  white-space: normal;
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  line-height: 1.25;
  padding: 0.4rem 0.3rem;
}

.form-doc .doc-firmas td {
  vertical-align: top;
  width: 25%;
  padding: 0.4rem 0.45rem 0.35rem;
}

.form-doc .firma-k {
  display: block;
  font-size: 0.78rem;
  color: #0f172a;
  margin-bottom: 0.15rem;
}

.form-doc .firma-k span {
  text-decoration: underline;
  font-weight: 600;
}

.form-doc .firma-nombre {
  border-bottom: 1px solid #64748b;
  padding: 0.15rem 0.1rem 0.2rem;
  min-height: 1.5rem;
}

.form-doc .firma-open {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
}

.form-doc .firma-pad-wrap {
  display: block;
  border: 1px dashed #94a3b8;
  border-bottom: 1px solid #64748b;
  margin-top: 0.1rem;
  background: #f8fafc;
}

.form-doc .firma-open.is-signed .firma-pad-wrap {
  background: #fff;
  border-style: solid;
}

.form-doc .firma-pad {
  display: block;
  width: 100%;
  height: 96px;
  pointer-events: none;
  background: transparent;
}

.form-doc .firma-hint {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.68rem;
  color: #64748b;
}

html.is-signing,
html.is-signing body {
  overflow: hidden;
  touch-action: none;
}

.dlg-firma {
  max-width: min(920px, 96vw);
}

.dlg-firma .dlg-body {
  max-height: none;
}

.firma-pad-lg-wrap {
  border: 1px solid #94a3b8;
  background: #fff;
  overscroll-behavior: none;
  touch-action: none;
}

.firma-pad-lg {
  display: block;
  width: 100%;
  height: min(42vh, 280px);
  min-height: 200px;
  cursor: crosshair;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  background: #fffbeb;
}

@media (max-width: 900px), (pointer: coarse) {
  .dlg-firma {
    width: 100%;
    max-width: 100vw;
    max-height: 100vh;
    height: 100%;
    margin: 0;
    border-radius: 0;
  }

  .firma-pad-lg {
    height: min(52vh, 360px);
    min-height: 240px;
  }
}

.form-doc .firma-clear {
  display: inline-block;
  margin-top: 0.2rem;
  padding: 0;
  border: 0;
  background: none;
  color: #64748b;
  font: inherit;
  font-size: 0.68rem;
  cursor: pointer;
}

.form-doc .firma-clear:hover {
  color: #0f172a;
  text-decoration: underline;
}

.dlg-firmas {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-top: 0.35rem;
}

.dlg-firma-card {
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  padding: 0.55rem 0.6rem;
  background: #fff;
}

.dlg-firma-card h5 {
  margin: 0 0 0.25rem;
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--muted);
}

.dlg-firma-card img {
  display: block;
  width: 100%;
  max-height: 72px;
  object-fit: contain;
  background: #f8fafc;
  border: 1px dashed var(--border);
  margin-top: 0.35rem;
}

.dlg-firma-empty {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.form-doc .doc-req td.req-cell {
  padding: 0.18rem;
  width: 52px;
  background: #f8fafc;
}

.form-doc .req-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  width: 100%;
  min-height: 1.9rem;
  cursor: pointer;
  position: relative;
  user-select: none;
}

.form-doc .req-mark.is-locked {
  cursor: not-allowed;
  opacity: 0.38;
  pointer-events: none;
}

.form-doc .req-sistema td:first-child {
  background: #fff;
}

.form-doc .req-tip {
  display: inline;
  cursor: help;
}

.form-doc .req-mark input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.form-doc .req-box {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.45rem;
  height: 1.45rem;
  border: 1.5px dashed #64748b;
  border-radius: 1px;
  background: #fff;
}

.form-doc .req-box::before {
  content: "";
  position: absolute;
  inset: -2px;
  pointer-events: none;
  background:
    linear-gradient(#475569, #475569) left top / 4px 4px no-repeat,
    linear-gradient(#475569, #475569) right top / 4px 4px no-repeat,
    linear-gradient(#475569, #475569) left bottom / 4px 4px no-repeat,
    linear-gradient(#475569, #475569) right bottom / 4px 4px no-repeat;
}

.form-doc .req-mark:hover .req-box {
  border-color: #0f172a;
  background: #fffbeb;
}

.form-doc .req-mark input:focus-visible + .req-box {
  outline: 2px solid var(--ring);
  outline-offset: 3px;
}

.form-doc .req-mark input:checked + .req-box {
  border-style: solid;
  border-color: #0f172a;
  background: #fff;
}

.form-doc .req-mark input:checked + .req-box::after {
  content: "X";
  font-weight: 800;
  font-size: 1.05rem;
  line-height: 1;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.form-doc .ok {
  color: #047857;
}

.form-doc .error {
  color: #b91c1c;
}

/* En viewport estrecho: scroll horizontal, sin reflow ni recorte */
@media (max-width: 1100px) {
  .form-doc {
    padding: 0.75rem 0.5rem 3rem;
  }

  .form-doc .doc-sheet {
    margin: 0;
  }
}

.op-shell {
  min-height: 100vh;
  background: #f4f6f8;
  overflow: visible;
}

.op-shell .op-topbar {
  background: #fff;
  border-bottom-color: var(--border);
  color: var(--foreground);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.04);
}

.op-shell .op-topbar .muted {
  color: var(--muted);
}

.op-shell .op-topbar .brand-mark {
  color: var(--primary);
}

.op-shell.is-historial .doc-zoom-bar {
  display: none !important;
}

.op-topbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.55rem;
  padding: 0.7rem 1.1rem 0.65rem;
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}

.op-topbar-main {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.op-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1 1 auto;
}

.op-brand-mark {
  display: grid;
  place-items: center;
  width: 2.55rem;
  height: 2.55rem;
  flex-shrink: 0;
  border-radius: 0.7rem;
  background: #fff7ed;
  color: var(--primary);
  border: 1px solid #fed7aa;
}

.op-brand-mark .icon {
  width: 1.35rem;
  height: 1.35rem;
}

.op-brand-text {
  min-width: 0;
}

.op-subtitle {
  margin: 0.12rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.doc-zoom-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding-top: 0.45rem;
  border-top: 1px solid var(--border);
}

.doc-zoom-label {
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.doc-zoom-group {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem;
  background: var(--muted-bg);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
}

.doc-zoom-pct {
  min-width: 3.2rem;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 600;
}

.doc-zoom-hint {
  margin-left: 0.15rem;
}

.op-title {
  margin-top: 0.12rem;
  font-size: 1.18rem;
  overflow-wrap: break-word;
  line-height: 1.25;
}

.op-topbar-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  min-width: 0;
  flex: 0 1 auto;
  justify-content: flex-end;
}

.op-session {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
  max-width: 16.5rem;
  padding: 0.28rem 0.75rem 0.28rem 0.32rem;
  background: var(--muted-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.op-session-avatar {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  flex-shrink: 0;
  border-radius: 999px;
  background: #fff;
  color: var(--primary);
  border: 1px solid #fed7aa;
}

.op-session-meta {
  min-width: 0;
}

.op-session-meta .session-name {
  font-size: 0.88rem;
  line-height: 1.2;
}

.op-session-meta .session-name,
.op-session-meta .muted {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.op-session-meta .muted {
  font-size: 0.72rem;
  line-height: 1.25;
}

.op-topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.op-body {
  max-width: 980px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 3rem;
}

.form-section h3 {
  margin-bottom: 0.9rem;
  font-size: 1.05rem;
}

.section-label {
  font-size: 0.8rem;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.data-table th,
.data-table td {
  border: 1px solid var(--border);
  padding: 0.45rem 0.55rem;
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  background: var(--muted-bg);
  font-size: 0.8rem;
}

.data-table input {
  width: 100%;
  border: 1px solid var(--input);
  border-radius: calc(var(--radius) - 2px);
  padding: 0.45rem 0.55rem;
}

.check-row,
.check-grid {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
  margin: 0;
}

.check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: center;
}

.check-row legend,
.check-grid legend {
  padding: 0 0.35rem;
  font-size: 0.85rem;
  font-weight: 560;
}

.check-grid {
  display: grid;
  gap: 0.45rem;
}

.check-row label,
.check-grid label,
.req-opts label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
}

.req-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.req-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) - 2px);
  background: #fff;
}

.req-opts {
  display: flex;
  gap: 0.65rem;
  white-space: nowrap;
}

.op-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  margin: 0;
  padding: 0.7rem 1.1rem calc(0.7rem + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
  box-shadow: 0 -8px 28px rgba(15, 23, 42, 0.08);
}

.op-footer-status {
  min-width: 0;
  flex: 1 1 auto;
}

.op-footer-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.op-footer .ok,
.op-footer .error {
  margin: 0;
  font-weight: 620;
}

.op-footer-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-save {
  min-width: 11.5rem;
  padding: 0.68rem 1.2rem;
  font-weight: 650;
  box-shadow: 0 1px 2px rgba(146, 64, 14, 0.25);
}

.dlg {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  max-width: min(680px, 92vw);
  width: 100%;
  box-shadow: var(--shadow);
}

.dlg::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.dlg-inner {
  margin: 0;
}

.dlg-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border);
}

.dlg-body {
  padding: 1rem;
  display: grid;
  gap: 0.45rem;
  max-height: 70vh;
  overflow: auto;
  font-size: 0.92rem;
}

.dlg.dlg-firma {
  max-width: min(920px, 96vw);
}

.dlg.dlg-firma .dlg-body {
  max-height: none;
  overflow: hidden;
}

@media (max-width: 900px), (pointer: coarse) {
  .dlg.dlg-firma {
    width: 100%;
    max-width: 100vw;
    max-height: 100%;
    height: 100%;
    margin: 0;
    border-radius: 0;
  }
}

.dlg-list {
  margin: 0.35rem 0 0;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.25rem;
}

@media (max-width: 900px) {
  .login-view {
    grid-template-columns: 1fr;
  }

  .login-visual {
    display: none;
  }

  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .nav {
    flex-direction: row;
    flex: 0;
    overflow-x: auto;
  }

  .grid-2,
  .grid-3,
  .stats-row,
  .stats-row-4 {
    grid-template-columns: 1fr;
  }

  .page-head,
  .op-topbar-main {
    flex-direction: column;
    align-items: stretch;
  }

  .op-topbar-right {
    justify-content: space-between;
  }

  .op-session {
    max-width: none;
    flex: 1 1 auto;
  }

  .op-title {
    font-size: 1.05rem;
  }

  .req-item {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .op-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .op-footer-actions {
    display: grid;
    grid-template-columns: auto 1fr;
  }

  .btn-save {
    min-width: 0;
    width: 100%;
  }

  .op-topbar-actions .btn-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .op-topbar-actions .btn {
    padding: 0.42rem;
    min-width: 2.4rem;
    min-height: 2.4rem;
  }

  .doc-zoom-hint {
    display: none;
  }

  #op-session-empresa {
    display: none !important;
  }
}

@media (max-width: 420px) {
  .op-subtitle {
    display: none;
  }

  .op-brand-mark {
    width: 2.2rem;
    height: 2.2rem;
    border-radius: 0.55rem;
  }
}
