:root {
  --ink: #1b1f23;
  --muted: #5f6b76;
  --line: #e3e8ee;
  --paper: #f3f5f8;
  --card: #ffffff;
  --accent: #1565c0;
  --up: #d32f2f;    /* price went up: dearer, red */
  --down: #0b7a3b;  /* price went down: cheaper, green */
  --error: #d32f2f;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

body .navbar,
body .web-footer,
body footer,
.page-breadcrumbs,
.page-header-wrapper {
  display: none !important;
}

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

.precyos {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 16px 64px;
}

.top {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
}

.wordmark {
  font-weight: 700;
  font-size: 26px;
  letter-spacing: -0.03em;
  color: var(--accent);
  text-decoration: none;
}

.wordmark span {
  display: block;
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0;
  color: var(--muted);
}

.tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.tools input[type="search"] {
  width: min(280px, 70vw);
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
}

.tools a,
.button,
button.button {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 14px;
  text-decoration: none;
  font: inherit;
  cursor: pointer;
}

button.button.primary,
.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.families {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 20px;
}

.families a {
  text-decoration: none;
  color: var(--accent);
  border-bottom: 2px solid transparent;
  padding: 4px 2px;
  font-size: 14px;
}

.families a.active {
  border-color: var(--accent);
  color: var(--accent);
}

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  overflow: hidden;
}

.panel h2 {
  font-size: 15px;
  margin: 0;
  padding: 14px 16px 0;
}

table.prices {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

table.prices th,
table.prices td {
  text-align: left;
  padding: 7px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}

table.prices th {
  color: var(--muted);
  font-weight: 650;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #f7f9fb;
}

table.prices tr.cat td {
  background: #e8f0f8;
  color: #16324f;
  font-weight: 700;
  font-size: 13px;
  padding-top: 8px;
  padding-bottom: 8px;
}

table.prices td.name {
  color: var(--accent);
  font-weight: 600;
}

table.prices tr.item {
  cursor: pointer;
}

table.prices tr.item:hover {
  background: #f4f8fc;
}

.num { text-align: right; }
.up { color: var(--up); }
.down { color: var(--down); }

.spark { width: 96px; height: 28px; }
.spark path { fill: none; stroke: var(--accent); stroke-width: 1.5; }

.item-head {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
}

.stat .label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat .value {
  font-size: 28px;
  font-weight: 650;
  letter-spacing: -0.03em;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

.stat .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

.chart-card { padding: 12px 12px 18px; }

.range-bar, .legend, .downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 0 8px 10px;
}

.range-bar button {
  border: 0;
  background: transparent;
  font: inherit;
  color: var(--muted);
  padding: 6px 8px;
  cursor: pointer;
  border-radius: 8px;
}

.range-bar button.active {
  background: #e7f5ef;
  color: var(--accent);
  font-weight: 650;
}

.chart-wrap { width: 100%; overflow: hidden; }
.chart-wrap svg { width: 100%; height: auto; display: block; }
.chart-wrap .grid { stroke: var(--line); stroke-width: 1; }
.chart-wrap .axis { fill: var(--muted); font-size: 11px; }
.chart-wrap .line { fill: none; stroke-width: 2; }
.chart-wrap .dot { stroke: white; stroke-width: 1.5; }

.readout {
  min-height: 1.4em;
  color: var(--muted);
  font-size: 13px;
  padding: 0 12px 8px;
  font-variant-numeric: tabular-nums;
}

/* Crosshair + tooltip on charts */
.chart-wrap.has-xhair { position: relative; }
.chart-wrap.has-xhair svg { touch-action: pan-y; cursor: crosshair; }
.chart-wrap .xhair-line { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.chart-wrap .xhair-dot { stroke: #fff; stroke-width: 2; pointer-events: none; }
.chart-tip {
  position: absolute; z-index: 5; pointer-events: none; white-space: nowrap;
  background: rgba(27, 31, 35, 0.92); color: #fff; border-radius: 8px;
  padding: 6px 9px; font-size: 12.5px; line-height: 1.45; box-shadow: 0 4px 14px rgba(16, 24, 40, 0.18);
  font-variant-numeric: tabular-nums;
}
.chart-tip .tip-date { color: #cfd6dd; font-size: 11.5px; }
.chart-tip .tip-sw { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

/* Caliper range selector (overview + two handles) */
.caliper {
  position: relative; height: 52px; margin: 6px 8px 10px; border: 1px solid #d5dbe3;
  border-radius: 8px; background: #e7ebf0; touch-action: none; user-select: none; -webkit-user-select: none; cursor: pointer;
}
.caliper .cal-ov { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 8px; }
.caliper .cal-area { opacity: 0.12; }
.caliper .cal-line { fill: none; stroke-width: 1.2; opacity: 0.75; vector-effect: non-scaling-stroke; }
.caliper .cal-mask { position: absolute; top: 0; bottom: 0; background: rgba(48, 56, 66, 0.46); pointer-events: none; }
.caliper .cal-ml { left: 0; border-radius: 8px 0 0 8px; }
.caliper .cal-mr { right: 0; border-radius: 0 8px 8px 0; }
.caliper .cal-win {
  position: absolute; top: 0; bottom: 0; background: transparent;
  box-shadow: inset 0 0 0 1px rgba(27, 31, 35, 0.28); box-sizing: border-box; cursor: grab;
}
.caliper.dragging .cal-win { cursor: grabbing; }
.caliper .cal-h {
  position: absolute; top: -4px; bottom: -4px; width: 32px; margin-left: -16px; cursor: ew-resize; outline: none;
  display: flex; align-items: center; justify-content: center; z-index: 2;
}
.caliper .cal-h span {
  width: 10px; height: 30px; background: var(--card); border: 2px solid var(--accent); border-radius: 4px;
  box-shadow: var(--shadow); position: relative;
}
.caliper .cal-h span::before, .caliper .cal-h span::after {
  content: ""; position: absolute; top: 8px; bottom: 8px; width: 1px; background: var(--accent);
}
.caliper .cal-h span::before { left: 2px; }
.caliper .cal-h span::after { right: 2px; }
.caliper .cal-h:focus-visible span { box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.3); }

.legend label { display: flex; gap: 6px; align-items: center; font-size: 13px; }

.empty {
  padding: 28px 16px;
  color: var(--muted);
}

.crumb { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.crumb a { color: var(--accent); }

.account {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.account form, .account .card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}

.account label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
.account input, .account select {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  background: white;
}

.avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  background: #e7f5ef;
}

.status { min-height: 1.2em; color: var(--accent); font-size: 14px; }

.login-modal {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}

.login-modal[hidden] { display: none; }

.login-card {
  width: min(420px, 100%);
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 16px 40px rgba(16, 24, 40, 0.2);
}

.login-card h2 { margin: 0 0 8px; font-size: 20px; }
.login-card p { margin: 0 0 12px; color: var(--muted); }
.login-card label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
.login-card input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
}
.login-error { color: var(--error); min-height: 1.2em; }
.login-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

@media (max-width: 800px) {
  .item-head, .account { grid-template-columns: 1fr; }
  table.prices .hide-sm { display: none; }
}

/* Item thumbnails on the main price page (issue #2). */
.name-with-thumb { display: inline-flex; align-items: center; gap: 10px; }
.thumb {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  object-fit: contain;
}
.thumb-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #e8f0f8;
  color: #16324f;
  font-weight: 700;
  font-size: 18px;
}
@media (max-width: 640px) {
  .thumb { flex-basis: 32px; width: 32px; height: 32px; font-size: 14px; }
}

/* Percent change since the last price change beside each graph (issue #3). */
.graph-cell { white-space: nowrap; }
.graph-cell .spark { vertical-align: middle; }
.change-cell { white-space: nowrap; }
.change-cell .graph-change { margin-left: 0; }
.graph-change { display: inline-block; margin-left: 6px; font-size: 12px; font-weight: 650; vertical-align: middle; font-variant-numeric: tabular-nums; }
.graph-change.up { color: #b3261e; }
.graph-change.down { color: #0b7a3b; }
.graph-change.same { color: var(--muted, #6b7280); font-weight: 500; }
.stat .value .graph-change { font-size: 14px; }


/* Auth menu (top-right): login button or user dropdown. */
.auth-menu { position: relative; }
.auth-login {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff !important;
  border-radius: 999px;
  padding: 8px 14px;
  text-decoration: none;
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
}
.auth-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: 4px 10px 4px 4px;
  font: inherit;
  cursor: pointer;
  max-width: min(220px, 70vw);
}
.auth-toggle:hover { background: #f4f8fc; }
.auth-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  background: #e8f0f8;
  flex: 0 0 28px;
}
.auth-avatar.placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  color: #16324f;
}
.auth-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
  font-size: 13px;
}
.auth-caret { color: var(--muted); font-size: 10px; }
.auth-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 200px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.14);
  padding: 6px;
  z-index: 40;
}
.auth-panel a, .auth-panel button {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  font: inherit;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
}
.auth-panel a:hover, .auth-panel button:hover { background: #f4f8fc; }
.auth-panel .auth-sep {
  height: 1px;
  background: var(--line);
  margin: 4px 6px;
}
@media (max-width: 640px) {
  .auth-name { max-width: 96px; }
  .auth-panel { right: 0; left: auto; min-width: 180px; }
}

/* Guest menu: always-visible hamburger + "Menú" (explicit colors so it never renders blank). */
.precyos .auth-menu .auth-toggle.auth-guest {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  min-height: 36px;
  background: #ffffff !important;
  color: #16324f !important;
  border: 1px solid #c9d6e3 !important;
  border-radius: 999px;
  visibility: visible !important;
  opacity: 1 !important;
}
.precyos .auth-menu .auth-toggle.auth-guest:hover { background: #f4f8fc !important; }
.precyos .auth-menu .auth-burger { display: block; flex: 0 0 20px; color: #16324f; }
.precyos .auth-menu .auth-guest-label { color: #16324f; font-weight: 600; font-size: 14px; max-width: none; }
.precyos .auth-panel a, .precyos .auth-panel button { color: #16324f !important; background: transparent; }
.precyos .auth-panel a.auth-panel-login { font-weight: 700; }
@media (max-width: 359px) {
  .precyos .auth-menu .auth-guest-label { display: none; }
  .precyos .auth-menu .auth-toggle.auth-guest { padding: 7px 9px; }
}
/* On phones the menu wraps to the left of the header on / and /canasta: open the dropdown rightwards. */
@media (max-width: 640px) {
  .precyos:not(.pantalla) .auth-panel { left: 0; right: auto; }
}

.pcard { cursor: pointer; }

/* /tasas-cd: term-deposit rates table. */
.tasas-panel { padding: 16px 18px; }
@media (max-width: 640px) { .tasas-panel { padding: 12px 10px; } }
.tasas-tools { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 14px; }
.tasas-tools select { padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font: inherit; }
table.tasas th button { all: unset; cursor: pointer; font: inherit; color: inherit; white-space: nowrap; }
table.tasas th button::after { content: attr(data-arrow); margin-left: 4px; font-size: 10px; }
table.tasas th button.active { color: var(--accent, #1565c0); }
table.tasas td.tasa { font-weight: 700; font-variant-numeric: tabular-nums; }
table.tasas .src { display: block; font-size: 12px; color: var(--muted); }
table.tasas .show-sm { display: none; }
.tasas-note { margin-top: 12px; font-size: 13px; }
table.tasas tr.item { cursor: pointer; }
table.tasas tr.item[aria-expanded="true"] td { background: #f3f7fc; }
table.tasas tr.chart-row td { padding: 6px 4px 14px; background: #fff; }
table.tasas tr.chart-row .chart-card { padding: 0; }
@media (max-width: 800px) {
  table.tasas .show-sm { display: block; }
}

table.tasas .spark path { stroke: var(--spark, var(--accent, #1565c0)); }

/* Salario en otras monedas: submenu in the site menu and salario subnav. */
.menu-sub { position: relative; }
.menu-sub-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font: inherit;
  cursor: pointer;
}
.menu-sub-toggle .auth-caret { color: inherit; opacity: 0.75; }
.menu-sub-panel {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  min-width: 200px;
  max-width: min(240px, calc(100vw - 24px));
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 28px rgba(16, 24, 40, 0.14);
  padding: 6px;
  z-index: 45;
}
.menu-sub-panel a {
  display: block;
  width: 100%;
  box-sizing: border-box;
  text-align: left;
  color: #16324f;
  text-decoration: none;
  font: inherit;
  padding: 10px 12px;
  border-radius: 8px;
  border: 0;
  background: transparent;
}
.menu-sub-panel a:hover { background: #f4f8fc; }
.menu-sub-panel a.active { font-weight: 650; color: var(--accent); background: #f4f8fc; }

/* Site menu (auth-panel): in-place group, no second flyout — works on a narrow screen. */
.auth-panel .menu-sub-static { padding: 2px 0 4px; }
.auth-panel .menu-sub-label {
  display: block;
  padding: 8px 12px 2px;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
  line-height: 1.35;
}
.auth-panel .menu-sub-static a { padding-left: 22px; }

/* Salario page subnav. */
.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 0 0 16px;
  font-size: 14px;
  align-items: center;
}
.subnav > a,
.subnav > .menu-sub > .menu-sub-toggle {
  color: var(--accent);
  text-decoration: none;
  padding: 4px 2px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.subnav > a.active,
.subnav > .menu-sub > .menu-sub-toggle.active {
  border-bottom-color: var(--accent);
  font-weight: 650;
}

/* Conversiones (and any) tools bar: the toggle looks like the other pills. */
.tools .menu-sub { position: relative; }
.tools .menu-sub-toggle {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  cursor: pointer;
}
.tools .menu-sub-toggle:hover { background: #f4f8fc; }
.tools .menu-sub-panel a {
  border-radius: 8px;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  color: #16324f;
}

@media (max-width: 640px) {
  /* Keep the subnav dropdown on-screen when the trigger wraps to the right. */
  .subnav > .menu-sub { max-width: 100%; }
  .subnav .menu-sub-panel {
    left: 0;
    right: auto;
  }
  .tools .menu-sub-panel {
    left: 0;
    right: auto;
  }
}
