* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: var(--fs-md)/1.45 var(--font); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; }
h1 { font-size: var(--fs-xl); }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.mono { font-family: var(--mono); font-size: var(--fs-sm); }
.small { font-size: var(--fs-sm); }
.xs { font-size: var(--fs-xs); }

/* shell */
.top { display: flex; align-items: center; gap: var(--gap); padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface); position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; letter-spacing: .02em; color: var(--text); }
.brand b { color: var(--accent); }
.crumbs { color: var(--text-muted); font-size: var(--fs-sm); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top .spacer { flex: 1; }
.top form { margin: 0; }
.wrap { max-width: 1440px; margin: 0 auto; padding: 16px; }

/* panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: var(--gap); }
.panel > header { display: flex; align-items: center; gap: 8px; padding: 10px var(--pad); border-bottom: 1px solid var(--line); }
.panel > header .spacer { flex: 1; }
.panel > .body { padding: var(--pad); }
.step { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line-strong); font-size: var(--fs-xs); color: var(--text-muted); flex: none; }

.grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: var(--gap); align-items: start; }
@media (max-width: 960px) { .grid { grid-template-columns: minmax(0, 1fr); } }

/* module header */
.mhead { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 16px; margin-bottom: var(--gap); }
.mhead .facts { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--text-muted); font-size: var(--fs-sm); }
.mhead .facts b { color: var(--text); font-weight: 500; }

.chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: var(--fs-xs); border: 1px solid currentColor; white-space: nowrap; }
.chip.propuesta { color: var(--chip-propuesta); }
.chip.ganado { color: var(--chip-ganado); }
.chip.cerrado { color: var(--chip-cerrado); }
.chip.perdido { color: var(--chip-perdido); }
.tag { display: inline-block; padding: 0 6px; border-radius: 4px; background: var(--surface-2); color: var(--text-muted); font-size: var(--fs-xs); border: 1px solid var(--line); white-space: nowrap; }

/* tables and lists */
table.t { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.t th, .t td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.t th { color: var(--text-muted); font-weight: 500; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: .04em; }
.t tr:last-child td { border-bottom: 0; }
.scroll-x { overflow-x: auto; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows > li { display: flex; gap: 10px; align-items: flex-start; padding: 9px var(--pad); border-bottom: 1px solid var(--line); }
.rows > li:last-child { border-bottom: 0; }
.rows .grow { flex: 1; min-width: 0; }
.rows .title { display: block; overflow-wrap: anywhere; }
.bar { height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.bar.done > i { background: var(--ok); }

/* feed */
.filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px var(--pad); border-bottom: 1px solid var(--line); align-items: center; }
.filters a.f { padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--text-muted); font-size: var(--fs-xs); }
.filters a.f.on { border-color: var(--accent); color: var(--accent); }
.filters form { display: flex; gap: 6px; margin-left: auto; }
.feed { max-height: 560px; overflow-y: auto; }
.snippet { color: var(--text-muted); font-size: var(--fs-sm); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }

/* forms */
label { display: block; font-size: var(--fs-sm); color: var(--text-muted); margin: 0 0 4px; }
label .req { color: var(--warn); }
input[type=text], input[type=email], input[type=password], input[type=date], textarea, select {
  width: 100%; background: var(--bg); color: var(--text); border: 1px solid var(--line-strong); border-radius: 4px;
  padding: 7px 9px; font: inherit; font-size: var(--fs-md);
}
textarea { min-height: 84px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.field { margin-bottom: 14px; }
.field.missing input, .field.missing textarea, .field.missing .cells { border-color: var(--warn); }
.hint { font-size: var(--fs-xs); color: var(--text-faint); margin-top: 3px; }
.cells input { padding: 5px 7px; font-size: var(--fs-sm); }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 4px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); font: inherit; font-size: var(--fs-sm); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--accent); text-decoration: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 3px 8px; font-size: var(--fs-xs); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline { display: inline; margin: 0; }
.notice { padding: 8px 12px; border-radius: 4px; border: 1px solid var(--line-strong); background: var(--surface-2); font-size: var(--fs-sm); margin-bottom: var(--gap); }
.notice.ok { border-color: var(--ok); }
.notice.warn { border-color: var(--warn); }
.notice.bad { border-color: var(--bad); }

/* Q&A */
.answer { white-space: pre-wrap; overflow-wrap: anywhere; }
.cites { margin: 8px 0 0; padding: 0; list-style: none; font-size: var(--fs-sm); }
.cites li { padding: 2px 0; }
.qa-item { padding: 12px var(--pad); border-bottom: 1px solid var(--line); }
.qa-item:last-child { border-bottom: 0; }
.qa-q { font-weight: 600; margin-bottom: 6px; }

/* login */
.login { max-width: 360px; margin: 12vh auto; padding: 0 16px; }
.login .panel .body { padding: 22px; }

.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
@media (max-width: 640px) {
  .cols-2 { grid-template-columns: 1fr; }
  .wrap { padding: 12px 16px; }
  .top { padding: 8px 12px; gap: 8px; }
  .filters form { margin-left: 0; width: 100%; }
  .filters form input { flex: 1; }
  .hide-sm { display: none; }
}
pre.body-text { white-space: pre-wrap; overflow-wrap: anywhere; font: var(--fs-sm)/1.5 var(--font); margin: 0; }
.t td.date { white-space: nowrap; }
