/* Angevale portal. The rules come from DESIGN.md at the root of the repository. */
:root {
  --ink: #15171C;
  --ink-2: #3A3D45;
  --muted: #5F636B;
  --line: #E5E5E5;
  --line-strong: #C4C4C4;
  --page: #FFFFFF;
  --hover: #FAFAFA;
  --soft: #F4F4F4;
  --surface: #FFFFFF;
  --coral: #FF5A36;
  --high: #B42318;
  --high-bg: #FEF1EF;
  --mid: #8A5A00;
  --mid-bg: #FFF4D6;
  --low: #2F6B45;
  --text: Inter, "Segoe UI", Arial, sans-serif;
  --display: Outfit, Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; }
body {
  font-family: var(--text);
  color: var(--ink);
  background: var(--page);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* buttons: pills, ink is the only action color */
button { cursor: pointer; border-radius: 9999px; border: 1px solid transparent; transition: background-color .12s, border-color .12s; }
button.primary { background: var(--ink); color: #fff; font-weight: 500; min-height: 40px; padding: 0 20px; }
button.primary:hover { background: #000; }
button.primary:disabled { opacity: .6; cursor: wait; }
button.ghost { background: var(--surface); border-color: var(--line); min-height: 36px; padding: 0 16px; font-size: 14px; font-weight: 500; }
button.ghost:hover { border-color: var(--ink); }

input, select {
  border: 1px solid var(--line); border-radius: 8px; min-height: 40px; padding: 0 12px; background: var(--surface); width: 100%;
  transition: border-color .12s;
}
input:hover, select:hover { border-color: var(--line-strong); }
label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); }
label input, label select { margin-top: 6px; color: var(--ink); font-size: 15px; font-weight: 400; }
label.inline { display: flex; align-items: center; gap: 8px; }
label.inline select { margin: 0; width: auto; min-width: 180px; min-height: 36px; font-size: 14px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.tag {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-2); border: 1px solid var(--line); border-radius: 9999px;
  padding: 3px 10px; margin: 0; justify-self: start; white-space: nowrap; background: var(--surface);
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--coral); }
.spacer { flex: 1; }
.error { color: var(--high); background: var(--high-bg); border-radius: 8px; padding: 10px 12px; margin: 0; font-size: 14px; }
.hint { font-size: 13px; color: var(--muted); margin: 0 0 12px; }

/* language switch */
.lang, .seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9999px; padding: 2px; background: var(--surface); }
.lang button, .seg button { min-height: 30px; min-width: 40px; padding: 0 10px; font-size: 12px; font-weight: 600; letter-spacing: .04em; background: transparent; color: var(--muted); }
.lang button:hover, .seg button:hover { color: var(--ink); }
.lang button[aria-pressed="true"], .seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.seg button { letter-spacing: 0; font-size: 13px; padding: 0 14px; white-space: nowrap; }

/* sign in */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 400px; padding: 32px 28px; display: grid; gap: 16px; }
.login-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.login-logo { width: 168px; height: auto; display: block; }
.login-card .primary { width: 100%; margin-top: 4px; }

/* top bar */
.top {
  display: flex; align-items: center; gap: 12px; padding: 10px 20px; background: var(--surface);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.top-logo { height: 30px; width: auto; display: block; }
.user { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 32vw; }

.wrap { max-width: 1280px; margin: 0 auto; padding: 24px 20px 48px; }
.bar, .filters { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-bottom: 16px; }
.business-info { margin: 0; font-size: 13px; color: var(--muted); }
.updated { font-size: 13px; color: var(--muted); }

/* counters: one strip divided by hairlines */
.counters {
  display: flex; flex-wrap: wrap; gap: 1px; margin-bottom: 20px;
  background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
}
.counter { flex: 1 1 150px; background: var(--surface); padding: 14px 18px; }  /* the last row stretches: no empty cell */
.counter b { display: block; font-family: var(--display); font-size: 28px; font-weight: 500; line-height: 1.2; }
.counter span { font-size: 13px; color: var(--muted); }
.counter.alert b { color: var(--high); }

/* list + detail */
.columns { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 16px; align-items: start; }
.list { display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.list:empty { display: none; }
.row {
  display: grid; gap: 4px; text-align: left; width: 100%; background: var(--surface); border: 0; border-radius: 0;
  border-bottom: 1px solid var(--line); padding: 12px 16px; position: relative;
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--hover); }
.row.selected { background: var(--soft); }
.row.selected::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--coral); }
.row:focus-visible { outline-offset: -2px; }
.row-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 13px; color: var(--muted); }
.row-summary { font-size: 15px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row-who { font-size: 13px; color: var(--muted); }

.badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; border-radius: 9999px;
  padding: 1px 9px; white-space: nowrap; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line);
}
.badge.alta, .badge.media, .badge.baja { padding-left: 8px; }
.badge.alta::before, .badge.media::before, .badge.baja::before { content: ""; width: 6px; height: 6px; border-radius: 50%; }
.badge.alta { color: var(--high); background: var(--high-bg); border-color: transparent; font-weight: 600; }
.badge.alta::before { background: var(--high); }
.badge.media::before { background: #D99A00; }
.badge.baja::before { background: var(--low); }
.badge.review { color: var(--mid); background: var(--mid-bg); border-color: transparent; }
.badge.handled { color: var(--low); border-color: transparent; background: var(--hover); padding-left: 8px; }
.badge.handled::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--low); }
.row.done .row-summary { color: var(--ink-2); }
.badge.emergency { color: #fff; background: var(--high); border-color: transparent; font-weight: 600; }

.detail { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 24px; position: sticky; top: 72px; max-height: calc(100vh - 92px); overflow: auto; }
.detail h2 { font-family: var(--display); font-size: 22px; font-weight: 600; line-height: 1.25; margin: 12px 0 4px; }
.detail h3 { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 24px 0 8px; padding-top: 16px; border-top: 1px solid var(--line); }
.detail p { margin: 0 0 6px; }
.detail audio { width: 100%; margin-top: 12px; }
.meta { font-size: 13px; color: var(--muted); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.facts dt { color: var(--muted); font-size: 13px; padding-top: 2px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.warn { color: var(--mid); font-size: 13px; font-weight: 500; }
.box { background: var(--soft); border-radius: 8px; padding: 12px 14px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; }
.box.mail { font-family: Consolas, "Courier New", monospace; font-size: 13px; margin-top: 10px; }
button.small { min-height: 32px; padding: 0 12px; font-size: 13px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 24px 0 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.detail .section-head h3 { margin: 0; padding: 0; border: 0; }
.handled-box { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 4px 0 8px; }
.handled-box.is-done { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; background: var(--soft); }
.handled-box.is-done p { margin: 0; font-size: 14px; flex: 1 1 220px; }
.handled-box .error { flex-basis: 100%; }
.fix-form, .note-form { display: grid; gap: 10px; margin: 4px 0 12px; }
.fix-form label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.fix-form .meta { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
textarea { font: inherit; color: inherit; width: 100%; min-height: 80px; resize: vertical; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: var(--surface); }
textarea:hover { border-color: var(--line-strong); }
.notes, .history { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 10px; }
.notes li { border-left: 2px solid var(--line); padding-left: 12px; display: grid; gap: 2px; }
.notes li p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.history { gap: 4px; }
.meta.block { display: block; }
.empty { color: var(--muted); text-align: center; padding: 40px 16px; margin: 0; }
.back { display: none; margin-bottom: 12px; }

@media (max-width: 900px) {
  .columns { grid-template-columns: 1fr; }
  .detail { position: static; max-height: none; padding: 20px 16px; }
  .columns.show-detail .list { display: none; }
  .columns:not(.show-detail) .detail { display: none; }
  .back { display: inline-block; }
  .user { display: none; }
  .wrap { padding: 16px 12px 40px; }
  .top { padding: 10px 12px; gap: 8px; }
  button.ghost, .lang button { min-height: 40px; }
  label.inline select { min-height: 40px; }
}

@media (max-width: 560px) {
  .top .tag { display: none; }
  .top-logo { height: 26px; }
  .bar label.inline, .filters label.inline { width: 100%; justify-content: space-between; }
  label.inline select { min-width: 0; flex: 1; max-width: 70%; }
  .facts { grid-template-columns: 1fr; gap: 0; }
  .facts dd { margin-bottom: 10px; }
}
