/* Shared by every page of Utilidades: Labitax Hub's tokens
   (apps/web/src/styles/_tokens.scss) in light and dark, the shell bar, the home
   list and the components the tools reuse (buttons, fields, tabs, tables).
   Layout: one narrow work column under the shell bar. */
:root {
  --bg: #f6f9fc;
  --surface: #ffffff;
  --surface-hover: #eef3f9;
  --border: #e3e8ee;
  --border-input: #a8c3de;
  --text: #0d253d;
  --text-2: #273951;
  --muted: #64748d;
  --brand: #022e77;
  --brand-hover: #021f55;
  --brand-blue: #2264ec;
  --brand-soft: #dce4f4;
  --on-brand: #ffffff;
  --success-soft: #dcfce7;
  --success-strong: #166534;
  --warning-soft: #fef3c7;
  --warning-strong: #92600a;
  --critical-soft: #fee2e2;
  --critical-strong: #b91c1c;
  --focus-ring: 0 0 0 3px rgba(34, 100, 236, 0.28);
  --shadow: 0 1px 2px rgba(0, 55, 112, 0.06), 0 2px 6px rgba(0, 55, 112, 0.05);
  --chevron: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23273951' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");

  --font-ui: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --radius-input: 8px;
  --radius-card: 14px;
  --radius-pill: 9999px;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --surface: #121a2a;
    --surface-hover: #1c2740;
    --border: #26324c;
    --border-input: #46597f;
    --text: #e9eefa;
    --text-2: #c3cfe6;
    --muted: #8b9bb8;
    --brand: #6f9dff;
    --brand-hover: #8bb2ff;
    --brand-blue: #6f9dff;
    --brand-soft: #182a4d;
    --on-brand: #0b1220;
    --success-soft: #10301f;
    --success-strong: #7fe3a5;
    --warning-soft: #33270f;
    --warning-strong: #f7d489;
    --critical-soft: #3a1a1c;
    --critical-strong: #ffa8a8;
    --focus-ring: 0 0 0 3px rgb(111 157 255 / 40%);
    --shadow: 0 1px 2px rgb(0 0 0 / 40%);
    --chevron: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23c3cfe6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.icon {
  font-family: "Material Symbols Outlined";
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  display: inline-block;
  white-space: nowrap;
  direction: ltr;
  font-feature-settings: "liga";
  font-variation-settings: "FILL" 0, "opsz" 20;
  user-select: none;
  flex: none;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ── Shell: the bar every page shares; the brand goes back to the list ── */
.shell {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.shell-inner {
  max-width: 920px;
  margin: 0 auto;
  min-height: 56px;
  display: flex;
  align-items: center;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.shell-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  border-radius: var(--radius-input);
}
.shell-brand:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.shell-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--brand);
  color: var(--on-brand);
  font-size: 18px;
}

.page {
  max-width: 920px;
  margin: 0 auto;
  padding-block: 32px 56px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: grid;
  gap: 24px;
}

/* ── Home: the list of tools ─────────────────────────────── */
.tool-list {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.tool-list li + li {
  border-top: 1px solid var(--border);
}
.tool-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  color: var(--text);
  text-decoration: none;
  transition: background-color 130ms var(--ease);
}
.tool-link:hover {
  background: var(--surface-hover);
}
.tool-link:focus-visible {
  outline: none;
  box-shadow: inset var(--focus-ring);
}
.tool-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
  flex: none;
}
.tool-text {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.tool-name {
  font-weight: 600;
}
.tool-desc {
  font-size: 0.8125rem;
  color: var(--muted);
}
.tool-go {
  margin-left: auto;
  color: var(--muted);
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
}
h1 {
  margin: 0;
  font-size: 1.625rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.privacy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.8125rem;
}
.privacy .icon {
  font-size: 16px;
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background-color 130ms var(--ease),
    color 130ms var(--ease),
    border-color 130ms var(--ease);
}
.btn:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.btn-primary {
  background: var(--brand);
  color: var(--on-brand);
}
.btn-primary:hover:not(:disabled) {
  background: var(--brand-hover);
}
.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.btn-ghost {
  min-height: 32px;
  padding: 0 10px;
  background: transparent;
  color: var(--text-2);
}
.btn-ghost:hover {
  background: var(--surface-hover);
  color: var(--text);
}
.btn-ghost .icon {
  font-size: 18px;
}

/* ── Fields ─────────────────────────────────────────────── */
.field {
  display: grid;
  gap: 6px;
  min-width: 0;
  flex: 1 1 180px;
}
.field label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-2);
}
.field select {
  width: 100%;
  min-height: 38px;
  padding: 0 34px 0 12px;
  border: 1px solid var(--border-input);
  border-radius: var(--radius-input);
  background: var(--surface) var(--chevron) no-repeat right 8px center / 18px 18px;
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  appearance: none;
  cursor: pointer;
}
.field select:focus-visible {
  outline: none;
  border-color: var(--brand-blue);
  box-shadow: var(--focus-ring);
}
.field.is-missing select {
  border-color: var(--critical-strong);
}

/* ── Tabs, counts and tables ─────────────────────────────── */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 6px 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-2);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition:
    background-color 130ms var(--ease),
    border-color 130ms var(--ease);
}
.tab:hover {
  background: var(--surface-hover);
}
.tab:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}
.tab[aria-selected="true"] {
  border-color: var(--brand);
  color: var(--text);
  background: var(--brand-soft);
}
.count {
  min-width: 28px;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.count.ok {
  background: var(--success-soft);
  color: var(--success-strong);
}

.sample-pill {
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: var(--warning-soft);
  color: var(--warning-strong);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.status {
  font-size: 0.8125rem;
  color: var(--muted);
}
.status.is-error {
  color: var(--critical-strong);
}

.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
th,
td {
  padding: 9px 16px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
th {
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--bg);
}
th.num,
td.num {
  width: 1%;
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody tr:hover td {
  background: var(--surface-hover);
}
td.changed span {
  text-decoration: underline dotted var(--brand-blue);
  text-underline-offset: 3px;
  cursor: help;
}
td.empty {
  color: var(--muted);
}
.reason {
  display: inline-block;
  padding: 1px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
}
.count.warn,
.reason.warn {
  background: var(--warning-soft);
  color: var(--warning-strong);
}
.count.bad,
.reason.bad {
  background: var(--critical-soft);
  color: var(--critical-strong);
}
.count.muted,
.reason.muted {
  background: var(--surface-hover);
  color: var(--text-2);
}
.table-foot {
  padding: 10px 16px;
  font-size: 0.8125rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}
.empty-state {
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
