/* vkoffline — Material 3 inspired */
:root {
  --md-primary: #1565c0;
  --md-on-primary: #ffffff;
  --md-primary-container: #d1e4ff;
  --md-on-primary-container: #001d36;
  --md-surface: #f8f9fc;
  --md-surface-container: #ffffff;
  --md-surface-container-high: #eef1f6;
  --md-on-surface: #1a1c1e;
  --md-on-surface-variant: #43474e;
  --md-outline: #73777f;
  --md-outline-variant: #c3c7cf;
  --md-error: #ba1a1a;
  --md-error-container: #ffdad6;
  --md-shadow-1: 0 1px 2px rgba(0, 0, 0, 0.08), 0 1px 3px rgba(0, 0, 0, 0.06);
  --md-shadow-2: 0 4px 12px rgba(0, 0, 0, 0.1);
  --md-shadow-3: 0 8px 24px rgba(0, 0, 0, 0.12);
  --md-radius-sm: 12px;
  --md-radius-md: 16px;
  --md-radius-lg: 28px;
  --md-font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  /** 1.4 = 140% por defecto */
  --vk-font-scale: 1.4;
  --top-bar-h: 56px;
  --fab-size: 56px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

html {
  font-size: calc(16px * var(--vk-font-scale, 1));
}

body.m3-app {
  font-family: var(--md-font);
  background: var(--md-surface);
  color: var(--md-on-surface);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.m3-app a {
  color: inherit;
  text-decoration: none;
}

.top-app-bar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 4px;
  height: calc(var(--top-bar-h) + var(--safe-t));
  padding: var(--safe-t) max(8px, var(--safe-l)) 0 max(4px, var(--safe-l));
  padding-right: max(8px, var(--safe-r));
  background: var(--md-surface-container);
  box-shadow: var(--md-shadow-1);
}

.top-app-bar-title {
  flex: 1;
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 8px;
}

.sync-upload-badge {
  flex-shrink: 0;
  max-width: 42vw;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sync-upload-badge--warn {
  color: #7a4f00;
  background: #fff3cd;
}

.sync-upload-badge--offline {
  color: #5d4037;
  background: #ffe0b2;
}

.sync-upload-badge--ok {
  color: #1b5e20;
  background: #c8e6c9;
}

.sync-upload-badge--auth {
  color: #0d47a1;
  background: #e3f2fd;
}

.sync-upload-badge--cot-nav {
  flex: 1 1 0;
  min-width: 0;
  max-width: none;
  padding: 6px 0;
  gap: 3px;
  font-size: 0.5625rem;
  line-height: 1.15;
  font-weight: 500;
  border-radius: 0;
  background: transparent;
  pointer-events: none;
  cursor: default;
  box-sizing: border-box;
}

.sync-upload-badge--cot-nav svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.sync-upload-badge--cot-nav.sync-upload-badge--ok {
  color: #2e7d32;
  background: transparent;
}

.sync-upload-badge--cot-nav.sync-upload-badge--warn {
  color: #7a4f00;
  background: transparent;
}

.sync-upload-badge--cot-nav.sync-upload-badge--offline {
  color: #5d4037;
  background: transparent;
}

.sync-upload-badge--cot-nav.sync-upload-badge--auth {
  color: #0d47a1;
  background: transparent;
}

.top-app-bar-sub {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--md-on-surface-variant);
  margin-top: 2px;
}

.top-app-bar-sub-calculos {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding-right: 4px;
}

.top-app-bar-sub-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-app-bar-calculos-total {
  flex-shrink: 0;
  font-size: 0.8125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--md-on-surface);
}

.list-card-calculos {
  border-radius: var(--md-radius-sm);
  overflow: hidden;
  --calculos-col-gap: 6px;
}

body.m3-app.page-calculos,
body.m3-app.page-conceptos {
  display: flex;
  flex-direction: column;
  height: var(--app-vh, 100dvh);
  max-height: var(--app-vh, 100dvh);
  overflow: hidden;
}

body.page-calculos .top-app-bar,
body.page-conceptos .top-app-bar {
  flex-shrink: 0;
}

body.page-calculos .page-main.page-calculos {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

body.page-conceptos .page-main.page-conceptos {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

.page-main.page-calculos {
  padding-top: 4px;
  padding-left: max(12px, var(--safe-l));
  padding-right: max(12px, var(--safe-r));
}

.calculos-col-head {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 8px 0 6px;
  border-bottom: 1px solid var(--md-outline-variant);
  background: var(--md-surface-container-high);
  position: sticky;
  top: 0;
  z-index: 2;
}

.calculos-col-head-line {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns:
    var(--calculos-base-w, max-content)
    var(--calculos-col-gap)
    var(--calculos-alt-w, max-content)
    var(--calculos-col-gap)
    var(--calculos-res-w, max-content);
  column-gap: 2px;
  align-items: end;
  padding-left: max(12px, var(--safe-l));
  padding-right: 4px;
}

.calculos-col-h {
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--md-on-surface-variant);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calculos-col-h-base {
  grid-column: 1;
  text-align: left;
}

.calculos-col-h-alt {
  grid-column: 3;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.calculos-col-h-res {
  grid-column: 5;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.calculos-col-head-menu {
  flex-shrink: 0;
  width: 36px;
  margin: 0 -2px 0 0;
}

.tile-calculo {
  align-items: center;
  min-height: 40px;
  padding: 4px 0;
  gap: 0;
}

.tile-calculo-body {
  flex: 1;
  min-width: 0;
  padding-left: max(12px, var(--safe-l));
  padding-right: 2px;
}

.tile-calculo-nombre {
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--md-on-surface);
  word-break: break-word;
  margin-bottom: 3px;
}

.tile-calculo-line {
  display: grid;
  grid-template-columns:
    var(--calculos-base-w, max-content)
    var(--calculos-col-gap)
    var(--calculos-alt-w, max-content)
    var(--calculos-col-gap)
    var(--calculos-res-w, max-content);
  column-gap: 2px;
  align-items: center;
  font-size: 0.8125rem;
  line-height: 1.25;
  width: 100%;
}

.tile-calculo-base,
.tile-calculo-alt,
.tile-calculo-res {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.tile-calculo-base {
  grid-column: 1;
  text-align: left;
  color: var(--md-on-surface);
  font-weight: 500;
}

.tile-calculo-alt {
  grid-column: 3;
  text-align: right;
  color: var(--md-on-surface-variant);
  font-size: 0.75rem;
}

.tile-calculo-res {
  grid-column: 5;
  text-align: right;
  font-weight: 600;
  color: var(--md-on-surface);
}

.tile-calculo .tile-menu-btn {
  width: 36px;
  height: 36px;
  margin: 0 -2px 0 0;
}

.top-app-bar-conceptos {
  align-items: center;
  min-height: calc(var(--top-bar-h) + var(--safe-t));
  padding-bottom: 0;
  padding-left: max(2px, var(--safe-l));
  padding-right: max(2px, var(--safe-r));
}

.top-app-bar-conceptos--minimal {
  min-height: calc(44px + var(--safe-t));
}

.top-app-bar-conceptos--minimal .top-app-bar-title {
  display: none;
}

.top-app-bar-conceptos--minimal .icon-btn {
  width: 44px;
  height: 44px;
}

.conceptos-cot-head {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  margin: 0 max(8px, var(--safe-l)) 6px max(8px, var(--safe-l));
  padding: 6px 0 4px;
  border-bottom: 1px solid var(--md-outline-variant);
}

.conceptos-cot-head-left {
  flex: 0 0 50%;
  width: 50%;
  max-width: 50%;
  min-width: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 2px;
  padding-right: 4px;
}

.conceptos-cot-dir {
  width: 100%;
  min-width: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.28;
  color: var(--md-on-surface);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;
}

.conceptos-cot-fecha {
  width: 100%;
  font-size: 0.75rem;
  line-height: 1.2;
  color: var(--md-on-surface-variant);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conceptos-cot-head .conceptos-prov-chip {
  flex: 0 0 50%;
  width: 50%;
  max-width: 50%;
  min-width: 0;
  box-sizing: border-box;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  padding: 0 0 0 4px;
  align-self: center;
}

.conceptos-cot-head .conceptos-prov-thumb--chip {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  order: 0;
}

.conceptos-cot-head .conceptos-prov-thumb--chip .conceptos-prov-initials {
  font-size: 0.75rem;
}

.conceptos-cot-head .conceptos-prov-name {
  order: 1;
  width: 100%;
  font-size: 0.8125rem;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-align: right;
  word-break: break-word;
}

.conceptos-cot-head .conceptos-prov-tel {
  order: 2;
  width: 100%;
  font-size: 0.75rem;
  line-height: 1.2;
  color: var(--md-on-surface-variant);
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conceptos-cot-head .conceptos-prov-chip--empty {
  min-height: 0;
  padding: 4px 6px;
  font-size: 0.8125rem;
}

body.page-conceptos-candado-cerrado .cot-bottom-nav {
  background: #fff3e0;
  border-top-color: #ffe0b2;
}

body.page-conceptos-candado-cerrado .cot-nav-item,
body.page-conceptos-candado-cerrado .cot-nav-global-menu {
  background: transparent;
}

#btn-cot-candado.icon-btn--candado-cerrado {
  color: #1b1b1f;
}

#btn-cot-candado.icon-btn--candado-abierto {
  color: #2e7d32;
}

#btn-cot-candado.icon-btn--candado-sync {
  color: #1565c0;
}

.top-app-bar-conceptos .icon-btn {
  flex-shrink: 0;
  align-self: center;
  margin-top: 0;
}

.top-app-bar-conceptos .top-app-bar-title {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  display: block;
  min-width: 0;
  padding: 8px 2px 4px;
  font-size: inherit;
  font-weight: inherit;
}

.top-app-bar-sub-conceptos {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  margin-top: 0;
  white-space: normal;
}

.top-app-bar-cot-left {
  flex: 1 1 50%;
  min-width: 0;
  max-width: 50%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  align-self: stretch;
}

.top-app-bar-cot-dir {
  width: 100%;
  min-width: 0;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--md-on-surface);
  text-align: left;
}

.top-app-bar-cot-fecha {
  font-size: 0.8125rem;
  line-height: 1.3;
  color: var(--md-on-surface-variant);
  text-align: left;
}

.conceptos-prov-chip {
  flex: 1 1 50%;
  min-width: 0;
  max-width: 50%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-end;
  gap: 8px;
  margin: 0 0 0 auto;
  padding: 2px 4px;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  text-align: right;
  font: inherit;
  color: inherit;
  align-self: stretch;
}

.conceptos-prov-chip:focus-visible {
  outline: 2px solid var(--md-primary);
  outline-offset: 2px;
}

.conceptos-prov-chip--empty {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--md-primary);
  justify-content: center;
  align-items: flex-end;
  min-height: 2.5rem;
  border: 1px dashed var(--md-outline-variant);
  background: var(--md-surface-container-high);
  padding: 6px 8px;
}

.conceptos-prov-thumb {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--md-primary-container);
}

.conceptos-prov-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.conceptos-prov-thumb--fallback {
  background: var(--md-surface-container);
}

.conceptos-prov-initials {
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--md-primary);
}

.conceptos-prov-thumb--chip {
  width: 64px;
  height: 64px;
  border-radius: 10px;
}

.conceptos-prov-thumb--chip .conceptos-prov-initials {
  font-size: 1.125rem;
}

.conceptos-prov-name {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
  max-width: 100%;
  word-break: break-word;
  color: var(--md-on-surface);
}

.conceptos-prov-line {
  font-size: 0.875rem;
  line-height: 1.35;
  color: var(--md-on-surface-variant);
  max-width: 100%;
  word-break: break-word;
}

.picker-proveedor-list {
  max-height: min(50vh, 360px);
  overflow-y: auto;
  margin-bottom: 8px;
}

.tile-picker-proveedor {
  cursor: pointer;
  padding-left: 8px;
}

.tile-picker-proveedor.is-selected {
  background: var(--md-primary-container);
}

.picker-link-proveedores {
  display: block;
  text-align: center;
  margin: 8px 0;
  color: var(--md-primary);
  text-decoration: none;
  font-weight: 600;
}

.field select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--md-outline-variant);
  border-radius: var(--md-radius-sm);
  font: inherit;
  font-size: 0.9375rem;
  background: var(--md-surface);
  color: var(--md-on-surface);
  box-sizing: border-box;
}

.icon-btn {
  width: 48px;
  height: 48px;
  border: none;
  border-radius: var(--md-radius-sm);
  background: transparent;
  color: var(--md-on-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.icon-btn:active {
  background: var(--md-surface-container-high);
}

.icon-btn svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.page-main {
  padding: 8px max(12px, var(--safe-l)) calc(var(--fab-size) + 24px + var(--safe-b)) max(12px, var(--safe-l));
  padding-right: max(12px, var(--safe-r));
  min-height: calc(100vh - var(--top-bar-h));
}

body.has-cot-nav .page-main {
  padding-bottom: calc(var(--fab-size) + 24px + 72px + var(--safe-b));
}

body.has-cot-nav .page-main.page-main-no-fab {
  padding-bottom: calc(72px + 16px + var(--safe-b));
}

.cot-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 18;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  min-height: 64px;
  padding-bottom: var(--safe-b);
  background: var(--md-surface-container);
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.08);
  border-top: 1px solid var(--md-outline-variant);
}

body.page-conceptos .cot-bottom-nav {
  align-items: flex-end;
  min-height: calc(56px + var(--safe-b));
  padding-top: 0;
  padding-bottom: calc(var(--safe-b) + 6px);
}

body.page-conceptos .cot-bottom-nav--with-global {
  align-items: flex-end;
}

body.page-conceptos .cot-nav-global-menu {
  margin-bottom: 2px;
}

body.page-conceptos .cot-nav-tabs {
  align-items: flex-end;
}

body.page-conceptos .cot-nav-item {
  padding-top: 4px;
  padding-bottom: 2px;
}

.cot-bottom-nav--with-global {
  justify-content: flex-start;
  align-items: center;
  gap: 0;
}

.cot-nav-global-menu {
  flex-shrink: 0;
  margin: 0 0 0 max(2px, var(--safe-l));
  color: var(--md-on-surface-variant);
}

.cot-nav-tabs {
  flex: 1;
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  min-width: 0;
}

.top-app-bar-conceptos .top-app-bar-title {
  padding-right: max(8px, var(--safe-r));
}

.cot-nav-tabs--scroll {
  overflow-x: auto;
  overflow-y: hidden;
  flex-wrap: nowrap;
  justify-content: flex-start;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  touch-action: pan-x;
  scrollbar-width: none;
}

.cot-nav-tabs--scroll::-webkit-scrollbar {
  display: none;
}

/* Pestañas de cotización (5 iconos) */
.cot-bottom-nav--cot-tabs {
  justify-content: stretch;
}

.cot-nav-tabs--fit-cot {
  flex: 1;
  display: flex;
  flex-direction: row;
  width: 100%;
  min-width: 0;
  overflow: visible;
  align-items: stretch;
  justify-content: stretch;
}

.cot-nav-tabs--fit-cot .cot-nav-item {
  flex: 1 1 0;
  min-width: 0;
  max-width: none;
  width: auto;
  padding: 6px 0;
  font-size: 0.5625rem;
  line-height: 1.15;
  gap: 3px;
  box-sizing: border-box;
}

.cot-nav-tabs--fit-cot .cot-nav-item svg {
  width: 22px;
  height: 22px;
}

.cot-nav-label-full,
.cot-nav-label-short {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.cot-nav-label-short {
  display: none;
}

@media (max-width: 420px) {
  .cot-nav-label-full {
    display: none;
  }

  .cot-nav-label-short {
    display: block;
  }
}

@media (max-width: 300px) {
  .cot-nav-tabs--fit-cot .cot-nav-label-full,
  .cot-nav-tabs--fit-cot .cot-nav-label-short {
    display: none;
  }
}

.page-tareas .cot-entry-link {
  margin-left: max(12px, var(--safe-l));
  margin-right: max(12px, var(--safe-r));
}

.home-entry-link,
.cot-entry-link {
  display: block;
  margin: 0 0 12px;
  padding: 14px 16px;
  border-radius: var(--md-radius-lg, 12px);
  background: var(--md-surface-container-high);
  color: var(--md-primary);
  font-size: 0.9375rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  box-shadow: var(--md-shadow-1);
}

.home-entry-link:active,
.cot-entry-link:active {
  opacity: 0.88;
}

.page-home .home-entry-link {
  margin-left: max(12px, var(--safe-l));
  margin-right: max(12px, var(--safe-r));
}

.cot-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--md-on-surface-variant);
  text-decoration: none;
  transition: color 0.15s ease, background 0.15s ease;
}

.cot-nav-item svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.cot-nav-item.active {
  color: var(--md-primary);
}

.cot-nav-item:active {
  background: var(--md-surface-container-high);
}

body.has-cot-nav .fab {
  bottom: calc(64px + 16px + var(--safe-b));
}

body.page-conceptos.has-cot-nav .fab {
  bottom: calc(58px + 22px + var(--safe-b));
}

body.has-cot-nav .snackbar {
  bottom: calc(64px + var(--fab-size) + 32px + var(--safe-b));
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.summary-chip {
  margin: 0 0 10px;
  padding: 12px 16px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--md-on-primary-container);
  background: var(--md-primary-container);
  border-radius: var(--md-radius-sm);
  box-shadow: var(--md-shadow-1);
}

.list-card-cotizaciones {
  overflow: hidden;
}

.cot-estado-head {
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  gap: 4px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--md-outline-variant);
  background: var(--md-surface-container-high);
}

.cot-estado-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 6px 4px;
  border: none;
  border-radius: var(--md-radius-sm);
  background: transparent;
  color: var(--md-on-surface-variant);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.cot-estado-btn svg {
  width: 26px;
  height: 26px;
  fill: currentColor;
}

.cot-estado-btn.active {
  color: var(--md-primary);
  background: var(--md-primary-container);
}

.cot-estado-btn:active {
  background: var(--md-surface-container);
}

.cot-search-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--md-outline-variant);
  background: var(--md-surface);
}

.cot-search-bar[hidden] {
  display: none !important;
}

.cot-search-input {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--md-outline-variant);
  border-radius: var(--md-radius-sm);
  background: var(--md-surface-container-high);
  color: var(--md-on-surface);
  font-size: 1rem;
}

.cot-search-input:focus {
  outline: 2px solid var(--md-primary);
  outline-offset: 1px;
}

.cot-search-clear {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: var(--md-radius-sm);
  background: transparent;
  color: var(--md-on-surface-variant);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.cot-search-clear:active {
  background: var(--md-surface-container-high);
}

.list-card {
  background: var(--md-surface-container);
  border-radius: var(--md-radius-md);
  box-shadow: var(--md-shadow-1);
  overflow: hidden;
}

.tile {
  display: flex;
  align-items: center;
  min-height: 56px;
  padding: 8px 4px 8px 16px;
  gap: 4px;
  border-bottom: 1px solid var(--md-outline-variant);
  transition: background 0.12s ease;
}

.tile:last-child {
  border-bottom: none;
}

.tile:active {
  background: var(--md-surface-container-high);
}

.tile-body {
  flex: 1;
  min-width: 0;
  padding: 6px 0;
  cursor: pointer;
}

.tile-title {
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-subtitle {
  font-size: 0.8125rem;
  color: var(--md-on-surface-variant);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-body-multiline .tile-title,
.tile-body-multiline {
  white-space: pre-wrap;
  word-break: break-word;
}

.tile-done .tile-title {
  text-decoration: line-through;
  opacity: 0.72;
}

.tile-task {
  align-items: center;
  gap: 2px;
  padding-left: 0;
}

.tile-task .tile-check {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 4px 8px 14px;
  margin: 0;
  cursor: pointer;
}

.tile-task .tile-check input {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--md-primary);
  cursor: pointer;
}

.tile-task .tile-body {
  flex: 1;
  min-width: 0;
  padding: 10px 4px;
  cursor: default;
}

.tile-task .tile-drag-handle {
  flex-shrink: 0;
  touch-action: none;
  cursor: grab;
  color: var(--md-on-surface-variant);
  display: none;
}

.tile-task .tile-drag-handle:active {
  cursor: grabbing;
}

.tile-task.tile-dragging {
  background: var(--md-surface-container-high);
  box-shadow: var(--md-shadow-2);
  z-index: 2;
  position: relative;
}

body.compact.show-row-reorder .tile-task .tile-drag-handle {
  display: inline-flex;
}

body.compact.show-row-reorder .tile-cotizacion .tile-drag-handle {
  display: inline-flex;
}

.tile-cotizacion {
  align-items: center;
  padding-left: 0;
  gap: 0;
}

.tile-cotizacion .tile-drag-handle {
  flex-shrink: 0;
  touch-action: none;
  cursor: grab;
  width: 30px;
  height: 36px;
  margin: 0;
  padding: 0 0 0 max(2px, var(--safe-l));
  color: var(--md-on-surface-variant);
  display: none;
}

.tile-cotizacion .tile-drag-handle svg {
  width: 18px;
  height: 18px;
}

.tile-cotizacion .tile-drag-handle:active {
  cursor: grabbing;
}

.tile-cotizacion.tile-dragging {
  background: var(--md-surface-container-high);
  box-shadow: var(--md-shadow-2);
  z-index: 2;
  position: relative;
}

body.compact .tile-cotizacion {
  padding-left: 0;
}

.page-main.page-tareas {
  padding-top: 4px;
  padding-left: 0;
  padding-right: max(4px, var(--safe-r));
}

.list-card-tareas {
  border-radius: 0 var(--md-radius-sm) var(--md-radius-sm) 0;
}

.page-tareas .tile-task {
  min-height: 36px;
  padding: 2px 0;
  gap: 0;
}

body.compact .page-tareas .tile-task {
  padding-left: 0;
}

.page-tareas .tile-task .tile-check {
  padding: 4px 2px 4px max(2px, var(--safe-l));
}

.page-tareas .tile-task .tile-check input {
  width: 20px;
  height: 20px;
}

.page-tareas .tile-task .tile-body {
  padding: 4px 2px;
}

.page-tareas .tile-task .tile-task-name {
  font-size: 0.8125rem;
  line-height: 1.25;
  font-weight: 500;
  white-space: normal;
  word-break: break-word;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 8;
  overflow: hidden;
  text-overflow: unset;
}

.page-tareas .tile-task .tile-task-prio {
  font-size: 0.6875rem;
  margin-top: 1px;
  white-space: nowrap;
}

.page-tareas .tile-task .tile-menu-btn {
  width: 36px;
  height: 36px;
  margin: 0 -2px 0 0;
}

.page-tareas .tile-task .tile-menu-btn svg {
  width: 20px;
  height: 20px;
}

.page-tareas .tile-task .tile-drag-handle {
  width: 30px;
  height: 36px;
  margin: 0;
  padding: 0 0 0 2px;
}

.page-tareas .tile-task .tile-drag-handle svg {
  width: 18px;
  height: 18px;
}

.form-hint {
  margin: -8px 0 16px;
  font-size: 0.8125rem;
  color: var(--md-on-surface-variant);
  line-height: 1.4;
}

body.has-cot-nav .page-main.page-conceptos {
  padding-bottom: calc(var(--fab-size) + 22px + 58px + var(--safe-b) + 6px);
}

.page-main.page-conceptos {
  padding-top: 4px;
  padding-left: 0;
  padding-right: max(4px, var(--safe-r));
  display: block;
  min-height: 0;
}

.cot-candado-banner {
  margin: 0;
  padding: 8px max(12px, var(--safe-l));
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  border-bottom: 1px solid var(--md-outline-variant);
}

.cot-candado-banner--cerrado {
  color: #5d4037;
  background: #ffe0b2;
  cursor: pointer;
}

.cot-candado-banner--cerrando,
.cot-candado-banner--abriendo {
  color: #0d47a1;
  background: #e3f2fd;
}

.page-main.page-conceptos .list-card-conceptos {
  margin-bottom: 10px;
}

.list-card-conceptos #cot-material-section {
  margin: 0;
  border-radius: 0;
  box-shadow: none;
  border-top: 1px solid var(--md-outline-variant);
  background: var(--md-surface-container);
}

.list-card-conceptos #cot-material-section .cot-material-inline {
  padding-left: max(12px, var(--safe-l));
  padding-right: max(8px, var(--safe-r));
}

.list-card-conceptos #cot-material-section .cot-material-view {
  background: transparent;
  padding-left: 0;
  padding-right: 0;
}

.cot-material-card {
  background: var(--md-surface-container);
  border-radius: 0 var(--md-radius-sm) var(--md-radius-sm) 0;
  box-shadow: var(--md-shadow-1);
  overflow: visible;
  margin-bottom: 8px;
}

.cot-material-inline {
  padding: 4px max(10px, var(--safe-r)) 6px max(10px, var(--safe-l));
}

.cot-material-label {
  display: block;
  margin: 0 0 2px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.15;
  color: var(--md-on-surface-variant);
}

.cot-material-view {
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--md-on-surface);
  padding: 4px 6px 2px;
  background: var(--md-surface-container-high);
  border-radius: var(--md-radius-sm);
  cursor: text;
  -webkit-tap-highlight-color: transparent;
}

.cot-material-view[hidden] {
  display: none !important;
}

.cot-material-view:focus-visible {
  outline: 2px solid var(--md-primary);
  outline-offset: 1px;
}

.cot-material-textarea {
  display: block;
  width: 100%;
  min-height: 2.25rem;
  margin: 0;
  padding: 6px 8px;
  font: inherit;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--md-on-surface);
  background: var(--md-surface);
  border: 1px solid var(--md-outline-variant);
  border-radius: var(--md-radius-sm);
  box-sizing: border-box;
  resize: none;
  overflow: hidden;
  max-height: none;
}

.cot-material-textarea[hidden] {
  display: none !important;
}

.cot-material-actions {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 8px 16px;
  margin-top: 6px;
  align-items: center;
  justify-content: flex-start;
  flex-shrink: 0;
}

.cot-material-actions[hidden] {
  display: none !important;
}

.cot-material-textarea:read-only {
  background: var(--md-surface-container-high);
  cursor: default;
}

body.conceptos-material-kb {
  height: 100dvh;
  max-height: 100dvh;
}

body.conceptos-material-kb .fab {
  display: none;
}

body.conceptos-compact-head .top-app-bar-sub-conceptos {
  display: none !important;
}

body.conceptos-compact-head .top-app-bar-conceptos .top-app-bar-title {
  padding-top: 2px;
  padding-bottom: 2px;
  min-height: 0;
}

body.conceptos-proveedor-open #sheet-proveedor.open {
  max-height: min(46vh, 380px);
}

body.conceptos-proveedor-open .scrim.open {
  background: rgba(0, 0, 0, 0.28);
}

body.conceptos-material-kb #cot-material-section {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 46;
  margin: 0;
  border-radius: var(--md-radius-sm) var(--md-radius-sm) 0 0;
  display: flex !important;
  flex-direction: column;
  overflow: visible;
  box-shadow: var(--md-shadow-3);
}

body.conceptos-material-kb .cot-material-inline {
  flex: 0 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: visible;
  padding-bottom: 6px;
}

body.conceptos-material-kb .cot-material-textarea {
  flex: 0 0 auto;
  min-height: 2.25rem;
  resize: none;
  overflow: hidden;
  max-height: none;
}

.cot-material-body {
  display: block;
  width: 100%;
  margin: 0;
  padding: 12px max(12px, var(--safe-r)) 14px max(12px, var(--safe-l));
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.cot-material-body:active {
  background: var(--md-surface-container-high);
}

.cot-material-text {
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--md-on-surface);
}

.cot-material-placeholder {
  font-size: 0.8125rem;
  color: var(--md-on-surface-variant);
  font-style: italic;
}

.field textarea {
  width: 100%;
  min-height: 140px;
  padding: 12px 14px;
  border: 1px solid var(--md-outline-variant);
  border-radius: var(--md-radius-sm);
  font: inherit;
  font-size: 0.9375rem;
  line-height: 1.45;
  resize: vertical;
  background: var(--md-surface);
  color: var(--md-on-surface);
  box-sizing: border-box;
}

.field textarea:focus {
  outline: 2px solid var(--md-primary);
  outline-offset: 1px;
  border-color: transparent;
}

.list-card-conceptos {
  border-radius: 0 var(--md-radius-sm) var(--md-radius-sm) 0;
  --conceptos-qty-gap: 4px;
  --conceptos-money-gap: 4px;
}

.conceptos-col-head {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 8px 0 6px;
  border-bottom: 1px solid var(--md-outline-variant);
  background: var(--md-surface-container-high);
}

.conceptos-col-head-drag {
  flex-shrink: 0;
  width: 0;
  padding-left: 0;
  box-sizing: content-box;
}

body.compact.show-row-reorder .conceptos-col-head-drag {
  width: 30px;
  padding-left: max(2px, var(--safe-l));
}

.conceptos-col-head-line {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: end;
  gap: 8px;
  padding-left: max(2px, var(--safe-l));
  padding-right: 4px;
}

body.compact.show-row-reorder .conceptos-col-head-line {
  padding-left: 0;
}

.conceptos-col-h {
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--md-on-surface-variant);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conceptos-col-h-qty {
  flex-shrink: 0;
  text-align: left;
}

.conceptos-col-h-name {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.conceptos-col-h-cost {
  flex-shrink: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.conceptos-col-h-amt {
  flex-shrink: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.conceptos-col-head-menu {
  flex-shrink: 0;
  width: 36px;
  margin: 0 -2px 0 0;
}

.tile-concepto {
  align-items: center;
  min-height: 36px;
  padding: 2px 0;
  gap: 0;
}

body.compact .tile-concepto {
  padding-left: 0;
}

.tile-concepto .tile-drag-handle {
  flex-shrink: 0;
  touch-action: none;
  cursor: grab;
  width: 30px;
  height: 36px;
  margin: 0;
  padding: 0 0 0 max(2px, var(--safe-l));
  color: var(--md-on-surface-variant);
  display: none;
}

body.compact.show-row-reorder .tile-concepto .tile-drag-handle {
  display: inline-flex;
}

.tile-concepto .tile-drag-handle svg {
  width: 18px;
  height: 18px;
}

.tile-concepto .tile-drag-handle:active {
  cursor: grabbing;
}

.tile-concepto.tile-dragging {
  background: var(--md-surface-container-high);
  box-shadow: var(--md-shadow-2);
  z-index: 2;
  position: relative;
}

.tile-concepto-body {
  flex: 1;
  min-width: 0;
  cursor: pointer;
  padding: 3px 0;
  padding-left: max(2px, var(--safe-l));
}

body.compact .tile-concepto-body {
  padding-left: max(2px, var(--safe-l));
}

body.compact.show-row-reorder .tile-concepto-body {
  padding-left: 0;
}

.tile-concepto-line {
  display: grid;
  grid-template-columns:
    var(--conceptos-qty-w, max-content)
    var(--conceptos-qty-gap)
    minmax(0, 1fr)
    var(--conceptos-cost-w, max-content)
    var(--conceptos-money-gap)
    var(--conceptos-amt-w, max-content);
  align-items: center;
  column-gap: 2px;
  row-gap: 2px;
  font-size: 0.8125rem;
  line-height: 1.25;
  width: 100%;
}

.tile-concepto-qty,
.tile-concepto-cost,
.tile-concepto-amount {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.tile-concepto-qty {
  grid-column: 1;
  text-align: left;
  color: var(--md-on-surface-variant);
  font-size: 0.75rem;
  justify-self: start;
  width: max-content;
  max-width: 100%;
  box-sizing: border-box;
}

.tile-concepto-name {
  grid-column: 3;
  min-width: 0;
  font-weight: 500;
  color: var(--md-on-surface);
  white-space: normal;
  word-break: break-word;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 8;
  overflow: hidden;
}

.tile-concepto-cost {
  grid-column: 4;
  color: var(--md-on-surface-variant);
  font-size: 0.75rem;
  text-align: right;
  justify-self: end;
  width: max-content;
  max-width: 100%;
}

.tile-concepto-amount {
  grid-column: 6;
  font-weight: 600;
  font-size: 0.8125rem;
  color: var(--md-on-surface);
  text-align: right;
  justify-self: end;
  width: max-content;
  max-width: 100%;
  box-sizing: border-box;
  padding-right: 0;
}

.tile-concepto .tile-menu-btn {
  width: 36px;
  height: 36px;
  margin: 0 -2px 0 0;
}

.tile-concepto .tile-menu-btn svg {
  width: 20px;
  height: 20px;
}

.list-card-conceptos .list-total-bar {
  padding: 8px 6px 8px max(2px, var(--safe-l));
  gap: 8px;
  z-index: 1;
  box-shadow: 0 -1px 0 var(--md-outline-variant);
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.list-card-conceptos .list-total-bar--no-mano {
  justify-content: flex-end;
}

.list-card-conceptos .list-total-bar-end {
  flex: 0 0 auto;
  min-width: 0;
  width: auto;
  justify-content: flex-end;
  gap: 10px;
}

.list-card-conceptos .list-total-mano {
  font-size: 0.8125rem;
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
  text-align: left;
  white-space: normal;
  line-height: 1.35;
  word-break: break-word;
  overflow: visible;
}

body.compact .list-card-conceptos .list-total-bar {
  padding-left: max(2px, var(--safe-l));
}

body.compact.show-row-reorder .list-card-conceptos .list-total-bar {
  padding-left: calc(max(2px, var(--safe-l)) + 28px);
}

.list-card-conceptos .list-total-label {
  font-size: 0.8125rem;
}

.list-card-conceptos .list-total-amount {
  font-size: 0.9375rem;
}

.list-total-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid var(--md-outline-variant);
  background: var(--md-surface-container-high);
}

.list-total-mano {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--md-on-surface-variant);
  word-break: break-word;
}

.list-total-bar-end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-shrink: 0;
}

.list-total-bar--no-mano {
  justify-content: flex-end;
}

.list-card-conceptos .list-total-bar--no-mano .list-total-mano {
  display: none;
}

.list-total-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--md-on-surface-variant);
}

.list-total-amount {
  font-size: 1.125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--md-primary);
}

.field-row {
  display: flex;
  gap: 12px;
}

.field-row .field {
  flex: 1;
  min-width: 0;
}

.signed-number-field {
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.signed-number-field input {
  flex: 1;
  min-width: 0;
}

.signed-number-toggle {
  flex: 0 0 44px;
  min-height: 44px;
  border: 1px solid var(--md-outline-variant);
  border-radius: var(--md-radius-sm);
  background: var(--md-surface-container-high);
  color: var(--md-primary);
  font-size: 1.35rem;
  font-weight: 700;
  cursor: pointer;
}

.signed-number-toggle:active {
  background: var(--md-primary-container);
}

.field-check label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  color: var(--md-on-surface);
  cursor: pointer;
}

.field-check input {
  width: 20px;
  height: 20px;
  accent-color: var(--md-primary);
}

body.page-calculos #fab {
  display: none;
}

body.page-calculos .icon-btn-add svg {
  fill: var(--md-primary);
}

.bottom-sheet-calculo.keyboard-visible {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.bottom-sheet-calculo {
  transition: transform 0.28s cubic-bezier(0.2, 0, 0, 1), bottom 0.2s ease;
  padding-top: 8px;
  padding-bottom: calc(12px + var(--safe-b));
}

.bottom-sheet-calculo .sheet-handle {
  margin-bottom: 8px;
}

.bottom-sheet-calculo form {
  max-height: none;
  overflow: visible;
  padding-bottom: 0;
}

.bottom-sheet-calculo .calculo-sheet-primary {
  margin-top: 0;
}

.bottom-sheet-calculo .calculo-sheet-primary .field {
  margin-bottom: 8px;
}

.calculo-autofill-trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.calculo-kb-next {
  position: fixed;
  right: calc(12px + var(--safe-r));
  bottom: calc(12px + var(--safe-b));
  z-index: 48;
  width: 52px;
  height: 52px;
  border: none;
  border-radius: var(--md-radius-lg);
  background: var(--md-primary);
  color: var(--md-on-primary);
  box-shadow: var(--md-shadow-3);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
}

.calculo-kb-next[hidden] {
  display: none !important;
}

.calculo-kb-next:active {
  opacity: 0.9;
  transform: scale(0.96);
}

.calculo-empty-prompt {
  margin-top: 12px;
  padding: 16px;
  border-radius: var(--md-radius-sm);
  background: var(--md-surface-container-high);
  border: 1px solid var(--md-outline-variant);
}

.calculo-empty-prompt-text {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  color: var(--md-on-surface);
}

.calculo-empty-prompt .sheet-actions-calculo {
  margin-bottom: 0;
}

.bottom-sheet-calculo.is-empty-prompt .field-row,
.bottom-sheet-calculo.is-empty-prompt .sheet-actions-dictado,
.bottom-sheet-calculo.is-empty-prompt .sheet-actions-calculo,
.bottom-sheet-calculo.is-empty-prompt .field-calculo-nombre {
  display: none;
}

.bottom-sheet-calculo.is-empty-prompt .calculo-empty-prompt {
  display: block;
}

.bottom-sheet-calculo.is-empty-prompt .calculo-empty-prompt .sheet-actions-calculo {
  display: flex;
}

.calculo-empty-prompt[hidden] {
  display: none !important;
}

.sheet-actions-dictado {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-start;
  margin: 0 0 8px;
  padding-top: 0;
  padding-bottom: 0;
}

.sheet-actions-dictado .btn-filled-inline {
  min-width: 5.5rem;
  flex: 0 0 auto;
}

.sheet-actions-dictado .btn-filled-inline.listening {
  outline: 2px solid #c62828;
  outline-offset: 1px;
}

.sheet-actions-calculo {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 12px;
  margin-top: 0;
  margin-bottom: 8px;
  padding-top: 0;
  padding-bottom: 4px;
}

.sheet-actions-calculo .btn-text {
  flex: 1;
  width: auto;
  margin: 0;
  order: 1;
  border-radius: var(--md-radius-sm);
  background: var(--md-surface-container-high);
  color: var(--md-on-surface);
}

.sheet-actions-calculo .btn-filled-inline {
  flex: 1;
  width: auto;
  margin: 0;
  order: 2;
}

.sheet-title-calculo[hidden] {
  display: none;
}

.bottom-sheet form {
  max-height: min(70vh, 520px);
  overflow-y: auto;
  padding-bottom: 8px;
}

.tile-menu-btn {
  flex-shrink: 0;
}

body.compact .tile-menu-btn {
  display: none;
}

body.compact.show-row-actions .tile-menu-btn {
  display: inline-flex;
}

body.compact .tile {
  min-height: 48px;
  padding-left: 16px;
}

body.compact .page-main {
  padding-top: 4px;
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--md-on-surface-variant);
  font-size: 0.9375rem;
}

.fab {
  position: fixed;
  right: calc(16px + var(--safe-r));
  bottom: calc(16px + var(--safe-b));
  width: var(--fab-size);
  height: var(--fab-size);
  border: none;
  border-radius: var(--md-radius-lg);
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
  box-shadow: var(--md-shadow-3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 25;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fab svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

.fab:active {
  transform: scale(0.96);
}

.fab-ia {
  left: calc(16px + var(--safe-l));
  right: auto;
  background: var(--md-secondary-container, #e8def8);
  color: var(--md-on-secondary-container, #1d192b);
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}

.fab-ia.listening {
  background: #c62828;
  color: #fff;
  box-shadow: var(--md-shadow-3);
  animation: fab-ia-pulse 1.2s ease-in-out infinite;
}

.fab-ia.busy {
  opacity: 0.72;
  pointer-events: none;
}

@keyframes fab-ia-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  z-index: 30;
  transition: opacity 0.2s ease;
}

.scrim.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(300px, 86vw);
  background: var(--md-surface-container);
  z-index: 40;
  transform: translateX(-105%);
  transition: transform 0.25s cubic-bezier(0.2, 0, 0, 1);
  padding: calc(16px + var(--safe-t)) 16px 16px;
  box-shadow: var(--md-shadow-3);
}

.drawer.open {
  transform: translateX(0);
}

.drawer-head {
  font-size: 1.375rem;
  font-weight: 600;
  margin: 8px 8px 24px;
  color: var(--md-primary);
}

.drawer-nav a {
  display: block;
  padding: 14px 16px;
  border-radius: var(--md-radius-sm);
  font-weight: 500;
  margin-bottom: 4px;
}

.drawer-nav a.active {
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
}

.drawer-nav a:active {
  background: var(--md-surface-container-high);
}

.menu-popup {
  position: fixed;
  z-index: 50;
  min-width: 220px;
  max-width: min(92vw, 360px);
  max-height: min(78dvh, 560px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  background: var(--md-surface-container);
  border-radius: var(--md-radius-sm);
  box-shadow: var(--md-shadow-3);
  padding: 8px 0;
  opacity: 0;
  transform: scale(0.95);
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  transform-origin: top right;
}

.menu-popup.open {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.menu-item {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 12px 20px;
  font: inherit;
  font-size: 0.9375rem;
  color: var(--md-on-surface);
  cursor: pointer;
}

.menu-item:active {
  background: var(--md-surface-container-high);
}

.menu-item--disabled,
.menu-item:disabled {
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}

.menu-item.danger {
  color: var(--md-error);
}

.menu-item.check {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.menu-item .check-mark {
  opacity: 0;
  color: var(--md-primary);
  font-weight: 700;
}

.menu-item.check.on .check-mark {
  opacity: 1;
}

.menu-section-title {
  padding: 10px 16px 4px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--md-on-surface-variant);
  pointer-events: none;
}

.menu-item-has-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.menu-chevron {
  opacity: 0.55;
  font-size: 1.125rem;
  line-height: 1;
}

.menu-item-back {
  font-weight: 600;
  color: var(--md-primary);
  border-bottom: 1px solid var(--md-outline-variant);
}

.bottom-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  background: var(--md-surface-container);
  border-radius: var(--md-radius-md) var(--md-radius-md) 0 0;
  box-shadow: var(--md-shadow-3);
  padding: 12px 20px calc(20px + var(--safe-b));
  transform: translateY(105%);
  transition: transform 0.28s cubic-bezier(0.2, 0, 0, 1);
  max-height: 85vh;
  overflow-y: auto;
}

.bottom-sheet.open {
  transform: translateY(0);
}

.sheet-handle {
  width: 32px;
  height: 4px;
  background: var(--md-outline-variant);
  border-radius: 2px;
  margin: 0 auto 16px;
}

.sheet-title {
  margin: 0 0 16px;
  font-size: 1.25rem;
  font-weight: 600;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--md-on-surface-variant);
  margin-bottom: 8px;
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--md-outline-variant);
  border-radius: var(--md-radius-sm);
  padding: 14px 16px;
  font: inherit;
  font-size: 1rem;
  background: var(--md-surface);
  color: var(--md-on-surface);
}

.field textarea {
  min-height: 120px;
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  outline: 2px solid var(--md-primary);
  outline-offset: 1px;
  border-color: transparent;
}

.btn-filled {
  width: 100%;
  border: none;
  border-radius: var(--md-radius-sm);
  padding: 14px 24px;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  background: var(--md-primary);
  color: var(--md-on-primary);
  cursor: pointer;
  margin-top: 8px;
}

.btn-filled:active {
  opacity: 0.92;
}

.btn-text {
  width: 100%;
  border: none;
  background: transparent;
  color: var(--md-primary);
  padding: 12px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  margin-top: 4px;
}

.snackbar {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(var(--fab-size) + 24px + var(--safe-b));
  z-index: 26;
  padding: 14px 16px;
  background: #323232;
  color: #fff;
  border-radius: var(--md-radius-sm);
  font-size: 0.875rem;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.snackbar.show {
  opacity: 1;
  transform: translateY(0);
}

.snackbar.err {
  background: var(--md-error);
}

.page-resumen {
  padding-bottom: calc(72px + 16px + var(--safe-b));
}

.page-gps {
  padding-bottom: calc(72px + 16px + var(--safe-b));
}

.gps-root {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gps-card {
  background: var(--md-surface-container);
  border-radius: var(--md-radius-md);
  box-shadow: var(--md-shadow-1);
  padding: 14px 16px;
}

.gps-cot-title {
  margin: 0 0 6px;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
  word-break: break-word;
}

.gps-cot-meta {
  margin: 0;
  font-size: 0.8125rem;
  color: var(--md-on-surface-variant);
  line-height: 1.35;
}

.gps-section-title {
  margin: 0 0 8px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--md-on-surface-variant);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.gps-coords {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--md-on-surface);
  word-break: break-all;
}

.gps-updated {
  margin: 8px 0 0;
  font-size: 0.8125rem;
  color: var(--md-on-surface-variant);
}

.gps-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.gps-btn-maps {
  font-weight: 600;
  color: var(--md-primary);
}

.gps-btn-clear {
  color: var(--md-error);
}

.bottom-sheet-gps-map {
  max-height: min(92vh, 720px);
}

.bottom-sheet-gps-map .gps-map-hint {
  margin: 0 0 10px;
  font-size: 0.8125rem;
  color: var(--md-on-surface-variant);
  line-height: 1.35;
}

.gps-map {
  width: 100%;
  height: min(48vh, 360px);
  min-height: 220px;
  border-radius: var(--md-radius-sm);
  overflow: hidden;
  border: 1px solid var(--md-outline-variant);
  margin-bottom: 10px;
  z-index: 0;
}

.gps-map-coords-preview {
  margin: 0 0 12px;
  font-size: 0.9375rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--md-on-surface);
}

.bottom-sheet-gps-map .btn-filled,
.bottom-sheet-gps-map .btn-text {
  width: 100%;
  margin-bottom: 4px;
}

.resumen-root {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.resumen-card {
  background: var(--md-surface-container);
  border-radius: var(--md-radius-md);
  box-shadow: var(--md-shadow-1);
  padding: 14px 16px;
}

.resumen-cliente {
  margin: 0 0 6px;
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
  word-break: break-word;
}

.resumen-meta {
  margin: 0 0 4px;
  font-size: 0.8125rem;
  color: var(--md-on-surface-variant);
  line-height: 1.35;
}

.resumen-section-title {
  margin: 0 0 10px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--md-on-surface-variant);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.resumen-totales,
.resumen-counts {
  list-style: none;
  margin: 0;
  padding: 0;
}

.resumen-total-row,
.resumen-count-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--md-outline-variant);
  font-size: 0.875rem;
}

.resumen-total-row:last-child,
.resumen-count-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.resumen-total-label {
  color: var(--md-on-surface);
  flex: 1;
  min-width: 0;
}

.resumen-total-value,
.resumen-count-n {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.resumen-total--primary .resumen-total-value {
  color: var(--md-primary);
  font-size: 1rem;
}

.resumen-total--gain .resumen-total-value {
  color: #2e7d32;
}

.resumen-chart {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.resumen-chart-row {
  display: grid;
  grid-template-columns: 4.5rem 1fr auto;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
}

.resumen-chart-label {
  color: var(--md-on-surface-variant);
}

.resumen-chart-track {
  height: 10px;
  border-radius: 5px;
  background: var(--md-surface-container-high);
  overflow: hidden;
}

.resumen-chart-bar {
  height: 100%;
  border-radius: 5px;
  min-width: 2px;
  transition: width 0.25s ease;
}

.resumen-chart-bar--cottotal {
  background: var(--md-primary);
}

.resumen-chart-bar--ingresos {
  background: #2e7d32;
}

.resumen-chart-bar--gastos {
  background: #c62828;
}

.resumen-chart-bar--ganancias {
  background: #6a1b9a;
}

.resumen-chart-bar--neg {
  opacity: 0.75;
  background: #ef6c00;
}

.resumen-chart-num {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
}

.resumen-chart-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 0.6875rem;
  color: var(--md-on-surface-variant);
}

.resumen-chart-legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}

.resumen-legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.resumen-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0 8px;
}

.resumen-link-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  border-radius: var(--md-radius-sm);
  background: var(--md-primary-container);
  color: var(--md-on-primary-container);
  font-size: 0.8125rem;
  font-weight: 600;
  text-decoration: none;
}

.resumen-link-btn:active {
  opacity: 0.88;
}

.resumen-total-value--text {
  white-space: pre-wrap;
  text-align: right;
  max-width: 55%;
  font-weight: 500;
  font-size: 0.8125rem;
}

.resumen-total-row--text {
  align-items: flex-start;
}

.tile-proveedor {
  align-items: center;
  gap: 0;
  padding-left: 0;
}

.tile-proveedor-thumb {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  margin: 6px 10px 6px 14px;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--md-primary-container);
  border: 1px solid var(--md-outline-variant);
}

.tile-proveedor-thumb--fallback {
  background: var(--md-surface-container-high);
}

.tile-proveedor-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tile-proveedor-initials {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--md-primary);
  line-height: 1;
}

.tile-proveedor .tile-body {
  min-width: 0;
}

.tile-multiline .tile-title,
.tile-multitarea-name,
.tile-multisub-name {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  word-break: break-word;
  line-height: 1.35;
}

.tile-multitarea .tile-body,
.tile-multisub .tile-body {
  cursor: pointer;
}

.page-main.page-multitareas,
.page-main.page-multisubtareas {
  padding-left: max(12px, var(--safe-l));
  padding-right: max(12px, var(--safe-r));
}

.tile-proveedor .tile-body {
  padding: 10px 4px 10px 0;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.field-logo .field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--md-on-surface-variant);
}

.prov-logo-picker {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.prov-logo-preview {
  width: 88px;
  height: 88px;
  border-radius: var(--md-radius-sm);
  overflow: hidden;
  background: var(--md-surface-container-high);
  border: 1px solid var(--md-outline-variant);
  flex-shrink: 0;
}

.prov-logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.prov-logo-picker-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
}

.prov-logo-file-btn {
  cursor: pointer;
  font-weight: 600;
  color: var(--md-primary);
  margin: 0;
}

.prov-logo-advanced {
  margin-top: 10px;
  font-size: 0.8125rem;
  color: var(--md-on-surface-variant);
}

.prov-logo-advanced summary {
  cursor: pointer;
  color: var(--md-primary);
  font-weight: 500;
  margin-bottom: 6px;
}

.prov-logo-advanced textarea {
  width: 100%;
  margin-top: 4px;
}

@media (min-width: 600px) {
  .page-main {
    max-width: 720px;
    margin: 0 auto;
  }

  body.page-conceptos .page-main.page-conceptos {
    max-width: min(960px, calc(100vw - 40px));
    padding-left: max(16px, var(--safe-l));
    padding-right: max(16px, var(--safe-r));
  }

  body.page-conceptos .top-app-bar-conceptos {
    max-width: min(960px, calc(100vw - 40px));
    margin-left: auto;
    margin-right: auto;
    padding-left: max(16px, var(--safe-l));
    padding-right: max(16px, var(--safe-r));
    box-sizing: border-box;
  }

  .menu-popup {
    min-width: 220px;
  }
}

/* Conceptos en pantalla ancha: misma columna y escala que la lista de cotizaciones */
body.page-conceptos.wide-layout .top-app-bar-conceptos,
body.page-conceptos.wide-layout .page-main.page-conceptos {
  max-width: 720px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: max(12px, var(--safe-l));
  padding-right: max(12px, var(--safe-r));
  box-sizing: border-box;
}

body.page-conceptos.wide-layout .top-app-bar-sub-conceptos {
  gap: 16px;
}

body.page-conceptos.wide-layout .top-app-bar-cot-left,
body.page-conceptos.wide-layout .conceptos-prov-chip {
  max-width: none;
  flex: 1 1 0;
}

body.page-conceptos.wide-layout .top-app-bar-cot-dir {
  font-size: 1.0625rem;
}

body.page-conceptos.wide-layout .top-app-bar-cot-fecha {
  font-size: 0.9375rem;
}

body.page-conceptos.wide-layout .conceptos-prov-name,
body.page-conceptos.wide-layout .conceptos-prov-line {
  font-size: 0.9375rem;
}

body.page-conceptos.wide-layout .list-card-conceptos {
  border-radius: var(--md-radius-md);
  --conceptos-qty-gap: 12px;
  --conceptos-money-gap: 12px;
}

body.page-conceptos.wide-layout .conceptos-col-head {
  padding: 10px 0 8px;
}

body.page-conceptos.wide-layout .conceptos-col-head-line {
  gap: 12px;
  padding-left: 16px;
  padding-right: 8px;
}

body.page-conceptos.wide-layout .conceptos-col-h {
  font-size: 0.875rem;
}

body.page-conceptos.wide-layout .tile-concepto {
  min-height: 56px;
  padding: 8px 0;
}

body.page-conceptos.wide-layout .tile-concepto-body {
  padding: 6px 0 6px 16px;
}

body.page-conceptos.wide-layout.compact .tile-concepto-body {
  padding-left: 16px;
}

body.page-conceptos.wide-layout.compact.show-row-reorder .tile-concepto-body {
  padding-left: 0;
}

body.page-conceptos.wide-layout .tile-concepto-line {
  font-size: 1rem;
  line-height: 1.35;
  column-gap: 10px;
}

body.page-conceptos.wide-layout .tile-concepto-name {
  font-size: 1rem;
  font-weight: 500;
}

body.page-conceptos.wide-layout .tile-concepto-qty,
body.page-conceptos.wide-layout .tile-concepto-cost {
  font-size: 0.9375rem;
}

body.page-conceptos.wide-layout .tile-concepto-amount {
  font-size: 1rem;
  font-weight: 600;
}

body.page-conceptos.wide-layout .list-card-conceptos .list-total-bar {
  padding: 14px 16px;
}

body.page-conceptos.wide-layout .list-card-conceptos .list-total-label {
  font-size: 0.9375rem;
}

body.page-conceptos.wide-layout .list-card-conceptos .list-total-amount {
  font-size: 1.125rem;
}

body.page-conceptos.wide-layout .list-card-conceptos .list-total-mano {
  font-size: 0.9375rem;
}

body.page-conceptos.wide-layout .tile-concepto .tile-menu-btn,
body.page-conceptos.wide-layout .conceptos-col-head-menu {
  width: 48px;
  height: 48px;
}

body.page-conceptos.wide-layout.compact .tile-concepto .tile-menu-btn {
  display: inline-flex;
}

body.page-conceptos.wide-layout .list-card-conceptos #cot-material-section {
  border-radius: 0;
  margin-left: 0;
}

body.page-conceptos.wide-layout .cot-material-text,
body.page-conceptos.wide-layout .cot-material-placeholder {
  font-size: 0.9375rem;
}

body.page-conceptos.wide-layout .cot-bottom-nav {
  left: 0;
  right: 0;
  margin-left: auto;
  margin-right: auto;
  max-width: 720px;
  box-sizing: border-box;
  border-left: 1px solid var(--md-outline-variant);
  border-right: 1px solid var(--md-outline-variant);
}

body.page-conceptos.wide-layout .cot-nav-item {
  font-size: 0.75rem;
}

body.page-conceptos.wide-layout .cot-nav-item svg {
  width: 26px;
  height: 26px;
}

body.page-calculos.wide-layout .top-app-bar,
body.page-calculos.wide-layout .page-main.page-calculos {
  max-width: 720px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: max(12px, var(--safe-l));
  padding-right: max(12px, var(--safe-r));
  box-sizing: border-box;
}

body.page-calculos.wide-layout .top-app-bar-title {
  font-size: 1.25rem;
}

body.page-calculos.wide-layout .top-app-bar-sub-calculos {
  font-size: 0.9375rem;
}

body.page-calculos.wide-layout .top-app-bar-calculos-total {
  font-size: 1rem;
}

body.page-calculos.wide-layout .list-card-calculos {
  --calculos-col-gap: 12px;
}

body.page-calculos.wide-layout .calculos-col-head {
  padding: 10px 0 8px;
}

body.page-calculos.wide-layout .calculos-col-head-line {
  padding-left: 16px;
  padding-right: 8px;
  column-gap: 8px;
}

body.page-calculos.wide-layout .calculos-col-h {
  font-size: 0.875rem;
}

body.page-calculos.wide-layout .tile-calculo {
  min-height: 56px;
  padding: 8px 0;
}

body.page-calculos.wide-layout .tile-calculo-body {
  padding-left: 16px;
  padding-right: 8px;
}

body.page-calculos.wide-layout .tile-calculo-nombre {
  font-size: 1rem;
  line-height: 1.35;
  margin-bottom: 4px;
}

body.page-calculos.wide-layout .tile-calculo-line {
  font-size: 1rem;
  line-height: 1.35;
  column-gap: 8px;
}

body.page-calculos.wide-layout .tile-calculo-alt {
  font-size: 0.9375rem;
}

body.page-calculos.wide-layout .tile-calculo .tile-menu-btn,
body.page-calculos.wide-layout .calculos-col-head-menu {
  width: 48px;
  height: 48px;
}

body.page-calculos.wide-layout.compact .tile-calculo .tile-menu-btn {
  display: inline-flex;
}

body.page-gps.wide-layout .top-app-bar,
body.page-gps.wide-layout .page-main.page-gps {
  max-width: 720px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: max(12px, var(--safe-l));
  padding-right: max(12px, var(--safe-r));
  box-sizing: border-box;
}

body.page-gps.wide-layout .gps-cot-title {
  font-size: 1.25rem;
}

body.page-gps.wide-layout .gps-coords {
  font-size: 1.125rem;
}

body.page-pdf-view.wide-layout .top-app-bar,
body.page-pdf-view.wide-layout .page-main.page-pdf {
  max-width: 720px;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  padding-left: max(12px, var(--safe-l));
  padding-right: max(12px, var(--safe-r));
  box-sizing: border-box;
}

body.page-pdf-view.wide-layout .pdf-preview {
  padding: 20px 16px 24px;
}

body.page-pdf-view.wide-layout .pdf-doc {
  --pdf-text-scale: 1;
  padding: 8px 12px 16px;
}

body.page-pdf-view.wide-layout .pdf-conceptos-grid {
  --pdf-qty-gap: 10px;
  --pdf-money-gap: 10px;
}

body.page-pdf-view.wide-layout .pdf-conceptos-head {
  padding: 12px 14px 14px;
  gap: 12px;
}

body.page-pdf-view.wide-layout .pdf-conceptos-line {
  padding: 10px 14px;
  column-gap: 6px;
}

body.page-pdf-view.wide-layout .pdf-doc-header-row {
  padding: 14px 8px 16px;
  gap: 16px;
}

body.page-pdf-view.wide-layout .pdf-actions .btn-filled,
body.page-pdf-view.wide-layout .pdf-actions .btn-text {
  font-size: 0.9375rem;
  min-height: 44px;
}

body.page-pdf-view.wide-layout .cot-bottom-nav {
  left: 0;
  right: 0;
  margin-left: auto;
  margin-right: auto;
  max-width: 720px;
  box-sizing: border-box;
  border-left: 1px solid var(--md-outline-variant);
  border-right: 1px solid var(--md-outline-variant);
}

body.page-pdf-view.wide-layout .cot-nav-item {
  font-size: 0.75rem;
}

body.page-pdf-view.wide-layout .cot-nav-item svg {
  width: 26px;
  height: 26px;
}

.page-pdf {
  padding-top: 4px;
}

body.m3-app.page-pdf-view {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body.page-pdf-view .top-app-bar {
  flex-shrink: 0;
}

body.page-pdf-view .page-main.page-pdf {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

.pdf-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
  flex-shrink: 0;
}

@media (min-width: 380px) {
  .pdf-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .pdf-actions .btn-filled {
    grid-column: 1 / -1;
  }
}

.pdf-btn-secondary {
  font-weight: 600;
  color: var(--md-primary);
}

.pdf-preview {
  background: var(--md-surface-container);
  border-radius: var(--md-radius-md);
  box-shadow: var(--md-shadow-1);
  padding: 16px max(12px, var(--safe-r)) 20px max(12px, var(--safe-l));
  min-width: 0;
}

.page-pdf-view .pdf-preview {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.pdf-doc {
  background: var(--md-surface);
  border-radius: var(--md-radius-sm);
  padding: 4px 2px 8px;
  --pdf-text-scale: 0.65;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.pdf-doc-head {
  padding-bottom: 4px;
}

.pdf-doc-title {
  margin: 0;
  font-size: calc(1.5rem * var(--pdf-text-scale));
  font-weight: 700;
  line-height: 1.2;
  text-align: left;
}

.pdf-doc-header-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 12px 4px 14px;
  border-bottom: 1px solid var(--md-outline-variant);
}

.pdf-doc-header-left {
  flex: 1 1 50%;
  min-width: 0;
  max-width: 50%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  text-align: left;
  gap: 6px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.pdf-doc-header-right {
  flex: 1 1 50%;
  min-width: 0;
  max-width: 50%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  text-align: right;
  gap: 6px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.pdf-doc-header-right .pdf-doc-prov-thumb {
  margin-left: auto;
}

.pdf-doc-direccion {
  margin: 0;
  font-size: calc(1.0625rem * var(--pdf-text-scale));
  font-weight: 500;
  line-height: 1.35;
  width: 100%;
  text-align: left;
}

.pdf-doc-fecha {
  margin: 0;
  font-size: calc(0.9375rem * var(--pdf-text-scale));
  line-height: 1.3;
  color: var(--md-on-surface-variant);
  width: 100%;
  text-align: left;
}

.pdf-doc-prov-thumb {
  width: calc(64px * var(--pdf-text-scale));
  height: calc(64px * var(--pdf-text-scale));
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--md-primary-container);
  flex-shrink: 0;
}

.pdf-doc-prov-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pdf-doc-prov-thumb--fallback {
  background: var(--md-surface-container);
}

.pdf-doc-prov-initials {
  font-size: calc(1.5rem * var(--pdf-text-scale));
  font-weight: 700;
  color: var(--md-primary);
}

.pdf-doc-prov-name {
  margin: 0;
  font-size: calc(1.0625rem * var(--pdf-text-scale));
  font-weight: 600;
  line-height: 1.3;
  word-break: break-word;
}

.pdf-doc-prov-line {
  margin: 0;
  font-size: calc(0.9375rem * var(--pdf-text-scale));
  line-height: 1.35;
  color: var(--md-on-surface-variant);
  word-break: break-word;
}

.pdf-doc-section {
  margin-top: 18px;
  padding-top: 14px;
}

.pdf-doc-section-conceptos {
  border-top: 1px solid var(--md-outline-variant);
  margin-top: 0;
  padding-top: 16px;
  min-width: 0;
}

.pdf-doc-section-title {
  margin: 0 0 10px;
  font-size: calc(1.125rem * var(--pdf-text-scale));
  font-weight: 600;
}

.pdf-conceptos-grid {
  --pdf-qty-gap: 4px;
  --pdf-money-gap: 4px;
  border-radius: var(--md-radius-sm);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--md-outline-variant);
  background: var(--md-surface);
  max-width: 100%;
}

.pdf-conceptos-head {
  display: flex;
  align-items: end;
  gap: 8px;
  padding: 10px 10px 12px;
  border-bottom: 1px solid var(--md-outline-variant);
  background: #ececec;
  font-size: calc(0.75rem * var(--pdf-text-scale));
  font-weight: 600;
  color: var(--md-on-surface);
  box-sizing: border-box;
}

.pdf-conceptos-head-cant {
  flex-shrink: 0;
}

.pdf-conceptos-head-nom {
  flex: 1;
  min-width: 0;
}

.pdf-conceptos-head-cu,
.pdf-conceptos-head-imp {
  flex-shrink: 0;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.pdf-conceptos-body {
  width: 100%;
}

.pdf-conceptos-body .pdf-conceptos-line:first-child {
  padding-top: 12px;
}

.pdf-conceptos-line {
  display: grid;
  grid-template-columns:
    var(--pdf-qty-w, max-content)
    var(--pdf-qty-gap)
    minmax(0, 1fr)
    var(--pdf-cost-w, max-content)
    var(--pdf-money-gap)
    var(--pdf-amt-w, max-content);
  column-gap: 2px;
  align-items: start;
  padding: 8px 10px;
  border-bottom: 1px solid var(--md-outline-variant);
  font-size: calc(0.9375rem * var(--pdf-text-scale));
  line-height: 1.3;
  background: var(--md-surface);
  width: 100%;
  box-sizing: border-box;
}

.pdf-conceptos-grid-foot {
  background: #ececec;
  min-height: 10px;
  padding: 0;
  border-bottom: none;
}

.pdf-c-cant {
  grid-column: 1;
  text-align: left;
  justify-self: start;
  width: max-content;
  max-width: 100%;
  font-variant-numeric: tabular-nums;
}

.pdf-c-nom {
  grid-column: 3;
  text-align: left;
  word-break: break-word;
}

.pdf-c-cu {
  grid-column: 4;
  text-align: right;
  justify-self: end;
  width: max-content;
  max-width: 100%;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 0;
}

.pdf-c-imp {
  grid-column: 6;
  text-align: right;
  justify-self: end;
  width: max-content;
  max-width: 100%;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-weight: 600;
  min-width: 0;
}

.page-pdf-view .pdf-conceptos-line:not(.pdf-conceptos-line--head) .pdf-c-cu,
.page-pdf-view .pdf-conceptos-line:not(.pdf-conceptos-line--head) .pdf-c-imp {
  white-space: nowrap;
}

.pdf-conceptos-line--head .pdf-c-imp {
  font-weight: 600;
}

.pdf-conceptos-line:not(.pdf-conceptos-line--head) .pdf-c-cant {
  color: var(--md-on-surface-variant);
  font-size: calc(0.875rem * var(--pdf-text-scale));
}

.pdf-conceptos-line:not(.pdf-conceptos-line--head) .pdf-c-cu {
  color: var(--md-on-surface-variant);
  font-size: calc(0.875rem * var(--pdf-text-scale));
}

.pdf-doc-muted {
  margin: 0;
  font-size: calc(0.875rem * var(--pdf-text-scale));
  color: var(--md-on-surface-variant);
}

.pdf-doc-total {
  margin: 12px 10px 6px;
  font-weight: 700;
  font-size: calc(1rem * var(--pdf-text-scale));
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  font-variant-numeric: tabular-nums;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.pdf-doc-total--no-mano .pdf-doc-total-bar-end {
  margin-left: auto;
}

.pdf-doc-total-mano {
  width: 100%;
  font-size: calc(0.9375rem * var(--pdf-text-scale));
  font-weight: 600;
  line-height: 1.35;
  color: var(--md-on-surface);
  word-break: break-word;
  white-space: pre-line;
  text-align: right;
}

.pdf-doc-total--no-mano .pdf-doc-total-mano {
  display: none;
}

.pdf-doc-total-bar-end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-shrink: 0;
  width: 100%;
}

.pdf-doc-total-label {
  font-weight: 600;
}

.pdf-doc-total-amt {
  font-weight: 700;
}

.pdf-doc-material {
  margin: 0;
  padding: 12px 10px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: calc(0.9375rem * var(--pdf-text-scale));
  line-height: 1.45;
  background: var(--md-surface-container-high);
  border-radius: var(--md-radius-sm);
}

body.pdf-blob-preview-open {
  overflow: hidden;
}

.pdf-blob-overlay {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: flex;
  flex-direction: column;
  background: var(--md-surface);
  padding-top: var(--safe-t);
  padding-bottom: var(--safe-b);
}

.pdf-blob-overlay-bar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 6px max(12px, var(--safe-r)) 6px max(12px, var(--safe-l));
  border-bottom: 1px solid var(--md-outline-variant);
  background: var(--md-surface-container);
  box-shadow: var(--md-shadow-1);
}

.pdf-blob-overlay-title {
  font-size: 1rem;
  font-weight: 600;
}

.pdf-blob-overlay-close {
  flex-shrink: 0;
  font-weight: 600;
}

.pdf-blob-overlay-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.pdf-blob-overlay-open {
  font-weight: 600;
}

.pdf-blob-overlay-viewer {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #525659;
}

.pdf-blob-overlay-frame {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  border: 0;
  background: #525659;
}

.pdf-blob-overlay-hint {
  flex-shrink: 0;
  margin: 0;
  padding: 8px 12px;
  font-size: 0.8125rem;
  line-height: 1.35;
  color: #fff;
  background: rgba(0, 0, 0, 0.35);
  text-align: center;
}

@media print {
  html,
  body {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
  }

  .scrim,
  .drawer,
  .top-app-bar,
  .pdf-actions,
  .cot-bottom-nav,
  .snackbar,
  .menu-popup {
    display: none !important;
  }

  body.page-pdf-view .page-main,
  body.page-pdf-view.has-cot-nav .page-main {
    min-height: 0 !important;
    height: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: none !important;
  }

  .pdf-preview {
    box-shadow: none;
    border-radius: 0;
    padding: 8mm !important;
    break-inside: avoid;
  }

  .pdf-doc-section {
    break-inside: avoid-page;
  }
}

/* —— Auth / login (Google GIS) —— */
.page-login {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--md-sys-color-surface, #f5f5f5);
}

.auth-page {
  width: 100%;
  max-width: 420px;
}

.auth-card {
  background: var(--md-sys-color-surface-container, #fff);
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.auth-title {
  margin: 0 0 12px;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--md-sys-color-primary, #1565c0);
}

.auth-lead {
  margin: 0 0 12px;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--md-sys-color-on-surface-variant, #444);
}

.auth-lead-muted {
  font-size: 0.8125rem;
  opacity: 0.92;
}

.auth-firebase-btn {
  width: 100%;
  margin: 0;
}

.auth-google-host {
  margin: 20px 0 16px;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.auth-guest-link {
  display: inline-block;
  margin-top: 8px;
  text-align: center;
  width: 100%;
}

.auth-hint {
  font-size: 0.85rem;
  color: var(--md-sys-color-on-surface-variant, #666);
  margin: 0;
}

.auth-safari-btn {
  display: block;
  text-align: center;
  text-decoration: none;
  margin-top: 12px;
  box-sizing: border-box;
}

.auth-google-gis-wrap {
  display: flex;
  justify-content: center;
  margin: 16px 0;
  min-height: 44px;
}

.auth-reset-link {
  display: block;
  margin-top: 1rem;
  width: 100%;
  text-align: center;
  font-size: 0.9rem;
}

.auth-hint.err {
  color: #b3261e;
}

.drawer-auth {
  padding: 12px 16px 8px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  margin-bottom: 4px;
}

.drawer-auth-guest {
  margin: 0 0 8px;
  font-size: 0.8rem;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.75);
}

.drawer-auth-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.drawer-auth-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.drawer-auth-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.drawer-auth-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-auth-email {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-auth-link {
  display: inline-block;
  font-size: 0.85rem;
  color: #90caf9;
  text-decoration: none;
  margin-top: 4px;
}

.drawer-auth-link:hover {
  text-decoration: underline;
}
