/* Reajuste de base e elementos comuns. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* O atributo hidden vale mais do que qualquer display declarado adiante.
   Sem isto, uma regra como `.focus { display: grid }` reativa um elemento
   marcado como hidden e ele cobre a tela inteira. */
[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-1);
  background: var(--surface-0);
  background-image: var(--app-backdrop);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 600;
  line-height: var(--leading-tight);
}

p {
  margin: 0;
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
}

a {
  color: inherit;
  text-decoration: none;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

hr {
  border: 0;
  border-top: 1px solid var(--border-soft);
  margin: var(--sp-4) 0;
}

/* Foco sempre visível: navegar por teclado não pode virar adivinhação. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

::selection {
  background: var(--accent-dim);
}

/* --- Barras de rolagem discretas ----------------------------------------- */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
  background-clip: content-box;
}

/* --- Marca ---------------------------------------------------------------- */

.mark {
  display: inline-block;
  width: 1.35em;
  height: 1.35em;
  flex: 0 0 auto;
  color: var(--brand-mark);
  background-color: currentColor;
  -webkit-mask: url("../img/mark.svg") center / contain no-repeat;
  mask: url("../img/mark.svg") center / contain no-repeat;
}

.wordmark {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: var(--tracking-brand);
  font-weight: 400;
}

/* --- Botões --------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-3);
  color: var(--text-1);
  border: 1px solid var(--border);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
    transform var(--dur-fast) var(--ease);
  white-space: nowrap;
}
.btn:hover {
  background: var(--surface-4);
  border-color: var(--border-strong);
}
.btn:active {
  transform: translateY(1px);
}
.btn--primary {
  background: var(--accent);
  color: var(--on-accent);
  border-color: transparent;
  font-weight: 600;
}
.btn--primary:hover {
  background: var(--accent-hover);
}
.btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-2);
}
.btn--ghost:hover {
  background: var(--surface-3);
  color: var(--text-1);
}
.btn--block {
  width: 100%;
}
.btn--sm {
  padding: 5px 10px;
  font-size: var(--text-xs);
}
.btn[disabled] {
  opacity: 0.5;
  pointer-events: none;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 1rem;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.icon-btn:hover {
  background: var(--surface-3);
  color: var(--text-1);
}
.icon-btn--tiny {
  width: 22px;
  height: 22px;
  font-size: var(--text-sm);
}

/* --- Campos --------------------------------------------------------------- */

.field {
  display: block;
  margin-bottom: var(--sp-3);
}
.field__label {
  display: block;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--text-3);
  margin-bottom: 5px;
}

input[type="text"],
input[type="password"],
input[type="date"],
input[type="email"],
input:not([type]),
textarea,
select {
  width: 100%;
  padding: 8px 10px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-2);
}
textarea {
  resize: vertical;
  min-height: 70px;
  line-height: var(--leading-normal);
}
select {
  cursor: pointer;
}
input::placeholder,
textarea::placeholder {
  color: var(--text-faint);
}

/* --- Peças reutilizadas --------------------------------------------------- */

.avatar {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: 50%;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--surface-0);
  background: var(--accent);
  letter-spacing: 0;
}
.avatar--sm {
  width: 20px;
  height: 20px;
  font-size: 9px;
}
.avatar--lg {
  width: 34px;
  height: 34px;
  font-size: var(--text-sm);
}
.avatar--empty {
  background: var(--surface-4);
  color: var(--text-3);
  border: 1px dashed var(--border-strong);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.7;
  white-space: nowrap;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: currentColor;
}

.muted {
  color: var(--text-3);
}
.tiny {
  font-size: var(--text-xs);
}
.strike {
  text-decoration: line-through;
  opacity: 0.55;
}
.nowrap {
  white-space: nowrap;
}
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.spacer {
  flex: 1;
}

.empty {
  display: grid;
  place-items: center;
  gap: var(--sp-2);
  padding: var(--sp-10) var(--sp-4);
  text-align: center;
  color: var(--text-3);
}
.empty strong {
  color: var(--text-2);
  font-weight: 600;
}
