/* Vaqora look and feel shared with Vaqora Finanzas (web/styles.css there): tokens, login and base controls.
   glass.css (copied as is from Finanzas) loads after this file and adds the Liquid Glass material.
   Modules move to these styles one at a time; until then styles.css keeps their layout. */

:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eff3f2;
  --ink: #17211d;
  --text: var(--ink);
  --muted: #69736f;
  --line: #d8dedb;
  --accent: #087f6f;
  --accent-dark: #065f54;
  --accent-soft: #dcefeb;
  --warning: #a95512;
  --danger: #b3261e;
  --shadow: 0 16px 40px rgba(23, 33, 29, 0.08);
  --brand-product: #1f8ea6;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.sr-only {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Controls */
.form-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button,
.primary-button,
.secondary-button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  padding: 0 14px;
  font-weight: 800;
}

.icon-button svg,
.primary-button svg,
.secondary-button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.primary-button {
  background: var(--accent);
  color: #fff;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.secondary-button {
  background: var(--surface-2);
  color: var(--ink);
  border-color: var(--line);
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  font-weight: 600;
  padding: 4px 0;
}

.hint {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

label {
  display: grid;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(8, 127, 111, 0.16);
}

/* Login */
.auth-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 24px;
}

.login-screen .auth-panel {
  width: min(440px, 100%);
  min-width: 0;
  padding: 32px;
}

.login-screen .auth-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  min-width: 0;
}

.login-screen .form-row {
  flex-wrap: wrap;
  min-width: 0;
}

.login-screen .form-row button {
  max-width: 100%;
  white-space: normal;
}

.login-logo {
  display: block;
  width: min(220px, 100%);
  height: auto;
  object-fit: contain;
  margin: 0 auto 4px;
}

.brand-slogan {
  margin: 0 0 16px;
  text-align: center;
  font-family: "Avenir Next", Avenir, Montserrat, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-dark);
}

.brand-description {
  margin: 0 0 20px;
  text-align: center;
  font-family: "Avenir Next", Avenir, Montserrat, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-weight: 400;
  color: var(--ink);
  line-height: 1.45;
}

.login-status-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.login-status-row #authStatus {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.forgot-row {
  display: flex;
  justify-content: flex-end;
  margin: -8px 0 0;
}

.forgot-row .link-button {
  font-size: 13.5px;
  padding: 2px 0;
}

.enroll-qr {
  width: 200px;
  height: 200px;
  justify-self: center;
  background: #fff;
  border-radius: 12px;
}

.auth-panel code {
  word-break: break-all;
  font-size: 12px;
}

/* App shell (Finanzas: .shell, .sidebar, .workspace, .topbar, .bottom-nav) */
.shell {
  width: min(1380px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
}

.sidebar {
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 24px 12px;
  align-self: start;
  position: sticky;
  top: 12px;
  margin: 12px 0 12px 12px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 0 8px 20px;
}

.sidebar-logo {
  display: block;
  width: min(132px, 100%);
  height: auto;
  object-fit: contain;
  margin: 0 auto;
}

.brand .brand-slogan {
  margin: 0;
  font-size: 9.5px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.sidebar nav .nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  font-size: 14px;
  color: var(--muted);
}

.sidebar nav svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar nav .nav-item:hover {
  background: var(--surface-2);
}

.sidebar nav .nav-item[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 700;
}

.nav-divider {
  border-top: 1px solid var(--line);
  margin: 16px 8px;
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.topbar-title {
  min-width: 0;
}

.farm-picker select {
  width: auto;
  max-width: 100%;
  min-height: 0;
  padding: 0 22px 0 0;
  border: 0;
  background-color: transparent;
  color: var(--accent-dark);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  box-shadow: none;
  cursor: pointer;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-dark);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(1.8rem, 2rem, 2.2rem);
  line-height: 1.1;
}

h2 {
  font-size: 1.05rem;
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.icon-button {
  width: 44px;
  padding: 0;
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
  position: relative;
}

.bell-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 18px;
}

.sync-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.sync-status .sync-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.sync-status[data-state="offline"] .sync-dot {
  background: var(--muted);
}

.sync-status[data-state="pending"] .sync-dot {
  background: var(--warning);
}

.sync-status[data-state="syncing"] .sync-dot {
  animation: sync-pulse 1s ease-in-out infinite;
}

@keyframes sync-pulse {
  50% {
    opacity: 0.3;
  }
}

/* Home (Finanzas: .summary-hero, .summary-grid, .home-columns, .panel, .section-heading) */
.summary-hero {
  background: linear-gradient(135deg, var(--accent) 0%, #0a9a86 100%);
  color: white;
  border-radius: 18px;
  padding: 22px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
}

.summary-hero .eyebrow {
  color: rgba(255, 255, 255, 0.85);
  text-transform: none;
  letter-spacing: 0;
  font-size: 14px;
  margin: 0 0 14px;
}

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

.summary-card {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  padding: 14px;
  display: grid;
  gap: 4px;
  min-width: 0;
}

.summary-card span {
  font-size: 13px;
  opacity: 0.9;
}

.summary-card strong {
  font-size: 20px;
  overflow-wrap: anywhere;
}

.summary-card small {
  font-size: 12px;
  opacity: 0.85;
}

/* Same cards on a light panel (liquidation analysis) */
.summary-grid-soft {
  margin: 14px 0;
}

.summary-grid-soft .summary-card {
  background: var(--surface-2);
  color: var(--ink);
}

.home-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.home-columns + .panel {
  margin-top: 18px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  min-width: 0;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.panel h2 {
  font-size: 16px;
}

.bottom-nav {
  display: none;
}

@media (max-width: 760px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .workspace {
    padding: 16px 16px calc(96px + env(safe-area-inset-bottom));
  }

  .topbar {
    align-items: center;
    gap: 10px;
  }

  .topbar-title {
    flex: 1;
  }

  .topbar h1 {
    font-size: clamp(1.15rem, 5.4vw, 1.6rem);
    overflow-wrap: normal;
  }

  .actions {
    flex-wrap: nowrap;
    gap: 6px;
  }

  .actions .icon-button {
    width: 40px;
    min-height: 40px;
  }

  /* Only the colored dot on phones; the full state stays in the button title */
  .sync-status {
    width: 40px;
    min-height: 40px;
    padding: 0;
    justify-content: center;
  }

  .sync-status .sync-label {
    display: none;
  }

  .account-chip {
    display: none;
  }

  /* The side menu becomes a sheet opened from "Más" */
  .sidebar {
    display: none;
  }

  .sidebar.open {
    display: block;
    position: fixed;
    inset: auto 10px calc(84px + env(safe-area-inset-bottom)) 10px;
    top: auto;
    z-index: 20;
    margin: 0;
    max-height: 70vh;
    border-radius: var(--radius-card, 20px);
    box-shadow: var(--shadow);
  }

  .sidebar.open .brand {
    display: none;
  }

  .bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 15;
    background: var(--surface);
    border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }

  .bottom-nav button {
    border: 0;
    background: transparent;
    display: grid;
    justify-items: center;
    gap: 2px;
    font-size: 11px;
    color: var(--muted);
    padding: 6px 0;
  }

  .bottom-nav svg {
    width: 22px;
    height: 22px;
  }

  .bottom-nav button[aria-current="page"],
  .bottom-nav button[aria-expanded="true"] {
    color: var(--accent-dark);
    font-weight: 700;
  }

  .summary-hero {
    padding: 18px;
    border-radius: 16px;
  }

  .summary-grid {
    grid-template-columns: 1fr 1fr;
  }

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

  .panel > .section-heading {
    flex-direction: row;
    align-items: center;
  }
}

/* Shared module pieces (Finanzas: .page-description, .notice, .filters, .filter-grid, tables, .sheet) */
.page-description {
  margin: -8px 0 16px;
  max-width: 640px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.notice {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.notice > svg {
  width: 22px;
  height: 22px;
  color: var(--accent);
  flex-shrink: 0;
}

.notice > div:not(.form-row) {
  flex: 1;
  display: grid;
  gap: 2px;
  min-width: 180px;
}

.notice span {
  font-size: 13px;
  color: var(--muted);
}

.file-button {
  display: inline-flex;
  color: var(--ink);
  font-size: inherit;
  cursor: pointer;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.filters {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 14px;
  margin-bottom: 14px;
}

.filters > summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  list-style: none;
}

.filters > summary::-webkit-details-marker {
  display: none;
}

.filters > summary svg {
  width: 18px;
  height: 18px;
}

.filters[open] > summary {
  margin-bottom: 10px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
}

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

.filter-grid label,
.filter-grid .producer-filter-group {
  display: grid;
  gap: 6px;
  font-size: 13px;
  min-width: 0;
  color: var(--muted);
  font-weight: 700;
}

.filter-grid .producer-select summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
}

.producer-select[open] summary {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(8, 127, 111, 0.16);
}

.segmented-control button.active {
  background: var(--surface);
  color: var(--accent-dark);
}

.table-scroll {
  overflow-x: auto;
  margin-top: 4px;
  position: relative;
  max-width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--surface);
}

th,
td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  font-size: 12px;
  color: var(--muted);
  background: var(--surface-2);
  white-space: nowrap;
}

.home-columns + .home-columns,
.panel + .home-columns,
.home-columns + .panel {
  margin-top: 18px;
}

.receipt-chart-stack h5 {
  margin: 8px 0 6px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* History dialog with the Finanzas sheet look */
.modal-card.sheet-form {
  display: grid;
  gap: 14px;
  width: min(640px, calc(100% - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  padding: 20px;
  border: 0;
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 24px 60px rgba(23, 33, 29, 0.25);
}

.sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sheet-header h2 {
  margin: 0;
  font-size: 19px;
}

.modal-backdrop {
  background: rgba(23, 33, 29, 0.45);
}

@media (max-width: 760px) {
  .filter-grid-2 {
    grid-template-columns: 1fr;
  }

  .notice .form-row {
    width: 100%;
  }

  .notice .form-row > * {
    flex: 1 1 auto;
  }

  .modal-card.sheet-form {
    width: 100%;
    margin: auto 0 0;
    border-radius: 18px 18px 0 0;
    max-height: 92vh;
  }
}

/* Lists (Finanzas: .chip-row, .chip, search, .sheet dialogs) */
.list-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.search-box {
  position: relative;
  flex: 1;
  display: block;
}

.search-box svg {
  position: absolute;
  left: 12px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search-box input {
  padding-left: 38px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}

.chip-row button {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 14px;
  color: var(--ink);
}

.chip-row button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  font-weight: 600;
}

.chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--muted);
}

.chip-active {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.chip-pending {
  background: #fff2dc;
  color: var(--warning);
}

.danger-button {
  min-height: 44px;
  border: 1px solid #f1c9c4;
  border-radius: 8px;
  background: var(--surface);
  color: var(--danger);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  font-weight: 600;
}

.secondary-button.small,
.danger-button.small {
  min-height: 32px;
  padding: 4px 12px;
  font-size: 13px;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.empty-state {
  padding: 24px 0;
  color: var(--muted);
}

.sheet {
  border: 0;
  border-radius: 18px;
  padding: 0;
  width: min(640px, calc(100% - 32px));
  max-height: calc(100vh - 48px);
  box-shadow: 0 24px 60px rgba(23, 33, 29, 0.25);
}

.sheet::backdrop {
  background: rgba(23, 33, 29, 0.45);
}

.sheet-form {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.sheet .form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.sheet-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  position: sticky;
  bottom: 0;
  background: inherit;
  padding-top: 8px;
}

.sheet-actions .primary-button {
  flex: 1;
  max-width: 220px;
  margin-left: auto;
}

@media (max-width: 760px) {
  .sheet {
    width: 100%;
    max-width: 100%;
    margin: auto 0 0;
    border-radius: 18px 18px 0 0;
    max-height: 92vh;
  }

  .sheet-form {
    padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  }

  .list-toolbar .primary-button {
    padding: 0 12px;
  }
}

.toolbar-field {
  display: grid;
  gap: 4px;
  font-size: 12px;
}

.list-toolbar .primary-button {
  margin-left: auto;
  align-self: end;
}

.sheet-small {
  width: min(440px, calc(100% - 32px));
}

@media (max-width: 760px) {
  .list-toolbar {
    flex-wrap: wrap;
  }

  .list-toolbar .toolbar-field {
    flex: 1 1 calc(50% - 5px);
  }

  .list-toolbar .search-box {
    flex: 1 1 100%;
  }

  .list-toolbar .primary-button {
    flex: 1 1 100%;
  }
}

/* List rows and status labels (Finanzas: .feed-item, .chip) */
.stack-list {
  display: grid;
  gap: 0;
}

.list-item {
  display: grid;
  gap: 4px;
  padding: 12px 4px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.list-item:last-child {
  border-bottom: 0;
}

.list-item header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.list-item strong {
  font-size: 15px;
  min-width: 0;
}

.list-item p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.list-item > .danger-button,
.list-item > .row-actions {
  justify-self: start;
  margin-top: 4px;
}

.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--muted);
  border: 0;
}

.pill.green {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.pill.amber {
  background: #fff2dc;
  color: var(--warning);
}

.pill.red {
  background: #fdebe7;
  color: var(--danger);
}

.pill.blue {
  background: #e8eef7;
  color: #3a5a8c;
}

.list-toolbar .chip-row {
  flex: 1;
  margin-bottom: 0;
}

/* Settings tabs (Finanzas: .view-tabs) */
.view-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}

.view-tabs button {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 12px 8px;
  color: var(--muted);
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  font-weight: 600;
  flex: 0 0 auto;
}

.view-tabs button[aria-selected="true"] {
  color: var(--accent-dark);
  border-bottom-color: var(--accent);
}

.view-tabs svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.settings-stack {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.settings-stack .panel {
  display: grid;
  gap: 12px;
}

[data-settings-panel] > .panel + .panel,
[data-settings-panel] > .home-columns + .panel {
  margin-top: 18px;
}

#finanzasPanel .data-form {
  display: grid;
  gap: 12px;
  max-width: 560px;
}

.sync-state {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sync-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0 0;
}

.sync-facts div {
  background: var(--surface-2);
  border-radius: 12px;
  padding: 12px;
}

.sync-facts dt {
  font-size: 12px;
  color: var(--muted);
}

.sync-facts dd {
  margin: 4px 0 0;
  font-weight: 800;
  font-size: 18px;
  overflow-wrap: anywhere;
}

/* Feed rows (Finanzas: .feed, .feed-item) */
.feed {
  list-style: none;
  margin: 0;
  padding: 0;
}

.feed-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
}

.feed-item:last-child {
  border-bottom: 0;
}

.feed-main {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 3px;
}

.feed-main strong {
  font-size: 15px;
}

.feed-main span {
  font-size: 13px;
  color: var(--muted);
}

.feed-side {
  display: grid;
  justify-items: end;
  gap: 4px;
  flex-shrink: 0;
}

.small-button {
  min-height: 36px;
  padding: 0 14px;
  text-decoration: none;
}

.import-note {
  margin-top: 12px;
}


/* Dark mode: same switch as Finanzas (system preference, or the theme button saved in data-theme).
   Base tokens come from glass.css; these cover Hato's own tokens and tinted labels. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --text: var(--ink);
    --green: #5ad2be;
    --green-2: #143530;
    --blue: #8fb6e8;
    --blue-2: #1d2a3d;
    --amber: #f0a35e;
    --amber-2: #3a2a14;
    --red: #ff8b80;
    --red-2: #3b1c19;
    --ink-soft: #c9d6d1;
    --brand-product: #4fc3d9;
  }
  :root:not([data-theme="light"]) .chip-pending, :root:not([data-theme="light"]) .pill.amber { background: #3a2a14; color: #f0a35e; }
  :root:not([data-theme="light"]) .pill.red { background: #3b1c19; color: #ff8b80; }
  :root:not([data-theme="light"]) .pill.blue { background: #1d2a3d; color: #9dbbe8; }
  :root:not([data-theme="light"]) .danger-button { border-color: #5a2a25; }
  :root:not([data-theme="light"]) .summary-hero { background: linear-gradient(135deg, #0d6b5e 0%, #0f8574 100%); }
}

:root[data-theme="dark"] {
  --text: var(--ink);
  --green: #5ad2be;
  --green-2: #143530;
  --blue: #8fb6e8;
  --blue-2: #1d2a3d;
  --amber: #f0a35e;
  --amber-2: #3a2a14;
  --red: #ff8b80;
  --red-2: #3b1c19;
  --ink-soft: #c9d6d1;
  --brand-product: #4fc3d9;
}
:root[data-theme="dark"] .chip-pending, :root[data-theme="dark"] .pill.amber { background: #3a2a14; color: #f0a35e; }
:root[data-theme="dark"] .pill.red { background: #3b1c19; color: #ff8b80; }
:root[data-theme="dark"] .pill.blue { background: #1d2a3d; color: #9dbbe8; }
:root[data-theme="dark"] .danger-button { border-color: #5a2a25; }
:root[data-theme="dark"] .summary-hero { background: linear-gradient(135deg, #0d6b5e 0%, #0f8574 100%); }

/* Invitation channel picker (Finanzas: .segmented) */
.segmented {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  padding: 4px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.segmented legend {
  margin-bottom: 6px;
  padding: 0;
}

.segmented label {
  min-width: 0;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  min-height: 40px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 8px;
  color: var(--muted);
  font-weight: 700;
}

.segmented span svg {
  width: 18px;
  height: 18px;
}

.segmented input:checked + span {
  background: var(--surface);
  color: var(--accent-dark);
  box-shadow: 0 1px 2px rgba(23, 33, 29, 0.08);
}

.segmented input:focus-visible + span {
  outline: 2px solid var(--accent);
}

@media (max-width: 760px) {
  .sheet.sheet-small {
    width: 100%;
  }
}

@media (max-width: 760px) {
  .panel > .section-heading {
    flex-wrap: wrap;
  }

  .panel > .section-heading .small-button {
    white-space: nowrap;
  }
}

/* Legal consent (same wording and flow as Vaqora Finanzas) */
.consent-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
  color: var(--ink);
}

.consent-check input {
  width: 20px;
  height: 20px;
  min-height: 20px;
  flex: 0 0 auto;
  margin: 1px 0 0;
  padding: 0;
  accent-color: var(--accent);
}

.consent-check a,
.legal-links a {
  color: var(--accent-dark);
  font-weight: 600;
}

.legal-links {
  margin: 18px 0 0;
  text-align: center;
  font-size: 12.5px;
  color: var(--muted);
}

.sidebar .legal-links {
  margin: 16px 8px 0;
  font-size: 11.5px;
  line-height: 1.6;
}

.view .legal-links {
  text-align: left;
  margin: -6px 0 16px;
}

input[readonly] {
  background: var(--surface-2);
  color: var(--muted);
  cursor: default;
}

/* Liquidation upload list */
.upload-list {
  max-height: 46vh;
  overflow-y: auto;
}

.upload-list .feed-main strong {
  overflow-wrap: anywhere;
}

.upload-list .feed-main span {
  overflow-wrap: anywhere;
}

.file-button.primary-button {
  color: #fff;
}

/* Liquidation filters: week and producers side by side, same size in Panel and Liquidación */
.analysis-filters,
.analysis-filters.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(720px, 100%);
}

.analysis-filters label,
.analysis-filters .producer-filter-group,
.filter-grid .producer-filter-group {
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
}

.analysis-filters select,
.filter-grid select,
.analysis-filters .producer-select summary,
.filter-grid .producer-select summary {
  display: block;
  width: 100%;
  min-width: 0;
  height: 44px;
  min-height: 44px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-control, 14px);
  background-color: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 42px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Open list: above whatever follows, with room for the bottom bar */
.producer-select[open] {
  z-index: 40;
}

.filters:has(.producer-select[open]),
.panel:has(.producer-select[open]) {
  position: relative;
  z-index: 40;
}

.producer-filter {
  gap: 2px;
  scroll-margin-bottom: 110px;
  max-height: min(320px, 60vh);
}

.producer-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.producer-row .producer-option {
  flex: 1;
  min-width: 0;
}

.producer-row .link-button {
  flex: 0 0 auto;
  padding: 6px 10px;
  font-size: 13px;
}

.producer-all {
  justify-self: end;
  font-size: 13px;
  padding: 2px 8px;
}

/* The base input rules (44 px tall, padding) must not reach these checkboxes */
.producer-option input {
  min-height: 0;
  padding: 0;
  margin: 0;
}

@media (max-width: 860px) {
  .analysis-filters,
  .analysis-filters.compact {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .producer-filter {
    left: 0;
    right: auto;
    width: 100%;
  }
}

/* Liquidación: two independent columns, so Evolución sits right under Calidad de la leche */
.home-stack {
  display: grid;
  gap: 18px;
  min-width: 0;
  align-content: start;
}

.evolution-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  min-width: 0;
}

.year-select summary {
  display: block;
  min-height: 36px;
  height: 36px;
  max-width: 170px;
  padding: 0 28px 0 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  line-height: 34px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.year-select summary::after {
  top: 3px;
  right: 10px;
}

.year-select .producer-filter {
  right: auto;
  left: 0;
  width: 200px;
}

/* Year filter and period selector on one line, year first */
.evolution-controls {
  flex-wrap: nowrap;
  gap: 6px;
}

.evolution-controls .segmented-control button {
  padding: 5px 6px;
}

.year-select summary {
  max-width: 124px;
}

@media (max-width: 760px) {
  .evolution-controls {
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}

/* Evolución: order button and pages */
.evolution-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 13px;
}

.evolution-bar .secondary-button svg {
  width: 15px;
  height: 15px;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.evolution-row strong {
  white-space: nowrap;
}

@media (max-width: 760px) {
  .evolution-row {
    grid-template-columns: 52px minmax(0, 1fr) auto;
  }
}
