/* NEW FORTALEZA 2.1.0 — ESTILOS BASEADOS NA VERSÃO 2.0.0 */

:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --navy: #0b1f33;
  --navy-2: #102b46;
  --primary: #1677ff;
  --primary-dark: #0d5fd3;
  --text: #162033;
  --muted: #6b778c;
  --border: #e3e8ef;
  --danger: #dc3545;
  --warning: #f4b400;
  --success: #198754;
  --info: #0d6efd;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(11,31,51,.08);
  --sidebar-width: 255px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Inter", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  min-height: 100vh;
}

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

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

/* LOGIN */

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at top right, rgba(22,119,255,.16), transparent 35%),
    linear-gradient(135deg, #071625, #0b1f33 50%, #123b61);
}

.login-card {
  width: 100%;
  max-width: 430px;
  padding: 34px;
  border-radius: 22px;
  background: rgba(255,255,255,.98);
  box-shadow: 0 25px 70px rgba(0,0,0,.25);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}

.login-logo h1 {
  margin: 0;
  font-size: 21px;
}

.login-logo p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.login-card > h2 {
  margin: 0 0 7px;
  font-size: 25px;
}

.login-card > p {
  margin: 0 0 25px;
  color: var(--muted);
  line-height: 1.5;
  font-size: 14px;
}

.login-form {
  display: grid;
  gap: 18px;
}

.login-form label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
}

.login-btn {
  min-height: 48px;
  margin-top: 5px;
}

.security-note {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  padding: 13px;
  border-radius: 11px;
  background: #f3f7fc;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.login-foot {
  margin-top: 25px;
  text-align: center;
  color: #98a2b3;
  font-size: 11px;
}

/* MARCA */

.brand-mark {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, #1684ff, #0a5ec7);
  color: #fff;
  font-weight: 800;
  letter-spacing: -.5px;
  box-shadow: 0 8px 20px rgba(22,119,255,.25);
}

/* APP */

.app-shell {
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  background: var(--navy);
  color: #fff;
  z-index: 50;
}

.brand {
  min-height: 82px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.brand strong {
  display: block;
  font-size: 15px;
}

.brand span {
  display: block;
  margin-top: 3px;
  color: #9db0c4;
  font-size: 11px;
}

.nav {
  display: grid;
  gap: 7px;
  padding: 18px 12px;
}

.nav-item {
  width: 100%;
  min-height: 45px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: #b8c6d5;
  text-align: left;
  transition: .18s ease;
}

.nav-item:hover {
  background: rgba(255,255,255,.07);
  color: #fff;
}

.nav-item.active {
  background: #1677ff;
  color: #fff;
  box-shadow: 0 8px 20px rgba(22,119,255,.2);
}

.sidebar-footer {
  margin-top: auto;
  padding: 18px;
  border-top: 1px solid rgba(255,255,255,.08);
  color: #93a5b7;
  font-size: 11px;
}

.sidebar-footer > div {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 13px;
}

.connection-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #31d17c;
}

.logout-btn {
  width: 100%;
  padding: 10px;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 9px;
  background: transparent;
  color: #c6d1dd;
  font-size: 12px;
}

.logout-btn:hover {
  background: rgba(255,255,255,.07);
  color: #fff;
}

/* CONTEÚDO PRINCIPAL */

.main {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  min-height: 82px;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 13px 28px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar h1 {
  margin: 0;
  font-size: 20px;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.topbar-actions {
  margin-left: auto;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-chip strong {
  display: block;
  font-size: 12px;
}

.user-chip span {
  display: block;
  margin-top: 2px;
}

.avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #eaf2ff;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
}

.role-chip {
  color: var(--muted);
  font-size: 10px;
}

.content {
  padding: 25px 28px 40px;
}

/* BOTÕES */

.btn {
  min-height: 40px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-weight: 700;
  font-size: 12px;
  transition: .15s ease;
}

.btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-secondary {
  background: #fff;
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  background: #f7f9fc;
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-small {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 11px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
}

/* CAMPOS */

.input,
.select,
.textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid #d8dee8;
  border-radius: 9px;
  outline: none;
  background: #fff;
  color: var(--text);
  transition: .15s ease;
}

.textarea {
  min-height: 90px;
  resize: vertical;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22,119,255,.1);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 16px;
}

.form-grid :is(.full, .span2, .span4) {
  grid-column: 1 / -1;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 11px;
  font-weight: 700;
  color: #485467;
}

.required::after {
  content: " *";
  color: var(--danger);
}

/* CARDS */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 3px 14px rgba(11,31,51,.04);
}

.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 17px 18px;
  border-bottom: 1px solid var(--border);
}

.card-head h3 {
  margin: 0;
  font-size: 14px;
}

.card-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.card-body {
  padding: 18px;
}

/* DASHBOARD */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 15px;
  margin-bottom: 20px;
}

.kpi {
  min-height: 112px;
  padding: 18px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 13px;
}

:is(.kpi-label, .kpi .label) {
  display: block;
  margin-bottom: 13px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.kpi-value {
  display: block;
  font-size: 27px;
  line-height: 1;
  font-weight: 800;
}

.kpi-foot {
  display: block;
  margin-top: 10px;
  color: #98a2b3;
  font-size: 10px;
}

:is(.dashboard-grid, .split) {
  display: grid;
  grid-template-columns: 1.3fr .7fr;
  gap: 18px;
}

/* STATUS */

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.status-em-aberto {
  background: #f2f4f7;
  color: #475467;
  border: 1px solid #e4e7ec;
}

.status-orcamento {
  background: #dcebff;
  color: #0b5ec7;
}

.status-visita {
  background: #fff3c4;
  color: #8a6300;
}

.status-aprovado {
  background: #d9f6e5;
  color: #147342;
}

.status-cancelado {
  background: #ffe0e3;
  color: #b4232f;
}

.status-finalizado {
  background: #ccefdc;
  color: #0d6b39;
}

/* TABELAS */

.table-wrap {
  width: 100%;
  overflow: auto;
}

:is(.table, .data-table) {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

:is(.table, .data-table) th {
  padding: 11px 12px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  color: #657186;
  text-align: left;
  white-space: nowrap;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .03em;
}

:is(.table, .data-table) td {
  padding: 11px 12px;
  border-bottom: 1px solid #edf0f4;
  vertical-align: middle;
}

:is(.table, .data-table) tbody tr:hover {
  background: #fafcff;
}

:is(.table, .data-table) tbody tr:last-child td {
  border-bottom: 0;
}

.table-actions {
  display: flex;
  gap: 6px;
}

/* BARRA DE FERRAMENTAS */

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.toolbar-search {
  width: min(380px,100%);
}

.toolbar-right {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

/* ESTADO VAZIO */

:is(.empty-state, .empty) {
  padding: 45px 20px;
  text-align: center;
  color: var(--muted);
}

:is(.empty-state, .empty) strong {
  display: block;
  margin-bottom: 7px;
  color: var(--text);
  font-size: 14px;
}

:is(.empty-state, .empty) p {
  margin: 0;
  font-size: 11px;
}

/* MODAL */

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4,15,27,.58);
  backdrop-filter: blur(3px);
  z-index: 100;
}

.modal {
  width: min(760px,100%);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 25px 70px rgba(0,0,0,.25);
}

.modal-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 17px 19px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.modal-head :is(h2, h3) {
  margin: 0;
  font-size: 16px;
}

.modal-head button {
  margin-left: auto;
}

.modal-body {
  padding: 20px;
}

:is(.modal-foot, .modal-actions) {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 19px;
  background: #fff;
  border-top: 1px solid var(--border);
}

/* ALERTAS */

.alert {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 9px;
  font-size: 11px;
  line-height: 1.5;
}

.alert-info {
  background: #eaf3ff;
  color: #145da8;
}

.alert-warning {
  background: #fff5d6;
  color: #7a5900;
}

.alert-danger {
  background: #ffe7e9;
  color: #a61b29;
}

/* TOAST */

.toast-host {
  position: fixed;
  top: 18px;
  right: 18px;
  display: grid;
  gap: 8px;
  z-index: 200;
}

.toast {
  width: min(350px,calc(100vw - 36px));
  padding: 13px 15px;
  border-radius: 10px;
  background: #172335;
  color: #fff;
  box-shadow: var(--shadow);
  font-size: 11px;
  animation: toastIn .2s ease;
}

.toast.error {
  background: #b4232f;
}

.toast.success {
  background: #167647;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* LOADING */

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: rgba(245,248,252,.96);
  color: var(--navy);
}

.spinner {
  width: 35px;
  height: 35px;
  border: 4px solid #dce5ef;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* UTILITÁRIOS */

.muted {
  color: var(--muted);
}

.text-danger {
  color: var(--danger);
}

.text-success {
  color: var(--success);
}

.text-right {
  text-align: right;
}

.mobile-only {
  display: none;
}

/* RESPONSIVO */

@media (max-width: 1100px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0,1fr));
  }

  :is(.dashboard-grid, .split) {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 800px) {
  .mobile-only {
    display: grid;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 15px 0 40px rgba(0,0,0,.18);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
  }

  .topbar {
    min-height: 72px;
    padding: 11px 15px;
  }

  .topbar h1 {
    font-size: 17px;
  }

  .topbar p {
    display: none;
  }

  .content {
    padding: 17px 14px 30px;
  }

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

  .form-grid :is(.full, .span2, .span4) {
    grid-column: auto;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-search {
    width: 100%;
  }

  .toolbar-right {
    width: 100%;
    margin-left: 0;
  }

  .toolbar-right .btn {
    flex: 1;
  }
}

@media (max-width: 540px) {
  .login-screen {
    padding: 14px;
  }

  .login-card {
    padding: 25px 20px;
    border-radius: 17px;
  }

  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .kpi {
    min-height: 100px;
    padding: 14px;
  }

  .kpi-value {
    font-size: 23px;
  }

  .user-chip strong {
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }

  .modal {
    width: 100%;
    max-height: 94vh;
    border-radius: 18px 18px 0 0;
  }

  .modal-body {
    padding: 16px;
  }
}


/* USUÁRIOS, SENHAS E PAINEL DO TÉCNICO — 2.1.0 */

.s-progress {
  background:#e7edff;
  color:#3949ab}

.muted {
  color:var(--muted);
  font-size:12px;
  margin:5px 0 0}

.small-modal {
  width:min(700px,100%)}

.user-table {
  min-width:850px}

.tech-summary {
  display:flex;
  justify-content:space-between;
  gap:16px;
  align-items:center;
  background:linear-gradient(135deg,#0b1f33,#143f68);
  color:#fff;
  border-radius:18px;
  padding:22px 24px;
  box-shadow:var(--shadow)}

.tech-summary h2 {
  margin:0;
  font-size:22px}

.tech-summary p {
  margin:5px 0 0;
  color:#bdd0e4;
  font-size:12px}

.tech-counts {
  display:flex;
  gap:10px;
  flex-wrap:wrap}

.tech-counts span {
  background:rgba(255,255,255,.10);
  border:1px solid rgba(255,255,255,.12);
  padding:10px 13px;
  border-radius:12px;
  font-size:11px}

.tech-counts strong {
  font-size:18px;
  margin-right:4px}

.tech-cards {
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:14px}

.tech-service,.tech-current {
  padding:20px}

.tech-current {
  border:2px solid #8bb5f7}

.tech-card-head {
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:flex-start}

.tech-card-head h3 {
  margin:4px 0 0;
  font-size:18px}

.eyebrow {
  font-size:10px;
  font-weight:800;
  letter-spacing:.08em;
  text-transform:uppercase;
  color:var(--muted)}

.tech-address {
  font-size:12px;
  color:#45566a;
  margin:14px 0}

.tech-mini {
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  margin:10px 0}

.tech-mini span {
  background:#f3f6fa;
  padding:6px 9px;
  border-radius:9px;
  font-size:10px;
  color:#526173}

.tech-defect {
  font-size:12px;
  line-height:1.55;
  color:#334155;
  min-height:38px}

.tech-service .btn {
  width:100%;
  margin-top:10px}

.tech-detail-grid {
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:12px;
  margin-top:18px}

.tech-detail {
  border:1px solid var(--border);
  background:#f8fafc;
  border-radius:12px;
  padding:12px}

.tech-detail span,.tech-detail strong {
  display:block}

.tech-detail span {
  font-size:10px;
  color:var(--muted);
  text-transform:uppercase;
  font-weight:700}

.tech-detail strong {
  font-size:12px;
  margin-top:5px;
  line-height:1.45}

.tech-actions {
  display:flex;
  justify-content:flex-end;
  margin-top:18px}

.tech-empty p {
  margin-bottom:0}

.tech-metric {
  grid-template-columns:1.5fr repeat(7,.7fr)}


@media(max-width:820px) {
  .tech-summary {
  align-items:flex-start;
  flex-direction:column}

.tech-cards {
  grid-template-columns:1fr}

.tech-detail-grid {
  grid-template-columns:1fr}

.tech-actions .btn {
  width:100%}

}



/* COMPATIBILIDADE COM O NOVO APP E AJUSTES RESPONSIVOS */

.main, .content, .card, .field, .tech-detail { min-width: 0; }
.sidebar { overflow-y: auto; }
.logout-btn + .logout-btn { margin-top: 8px; }
.section { margin-top: 20px; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.section-head :is(h2, h3) { margin: 0; font-size: 16px; }
.section-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.table-card { overflow: hidden; }
.data-table { min-width: 680px; }
.user-table { min-width: 850px; }
.field.span2, .field.span4 { grid-column: 1 / -1; }
.s-open { background: #f2f4f7; color: #475467; }
.s-orc { background: #dcebff; color: #0b5ec7; }
.s-vis { background: #fff3c4; color: #8a6300; }
.s-ok { background: #d9f6e5; color: #147342; }
.s-cancel { background: #ffe0e3; color: #b4232f; }
.s-final { background: #ccefdc; color: #0d6b39; }
.tech-detail strong, .tech-address, .tech-defect { overflow-wrap: anywhere; }
.tech-detail strong, .tech-defect { white-space: pre-wrap; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
button:focus-visible, a:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

@media (max-width: 800px) {
  .section-head { align-items: stretch; flex-direction: column; }
  .section-head > .btn { width: 100%; }
  .field.span2, .field.span4 { grid-column: 1 / -1; }
  .tech-counts { width: 100%; }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions .btn { flex: 1; }
}

@media (max-width: 540px) {
  .tech-summary { padding: 18px; }
  .tech-summary h2 { font-size: 19px; }
  .tech-service, .tech-current { padding: 16px; }
  .tech-card-head { flex-wrap: wrap; }
  .topbar-actions { min-width: 0; }
  .user-chip > div:not(.avatar) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
