:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafb;
  --sidebar: #16181b;
  --sidebar-hover: #20242a;
  --sidebar-active: #232a31;
  --text: #1b1f23;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #008287;
  --primary-dark: #00666a;
  --magenta: #e91e63;
  --yellow: #f2c94c;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --radius: 14px;
  --sidebar-width: 260px;
  --header-height: 72px;
  --font-main: "Futura Md BT", "Trebuchet MS", Arial, sans-serif;
  --font-brand: "Magic Seventies", "Brush Script MT", cursive;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text);
}

body {
  overflow: hidden;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--header-height) 1fr;
  grid-template-areas:
    "sidebar header"
    "sidebar main";
  height: 100vh;
  transition: grid-template-columns 0.25s ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 92px 1fr;
}

.sidebar {
  grid-area: sidebar;
  background: linear-gradient(180deg, #111315 0%, #1a1d21 100%);
  color: #fff;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--magenta), var(--yellow));
  display: grid;
  place-items: center;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  align-items: baseline;
  white-space: nowrap;
  overflow: hidden;
}

.brand-text .color {
  font-family: var(--font-brand);
  font-size: 1.75rem;
  color: #fff;
  line-height: 1;
}

.brand-text .tec {
  font-size: 1.4rem;
  font-weight: 700;
  color: #fff;
  margin-left: 4px;
  line-height: 1;
}

.sidebar-nav {
  padding: 18px 12px;
  overflow: auto;
  flex: 1;
}

.nav-section-title {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  padding: 10px 12px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.9);
  text-decoration: none;
  transition: 0.2s ease;
  margin-bottom: 6px;
}

.nav-item:hover {
  background: var(--sidebar-hover);
}

.nav-item.active {
  background: var(--sidebar-active);
  box-shadow: inset 3px 0 0 var(--primary);
}

.nav-icon {
  width: 22px;
  text-align: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}

.nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding: 14px 12px 18px;
}

.quick-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 14px;
  color: rgba(255, 255, 255, 0.9);
}

.quick-card h4 {
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.quick-card p {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 12px;
  line-height: 1.4;
}

.header {
  grid-area: header;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 22px;
}

.header-left,
.header-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  display: grid;
  place-items: center;
  cursor: pointer;
  color: var(--text);
}

.search {
  width: min(420px, 40vw);
  position: relative;
}

.search input {
  width: 100%;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 0 16px 0 42px;
  font: inherit;
  color: var(--text);
  outline: none;
}

.search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 130, 135, 0.12);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  font-size: 0.95rem;
}

.primary-btn,
.secondary-btn {
  height: 44px;
  border: 0;
  border-radius: 14px;
  padding: 0 18px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

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

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

.secondary-btn {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
}

.primary-btn.full {
  width: 100%;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 8px 12px 8px 8px;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), #0ea5a8);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.user-meta small {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
}

.main {
  grid-area: main;
  overflow: auto;
  padding: 24px;
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
}

.page-head h1 {
  font-size: 1.8rem;
  margin-bottom: 6px;
}

.page-head p {
  color: var(--muted);
  line-height: 1.4;
}

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

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

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 18px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.stat-card .label {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.stat-card .value {
  font-size: 1.8rem;
  font-weight: 700;
}

.stat-card .trend {
  margin-top: 8px;
  font-size: 0.85rem;
  font-weight: 700;
}

.trend.up {
  color: var(--success);
}

.trend.warn {
  color: var(--warning);
}

.trend.down {
  color: var(--danger);
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  color: #fff;
  flex-shrink: 0;
}

.bg-primary {
  background: linear-gradient(135deg, var(--primary), #0ea5a8);
}

.bg-magenta {
  background: linear-gradient(135deg, var(--magenta), #fb7185);
}

.bg-yellow {
  background: linear-gradient(135deg, #d4a813, var(--yellow));
  color: #222;
}

.bg-dark {
  background: linear-gradient(135deg, #1f2937, #374151);
}

.content-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.panel {
  padding: 20px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-head h3 {
  font-size: 1.08rem;
}

.muted-link {
  color: var(--primary);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
}

.gantt-mock {
  display: grid;
  gap: 14px;
}

.gantt-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  align-items: center;
}

.gantt-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.gantt-track {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px;
  position: relative;
  overflow: hidden;
  height: 34px;
}

.gantt-bar {
  position: absolute;
  top: 6px;
  height: 20px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  padding: 0 10px;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.bar-blue {
  background: #2563eb;
}

.bar-green {
  background: #16a34a;
}

.bar-orange {
  background: #ea580c;
}

.bar-red {
  background: #dc2626;
}

.mini-list {
  display: grid;
  gap: 12px;
}

.list-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.list-item strong {
  display: block;
  margin-bottom: 4px;
}

.list-item small {
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge.success {
  background: rgba(22, 163, 74, 0.12);
  color: var(--success);
}

.badge.warning {
  background: rgba(217, 119, 6, 0.12);
  color: var(--warning);
}

.badge.danger {
  background: rgba(220, 38, 38, 0.12);
  color: var(--danger);
}

.badge.info {
  background: rgba(0, 130, 135, 0.12);
  color: var(--primary);
}

.table-card {
  padding: 0;
  overflow: hidden;
}

.table-toolbar {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.table-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-chip {
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  height: 38px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: 0.9rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

th,
td {
  text-align: left;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}

th {
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: #fbfcfd;
}

tr:hover td {
  background: #fcfdfd;
}

.service-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.service-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
}

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

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

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: var(--header-height) auto 1fr;
    grid-template-areas:
      "header"
      "sidebar"
      "main";
    height: auto;
    min-height: 100vh;
  }

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

  .nav-section-title,
  .sidebar-footer {
    grid-column: 1 / -1;
  }

  .header {
    padding: 12px 16px;
    flex-wrap: wrap;
    height: auto;
  }

  .header-left,
  .header-right,
  .page-head {
    width: 100%;
  }

  .header-right,
  .page-head {
    justify-content: space-between;
  }

  .search {
    width: 100%;
  }

  .main {
    padding: 16px;
  }
}

@media (max-width: 640px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .sidebar-nav {
    grid-template-columns: 1fr;
  }

  .page-actions,
  .table-toolbar,
  .table-filters {
    flex-direction: column;
  }

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

  th,
  td {
    padding: 14px 12px;
  }
}

html {
  -webkit-text-size-adjust: 100%;
}

body,
.app-shell,
.main,
#view,
.card,
.panel {
  min-width: 0;
}

img,
svg,
canvas,
video {
  max-width: 100%;
  height: auto;
}

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

button,
.nav-item {
  touch-action: manipulation;
}

.sidebar-backdrop {
  display: none;
}

.table-card,
.table-responsive,
.crm-table-wrap {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.clientes-page,
.crm-page,
.servicos-page,
#estoque-module,
#equipamentos-module,
.orcamentos-page,
.configuracoes-page {
  min-width: 0;
  max-width: 100%;
}

.users-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.9fr);
  gap: 18px;
  align-items: start;
  min-width: 0;
  max-width: 100%;
}

.users-panel {
  padding: 20px;
  min-width: 0;
}

.users-form {
  display: grid;
  gap: 14px;
}

.form-row {
  display: grid;
  gap: 8px;
}

.form-row label {
  font-size: 0.92rem;
  font-weight: 700;
  color: #374151;
}

.form-row input,
.form-row select {
  width: 100%;
  min-height: 44px;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 0 14px;
  background: #fff;
  color: #1b1f23;
  outline: none;
}

.form-row input:focus,
.form-row select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0, 130, 135, 0.12);
}

.form-actions,
.table-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.form-actions {
  margin-top: 6px;
}

.users-message {
  min-height: 20px;
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.users-message.error {
  color: var(--danger);
}

.users-message.success {
  color: var(--success);
}

.users-modal-open {
  overflow: hidden;
}

.users-password-modal[hidden] {
  display: none;
}

.users-password-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.users-password-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(15, 23, 42, 0.42);
  cursor: pointer;
}

.users-password-dialog {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.22);
  padding: 20px;
}

.users-password-header {
  margin-bottom: 14px;
}

.users-password-header h3 {
  margin: 0;
  color: var(--text);
}

.users-password-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.mini-btn {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 10px;
  background: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}

.mini-btn:hover {
  border-color: #cfd5dc;
}

.mini-btn.warn {
  color: var(--warning);
}

.mini-btn.danger {
  color: var(--danger);
}

.mini-btn.primary {
  color: var(--primary);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-pill.active {
  background: rgba(22, 163, 74, 0.12);
  color: var(--success);
}

.status-pill.inactive {
  background: rgba(220, 38, 38, 0.12);
  color: var(--danger);
}

.btn {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover {
  border-color: #cbd5e1;
}

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

.btn-primary:hover {
  border-color: var(--primary-dark);
  background: var(--primary-dark);
}

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

.btn-danger {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.btn-sm {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.84rem;
}

@media (max-width: 1000px) {
  .users-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  :root {
    --header-height: auto;
    --radius: 12px;
  }

  html,
  body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
  }

  body.mobile-menu-open {
    overflow: hidden;
  }

  .app-shell {
    width: 100%;
    min-height: 100dvh;
    height: auto;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "header"
      "main";
    overflow-x: clip;
  }

  .header {
    position: sticky;
    top: 0;
    z-index: 60;
    min-height: 0;
    height: auto;
    padding: 10px 12px;
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  }

  .header-left {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 8px;
  }

  .header-right {
    width: 100%;
    min-width: 0;
    justify-content: flex-start;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .header-right::-webkit-scrollbar {
    display: none;
  }

  .header-right > * {
    flex: 0 0 auto;
  }

  .search {
    width: 100%;
    min-width: 0;
  }

  .search input,
  input,
  select,
  textarea {
    font-size: 16px;
  }

  .search input,
  .icon-btn,
  .primary-btn,
  .secondary-btn {
    min-height: 44px;
    border-radius: 12px;
  }

  .primary-btn,
  .secondary-btn {
    height: auto;
    padding: 10px 14px;
    line-height: 1.2;
  }

  .user-badge {
    min-height: 44px;
    max-width: 190px;
    border-radius: 12px;
  }

  .user-meta {
    min-width: 0;
  }

  .user-meta strong,
  .user-meta small {
    display: block;
    max-width: 104px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 80;
    width: min(86vw, 320px);
    max-width: 320px;
    height: 100dvh;
    grid-area: unset;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: 24px 0 50px rgba(15, 23, 42, 0.28);
  }

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

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 70;
    border: 0;
    background: rgba(15, 23, 42, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
  }

  .sidebar-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
  }

  .brand {
    min-height: 72px;
    padding: 12px 18px;
  }

  .brand img {
    width: min(220px, 68vw);
  }

  .sidebar-nav {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
    padding: 12px;
  }

  .nav-section-title,
  .sidebar-footer {
    grid-column: auto;
  }

  .nav-item {
    min-height: 46px;
    border-radius: 10px;
  }

  .sidebar-footer {
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }

  .quick-card {
    border-radius: 12px;
  }

  .main {
    padding: 14px;
    overflow: visible;
  }

  .page-head {
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
  }

  .page-head h1 {
    font-size: 1.45rem;
  }

  .page-actions,
  .table-filters,
  .form-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .page-actions > *,
  .form-actions > *,
  .table-filters > * {
    width: 100%;
  }

  .stats-grid,
  .content-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .card {
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  }

  .stat-card,
  .panel,
  .users-panel {
    padding: 16px;
  }

  .table-toolbar {
    padding: 14px;
    align-items: stretch;
  }

  .table-card {
    overflow-x: auto;
    overflow-y: hidden;
  }

  .table-card table,
  .table-responsive table,
  .crm-table-wrap table {
    min-width: 720px;
  }

  th,
  td {
    padding: 12px;
  }

  .list-item,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .clientes-page .page-header,
  .cliente-location-header,
  .cliente-map-preview-header,
  .servicos-hero,
  #estoque-module .module-header,
  #equipamentos-module .equipamentos-header,
  .crm-hero,
  .crm-card-header,
  .orcamentos-hero,
  .orcamentos-modal-header,
  .configuracoes-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .clientes-page .page-header,
  #estoque-module .module-header,
  #equipamentos-module .equipamentos-header {
    gap: 12px;
  }

  .clientes-page .page-header > div:last-child,
  .cliente-location-actions,
  .servicos-hero-actions,
  #estoque-module .module-header-actions,
  #equipamentos-module .equipamentos-header > div:last-child,
  .crm-hero-actions,
  .crm-form-actions,
  .orcamentos-hero-actions,
  .orcamentos-form-actions,
  .configuracoes-hero-actions,
  .configuracoes-editor-actions,
  .configuracoes-footer {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .clientes-page .page-header > div:last-child > *,
  .cliente-location-actions > *,
  .servicos-hero-actions > *,
  #estoque-module .module-header-actions > *,
  #equipamentos-module .equipamentos-header > div:last-child > *,
  .crm-hero-actions > *,
  .crm-form-actions > *,
  .orcamentos-hero-actions > *,
  .orcamentos-form-actions > *,
  .configuracoes-hero-actions > *,
  .configuracoes-editor-actions > *,
  .configuracoes-footer > * {
    width: 100%;
  }

  .filtros-clientes,
  .tabela-card,
  .crm-card,
  #estoque-module .card-body,
  #estoque-module .card-header,
  #equipamentos-module .card-body,
  #equipamentos-module .card-header,
  .orcamentos-card,
  .orcamentos-next,
  .configuracoes-sidebar,
  .configuracoes-editor {
    padding: 16px;
  }

  .crm-hero,
  .servicos-hero,
  .orcamentos-hero,
  .configuracoes-hero {
    padding: 18px;
    border-radius: 16px;
  }

  .crm-hero h1,
  .servicos-hero h1,
  .orcamentos-hero h1,
  .configuracoes-hero h1,
  #estoque-module .module-header h1,
  #equipamentos-module .equipamentos-header h1 {
    font-size: 1.55rem;
  }

  .crm-layout,
  .servicos-layout {
    flex-direction: column;
  }

  .crm-side,
  .servicos-sidebar {
    width: 100%;
    min-width: 0;
  }

  .crm-stats,
  .servicos-overview,
  #estoque-module .estoque-overview,
  #equipamentos-module .equipamentos-overview,
  .orcamentos-stats,
  .orcamentos-board,
  .orcamentos-intelligence,
  .orcamentos-flow,
  .configuracoes-layout,
  .configuracoes-form-grid,
  .crm-agenda-grid,
  .crm-form-grid,
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .crm-form-grid > *,
  .configuracoes-form-grid > *,
  .form-grid > *,
  .orcamentos-form > *,
  .orcamentos-type-form > *,
  .orcamentos-cost-grid > *,
  .servico-form > *,
  .servico-intervalo-form > *,
  .servico-form .form-row,
  .servico-intervalo-form .form-row,
  .servico-form .form-group,
  .servico-intervalo-form .form-group {
    min-width: 0;
    max-width: 100%;
  }

  .servico-form .form-row,
  .servico-intervalo-form .form-row,
  .agenda-controls,
  .agenda-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .crm-pipeline {
    scroll-snap-type: x proximity;
  }

  .crm-pipeline-column {
    min-width: min(78vw, 300px);
    scroll-snap-align: start;
  }

  .timeline-grid,
  .week-agenda,
  .agenda-backlog-cards,
  .month-strip-events {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .week-agenda {
    grid-template-columns: repeat(7, minmax(220px, 1fr));
  }

  .agenda-month {
    grid-template-columns: 1fr;
  }

  .month-strip {
    flex-direction: column;
  }

  .month-strip-title {
    width: 100%;
    flex: none;
  }

  .modal-content {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
    margin: 10px auto;
    border-radius: 16px;
  }

  .modal-header,
  .modal-footer {
    padding: 14px 16px;
  }

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

  .modal-footer > * {
    width: 100%;
  }

  .orcamentos-modal {
    padding: 10px;
  }

  .orcamentos-modal-dialog,
  .orcamentos-modal-dialog-lg,
  .orcamentos-modal-dialog-xl,
  #equipamentos-module .equipamento-modal-card,
  #estoque-module .modal-card,
  #estoque-module .modal-card-lg {
    width: calc(100vw - 20px);
    max-width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
    margin: 10px auto;
    overflow: auto;
    border-radius: 16px;
  }

  .orcamentos-modal-dialog {
    padding: 18px;
  }
}

@media (max-width: 520px) {
  .main {
    padding: 12px;
  }

  .header {
    padding: 8px 10px;
  }

  .header-right .icon-btn {
    display: none;
  }

  .header-right .user-meta {
    display: none;
  }

  .header-right .user-badge {
    padding: 6px;
  }

  .header .primary-btn,
  .header .secondary-btn {
    min-width: max-content;
  }

  .stat-card .value,
  .crm-stat-card strong,
  #estoque-module .overview-value,
  #equipamentos-module .overview-card strong,
  .orcamentos-stat-card strong {
    font-size: 1.55rem;
  }

  .table-card table,
  .table-responsive table,
  .crm-table-wrap table {
    min-width: 680px;
  }

  .mini-btn,
  .btn.btn-sm,
  #estoque-module .btn-sm,
  #equipamentos-module .btn-sm {
    min-height: 38px;
  }
}
