:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #667085;
  --border: #e3e6ea;
  --accent: #1f5fbf;
  --accent-text: #ffffff;
  --pos: #11804a;
  --neg: #c4321c;
  --review: #fff6db;
  --closed: #8a94a3;
  --tag-bg: #eef1f5;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161c;
    --surface: #1b2129;
    --text: #e6e9ee;
    --muted: #98a2b3;
    --border: #2c343f;
    --accent: #5b9bf0;
    --accent-text: #0d1117;
    --pos: #4cc38a;
    --neg: #f07a66;
    --review: #3a3220;
    --closed: #6b7585;
    --tag-bg: #262e39;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }

.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 1.25rem; padding-bottom: 3rem; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner { display: flex; align-items: center; gap: 1.25rem; min-height: 52px; flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
.topbar nav { display: flex; gap: .25rem; flex: 1; flex-wrap: wrap; }
.topbar nav a { color: var(--muted); text-decoration: none; padding: .35rem .6rem; border-radius: 6px; }
.topbar nav a:hover, .topbar nav a.active { color: var(--text); background: var(--tag-bg); }
.link-button { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; }

.page-head { margin-bottom: 1rem; }
.page-head p { margin: .25rem 0 0; }
.muted { color: var(--muted); }
.small { font-size: .85em; }
.pos { color: var(--pos); }
.neg { color: var(--neg); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.card.narrow { max-width: 520px; }
.table-scroll { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { padding: .45rem .6rem; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; }
tfoot td { font-weight: 600; border-bottom: 0; }
tr.review td { background: var(--review); }
tr.closed td { color: var(--closed); }

.tag { display: inline-block; padding: 0 .45rem; border-radius: 999px; font-size: .8rem; background: var(--tag-bg); }
.tag-compra { color: var(--accent); }
.tag-venta { color: var(--neg); }
.tag-renta { color: var(--pos); }
.tag-mep { font-weight: 600; }

.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.toolbar { margin: 0 0 1rem; }
select, input[type=text], input[type=email], input[type=password], input[type=number], textarea {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 6px; padding: .35rem .5rem;
}
.stack { display: flex; flex-direction: column; gap: .75rem; }
.stack label { display: flex; flex-direction: column; gap: .25rem; font-size: .9rem; color: var(--muted); }
.stack label.check, label.check { flex-direction: row; align-items: center; gap: .4rem; color: var(--text); }
.inline-form { display: flex; gap: .5rem; flex-wrap: wrap; }
.button {
  background: var(--accent); color: var(--accent-text); border: 0; border-radius: 6px;
  padding: .45rem .9rem; font: inherit; font-weight: 600; cursor: pointer; align-self: flex-start;
}

.flash { padding: .6rem .9rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid var(--border); background: var(--surface); }
.flash-alert { background: var(--review); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: start; }
.details { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0 0 .75rem; }
.details dt { color: var(--muted); }
.details dd { margin: 0; font-variant-numeric: tabular-nums; }

.login { max-width: 360px; margin: 10vh auto 0; }

@media (max-width: 760px) {
  .grid-2 { grid-template-columns: 1fr; }
  .topbar-inner { gap: .5rem; padding-block: .5rem; }
}
