/* SindFacio: all white, with one blue accent (the office asked for both), 1px hairlines, Geist + Geist Mono. */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f6f6f6;
  --line: #ebebeb;
  --line-strong: #dcdcdc;
  --text: #1f1f1f;
  --text-2: rgba(31, 31, 31, .68);
  --text-3: rgba(31, 31, 31, .5);
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, .08);
  --accent-line: rgba(37, 99, 235, .28);
  --error: #c4320a;
  --error-bg: rgba(240, 68, 56, .08);
  --radius: 6px;
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--font); }
a { color: var(--accent); }
button { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); }
.muted { color: var(--text-2); }

/* Header */
.top { border-bottom: 1px solid var(--line); }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 820px;
  margin: 0 auto; padding: 0 16px; height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 16px; letter-spacing: -.02em;
  color: var(--text); text-decoration: none; }
.logo { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 7px; background: var(--accent);
  color: #fff; font-size: 15px; font-weight: 600; letter-spacing: 0; }
.nav { display: flex; gap: 4px; }
.nav a { display: inline-flex; align-items: center; height: 34px; padding: 0 12px; border-radius: var(--radius);
  color: var(--text-2); text-decoration: none; font-size: 14px; font-weight: 500; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); }

.wrap { max-width: 820px; margin: 0 auto; padding: 8px 16px 48px; }
h1 { margin: 36px 0 8px; font-size: clamp(26px, 5vw, 34px); line-height: 1.15; letter-spacing: -.03em; font-weight: 600; }
.lead { margin: 0 0 22px; color: var(--text-2); font-size: 16px; max-width: 62ch; }
h2 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -.01em; }

/* Buttons and fields */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 16px;
  font-size: 14px; font-weight: 500; color: var(--text); text-decoration: none; background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--radius); cursor: pointer; white-space: nowrap; }
.button:hover { border-color: var(--accent); color: var(--accent); }
.button.primary { color: #fff; background: var(--accent); border-color: var(--accent); }
.button.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }
.button.small { height: 32px; padding: 0 12px; font-size: 13px; }
.button.quiet { border-color: transparent; color: var(--text-2); }
.button.quiet:hover { color: var(--error); border-color: transparent; background: var(--error-bg); }
.button:disabled { opacity: .55; cursor: default; }
.button:focus-visible, .union-row:focus-visible, .nav a:focus-visible, .icon-button:focus-visible,
.link-button:focus-visible, .pick:focus-within {
  outline: 2px solid var(--accent); outline-offset: 2px; }

/* The search form: the field and the button side by side, the hint and the filters below them. On a phone, the
   button goes after the filters. */
.search { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin: 0; }
.search > .hint, .search > .filters { grid-column: 1 / -1; }
.search > .hint { margin: 0; }
.search-field { position: relative; min-width: 0; }
.search-field input { width: 100%; height: 48px; padding: 0 14px; font: 500 17px/1 var(--font); color: var(--text);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); }
.search-field.has-pick input { padding-right: 54px; }
/* The list icon inside the field: a native select laid over it, so phones open their own picker. */
.pick { position: absolute; top: 6px; right: 6px; display: grid; place-items: center; width: 36px; height: 36px;
  color: var(--accent); border-radius: var(--radius); }
.pick:hover { background: var(--accent-soft); }
.pick select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 16px; }
.search-field input::placeholder { color: var(--text-3); font-weight: 400; }
.search-field input:focus, textarea:focus, .field:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft); }
.search > .button { height: 48px; padding: 0 22px; font-size: 15px; }
.hint { margin: 8px 0 0; color: var(--text-3); font-size: 13px; }

/* The portal's filters, under the search */
.filters { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: 10px 12px;
  margin: 8px 0 0; padding: 0; border: 0; min-width: 0; }
.filter { display: grid; gap: 4px; min-width: 0; align-content: start; color: var(--text-2); font-size: 13px; }
.filter.period { grid-column: span 2; }
.filter.clear { align-content: end; }
.period-row { display: flex; align-items: center; gap: 8px; }
.period-row .field { flex: 1; min-width: 0; }
.filters .field { font-size: 14px; padding: 0 10px; }
.link-button { height: 40px; padding: 0; background: none; border: 0; color: var(--accent); font-size: 13px;
  text-decoration: underline; text-underline-offset: 3px; cursor: pointer; justify-self: start; }

textarea, .field { width: 100%; padding: 10px 12px; font: 15px/1.5 var(--mono); color: var(--text);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); }
textarea { min-height: 112px; resize: vertical; }
.field { height: 40px; font-family: var(--font); }

.error { margin: 14px 0 0; padding: 10px 14px; color: var(--error); background: var(--error-bg); border-radius: var(--radius); }
.notice { margin: 14px 0 0; padding: 10px 14px; background: var(--accent-soft); border: 1px solid var(--accent-line);
  border-radius: var(--radius); }
.notice.plain { background: var(--surface-2); border-color: var(--line); color: var(--text-2); }
.notice p { margin: 0; }
.notice p + p { margin-top: 4px; }

/* Waiting */
.waiting { display: flex; gap: 14px; align-items: flex-start; margin-top: 18px; padding: 16px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); }
.waiting p { margin: 0; }
.waiting-title { font-weight: 500; }
.waiting-note { color: var(--text-2); font-size: 14px; }
.spinner { flex: none; width: 18px; height: 18px; margin-top: 2px; border-radius: 50%; border: 2px solid var(--line-strong);
  border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

/* Sections */
.section { margin-top: 36px; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px;
  margin-bottom: 12px; }
.section-head h2 .count { color: var(--text-3); font-weight: 500; }
.panel { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-head h2 { font-size: 16px; }
.panel-text { margin: 6px 0 0; color: var(--text-2); }
.panel-text strong { color: var(--text); font-weight: 600; }
.month-nav { display: flex; gap: 4px; }
.icon-button { display: grid; place-items: center; width: 32px; height: 32px; padding: 0; background: none;
  border: 1px solid var(--line); border-radius: var(--radius); color: var(--text-2); cursor: pointer; font-size: 16px; }
.icon-button:hover:not(:disabled) { color: var(--text); border-color: var(--line-strong); }
.icon-button:disabled { opacity: .35; cursor: default; }
.panel-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 12px; }
.small-note { margin: 0; color: var(--text-3); font-size: 13px; }

/* Results */
#resultado { margin-top: 24px; }
.summary { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.summary-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.summary .when { color: var(--text-3); font: 13px var(--mono); }
.summary .meta { margin: 2px 0 0; color: var(--text-2); font-size: 14px; }
.summary .actions-row { margin-top: 10px; }
.note { margin: 12px 0 0; color: var(--text-2); font-size: 14px; }

.group { margin-top: 22px; }
.group > h3 { margin: 0 0 8px; color: var(--text-3); font: 500 12px var(--mono); letter-spacing: .06em; text-transform: uppercase; }
.group > h3.union-title { color: var(--text); font: 600 15px var(--font); letter-spacing: -.01em; text-transform: none; }
.group > h3 .cnpj { margin-left: 6px; color: var(--text-3); font: 400 12px var(--mono); }
.items { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); }
.item { padding: 14px 16px; }
.item + .item { border-top: 1px solid var(--line); }
.item.is-new { background: linear-gradient(90deg, var(--accent-soft), transparent 60%); }
.item-top { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.reg { font: 500 15px var(--mono); }
.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px;
  font-weight: 500; white-space: nowrap; }
.badge.new { color: #fff; background: var(--accent); }
.badge.opened { color: var(--text-2); background: var(--surface-2); border: 1px solid var(--line); }
.badge.side { color: var(--text-2); background: var(--surface-2); border: 1px solid var(--line); }
.tag { color: var(--text-2); font-size: 13px; }
.validity { color: var(--text-2); font-size: 14px; }
.validity .expired { color: var(--text-3); }
.parties { margin: 6px 0 0; padding: 0; list-style: none; font-size: 14px; overflow-wrap: anywhere; }
.parties li { position: relative; padding-left: 14px; }
.parties li::before { content: ""; position: absolute; left: 2px; top: .7em; width: 5px; height: 1px; background: var(--text-3); }
.item-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-top: 10px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions a { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; font-size: 13px; font-weight: 500;
  color: var(--text); text-decoration: none; background: var(--surface-2); border: 1px solid var(--line-strong); border-radius: var(--radius); }
.actions a:hover { border-color: var(--accent); color: var(--accent); }
.seen { color: var(--text-3); font-size: 13px; }

.empty { padding: 24px 16px; text-align: center; color: var(--text-2); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.empty strong { display: block; margin-bottom: 4px; color: var(--text); font-size: 16px; font-weight: 500; }
.empty p { margin: 0; }
.empty .button { margin-top: 12px; }

/* "Consultar todos" */
.batch { margin-bottom: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); }
.batch p { margin: 0; }
.batch-title { font-weight: 500; overflow-wrap: anywhere; }
.batch-note { color: var(--text-2); font-size: 14px; }
.bar { height: 6px; margin: 10px 0 8px; overflow: hidden; background: var(--surface-2); border-radius: 999px; }
.bar span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s; }
.failures { margin: 10px 0 0; padding-left: 18px; color: var(--text-2); font-size: 14px; }

/* Registered unions, on the Consulta page */
.union-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); }
.union-list li + li { border-top: 1px solid var(--line); }
.union-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 12px 16px;
  text-align: left; background: none; border: 0; cursor: pointer; }
.union-row:hover { background: var(--surface-2); }
.union-main { min-width: 0; }
.union-name { display: block; font-weight: 500; overflow-wrap: anywhere; }
.union-meta { display: block; color: var(--text-3); font-size: 13px; }
.union-side { display: flex; flex: none; flex-direction: column; align-items: flex-end; gap: 2px; text-align: right; }
.union-state { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.union-state.ok { color: var(--accent); }
.union-state.bad { color: var(--error); }

/* Sindicatos page */
.register { display: grid; gap: 10px; }
.register .row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.card { padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-head h3 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.01em; overflow-wrap: anywhere; }
.card-head h3.unnamed { color: var(--text-3); font-weight: 500; }
.card-sub { margin: 4px 0 0; color: var(--text-2); font-size: 14px; }
.card-sub .mono { color: var(--text); }
.facts { display: grid; grid-template-columns: 132px 1fr; gap: 6px 16px; margin: 12px 0 0; font-size: 14px; }
.facts dt { color: var(--text-3); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts dd p { margin: 0; }
details.more { margin-top: 10px; font-size: 14px; }
details.more summary { color: var(--accent); cursor: pointer; width: fit-content; }
details.more .facts { margin-top: 8px; }
.card-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.card-foot .actions { gap: 6px; }
.filter-field { max-width: 280px; }
.rename { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.rename .field { flex: 1 1 240px; }
.out-of-cnes { margin: 10px 0 0; color: var(--text-2); font-size: 14px; }

.foot { margin-top: 56px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 13px; }
.foot a { color: inherit; }

@media (max-width: 560px) {
  h1 { margin-top: 28px; }
  .search { grid-template-columns: minmax(0, 1fr); }
  .search > .button { width: 100%; }
  #consultar { order: 1; margin-top: 8px; }
  .filters { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .filter.type, .filter.period { grid-column: 1 / -1; }
  .facts { grid-template-columns: 1fr; gap: 0; }
  .facts dd { margin-bottom: 8px; }
  .union-row { flex-direction: column; align-items: flex-start; gap: 6px; }
  .union-side { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 8px; text-align: left; }
  .nav a { padding: 0 10px; }
}
