/* ==========================================================================
   forms.css — NTWeb 2026 Deep Command
   Form primitives + client-area specifics:
     .nt-form             — wrapper com grid de fields
     .nt-field            — label+input+hint+error
     .nt-input / textarea / select — base
     .nt-checkbox / .nt-radio — custom styled
     .nt-alert            — info/success/warning/danger
     .nt-table            — tabela de dados (faturas, serviços)
     .nt-dashcard         — card de métrica (numero grande + label)
     .nt-timeline         — linha do tempo vertical (fatura, ticket)
     .nt-ticket-row       — linha de lista de tickets
   ========================================================================== */

/* ==========================================================================
   Form base
   ========================================================================== */

.nt-form {
  display: grid;
  gap: var(--space-5);
}
.nt-form--2col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.nt-form--2col .nt-field--full { grid-column: 1 / -1; }

.nt-field {
  display: grid;
  gap: var(--space-2);
}

.nt-profile-form {
  display: grid;
  gap: var(--space-5);
  max-width: 920px;
}

.nt-form-section {
  display: grid;
  gap: var(--space-4);
  min-width: 0;
  margin: 0;
  padding: var(--space-6);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card-translucent);
  box-shadow: var(--shadow-sm);
}

.nt-form-section__title {
  display: block;
  float: left;
  width: 100%;
  margin: 0 0 var(--space-1);
  padding: 0;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  color: var(--text-1);
}

.nt-form-section__title + * {
  clear: both;
}

.nt-form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.nt-form-group {
  display: grid;
  gap: var(--space-2);
  min-width: 0;
}

.nt-form-label {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-3);
}

@media (max-width: 720px) {
  .nt-profile-form {
    max-width: none;
  }

  .nt-form-section {
    padding: var(--space-5);
  }

  .nt-form-row {
    grid-template-columns: 1fr;
  }
}

/* Form actions — barra de botões de submit */
.nt-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}
.nt-form-actions--right   { justify-content: flex-end; }
.nt-form-actions--between { justify-content: space-between; }

/* Alert block-level inside forms */
.nt-form > .nt-alert { margin-bottom: var(--space-4); }

.nt-field__label {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-3);
}
.nt-field__label .req { color: var(--accent); margin-left: 2px; }

.nt-field__hint {
  font-family: var(--font-body);
  font-size: var(--text-xs);
  color: var(--text-3);
}

.nt-field__error {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--red);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.nt-field__error::before {
  content: "!";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px; height: 14px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: 10px;
}

/* ==========================================================================
   Inputs
   ========================================================================== */

.nt-input,
.nt-select,
.nt-textarea {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-1);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  line-height: 1.4;
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out);
}
.nt-input::placeholder,
.nt-textarea::placeholder {
  color: var(--text-3);
  opacity: 0.7;
}
.nt-input:hover,
.nt-select:hover,
.nt-textarea:hover { border-color: var(--border-bright); }

.nt-input:focus,
.nt-select:focus,
.nt-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: var(--card);
}

.nt-textarea { min-height: 120px; resize: vertical; font-family: var(--font-body); }

.nt-select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6' fill='none' stroke='%23808080' stroke-width='1.4'><path d='M1 1l4 4 4-4'/></svg>");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  background-size: 10px 6px;
  padding-right: calc(var(--space-4) * 2);
}

.nt-field[data-state="error"] .nt-input,
.nt-field[data-state="error"] .nt-select,
.nt-field[data-state="error"] .nt-textarea {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.15);
}
.nt-field[data-state="success"] .nt-input { border-color: var(--green); }

/* Inline input group (ex: campo + botão submit) */
.nt-input-group {
  display: flex;
  align-items: stretch;
}
.nt-input-group .nt-input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-right: 0;
}
.nt-input-group .nt-btn {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

/* ==========================================================================
   Checkbox / radio
   ========================================================================== */

.nt-checkbox,
.nt-radio {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--text-1);
  cursor: pointer;
  user-select: none;
}
.nt-checkbox input,
.nt-radio input {
  position: absolute; opacity: 0; pointer-events: none;
}
.nt-checkbox .box,
.nt-radio .box {
  width: 18px; height: 18px;
  border: 1px solid var(--border-bright);
  background: var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--duration-fast) var(--ease-out);
}
.nt-checkbox .box { border-radius: var(--radius-xs); }
.nt-radio .box    { border-radius: 50%; }

.nt-checkbox input:focus-visible ~ .box,
.nt-radio    input:focus-visible ~ .box {
  box-shadow: 0 0 0 3px var(--accent-soft);
  border-color: var(--accent);
}

.nt-checkbox input:checked ~ .box {
  background: var(--accent);
  border-color: var(--accent);
}
.nt-checkbox input:checked ~ .box::after {
  content: "";
  width: 10px; height: 5px;
  border-left: 2px solid var(--accent-contrast);
  border-bottom: 2px solid var(--accent-contrast);
  transform: rotate(-45deg) translate(1px, -1px);
}

.nt-radio input:checked ~ .box::after {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

/* ==========================================================================
   Alerts
   ========================================================================== */

.nt-alert {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--card-translucent);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border-bright);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--text-2);
  line-height: var(--lh-body);
}
.nt-alert__title {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-1);
  margin: 0 0 var(--space-1);
}
.nt-alert__icon {
  width: 20px; height: 20px;
  color: currentColor;
  flex-shrink: 0;
}
.nt-alert--info    { border-left-color: var(--accent); }
.nt-alert--info    .nt-alert__icon { color: var(--accent); }
.nt-alert--success { border-left-color: var(--green); }
.nt-alert--success .nt-alert__icon { color: var(--green); }
.nt-alert--warning { border-left-color: var(--amber); }
.nt-alert--warning .nt-alert__icon { color: var(--amber); }
.nt-alert--danger  { border-left-color: var(--red); }
.nt-alert--danger  .nt-alert__icon { color: var(--red); }

/* ==========================================================================
   Dashboard cards (metric)
   ========================================================================== */

.nt-dashcard {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-6);
  background: var(--card-translucent);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all var(--duration-base) var(--ease-out);
  position: relative;
  overflow: hidden;
}
.nt-dashcard:hover {
  border-color: var(--border-bright);
  box-shadow: var(--shadow-md);
}
.nt-dashcard__label {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-3);
}
.nt-dashcard__value {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  font-weight: 700;
  color: var(--text-1);
  line-height: 1;
}
.nt-dashcard__value em {
  color: var(--accent);
  font-style: normal;
}
.nt-dashcard__delta {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}
.nt-dashcard__delta--up   { color: var(--green); }
.nt-dashcard__delta--down { color: var(--red); }

.nt-dashcard--accent {
  border-color: var(--accent-border);
  background: linear-gradient(180deg, var(--accent-soft) 0%, var(--card) 120%);
}

/* ==========================================================================
   Tabelas de dados
   ========================================================================== */

.nt-table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--card-translucent);
}

.nt-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--text-1);
}
.nt-table thead th {
  padding: var(--space-3) var(--space-4);
  text-align: left;
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-3);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.nt-table tbody td {
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.nt-table tbody tr:last-child td { border-bottom: 0; }
.nt-table tbody tr:hover { background: var(--card-hover); }

.nt-table td.num,
.nt-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.nt-table td.mono { font-family: var(--font-mono); font-size: var(--text-xs); }

/* Status pills inside tables */
.nt-table .nt-badge { white-space: nowrap; }

/* ==========================================================================
   Timeline (fatura / ticket history)
   ========================================================================== */

.nt-timeline {
  display: grid;
  gap: var(--space-6);
  padding: var(--space-4) 0;
}
.nt-timeline__item {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: var(--space-4);
  position: relative;
}
.nt-timeline__item:not(:last-child)::before {
  content: "";
  position: absolute;
  top: 28px;
  left: 15px;
  bottom: -24px;
  width: 1px;
  background: var(--border);
}
.nt-timeline__dot {
  width: 32px; height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-bright);
  background: var(--card);
  border-radius: 50%;
  color: var(--text-2);
  flex-shrink: 0;
  z-index: 1;
}
.nt-timeline__dot svg { width: 14px; height: 14px; }
.nt-timeline__item--active .nt-timeline__dot {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}
.nt-timeline__item--done .nt-timeline__dot {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.nt-timeline__content { display: grid; gap: var(--space-1); padding-top: var(--space-1); }
.nt-timeline__title {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 700;
  color: var(--text-1);
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.nt-timeline__meta {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
}
.nt-timeline__body {
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--text-2);
  line-height: var(--lh-body);
}

/* ==========================================================================
   Ticket row
   ========================================================================== */

.nt-ticket-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--card-translucent);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--text-1);
  transition: all var(--duration-fast) var(--ease-out);
}
.nt-ticket-row:hover {
  border-color: var(--border-bright);
  transform: translateX(2px);
  color: var(--text-1);
  text-decoration: none;
}
.nt-ticket-row__id {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.nt-ticket-row__main { display: grid; gap: 2px; min-width: 0; }
.nt-ticket-row__subject {
  font-family: var(--font-body);
  font-size: var(--text-md);
  font-weight: 500;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nt-ticket-row__dept {
  font-family: var(--font-mono);
  font-size: var(--text-2xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
}
.nt-ticket-row__date {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-2);
  text-align: right;
  white-space: nowrap;
}

/* ==========================================================================
   Empty state
   ========================================================================== */

.nt-empty {
  display: grid;
  gap: var(--space-3);
  padding: var(--space-12) var(--space-8);
  text-align: center;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  color: var(--text-3);
}
.nt-empty__icon {
  margin: 0 auto;
  width: 48px; height: 48px;
  color: var(--text-3);
  opacity: 0.5;
}
.nt-empty__title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-2);
  margin: 0;
}
.nt-empty__body {
  font-size: var(--text-sm);
  color: var(--text-3);
  margin: 0;
  max-width: 48ch;
  margin-inline: auto;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 768px) {
  .nt-form--2col { grid-template-columns: 1fr; }
  .nt-ticket-row { grid-template-columns: 1fr auto; grid-auto-rows: auto; }
  .nt-ticket-row__id { grid-column: 1 / -1; }
  .nt-ticket-row__date { grid-column: 1 / -1; text-align: left; }
  .nt-table thead { display: none; }
  .nt-table tbody tr { display: grid; gap: var(--space-1); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--border); }
  .nt-table tbody td { padding: 0; border: 0; display: flex; justify-content: space-between; }
  .nt-table tbody td::before {
    content: attr(data-label);
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-3);
  }
}
