* {
  box-sizing: border-box;
}

:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #222432;
  --muted: #777b8d;
  --border: #e7e8ef;

  --primary: #6d28d9;
  --primary-dark: #541caf;

  --success-bg: #e9f9ef;
  --success: #198754;

  --danger-bg: #fdecec;
  --danger: #d33c3c;

  --sidebar: #17121f;
}

body {
  margin: 0;
  font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  background: var(--bg);
  color: var(--text);
}

.hidden {
  display: none !important;
}


/* LOGIN */

.login-screen {
  min-height: 100vh;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 25px;

  background:
    radial-gradient(
      circle at top right,
      #8f46d8,
      #3e185d 38%,
      #17121f 75%
    );
}

.login-card {
  width: 100%;
  max-width: 420px;

  background: white;

  padding: 38px;

  border-radius: 20px;

  box-shadow:
    0 20px 60px rgba(0, 0, 0, .25);
}

.brand,
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  margin-bottom: 35px;
}

.brand-mark {
  width: 43px;
  height: 43px;

  border-radius: 12px;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 23px;
  font-weight: 800;

  color: white;

  background:
    linear-gradient(
      135deg,
      #702bd4,
      #d33282
    );
}

.brand h1 {
  margin: 0;

  font-size: 17px;
  letter-spacing: .5px;
}

.brand p {
  margin: 3px 0 0;

  color: var(--muted);
  font-size: 13px;
}

.login-card h2 {
  margin-bottom: 22px;
}

label {
  display: block;

  font-size: 13px;
  font-weight: 600;

  margin-bottom: 17px;
}

input,
select {
  width: 100%;

  margin-top: 7px;

  padding: 12px 13px;

  border: 1px solid var(--border);
  border-radius: 9px;

  font: inherit;

  background: white;
}

input:focus,
select:focus {
  outline: none;

  border-color: var(--primary);

  box-shadow:
    0 0 0 3px rgba(109,40,217,.09);
}


/* APP */

.app {
  min-height: 100vh;

  display: flex;
}

.sidebar {
  position: fixed;

  width: 235px;
  height: 100vh;

  background: var(--sidebar);
  color: white;

  padding: 23px 15px;

  display: flex;
  flex-direction: column;
}

.sidebar-brand {
  padding: 0 10px 25px;

  border-bottom:
    1px solid rgba(255,255,255,.07);

  margin-bottom: 20px;
}

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

.sidebar-brand span {
  display: block;

  font-size: 12px;
  color: #a8a3b0;

  margin-top: 2px;
}

nav {
  display: flex;
  flex-direction: column;

  gap: 5px;
}

.nav-item {
  border: 0;
  background: transparent;
  color: #b8b3c2;

  text-align: left;

  padding: 12px 13px;

  border-radius: 9px;

  cursor: pointer;

  font-size: 14px;
}

.nav-item span {
  display: inline-block;

  width: 24px;
}

.nav-item:hover {
  background: rgba(255,255,255,.05);
  color: white;
}

.nav-item.active {
  color: white;

  background:
    linear-gradient(
      90deg,
      rgba(121,50,200,.42),
      rgba(121,50,200,.14)
    );
}

.sidebar-footer {
  margin-top: auto;

  padding: 16px 10px 0;

  border-top:
    1px solid rgba(255,255,255,.07);
}

.current-user {
  font-size: 12px;

  color: #aaa4b2;

  margin-bottom: 10px;
}

.logout-button {
  background: transparent;
  border: 0;

  padding: 0;

  color: #d7d2dd;

  cursor: pointer;
}

.main {
  margin-left: 235px;

  width: calc(100% - 235px);

  padding: 32px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;

  margin-bottom: 28px;
}

.topbar h1 {
  margin: 0;

  font-size: 26px;
}

.topbar p {
  margin: 6px 0 0;

  color: var(--muted);
  font-size: 14px;
}


/* BUTTONS */

.btn {
  border: 0;

  border-radius: 9px;

  padding: 11px 17px;

  font-weight: 600;

  cursor: pointer;
}

.btn.primary {
  color: white;

  background:
    linear-gradient(
      135deg,
      #702bd4,
      #9d3cc6
    );
}

.btn.primary:hover {
  opacity: .92;
}

.btn.secondary {
  background: #eeeeF4;
  color: #414353;
}

.btn.full {
  width: 100%;
}


/* STATS */

.stats {
  display: grid;

  grid-template-columns:
    repeat(3, minmax(160px, 230px));

  gap: 15px;

  margin-bottom: 20px;
}

.stat-card {
  background: white;

  border: 1px solid var(--border);

  border-radius: 12px;

  padding: 17px;
}

.stat-card span {
  display: block;

  font-size: 13px;
  color: var(--muted);

  margin-bottom: 7px;
}

.stat-card strong {
  font-size: 26px;
}


/* CARD */

.card {
  background: var(--card);

  border: 1px solid var(--border);

  border-radius: 14px;

  overflow: hidden;
}

.card-header {
  padding: 20px;

  display: flex;
  justify-content: space-between;
  align-items: center;

  border-bottom:
    1px solid var(--border);
}

.card-header h2 {
  font-size: 17px;
  margin: 0;
}

.card-header p {
  margin: 4px 0 0;

  color: var(--muted);
  font-size: 12px;
}

.search-box {
  width: 260px;
}

.search-box input {
  margin: 0;
}


/* TABLE */

.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  padding: 12px 18px;

  text-align: left;

  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .4px;

  color: #858898;

  background: #fafafe;
}

td {
  padding: 15px 18px;

  border-top:
    1px solid var(--border);

  font-size: 13px;
}

.technician-name {
  font-weight: 650;
}

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

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

.edit-button {
  border: 0;

  background: #f0ebfa;
  color: var(--primary);

  padding: 7px 11px;

  border-radius: 7px;

  cursor: pointer;

  font-weight: 600;
}

.status {
  display: inline-flex;
  align-items: center;

  padding: 5px 9px;

  border-radius: 100px;

  font-size: 11px;
  font-weight: 700;
}

.status.active {
  background: var(--success-bg);
  color: var(--success);
}

.status.inactive {
  background: var(--danger-bg);
  color: var(--danger);
}

.empty-state {
  padding: 45px;

  text-align: center;

  color: var(--muted);
}


/* MODAL */

.modal {
  position: fixed;
  inset: 0;

  z-index: 100;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 20px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;

  background:
    rgba(13, 9, 18, .60);

  backdrop-filter:
    blur(2px);
}

.modal-card {
  position: relative;

  z-index: 2;

  width: 100%;
  max-width: 540px;

  background: white;

  border-radius: 16px;

  padding: 24px;

  box-shadow:
    0 20px 60px rgba(0,0,0,.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;

  margin-bottom: 22px;
}

.modal-header h2 {
  margin: 0;
  font-size: 19px;
}

.modal-header p {
  margin: 4px 0 0;

  font-size: 12px;
  color: var(--muted);
}

.close-button {
  border: 0;
  background: transparent;

  font-size: 27px;
  color: #777;

  cursor: pointer;
}

.form-grid {
  display: grid;

  grid-template-columns:
    1fr 150px;

  gap: 14px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;

  gap: 9px;

  margin-top: 25px;
}

.error-message {
  color: #c83333;

  font-size: 12px;

  min-height: 17px;

  margin-top: 8px;
}


/* TOAST */

.toast {
  position: fixed;

  right: 25px;
  bottom: 25px;

  z-index: 200;

  background: #26222c;
  color: white;

  padding: 13px 17px;

  border-radius: 9px;

  box-shadow:
    0 8px 30px rgba(0,0,0,.18);

  font-size: 13px;
}


/* MOBILE */

@media (max-width: 800px) {

  .sidebar {
    display: none;
  }

  .main {
    margin-left: 0;
    width: 100%;

    padding: 18px;
  }

  .stats {
    grid-template-columns:
      repeat(3, 1fr);
  }

  .topbar {
    gap: 20px;
  }

  .card-header {
    align-items: flex-start;
    flex-direction: column;

    gap: 15px;
  }

  .search-box {
    width: 100%;
  }

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


/* ===== RESPONSIVIDADE MAXIMUS ===== */

.mobile-menu-btn {
  display: none;
}

.mobile-menu-overlay {
  display: none;
}


/* TABLET / CELULAR */
@media (max-width: 900px) {

  .app {
    display: block;
    min-height: 100vh;
  }

  .sidebar {
    display: flex !important;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;

    width: 280px;
    max-width: 86vw;

    z-index: 1200;

    transform: translateX(-105%);
    transition: transform .22s ease;

    box-shadow:
      12px 0 35px rgba(0, 0, 0, .18);

    overflow-y: auto;
  }

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

  .mobile-menu-btn {
    display: flex;

    position: fixed;
    top: 14px;
    left: 14px;

    width: 44px;
    height: 44px;

    align-items: center;
    justify-content: center;

    z-index: 1100;

    border: 0;
    border-radius: 12px;

    background: #7d2bd4;
    color: #fff;

    font-size: 24px;
    line-height: 1;

    cursor: pointer;

    box-shadow:
      0 5px 18px rgba(67, 27, 110, .25);
  }

  .mobile-menu-overlay {
    display: block;

    position: fixed;
    inset: 0;

    z-index: 1150;

    background:
      rgba(15, 12, 25, .48);

    opacity: 0;
    visibility: hidden;

    transition:
      opacity .2s ease,
      visibility .2s ease;
  }

  .mobile-menu-overlay.visible {
    opacity: 1;
    visibility: visible;
  }

  .main {
    width: 100%;
    min-width: 0;

    margin-left: 0 !important;

    padding:
      72px 16px 30px;
  }

  .topbar {
    gap: 14px;
    align-items: flex-start;
  }

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

  .stats {
    grid-template-columns:
      repeat(3, minmax(0, 1fr));

    gap: 10px;
  }

  .stat-card {
    min-width: 0;
  }

  .card {
    max-width: 100%;
    overflow: hidden;
  }

  .table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 720px;
  }

}


/* CELULAR */
@media (max-width: 600px) {

  .main {
    padding:
      72px 12px 24px;
  }

  .topbar {
    flex-direction: column;
  }

  .topbar .btn {
    width: 100%;
  }

  .stats {
    grid-template-columns:
      repeat(3, minmax(0, 1fr));
  }

  .stat-card {
    padding: 14px 12px;
  }

  .stat-card span {
    font-size: 11px;
  }

  .stat-card strong {
    font-size: 22px;
  }

  .card {
    border-radius: 14px;
  }

  .card-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .search-box,
  .search-box input {
    width: 100%;
  }

}


/* CELULAR PEQUENO */
@media (max-width: 420px) {

  .stats {
    gap: 7px;
  }

  .stat-card {
    padding: 12px 8px;
  }

  .stat-card span {
    font-size: 10px;
  }

  .stat-card strong {
    font-size: 20px;
  }

}



/* =========================================================
   MAXIMUS CLIENTES UI V1
   ========================================================= */

.client-search-area {
  display: flex;
  gap: 12px;
  padding: 0 24px 24px;
}

.client-search-box {
  flex: 1;
  min-width: 0;

  display: flex;
  align-items: center;
  gap: 10px;

  padding: 0 14px;

  border: 1px solid #ddd9e3;
  border-radius: 11px;

  background: #fff;
}

.client-search-box span {
  color: #817989;
  font-size: 19px;
}

.client-search-box input {
  flex: 1;
  width: 100%;

  border: 0;
  outline: 0;

  padding: 13px 0;

  background: transparent;
  color: inherit;

  font: inherit;
}

.client-search-message {
  margin: 0 24px 18px;
  padding: 11px 13px;

  border-radius: 9px;

  font-size: 13px;
}

.client-search-message.success {
  background: rgba(24, 150, 92, .09);
  color: #13774c;
}

.client-search-message.error {
  background: rgba(203, 55, 72, .09);
  color: #a52f3d;
}

.client-search-message.info {
  background: rgba(101, 82, 154, .08);
  color: #65529a;
}

.client-name-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.client-name-cell strong {
  font-size: 13px;
}

.client-name-cell small {
  color: #8b8492;
  font-size: 11px;
}

.client-status {
  display: inline-flex;
  align-items: center;

  padding: 5px 9px;

  border-radius: 999px;

  font-size: 11px;
  font-weight: 700;
}

.client-status.status-active {
  background: rgba(25, 154, 91, .10);
  color: #177849;
}

.client-status.status-inactive {
  background: rgba(205, 54, 72, .10);
  color: #a93242;
}

.client-status.status-neutral {
  background: rgba(115, 102, 133, .10);
  color: #665d70;
}

.btn.small {
  padding: 7px 10px;
  font-size: 12px;
}

.client-detail-card {
  margin-top: 20px;
}

.client-detail-header {
  align-items: center;
}

.client-detail-grid {
  display: grid;

  grid-template-columns:
    repeat(3, minmax(0, 1fr));

  gap: 1px;

  background: #ece9ef;

  border-top:
    1px solid #ece9ef;
}

.client-detail-item {
  min-width: 0;

  padding: 18px 20px;

  background: #fff;

  display: flex;
  flex-direction: column;
  gap: 6px;
}

.client-detail-item span {
  color: #8a8391;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.client-detail-item strong {
  font-size: 14px;
  overflow-wrap: anywhere;
}

.client-detail-full {
  grid-column: 1 / -1;
}


@media (max-width: 900px) {

  .client-search-area {
    padding:
      0 18px 20px;
  }

  .clients-table {
    min-width: 800px;
  }

  .client-detail-grid {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }

}


@media (max-width: 600px) {

  .client-search-area {
    flex-direction: column;

    padding:
      0 14px 18px;
  }

  .client-search-area .btn {
    width: 100%;
  }

  .client-search-message {
    margin:
      0 14px 16px;
  }

  .client-detail-grid {
    grid-template-columns: 1fr;
  }

  .client-detail-full {
    grid-column: auto;
  }

  .client-detail-header .btn {
    width: 100%;
  }

}



/* =========================================================
   MAXIMUS - DETALHES COMPLETOS DO CLIENTE
   ========================================================= */

.client-detail-section-title {
  grid-column: 1 / -1;

  padding:
    12px 20px;

  background:
    #f5f3f8;

  color:
    #6e6479;

  font-size:
    11px;

  font-weight:
    800;

  text-transform:
    uppercase;

  letter-spacing:
    .06em;
}

.client-map-link {
  display:
    inline-flex;

  width:
    fit-content;

  align-items:
    center;

  gap:
    7px;

  padding:
    9px 13px;

  margin-top:
    3px;

  border-radius:
    9px;

  background:
    #7d2bd4;

  color:
    #fff;

  text-decoration:
    none;

  font-size:
    13px;

  font-weight:
    700;
}

.client-map-link:hover {
  opacity:
    .9;
}


/* Senhas e logins técnicos */
#clientDetailPppoe,
#clientDetailPppoePassword,
#clientDetailWifiPassword,
#clientDetailWifiPassword5,
#clientDetailMac,
#clientDetailMac2,
#clientDetailSerial,
#clientDetailIp {
  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Monaco,
    Consolas,
    monospace;
}


@media (max-width: 600px) {

  .client-detail-section-title {
    grid-column:
      auto;

    padding:
      11px 14px;
  }

}



/* =========================================================
   MAXIMUS - DIAGNÓSTICO TÉCNICO / RADIUS
   ========================================================= */

.client-technical-loading,
.client-technical-error {
  padding: 22px 20px;
  background: #fff;
  font-size: 13px;
}

.client-technical-loading {
  color: #746b7d;
}

.client-technical-error {
  background: rgba(203, 55, 72, .07);
  color: #a52f3d;
  font-weight: 600;
}

.client-technical-content {
  background: #fff;
}

.technical-status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 22px 20px;
  border-bottom: 1px solid #ece9ef;
}

.technical-label,
.technical-connected-time span {
  display: block;
  margin-bottom: 7px;
  color: #8a8391;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.technical-connection-status {
  font-size: 20px;
  font-weight: 800;
}

.technical-connection-status.online {
  color: #168b55;
}

.technical-connection-status.offline {
  color: #b73445;
}

.technical-connection-status.neutral {
  color: #716779;
}

.technical-connected-time {
  text-align: right;
}

.technical-connected-time strong {
  font-size: 15px;
}

.technical-info-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  background: #ece9ef;
}

.technical-info-item {
  min-width: 0;
  padding: 17px 18px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.technical-info-item span {
  color: #8a8391;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}

.technical-info-item strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

#technicalIp,
#technicalMac,
#technicalNas,
#technicalPortId,
#technicalServiceName,
#technicalIpv6Prefix,
#technicalCgnatIp,
#technicalCgnatPorts,
.technical-mono {
  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Monaco,
    Consolas,
    monospace;
}

.technical-subtitle {
  padding: 13px 20px;
  border-top: 1px solid #ece9ef;
  border-bottom: 1px solid #ece9ef;
  background: #f8f7fa;
  color: #6d6476;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.technical-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 18px 20px;
  background: #fff;
}

.technical-metric-card {
  padding: 16px;
  border: 1px solid #ebe7ef;
  border-radius: 11px;
  background: #faf9fb;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.technical-metric-card span {
  color: #77707e;
  font-size: 11px;
  font-weight: 700;
}

.technical-metric-card strong {
  font-size: 24px;
}

.technical-metric-card small {
  color: #9a929f;
  font-size: 10px;
}

.technical-sessions-wrapper {
  overflow-x: auto;
}

.technical-sessions-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.technical-sessions-table th,
.technical-sessions-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #eeeaf1;
  text-align: left;
  vertical-align: middle;
  font-size: 12px;
}

.technical-sessions-table th {
  background: #faf9fb;
  color: #746b7c;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.technical-reason {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.technical-reason-online {
  background: rgba(24, 150, 92, .10);
  color: #14784b;
}

.technical-reason-drop {
  background: rgba(205, 54, 72, .10);
  color: #a93242;
}

.technical-reason-infra {
  background: rgba(80, 106, 170, .10);
  color: #49629e;
}

.technical-reason-admin {
  background: rgba(230, 155, 40, .12);
  color: #996719;
}

.technical-reason-other {
  background: rgba(115, 102, 133, .10);
  color: #665d70;
}

.technical-no-sessions {
  padding: 24px !important;
  color: #8b8492;
  text-align: center !important;
}

.technical-note {
  padding: 14px 20px 18px;
  color: #8a8391;
  font-size: 11px;
  line-height: 1.5;
}

@media (max-width: 900px) {

  .technical-info-grid {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }

  .technical-metrics-grid {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
  }

}

@media (max-width: 600px) {

  .technical-status-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .technical-connected-time {
    text-align: left;
  }

  .technical-info-grid {
    grid-template-columns: 1fr;
  }

  .technical-metrics-grid {
    grid-template-columns: 1fr;
    padding: 14px;
  }

}



/* =========================================================
   NOVA ORDEM DE SERVIÇO
   ========================================================= */

.service-modal-card {
  width: min(860px, calc(100vw - 32px));
  max-height: 92vh;
  overflow-y: auto;
}

.service-section {
  padding: 18px 0;
  border-bottom: 1px solid rgba(127, 127, 127, 0.18);
}

.service-section:last-of-type {
  border-bottom: 0;
}

.service-section-title {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 14px;
}

.service-section-title strong {
  font-size: 15px;
}

.service-section-title span,
.service-helper {
  font-size: 12px;
  opacity: 0.7;
}

.service-client-search {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.service-client-results {
  margin-top: 12px;
  border: 1px solid rgba(127, 127, 127, 0.22);
  border-radius: 12px;
  overflow: hidden;
  max-height: 260px;
  overflow-y: auto;
}

.service-client-result {
  display: flex;
  flex-direction: column;
  width: 100%;
  gap: 4px;
  padding: 13px 15px;
  text-align: left;
  background: transparent;
  color: inherit;
  border: 0;
  border-bottom: 1px solid rgba(127, 127, 127, 0.16);
  cursor: pointer;
}

.service-client-result:last-child {
  border-bottom: 0;
}

.service-client-result:hover {
  background: rgba(127, 127, 127, 0.08);
}

.service-client-result span,
.service-client-result small {
  opacity: 0.72;
}

.service-client-empty {
  padding: 16px;
  text-align: center;
  opacity: 0.7;
}

.service-selected-client {
  margin-top: 12px;
  padding: 14px 15px;
  border: 1px solid rgba(127, 127, 127, 0.22);
  border-radius: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.service-selected-client > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.service-selected-client span {
  font-size: 12px;
  opacity: 0.75;
}

.service-participants {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.service-participant-option {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 7px;
  width: auto;
  padding: 8px 11px;
  border: 1px solid rgba(127, 127, 127, 0.22);
  border-radius: 10px;
  cursor: pointer;
}

.service-participant-option input {
  width: auto;
  margin: 0;
}

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

#serviceClientMessage {
  margin-top: 8px;
}

@media (max-width: 700px) {

  .service-modal-card {
    width: calc(100vw - 18px);
    max-height: 95vh;
  }

  .service-client-search {
    grid-template-columns: 1fr;
  }

  .service-client-search .btn {
    width: 100%;
  }

  .service-selected-client {
    align-items: flex-start;
    flex-direction: column;
  }

}



/* =========================================================
   LISTAGEM DE SERVIÇOS
   ========================================================= */

.service-stats {
  grid-template-columns:
    repeat(4, minmax(0, 1fr));
}

.service-filters {
  display: grid;
  grid-template-columns:
    minmax(260px, 1fr)
    180px
    200px
    auto;
  gap: 10px;
  margin-bottom: 14px;
}

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

.services-table {
  width: 100%;
  border-collapse: collapse;
}

.services-table th {
  text-align: left;
  font-size: 12px;
  opacity: 0.7;
  padding: 12px 10px;
  border-bottom:
    1px solid rgba(127,127,127,.2);
}

.services-table td {
  padding: 14px 10px;
  border-bottom:
    1px solid rgba(127,127,127,.13);
  vertical-align: middle;
}

.services-table td strong {
  display: block;
}

.services-table td small {
  display: block;
  margin-top: 3px;
  opacity: 0.65;
}

.service-row {
  transition:
    background .15s ease;
}

.service-row:hover {
  background:
    rgba(127,127,127,.06);
}

.service-status,
.service-priority {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  background:
    rgba(127,127,127,.12);
}

.priority-alta,
.status-atribuido {
  background:
    rgba(255, 170, 0, .13);
}

.priority-urgente,
.status-nao_concluido,
.status-cancelado {
  background:
    rgba(255, 70, 70, .13);
}

.status-concluido {
  background:
    rgba(40, 180, 100, .14);
}

.status-em_atendimento,
.status-a_caminho {
  background:
    rgba(60, 130, 255, .14);
}

.service-table-empty {
  text-align: center;
  padding: 32px !important;
  opacity: .65;
}

@media (max-width: 900px) {

  .service-stats {
    grid-template-columns:
      repeat(2, 1fr);
  }

  .service-filters {
    grid-template-columns:
      1fr 1fr;
  }

}

@media (max-width: 600px) {

  .service-filters {
    grid-template-columns:
      1fr;
  }

  .service-stats {
    grid-template-columns:
      repeat(2, 1fr);
  }

}


/* =========================================================
   DETALHE DA ORDEM DE SERVIÇO
   ========================================================= */

.service-detail-modal-card {
  width: min(900px, calc(100vw - 32px));
  max-height: 90vh;
  overflow-y: auto;
}

.service-detail-section {
  margin-top: 18px;
  padding-top: 18px;
  border-top:
    1px solid rgba(127,127,127,.15);
}

.service-detail-section:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.service-detail-section h3 {
  margin: 0 0 14px;
  font-size: 15px;
}

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

.service-detail-grid > div {
  padding: 12px;
  border-radius: 10px;
  background:
    rgba(127,127,127,.06);
}

.service-detail-grid span {
  display: block;
  margin-bottom: 5px;
  font-size: 11px;
  opacity: .65;
}

.service-detail-grid strong {
  display: block;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

.service-detail-wide {
  grid-column: 1 / -1;
}

.service-detail-team {
  display: grid;
  gap: 8px;
}

.service-team-member {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px;
  border-radius: 10px;
  background:
    rgba(127,127,127,.06);
}

.service-team-member strong,
.service-team-member small {
  display: block;
}

.service-team-member small {
  margin-top: 3px;
  opacity: .6;
}

.service-history {
  display: grid;
  gap: 0;
}

.service-history-item {
  position: relative;
  display: grid;
  grid-template-columns:
    16px 1fr;
  gap: 10px;
  padding-bottom: 18px;
}

.service-history-item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 13px;
  bottom: -2px;
  width: 1px;
  background:
    rgba(127,127,127,.2);
}

.service-history-dot {
  width: 11px;
  height: 11px;
  margin-top: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: .55;
}

.service-history-head {
  display: flex;
  justify-content: space-between;
  gap: 15px;
}

.service-history-head span {
  font-size: 11px;
  opacity: .6;
  white-space: nowrap;
}

.service-history-body small {
  display: block;
  margin-top: 4px;
  opacity: .6;
}

.service-history-status {
  display: inline-block;
  margin-top: 7px;
  padding: 4px 8px;
  border-radius: 8px;
  font-size: 11px;
  background:
    rgba(127,127,127,.08);
}

.service-detail-empty {
  padding: 14px;
  opacity: .65;
}

.service-row {
  cursor: pointer;
}

@media (max-width: 650px) {

  .service-detail-grid {
    grid-template-columns:
      1fr;
  }

  .service-detail-wide {
    grid-column: auto;
  }

  .service-history-head {
    display: block;
  }

  .service-history-head span {
    display: block;
    margin-top: 4px;
  }

}


/* =========================================================
   AÇÕES DA ORDEM DE SERVIÇO
   ========================================================= */

.service-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.service-detail-actions .btn {
  min-height: 40px;
}

.service-detail-actions button:disabled {
  opacity: .55;
  cursor: wait;
}

.service-danger-button {
  border: 1px solid rgba(220, 60, 60, .35);
  background: rgba(220, 60, 60, .10);
}

.service-action-info {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(127,127,127,.07);
  font-size: 13px;
}

@media (max-width: 600px) {

  .service-detail-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .service-detail-actions .btn {
    width: 100%;
  }

}


/* =========================================================
   EQUIPE DA ORDEM DE SERVIÇO
   ========================================================= */

.service-team-management {
  display: grid;
  gap: 14px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid rgba(127,127,127,.16);
}

.service-team-control {
  display: grid;
  gap: 7px;
}

.service-team-control label {
  font-size: 12px;
  font-weight: 700;
}

.service-team-control-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.service-team-control-row select {
  width: 100%;
  min-height: 40px;
}

.service-team-member-side {
  display: flex;
  align-items: center;
  gap: 12px;
}

.service-team-remove {
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  opacity: .75;
}

.service-team-remove:hover {
  opacity: 1;
  text-decoration: underline;
}

.service-team-management-disabled {
  opacity: .65;
}

@media (max-width: 600px) {

  .service-team-control-row {
    grid-template-columns: 1fr;
  }

  .service-team-control-row .btn {
    width: 100%;
  }

  .service-team-member-side {
    align-items: flex-end;
    flex-direction: column;
    gap: 5px;
  }

}

/* =========================================================
   FOTOS DA ORDEM DE SERVIÇO
   ========================================================= */

.service-photos-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.service-photos-header h3 {
  margin: 0 0 4px 0;
}

.service-photos-grid {
  display: grid;
  grid-template-columns:
    repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.service-photo-card {
  border:
    1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  overflow: hidden;
  background:
    rgba(15, 23, 42, 0.45);
}

.service-photo-image-wrap {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background:
    rgba(15, 23, 42, 0.8);
  cursor: pointer;
}

.service-photo-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition:
    transform 0.2s ease;
}

.service-photo-image-wrap:hover
.service-photo-image {
  transform: scale(1.03);
}

.service-photo-type {
  position: absolute;
  left: 8px;
  bottom: 8px;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background:
    rgba(15, 23, 42, 0.82);
  color: #fff;
  backdrop-filter:
    blur(6px);
}

.service-photo-info {
  padding: 10px 12px 12px;
}

.service-photo-info strong {
  display: block;
  font-size: 13px;
  margin-bottom: 3px;
}

.service-photo-info span {
  display: block;
  font-size: 12px;
  opacity: 0.7;
  line-height: 1.45;
}

.service-photos-empty {
  padding: 20px;
  border:
    1px dashed rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  text-align: center;
}

.service-photo-viewer {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.service-photo-viewer.hidden {
  display: none;
}

.service-photo-viewer-backdrop {
  position: absolute;
  inset: 0;
  background:
    rgba(0, 0, 0, 0.82);
}

.service-photo-viewer-content {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.service-photo-viewer-content img {
  max-width: 100%;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 12px;
}

.service-photo-viewer-close {
  position: absolute;
  top: -14px;
  right: -14px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
}

.service-photo-viewer-caption {
  text-align: center;
  font-size: 13px;
  color: #fff;
}

@media (max-width: 700px) {

  .service-photos-header {
    flex-direction: column;
    align-items: stretch;
  }

  .service-photos-header .btn {
    width: 100%;
  }

  .service-photos-grid {
    grid-template-columns:
      repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

}
