[hidden] {
  display: none !important;
}

:root {
  --rumi-bottom-nav-height: 76px;
  --rumi-sticky-action-height: 72px;
  --rumi-fixed-gap: 10px;
}

.pwa-banner,
.offline-message {
  display: none;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff9e8;
  color: #6e4a00;
  padding: 12px 14px;
}

.offline-app-shell {
  min-height: 100vh;
  background: var(--bg);
}

.offline-app-header {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 5;
}

.offline-app-main {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 18px 18px calc(var(--rumi-bottom-nav-height) + 28px + env(safe-area-inset-bottom));
}

.pwa-update-banner {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: .75rem;
  max-width: min(420px, calc(100vw - 2rem));
  padding: .85rem 1rem;
  border: 1px solid #b7d8c9;
  border-radius: 8px;
  background: #f5fff9;
  box-shadow: 0 12px 30px rgba(15, 44, 37, .16);
  color: #14352e;
}

.pwa-banner.is-visible,
.offline-message.is-visible {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.sync-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.sync-login-actions {
  width: 100%;
  margin-top: 10px;
}

.sync-login-actions .button {
  min-height: 44px;
}

.pwa-home-panel {
  display: grid;
  gap: 12px;
}

.home-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(156px, 1fr));
  gap: 10px;
}

.home-action-grid .button {
  min-height: 52px;
  width: 100%;
  white-space: normal;
  text-align: center;
}

[data-online-only].is-disabled {
  opacity: .55;
  cursor: not-allowed;
}

.home-more-actions {
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

.home-more-actions summary {
  min-height: 44px;
  cursor: pointer;
  color: var(--primary);
  font-weight: 800;
}

.home-entry-panel {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdfb;
}

.home-entry-panel h2 {
  margin: 0;
  font-size: 1.15rem;
}

.home-session-warning {
  align-items: flex-start;
}

.sync-counters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.sync-counter {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
}

.sync-counter span {
  display: block;
  color: var(--muted);
  margin-bottom: 6px;
}

.sync-counter strong {
  font-size: 1.6rem;
}

.offline-setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, .8fr);
  gap: 16px;
}

.readiness-list {
  display: grid;
  gap: 10px;
}

.readiness-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  align-items: center;
  min-height: 58px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.readiness-item span {
  color: var(--muted);
}

.readiness-item em {
  grid-row: 1 / span 2;
  grid-column: 2;
  min-width: 74px;
  border-radius: 999px;
  background: #eef3f0;
  padding: 6px 10px;
  color: var(--primary-strong);
  font-style: normal;
  font-weight: 800;
  text-align: center;
}

.readiness-ok {
  border-color: #b7d8c9;
  background: #f7fffa;
}

.readiness-error {
  border-color: #efc3bd;
  background: #fff8f6;
}

.readiness-warning {
  border-color: #e0c070;
  background: #fff9e8;
}

.readiness-warning em {
  background: #fff1c7;
  color: #6e4a00;
}

.offline-setup-status[data-state="success"] {
  border-color: #b7d8c9;
  background: #f5fff9;
  color: #154f41;
}

.offline-setup-status[data-state="error"] {
  border-color: #efc3bd;
  background: #fff4f1;
  color: #84251c;
}

.offline-setup-status[data-state="working"],
.offline-setup-status[data-state="warning"] {
  border-color: #e0c070;
  background: #fff9e8;
  color: #6e4a00;
}

.pin-lock-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 18px;
  background: rgba(29, 37, 33, 0.72);
  z-index: 1000;
}

.pin-lock-backdrop.is-visible {
  display: grid;
}

.pin-lock-panel {
  width: min(100%, 420px);
  border-radius: 8px;
  background: white;
  padding: 20px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
}

.pin-lock-panel h2 {
  margin: 0 0 8px;
}

.pin-lock-panel p {
  color: var(--muted);
}

.pin-lock-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.offline-auth-users {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.offline-auth-users:empty {
  display: none;
}

.offline-auth-panel form {
  display: grid;
  gap: 12px;
}

@media (max-width: 820px) {
  .sync-counters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.mobile-shell {
  min-height: 100vh;
  padding-bottom: calc(
    var(--rumi-bottom-nav-height) +
    var(--rumi-sticky-action-height) +
    32px +
    env(safe-area-inset-bottom)
  );
  background: var(--bg);
}

.mobile-header {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 66px;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.mobile-main {
  display: grid;
  gap: 14px;
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 14px 14px calc(
    var(--rumi-bottom-nav-height) +
    var(--rumi-sticky-action-height) +
    24px +
    env(safe-area-inset-bottom)
  );
}

.mobile-section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.mobile-section-title h1,
.step-card h1 {
  margin: 0 0 8px;
  font-size: 1.45rem;
  line-height: 1.15;
}

.offline-badge,
.sync-badge {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 7px 10px;
  border-radius: 8px;
  background: #eef0f2;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}

.offline-badge[data-state="online"] {
  background: #e4f5ea;
  color: #146436;
}

.offline-badge[data-state="offline"],
.offline-badge[data-state="pending"] {
  background: #fff4db;
  color: #7d5200;
}

.offline-badge[data-state="syncing"] {
  background: #e8f0ff;
  color: #244f9e;
}

.offline-badge[data-state="error"] {
  background: #fff0ee;
  color: var(--danger);
}

.stepper {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.step-dot {
  min-height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e9eeeb;
  color: var(--muted);
  font-weight: 700;
}

.step-dot.is-active {
  background: var(--primary);
  color: #fff;
}

.step-card {
  display: none;
  gap: 14px;
}

.step-card.is-active {
  display: grid;
}

.mobile-form {
  display: grid;
  gap: 14px;
  padding-bottom: calc(
    var(--rumi-bottom-nav-height) +
    var(--rumi-sticky-action-height) +
    var(--rumi-fixed-gap) +
    26px +
    env(safe-area-inset-bottom)
  );
}

.mobile-form > .button.primary.full:last-child {
  position: sticky;
  bottom: var(--rumi-fixed-gap);
  z-index: 6;
  box-shadow: 0 10px 22px rgba(15, 44, 37, .14);
}

[data-inventory-create] .mobile-form > .button.primary.full:last-child,
[data-inventory-movement] .mobile-form > .button.primary.full:last-child {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: calc(var(--rumi-bottom-nav-height) + var(--rumi-fixed-gap) + env(safe-area-inset-bottom));
  z-index: 13;
  width: auto;
  max-width: 732px;
  margin: 0 auto;
}

.touch-grid,
.mobile-card-list,
.calendar-list {
  display: grid;
  gap: 10px;
}

.activity-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.touch-card,
.field-log-card,
.calendar-day {
  width: 100%;
  min-height: 64px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.touch-card {
  display: grid;
  gap: 4px;
}

.place-option-card {
  align-content: center;
  justify-items: start;
  min-height: 66px;
  text-align: left;
  line-height: 1.25;
}

.place-option-card strong,
.place-option-card small {
  display: block;
  width: 100%;
  overflow-wrap: anywhere;
  text-align: left;
}

[data-place-options] {
  padding-bottom: 10px;
}

[data-quality-place-options],
[data-cupping-place-options],
[data-cost-place-options],
[data-lot-qr-places] {
  padding-bottom: calc(var(--rumi-bottom-nav-height) + 18px + env(safe-area-inset-bottom));
}

[data-lot-qr] .sync-toolbar {
  position: sticky;
  bottom: calc(var(--rumi-bottom-nav-height) + var(--rumi-fixed-gap) + env(safe-area-inset-bottom));
  z-index: 8;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(248, 251, 249, .98);
  box-shadow: 0 12px 28px rgba(15, 44, 37, .12);
}

.loading-state {
  min-height: 86px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--primary-strong);
  font-weight: 900;
  letter-spacing: 0;
}

.loading-dots {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.loading-dots i {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
  opacity: .35;
  animation: rumi-loading-dot 1s infinite ease-in-out;
}

.loading-dots i:nth-child(2) {
  animation-delay: .16s;
}

.loading-dots i:nth-child(3) {
  animation-delay: .32s;
}

@keyframes rumi-loading-dot {
  0%,
  80%,
  100% {
    opacity: .35;
    transform: translateY(0);
  }

  40% {
    opacity: 1;
    transform: translateY(-4px);
  }
}

.touch-card small {
  color: var(--muted);
}

.touch-card.is-selected {
  border-color: var(--primary);
  background: #e8f4ee;
  box-shadow: inset 0 0 0 2px var(--primary);
}

.activity-card {
  min-height: 88px;
  justify-items: start;
}

.activity-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-2);
  font-weight: 700;
}

.mobile-field-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-label {
  display: grid;
  gap: 7px;
  font-weight: 700;
}

.mobile-input {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px 12px;
  color: var(--text);
}

textarea.mobile-input {
  min-height: 92px;
  resize: vertical;
}

.field-error {
  min-height: 22px;
  margin: 0;
  color: var(--danger);
  font-weight: 700;
}

.sticky-action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--rumi-bottom-nav-height) + var(--rumi-fixed-gap) + env(safe-area-inset-bottom));
  z-index: 13;
  display: grid;
  grid-template-columns: minmax(96px, .42fr) minmax(0, 1fr);
  gap: 10px;
  padding: 10px 14px;
  background: rgba(244, 246, 243, .96);
  border-top: 1px solid var(--border);
}

.sticky-action-bar button,
.sticky-action-bar .button {
  min-width: 0;
}

.primary-action,
.secondary-action,
.mobile-form .button,
.mobile-bottom-nav a,
.mobile-bottom-nav button {
  min-height: 48px;
}

.mobile-bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 12;
  display: flex;
  align-items: stretch;
  gap: 6px;
  min-height: 64px;
  max-height: var(--rumi-bottom-nav-height);
  padding: 6px 6px max(6px, env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.mobile-bottom-nav a,
.mobile-bottom-nav button {
  display: grid;
  place-items: center;
  flex: 0 0 82px;
  min-width: 82px;
  min-height: 50px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  font-size: .78rem;
  line-height: 1.12;
  white-space: normal;
  text-align: center;
  padding: 4px;
  overflow-wrap: anywhere;
}

.mobile-bottom-nav a span,
.mobile-bottom-nav button span {
  display: block;
  max-width: 100%;
  min-width: 0;
}

.mobile-bottom-form {
  display: grid;
  flex: 0 0 96px;
  min-width: 96px;
  margin: 0;
}

.mobile-bottom-form button {
  width: 100%;
}

@media (max-width: 520px) {
  :root {
    --rumi-bottom-nav-height: 76px;
    --rumi-sticky-action-height: 72px;
  }

  .mobile-shell,
  .offline-app-shell {
    min-height: 100dvh;
    padding-bottom: var(--rumi-bottom-nav-height);
  }

  .mobile-main,
  .offline-app-main {
    max-height: calc(100dvh - 66px - var(--rumi-bottom-nav-height));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .mobile-bottom-nav a,
  .mobile-bottom-nav button {
    flex-basis: 78px;
    min-width: 78px;
    min-height: 50px;
    font-size: .7rem;
    line-height: 1.05;
  }

  .mobile-bottom-form {
    flex-basis: 98px;
    min-width: 98px;
  }
}

.mobile-bottom-nav a:active,
.mobile-bottom-nav button:active {
  background: var(--surface-2);
}

.draft-banner {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(
    var(--rumi-bottom-nav-height) +
    var(--rumi-sticky-action-height) +
    20px +
    env(safe-area-inset-bottom)
  );
  z-index: 13;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px;
  border: 1px solid #e0c070;
  border-radius: 8px;
  background: #fff9e8;
  color: #6e4a00;
}

.photo-preview {
  display: grid;
  gap: 8px;
  min-height: 70px;
  place-items: center;
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 12px;
  color: var(--muted);
}

.photo-preview img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 8px;
}

.success-state,
.empty-state {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
}

.success-state {
  border-color: #b7d8c9;
  background: #f5fff9;
}

.mobile-actions,
.quick-filters,
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.compact-panel {
  padding: 12px;
}

.compact-panel summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  font-weight: 700;
}

.calendar-toolbar {
  display: grid;
  grid-template-columns: minmax(92px, .7fr) 1fr minmax(92px, .7fr);
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  text-align: center;
}

.calendar-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-month-grid > strong {
  text-align: center;
  color: var(--muted);
  font-size: .84rem;
}

.calendar-date {
  min-height: 50px;
  display: grid;
  place-items: center;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
}

.calendar-date small {
  min-height: 18px;
  color: var(--primary);
}

.filter-chip {
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  padding: 8px 12px;
  color: var(--text);
  font-weight: 700;
}

.filter-chip.is-active {
  border-color: var(--primary);
  background: #e8f4ee;
  color: var(--primary-strong);
}

.field-log-card {
  display: grid;
  gap: 10px;
}

.parcel-list-card,
.graphic-log-card,
.parcel-lot-card {
  text-decoration: none;
  color: inherit;
}

.parcel-list-card {
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
}

.parcel-card-action {
  color: var(--primary-strong);
  font-size: .9rem;
  white-space: nowrap;
}

.parcel-hero {
  display: grid;
  gap: 10px;
  background: #f7fbf8;
  border-color: #bad8cb;
}

.parcel-hero h1 {
  margin: 0;
  font-size: clamp(1.65rem, 7vw, 2.4rem);
  line-height: 1.05;
}

.parcel-hero-actions,
.parcel-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.parcel-hero-note {
  border-left: 4px solid var(--primary);
  padding: 10px 12px;
  border-radius: 8px;
  background: #eef8f4;
  color: var(--primary-strong);
  font-weight: 700;
}

.parcel-stats-grid,
.parcel-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.parcel-fact {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfdfb;
}

.parcel-fact span {
  color: var(--muted);
  font-size: .9rem;
}

.parcel-lot-list,
.parcel-timeline {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.parcel-lot-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.parcel-lot-card small {
  color: var(--muted);
}

.graphic-log-card {
  grid-template-columns: 64px 1fr;
  align-items: stretch;
  border-left: 5px solid var(--primary);
}

.graphic-log-card.priority-high,
.graphic-log-card.priority-alta {
  border-left-color: #bd3b2f;
}

.graphic-log-card.priority-low,
.graphic-log-card.priority-baja {
  border-left-color: #4c8f7a;
}

.log-card-date {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 74px;
  border-radius: 8px;
  background: #e8f4ee;
  color: var(--primary-strong);
}

.log-card-date strong {
  font-size: 1.55rem;
  line-height: 1;
}

.log-card-date span {
  font-size: .86rem;
  font-weight: 800;
}

.log-card-body {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field-log-card h2,
.calendar-day h2 {
  margin: 0 0 6px;
  font-size: 1.08rem;
}

.calendar-item {
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.metric-card {
  display: grid;
  gap: 6px;
  min-height: 78px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.metric-card strong {
  font-size: 1.35rem;
}

.stock-low {
  border-color: #f0b7ad;
  background: #fff4f1;
}

.money-value {
  color: var(--primary-strong);
  font-weight: 800;
}

.qr-video {
  width: 100%;
  max-height: 320px;
  border-radius: 8px;
  background: #10241f;
  object-fit: cover;
}

.print-card {
  border: 2px solid var(--primary-strong);
  border-radius: 8px;
  padding: 24px;
  text-align: center;
}

.code-block {
  max-width: 100%;
  overflow: auto;
  padding: 12px;
  border-radius: 8px;
  background: #f2f5f3;
  color: var(--primary-strong);
  white-space: pre-wrap;
}

@media (max-width: 520px) {
  :root {
    --rumi-bottom-nav-height: 156px;
    --rumi-sticky-action-height: 72px;
  }

  .mobile-bottom-nav {
    min-height: var(--rumi-bottom-nav-height);
    max-height: var(--rumi-bottom-nav-height);
    flex-wrap: wrap;
    align-content: stretch;
    overflow-x: hidden;
    overflow-y: auto;
  }

  .mobile-bottom-nav a,
  .mobile-bottom-nav button,
  .mobile-bottom-form {
    flex: 1 1 calc(25% - 6px);
    min-width: 68px;
  }

  .offline-app-header {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr auto;
    padding: 10px 12px;
  }

  .offline-app-main {
    padding: 12px 12px calc(var(--rumi-bottom-nav-height) + 28px + env(safe-area-inset-bottom));
  }

  .pwa-home-panel {
    padding: 14px;
  }

  .pwa-home-panel h1 {
    font-size: 2rem;
    line-height: 1.1;
  }

  .home-action-grid {
    grid-template-columns: 1fr;
  }

  .sync-toolbar .button,
  .mobile-section-title .button {
    width: 100%;
  }

  .mobile-field-grid,
  .activity-grid {
    grid-template-columns: 1fr;
  }

  .mobile-form {
    padding-bottom: calc(
      var(--rumi-bottom-nav-height) +
      var(--rumi-sticky-action-height) +
      var(--rumi-fixed-gap) +
      34px +
      env(safe-area-inset-bottom)
    );
  }

  .place-option-card {
    min-height: 70px;
    padding: 13px 14px;
  }

  .parcel-list-card,
  .graphic-log-card {
    grid-template-columns: 1fr;
  }

  .parcel-card-action {
    white-space: normal;
  }

  .parcel-stats-grid,
  .parcel-detail-grid {
    grid-template-columns: 1fr;
  }

  .log-card-date {
    grid-template-columns: auto auto;
    justify-content: start;
    gap: 8px;
    min-height: 48px;
    padding: 8px 10px;
  }

  .mobile-section-title {
    display: grid;
  }

  .offline-setup-grid {
    grid-template-columns: 1fr;
  }

  .readiness-item {
    grid-template-columns: 1fr;
  }

  .readiness-item em {
    grid-row: auto;
    grid-column: auto;
    width: fit-content;
  }
}

