/* Estúdio CRM — estilos. Cores por função (tokens), tema claro e escuro. */

:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --surface-3: #e7e6e1;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #6b6a66;
  --line: #e1e0d9;
  --line-strong: #c3c2b7;
  --accent: #256abf;
  --accent-hover: #1c5cab;
  --accent-ink: #184f95;
  --accent-soft: #e6f0fc;
  --on-accent: #ffffff;
  --series-1: #2a78d6;
  --good: #0ca30c;
  --good-ink: #006300;
  --good-soft: #e2f3e2;
  --warn: #fab219;
  --warn-ink: #7a5200;
  --warn-soft: #fdf1d1;
  --bad: #d03b3b;
  --bad-ink: #a82a2a;
  --bad-soft: #fbe5e5;
  --shadow: 0 1px 2px rgba(11, 11, 11, 0.05), 0 4px 16px rgba(11, 11, 11, 0.06);
  --shadow-lg: 0 12px 40px rgba(11, 11, 11, 0.18);
  --radius: 12px;
  --radius-sm: 8px;
  --sidebar: 228px;
  --topbar: 60px;
  --tabbar: 60px;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --surface-2: #262624;
    --surface-3: #323230;
    --ink: #f0efec;
    --ink-2: #c3c2b7;
    --muted: #a3a29a;
    --line: #2c2c2a;
    --line-strong: #44443f;
    --accent: #2a78d6;
    --accent-hover: #3987e5;
    --accent-ink: #9ec5f4;
    --accent-soft: #14304f;
    --series-1: #3987e5;
    --good-ink: #5fd05f;
    --good-soft: #13301a;
    --warn-ink: #fab219;
    --warn-soft: #3a2d0b;
    --bad-ink: #f08a8a;
    --bad-soft: #3d1818;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #262624;
  --surface-3: #323230;
  --ink: #f0efec;
  --ink-2: #c3c2b7;
  --muted: #a3a29a;
  --line: #2c2c2a;
  --line-strong: #44443f;
  --accent: #2a78d6;
  --accent-hover: #3987e5;
  --accent-ink: #9ec5f4;
  --accent-soft: #14304f;
  --series-1: #3987e5;
  --good-ink: #5fd05f;
  --good-soft: #13301a;
  --warn-ink: #fab219;
  --warn-soft: #3a2d0b;
  --bad-ink: #f08a8a;
  --bad-soft: #3d1818;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.6);
}

/* ---------- Base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
body.modal-open {
  overflow: hidden;
}
h1,
h2,
h3,
p,
dl,
dd,
ol,
figure {
  margin: 0;
}
h1 {
  font-size: 24px;
  line-height: 1.2;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
h2 {
  font-size: 16px;
  font-weight: 650;
}
h3 {
  font-size: 14px;
  font-weight: 600;
}
a {
  color: var(--accent-ink);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
[hidden] {
  display: none !important;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.muted {
  color: var(--muted);
}
.num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.text-bad {
  color: var(--bad-ink);
}
.text-out {
  color: var(--ink-2);
}
.spacer {
  flex: 1;
}
.icon {
  width: 20px;
  height: 20px;
  flex: none;
}
.icon-sm {
  width: 15px;
  height: 15px;
}
.rot90 {
  transform: rotate(90deg);
}

/* ---------- Botões e campos ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font-weight: 550;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover {
  background: var(--surface-2);
  text-decoration: none;
}
.btn:disabled {
  opacity: 0.55;
  cursor: default;
}
.btn .icon {
  width: 17px;
  height: 17px;
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.btn-danger {
  background: var(--bad);
  border-color: var(--bad);
  color: #fff;
}
.btn-danger:hover {
  background: #b93232;
}
.btn-ghost-danger {
  border-color: transparent;
  background: transparent;
  color: var(--bad-ink);
}
.btn-ghost-danger:hover {
  background: var(--bad-soft);
}
.btn-quiet {
  border-color: transparent;
  background: transparent;
  color: var(--accent-ink);
}
.btn-sm {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13.5px;
}
.btn-lg {
  min-height: 48px;
  padding: 0 22px;
  font-size: 16px;
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink-2);
}
.icon-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}
.icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.icon-btn-sm {
  width: 30px;
  height: 30px;
}
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.input {
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
}
.input::placeholder {
  color: var(--muted);
  opacity: 1;
}
.input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}
select.input {
  padding-right: 30px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23898781' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 15px;
}
textarea.input {
  resize: vertical;
  line-height: 1.5;
}
.input-sm {
  min-height: 34px;
  padding: 5px 9px;
  font-size: 13.5px;
}
select.input-sm {
  width: auto;
  max-width: 100%;
}
.input-title {
  font-weight: 650;
  font-size: 16px;
}
.input-affix {
  display: flex;
  align-items: stretch;
}
.input-affix > span {
  display: grid;
  place-items: center;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-right: 0;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 13.5px;
}
.input-affix > .input {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  min-width: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.field {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.field.half {
  grid-column: span 1;
}
.field > label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}
.field-inline {
  flex: 1;
  min-width: 0;
}
.req {
  color: var(--bad-ink);
}
.hint {
  font-size: 12.5px;
  color: var(--muted);
}
.form-intro {
  margin-bottom: 14px;
}
.form-error {
  margin-top: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--bad-soft);
  color: var(--bad-ink);
  font-weight: 550;
}
.check-row {
  grid-column: 1 / -1;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  cursor: pointer;
}
.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}
.check-inline {
  font-size: 13.5px;
  color: var(--ink-2);
}

.combo {
  position: relative;
}
.combo-list {
  position: absolute;
  z-index: 5;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.combo-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-align: left;
}
.combo-item small {
  margin-left: auto;
  color: var(--muted);
  font-size: 12.5px;
}
.combo-item:hover,
.combo-item.active {
  background: var(--accent-soft);
}
.combo-item.create {
  color: var(--accent-ink);
  font-weight: 600;
}
.combo-empty {
  padding: 10px;
  color: var(--muted);
  font-size: 13.5px;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.segmented button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  font-weight: 550;
  font-size: 13.5px;
}
.segmented button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

/* ---------- Selos, avatar, etiquetas ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  vertical-align: middle;
}
.badge-neutral {
  background: var(--surface-2);
  color: var(--ink-2);
}
.badge-info {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.badge-good {
  background: var(--good-soft);
  color: var(--good-ink);
}
.badge-warn {
  background: var(--warn-soft);
  color: var(--warn-ink);
}
.badge-bad {
  background: var(--bad-soft);
  color: var(--bad-ink);
}
.tag {
  display: inline-block;
  padding: 1px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--ink-2);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chip-warn {
  background: var(--warn-soft);
  color: var(--warn-ink);
}
.chip-bad {
  background: var(--bad-soft);
  color: var(--bad-ink);
}
.avatar {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  background: hsl(var(--h) 45% 88%);
  color: hsl(var(--h) 55% 26%);
  font-size: 14px;
  font-weight: 650;
}
.avatar-sm {
  width: 30px;
  height: 30px;
  font-size: 11.5px;
}
.avatar-lg {
  width: 56px;
  height: 56px;
  font-size: 19px;
}
:root[data-theme='dark'] .avatar {
  background: hsl(var(--h) 35% 24%);
  color: hsl(var(--h) 60% 82%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) .avatar {
    background: hsl(var(--h) 35% 24%);
    color: hsl(var(--h) 60% 82%);
  }
}

/* ---------- Telas de entrada ---------- */

.screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.screen-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}
.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid var(--line-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---------- Estrutura ---------- */

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  z-index: 100;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--on-accent);
}
.skip-link:focus {
  left: 8px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.01em;
}
.brand:hover {
  text-decoration: none;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--on-accent);
}
.brand-lg {
  font-size: 22px;
}
.brand-lg .brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 13px;
}
.brand-mobile {
  display: none;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 16px 12px;
  border-right: 1px solid var(--line);
  background: var(--surface);
  overflow-y: auto;
}
.sidebar .brand {
  padding: 4px 8px;
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 40px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-weight: 550;
}
.nav-link:hover {
  background: var(--surface-2);
  color: var(--ink);
  text-decoration: none;
}
.nav-link.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.sidebar-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.net {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  font-size: 12.5px;
  color: var(--muted);
}
.net:empty {
  display: none;
}
.net.offline {
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  background: var(--warn-soft);
  color: var(--warn-ink);
  font-weight: 550;
}
.net-mobile {
  display: none;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-size: 13.5px;
  min-width: 0;
}
.user-chip span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-chip:hover {
  background: var(--surface-2);
  text-decoration: none;
}
.main {
  margin-left: var(--sidebar);
  min-height: 100vh;
  min-height: 100dvh;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar);
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.global-search {
  position: relative;
  flex: 1;
  max-width: 520px;
}
.global-search > .icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--muted);
  pointer-events: none;
}
.global-search .input {
  padding-left: 36px;
}
.topbar #quick-add {
  margin-left: auto;
}
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: min(60vh, 440px);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.search-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink);
}
.search-item .icon {
  color: var(--muted);
}
.search-item span {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.search-item small {
  color: var(--muted);
  font-size: 12.5px;
}
.search-item:hover,
.search-item.active {
  background: var(--accent-soft);
  text-decoration: none;
}
.search-empty {
  padding: 14px;
  color: var(--muted);
}
#view {
  outline: none;
}
.tabbar {
  display: none;
}

.page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px;
}
.page-board {
  max-width: none;
}
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.page-head > div:first-child {
  min-width: 0;
}
.page-head p {
  margin-top: 4px;
}
.page-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.page-actions select.input {
  width: auto;
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 10px;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 550;
}
.cols {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.col-main,
.col-side {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

/* ---------- Painéis e linhas ---------- */

.panel {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.page > .panel,
.settings-body > .panel {
  margin-bottom: 18px;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.panel-head h2 {
  display: flex;
  align-items: center;
  gap: 6px;
}
.panel-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.panel > .muted {
  margin-bottom: 12px;
}
.panel-empty {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 0;
  color: var(--muted);
}
.panel-alert {
  border-color: var(--bad);
}
.group-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 16px 0 6px;
  color: var(--ink-2);
  text-transform: none;
}
.group-title:first-of-type {
  margin-top: 4px;
}
.more-link {
  display: inline-block;
  margin-top: 8px;
  font-size: 13.5px;
  font-weight: 550;
}
.rows {
  display: flex;
  flex-direction: column;
}
.row-item {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 54px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  color: var(--ink);
  min-width: 0;
}
.rows > .row-item:first-child,
.panel > .row-item:first-of-type {
  border-top: 0;
}
.row-link {
  margin: 0 -8px;
  padding-left: 8px;
  padding-right: 8px;
  border-radius: var(--radius-sm);
}
button.row-link {
  width: calc(100% + 16px);
  border-width: 1px 0 0;
  border-style: solid;
  border-color: var(--line);
  background: transparent;
  text-align: left;
}
.rows > button.row-link:first-child {
  border-top-color: transparent;
}
.row-link:hover {
  background: var(--surface-2);
  text-decoration: none;
}
.row-main {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}
.row-btn {
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
}
.row-btn:hover .row-title {
  text-decoration: underline;
}
.row-title {
  font-weight: 550;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.row-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  color: var(--muted);
  font-size: 13px;
}
.row-side {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  flex: none;
  max-width: 55%;
}
.row-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.type-dot {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-2);
}
.type-dot .icon {
  width: 16px;
  height: 16px;
}
.tick {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  margin: 0 3px;
  padding: 0;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
  color: transparent;
}
.tick .icon {
  width: 15px;
  height: 15px;
  stroke-width: 3;
}
.tick:hover {
  border-color: var(--good);
  color: var(--good);
}
.activity.done .tick {
  border-color: var(--good);
  background: var(--good);
  color: #fff;
}
.activity.done .row-title {
  color: var(--muted);
  text-decoration: line-through;
}
.activity.overdue .tick {
  border-color: var(--bad);
}
.mini-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  margin-bottom: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 13.5px;
}
.mini-stats strong {
  margin-left: 4px;
  color: var(--ink);
}
.list-total {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
  padding-top: 12px;
  border-top: 1px solid var(--line-strong);
  color: var(--ink-2);
}
.facts {
  display: flex;
  flex-direction: column;
}
.facts > div {
  display: grid;
  grid-template-columns: minmax(96px, 36%) 1fr;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.facts > div:first-child {
  border-top: 0;
  padding-top: 0;
}
.facts dt {
  color: var(--muted);
  font-size: 13.5px;
}
.facts dd {
  min-width: 0;
}
.facts-code > div {
  grid-template-columns: minmax(150px, 46%) 1fr;
}
code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-2);
}
.deal-notes {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
}
.quick-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.banner > span {
  flex: 1;
  min-width: 0;
}
.banner-bad {
  background: var(--bad-soft);
  color: var(--bad-ink);
}
.banner-warn {
  background: var(--warn-soft);
  color: var(--warn-ink);
}
.banner-info {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.banner-flat {
  margin: 0;
  border-radius: 0;
  padding: 8px 24px;
  font-size: 13.5px;
}
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 56px 20px;
  text-align: center;
  color: var(--muted);
}
.empty h3 {
  color: var(--ink);
  font-size: 17px;
}
.empty p {
  max-width: 420px;
}
.empty .btn {
  margin-top: 10px;
}
.empty-icon {
  width: 40px;
  height: 40px;
  color: var(--line-strong);
}
.welcome {
  margin-bottom: 18px;
  border-color: var(--accent);
  background: var(--accent-soft);
}
.welcome .muted {
  color: var(--ink-2);
  margin: 4px 0 14px;
}
.welcome-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---------- Indicadores ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  min-width: 0;
}
a.stat:hover {
  border-color: var(--line-strong);
  text-decoration: none;
}
.stat-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 550;
}
.stat-value {
  font-size: 25px;
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.stat-sub {
  color: var(--muted);
  font-size: 13px;
}
.stat-bad .stat-label,
.stat-bad .stat-value {
  color: var(--bad-ink);
}

/* ---------- Gráficos ---------- */

.chart-plot {
  position: relative;
  height: 190px;
  margin-top: 28px;
  padding-left: 62px;
}
.chart-grid {
  position: absolute;
  inset: 0 0 26px 62px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.chart-grid span {
  position: relative;
  border-top: 1px solid var(--line);
}
.chart-grid span:last-child {
  border-top-color: var(--line-strong);
}
.chart-grid i {
  position: absolute;
  right: calc(100% + 8px);
  top: -9px;
  font-style: normal;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.chart-cols {
  position: relative;
  display: flex;
  height: 100%;
  gap: 2px;
}
.chart-col {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  border-radius: 6px;
}
.chart-bar-wrap {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.chart-bar {
  width: min(24px, 56%);
  border-radius: 4px 4px 0 0;
  background: var(--series-1);
}
.chart-col:hover .chart-bar,
.chart-col:focus-visible .chart-bar {
  filter: brightness(0.88);
}
.chart-x {
  height: 26px;
  display: grid;
  place-items: center;
  font-size: 12.5px;
  color: var(--muted);
}
.chart-tip {
  position: absolute;
  left: 50%;
  top: -6px;
  transform: translate(-50%, -100%);
  z-index: 3;
  display: none;
  flex-direction: column;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--page);
  font-size: 12.5px;
  white-space: nowrap;
  pointer-events: none;
}
.chart-col:hover .chart-tip,
.chart-col:focus-visible .chart-tip {
  display: flex;
}
.barlist {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.barlist-row {
  display: grid;
  grid-template-columns: minmax(96px, 34%) 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
}
.barlist-label {
  color: var(--ink-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.barlist-track {
  display: block;
  height: 12px;
}
.barlist-bar {
  display: block;
  height: 100%;
  border-radius: 0 4px 4px 0;
  background: var(--series-1);
}
.barlist-value {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 34px;
  font-weight: 600;
}
.barlist-value small {
  font-weight: 400;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- Abas ---------- */

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar {
  display: none;
}
.tab {
  min-height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
  font-weight: 600;
  white-space: nowrap;
}
.tab:hover {
  background: var(--surface-2);
}
.tab.active {
  background: var(--ink);
  color: var(--page);
}
.tabs-inline {
  margin-bottom: 0;
}

/* ---------- Funil (Kanban) ---------- */

.board {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 16px;
  min-height: 50vh;
}
.column {
  flex: 0 0 272px;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 2px solid transparent;
}
.column.drop-target {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.column-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 8px;
  border-top: 3px solid var(--line-strong);
  border-radius: 10px 10px 0 0;
}
.column.kind-won .column-head {
  border-top-color: var(--series-1);
}
.column.kind-done .column-head {
  border-top-color: var(--good);
}
.column-name {
  font-weight: 650;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.column-count {
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
}
.column-sum {
  margin-left: auto;
  color: var(--ink-2);
  font-size: 13px;
}
.column-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 8px 8px;
  min-height: 60px;
}
.column-add {
  display: grid;
  place-items: center;
  min-height: 36px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
}
.column-add:hover {
  background: var(--surface);
  color: var(--ink);
}
.card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  cursor: grab;
}
.card.dragging {
  opacity: 0.4;
}
.card-link {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  padding: 11px 12px;
  color: var(--ink);
}
.card-link:hover {
  text-decoration: none;
}
.card:hover {
  border-color: var(--line-strong);
}
.card-title {
  font-weight: 600;
  line-height: 1.3;
}
.card-contact {
  color: var(--muted);
  font-size: 13px;
}
.card-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}
.stepper {
  display: flex;
  gap: 3px;
  margin-bottom: 14px;
  overflow-x: auto;
  scrollbar-width: none;
}
.stepper::-webkit-scrollbar {
  display: none;
}
.step {
  flex: 1 0 auto;
  min-width: 96px;
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.step:first-child {
  border-radius: 999px 0 0 999px;
}
.step:last-child {
  border-radius: 0 999px 999px 0;
}
.step:hover {
  background: var(--surface-3);
}
.step.past {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.step.current {
  background: var(--accent);
  color: var(--on-accent);
}
.stepper.is-lost .step.past,
.stepper.is-lost .step.current {
  background: var(--surface-3);
  color: var(--ink-2);
}
.deal-cta {
  display: flex;
  justify-content: flex-end;
  margin: -6px 0 14px;
}

/* ---------- Tabelas e filtros ---------- */

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.filters select.input {
  width: auto;
}
.search-field {
  position: relative;
  flex: 1 1 260px;
}
.search-field .icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: var(--muted);
  pointer-events: none;
}
.search-field .input {
  padding-left: 36px;
}
.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
}
.table td {
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  vertical-align: middle;
}
.table tbody tr:first-child td {
  border-top: 0;
}
.table tbody tr {
  cursor: pointer;
}
.table tbody tr:hover {
  background: var(--surface-2);
}
.table th.num,
.table td.num {
  text-align: right;
}
.cell-person {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.cell-person > span:last-child {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.cell-name {
  color: var(--ink);
  font-weight: 600;
}
.cell-sub {
  display: block;
  color: var(--muted);
  font-size: 13px;
}
.cell-sub:empty {
  display: none;
}
.show-sm {
  display: none;
}
.contact-head .contact-id {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* ---------- Histórico ---------- */

.timeline {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.tl-item {
  position: relative;
  display: flex;
  gap: 12px;
  padding-bottom: 16px;
}
.tl-item:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 14px;
  top: 30px;
  bottom: 0;
  width: 1px;
  background: var(--line);
}
.tl-dot {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  flex: none;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-2);
}
.tl-dot.done {
  background: var(--good-soft);
  color: var(--good-ink);
}
.tl-body {
  flex: 1;
  min-width: 0;
}
.tl-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  min-height: 29px;
  font-size: 13.5px;
}
.tl-head .icon-btn {
  margin-left: auto;
}
.tl-body p {
  margin-top: 2px;
  color: var(--ink-2);
}

/* ---------- Agenda ---------- */

.agenda-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  align-items: start;
}
.cal-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
}
.cal-head h2 {
  flex: 1;
  text-align: center;
}
.cal-head h2::first-letter,
.month-nav h2::first-letter,
.page-head p.muted::first-letter {
  text-transform: uppercase;
}
.cal-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  text-align: center;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--line);
  overflow: hidden;
}
.day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 3px;
  min-height: 96px;
  padding: 6px;
  border: 0;
  background: var(--surface);
  text-align: left;
  min-width: 0;
}
.day:hover {
  background: var(--surface-2);
}
.day.outside {
  background: var(--page);
}
.day.outside .day-num {
  color: var(--muted);
}
.day-num {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 13.5px;
  font-weight: 600;
}
.day.today .day-num {
  background: var(--accent);
  color: var(--on-accent);
}
.day.selected {
  box-shadow: inset 0 0 0 2px var(--accent);
}
.day-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.day-item {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 11.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.day-item.virtual {
  background: var(--surface-3);
  color: var(--ink);
}
.day-item.late {
  background: var(--bad-soft);
  color: var(--bad-ink);
}
.day-item.done {
  background: transparent;
  color: var(--muted);
  text-decoration: line-through;
}
.day-more {
  padding: 0 5px;
  color: var(--muted);
  font-size: 11.5px;
}
.day-dot {
  display: none;
}
.gcal-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: -4px 0 8px 43px;
  font-size: 12.5px;
}
.done-toggle {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.month-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
}
.month-nav h2 {
  min-width: 170px;
  text-align: center;
}

/* ---------- Orçamentos e contratos ---------- */

.doc-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.preview-title {
  margin-bottom: 10px;
  color: var(--ink-2);
  font-size: 13.5px;
}
.print-doc {
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
  color: #111111;
  box-shadow: var(--shadow);
  font-size: 13.5px;
  line-height: 1.5;
}
.contract-doc {
  white-space: pre-wrap;
  font-size: 13.5px;
  line-height: 1.6;
}
.doc-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  border-bottom: 2px solid #111111;
}
.doc-head > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: #444444;
  font-size: 12.5px;
  min-width: 0;
}
.doc-brand {
  color: #111111;
  font-size: 19px;
  letter-spacing: -0.01em;
}
.doc-meta {
  text-align: right;
  flex: none;
}
.doc-meta strong {
  color: #111111;
  font-size: 14.5px;
}
.doc-to {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 20px 0;
  color: #444444;
}
.doc-to strong {
  color: #111111;
  font-size: 15px;
}
.doc-label {
  color: #666666;
  font-size: 11.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.doc-title {
  margin: 0 0 12px;
  font-size: 17px;
  color: #111111;
}
.doc-table {
  width: 100%;
  border-collapse: collapse;
}
.doc-table th {
  padding: 7px 8px;
  border-bottom: 1px solid #111111;
  color: #444444;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
}
.doc-table td {
  padding: 9px 8px;
  border-bottom: 1px solid #dddddd;
  vertical-align: top;
}
.doc-table .num {
  text-align: right;
}
.doc-details {
  color: #555555;
  font-size: 12.5px;
}
.doc-empty {
  color: #777777;
  text-align: center;
}
.doc-totals {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: min(280px, 100%);
  margin: 14px 0 0 auto;
}
.doc-totals > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 0 8px;
  color: #444444;
}
.doc-totals .doc-total {
  margin-top: 4px;
  padding: 9px 8px;
  border-top: 2px solid #111111;
  color: #111111;
  font-size: 16.5px;
  font-weight: 700;
}
.doc-block {
  margin-top: 20px;
  page-break-inside: avoid;
}
.doc-block p {
  margin-top: 3px;
  color: #222222;
}
.contract-body {
  font-family: var(--font);
  min-height: 420px;
}
.q-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 18px 0;
}
.q-item {
  display: grid;
  grid-template-columns: 76px minmax(110px, 170px) minmax(0, 1fr) 40px;
  align-items: end;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--page);
}
.q-item .field {
  grid-column: auto;
}
.q-item .q-desc,
.q-item .q-details {
  grid-column: 1 / -1;
}
.q-total {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  min-width: 0;
  min-height: 40px;
  font-size: 13px;
}
.q-total strong {
  font-size: 14.5px;
}
.q-add {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.q-summary {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.q-discount {
  width: 180px;
}
.q-grand {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.q-grand strong {
  font-size: 24px;
  letter-spacing: -0.02em;
}
.doc-cols .panel > .field {
  margin-top: 14px;
}

/* ---------- Configurações ---------- */

.settings {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.settings-nav {
  position: sticky;
  top: calc(var(--topbar) + 16px);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.settings-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-weight: 550;
  white-space: nowrap;
}
.settings-link:hover {
  background: var(--surface-2);
  text-decoration: none;
}
.settings-link.active {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.settings-body {
  min-width: 0;
  max-width: 760px;
}
.stage-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.stage-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1.2fr) minmax(0, 1fr) 26px 40px;
  align-items: center;
  gap: 8px;
}
.stage-order {
  display: flex;
}
.stage-count {
  text-align: right;
  font-size: 13px;
}

/* ---------- Janelas e avisos ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(11, 11, 11, 0.5);
  animation: fade 0.14s ease-out;
}
.dialog {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 580px;
  max-height: calc(100dvh - 40px);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  animation: pop 0.16s ease-out;
}
.dialog-sm {
  max-width: 420px;
}
.dialog-lg {
  max-width: 820px;
}
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 14px 20px;
  border-bottom: 1px solid var(--line);
}
.dialog-head h2 {
  font-size: 17px;
}
.dialog-body {
  padding: 20px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.dialog-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}
.dialog-sm .dialog-foot {
  justify-content: flex-end;
}
.confirm-text {
  font-size: 16px;
  font-weight: 550;
}
.confirm-text + .muted {
  margin-top: 8px;
}
.sheet-list {
  display: flex;
  flex-direction: column;
  margin: -8px;
}
.sheet-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  text-align: left;
  font-weight: 550;
}
.sheet-item .icon {
  color: var(--ink-2);
}
.sheet-item:hover {
  background: var(--surface-2);
}
.sheet-item.danger,
.sheet-item.danger .icon {
  color: var(--bad-ink);
}
@keyframes fade {
  from {
    opacity: 0;
  }
}
@keyframes pop {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.985);
  }
}
.toasts {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: min(92vw, 460px);
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  padding: 11px 16px;
  border-radius: 10px;
  background: var(--ink);
  color: var(--page);
  box-shadow: var(--shadow-lg);
  font-weight: 550;
  font-size: 14px;
  animation: pop 0.18s ease-out;
  transition: opacity 0.25s;
}
.toast-error {
  background: var(--bad);
  color: #fff;
}
.toast.leaving {
  opacity: 0;
}

/* ---------- Telas médias ---------- */

@media (max-width: 1180px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .doc-cols,
  .agenda-cols {
    grid-template-columns: minmax(0, 1fr);
  }
  .hide-md {
    display: none;
  }
}

/* ---------- Celular ---------- */

@media (max-width: 860px) {
  body {
    font-size: 15.5px;
  }
  .sidebar {
    display: none;
  }
  .main {
    margin-left: 0;
    padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom, 0px));
  }
  .topbar {
    gap: 8px;
    padding: 0 12px;
    padding-top: env(safe-area-inset-top, 0px);
    height: calc(var(--topbar) + env(safe-area-inset-top, 0px));
  }
  .brand-mobile {
    display: flex;
  }
  .topbar #quick-add {
    width: 40px;
    padding: 0;
  }
  .topbar #quick-add span {
    display: none;
  }
  .net-mobile.offline {
    display: flex;
    padding: 6px;
  }
  .net-mobile.offline span {
    display: none;
  }
  .banner-flat {
    padding: 8px 14px;
  }
  .tabbar {
    position: fixed;
    inset: auto 0 0 0;
    z-index: 30;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: calc(var(--tabbar) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    border-top: 1px solid var(--line);
    background: var(--surface);
  }
  .tab-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 11.5px;
    font-weight: 600;
  }
  .tab-link:hover {
    text-decoration: none;
  }
  .tab-link.active {
    color: var(--accent-ink);
  }
  .toasts {
    bottom: calc(var(--tabbar) + env(safe-area-inset-bottom, 0px) + 12px);
  }
  .page {
    padding: 16px 14px 24px;
  }
  h1 {
    font-size: 21px;
  }
  .cols,
  .settings {
    grid-template-columns: minmax(0, 1fr);
  }
  .stats {
    gap: 10px;
  }
  .stat {
    padding: 13px;
  }
  .stat-value {
    font-size: 20px;
  }
  .panel {
    padding: 14px;
  }
  .btn,
  .input,
  .icon-btn {
    min-height: 44px;
  }
  .icon-btn {
    width: 44px;
    height: 44px;
  }
  .btn-sm,
  .input-sm {
    min-height: 38px;
  }
  .icon-btn-sm {
    width: 36px;
    height: 36px;
    min-height: 36px;
  }
  .input,
  .input-sm {
    font-size: 16px; /* evita o zoom automático ao focar no celular */
  }
  .hide-sm {
    display: none;
  }
  .hide-sm-flex {
    display: none;
  }
  .show-sm {
    display: block;
  }
  .table td,
  .table th {
    padding: 10px 12px;
  }
  .page-head .page-actions {
    width: 100%;
  }
  .page-actions .btn-primary {
    flex: 1;
  }
  .board {
    margin: 0 -14px;
    padding: 0 14px 16px;
    scroll-snap-type: x proximity;
    scroll-padding: 0 14px;
  }
  .column {
    flex-basis: min(82vw, 320px);
    scroll-snap-align: start;
  }
  .settings-nav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    margin: 0 -14px;
    padding: 0 14px 4px;
    scrollbar-width: none;
  }
  .settings-nav::-webkit-scrollbar {
    display: none;
  }
  .settings-link {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0 14px;
  }
  .settings-link .icon {
    display: none;
  }
  .stage-row {
    grid-template-columns: auto minmax(0, 1fr) 44px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
  }
  .stage-row select {
    grid-column: 2;
  }
  .stage-count {
    display: none;
  }
  .stage-row > .icon-btn:last-child {
    grid-column: 3;
    grid-row: 1;
  }
  .day {
    min-height: 50px;
    align-items: center;
    padding: 5px 2px;
  }
  .day-items {
    display: none;
  }
  .day-dot {
    display: block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--series-1);
  }
  .day-dot.late {
    background: var(--bad);
  }
  .q-item {
    grid-template-columns: 72px minmax(0, 1fr) auto 44px;
  }
  .print-doc {
    padding: 20px 16px;
    font-size: 12.5px;
  }
  .doc-head {
    flex-direction: column;
    gap: 10px;
  }
  .doc-meta {
    text-align: left;
  }
  .row-side {
    max-width: 50%;
  }
  .overlay {
    padding: 0;
    place-items: end stretch;
  }
  .dialog,
  .dialog-sm,
  .dialog-lg {
    max-width: none;
    max-height: 94dvh;
    border-radius: 16px 16px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    animation-name: sheet;
  }
  .dialog-foot {
    flex-wrap: wrap;
  }
  .dialog-foot .btn-primary {
    flex: 1;
  }
  .form-grid {
    gap: 12px;
  }
  .chart-plot {
    padding-left: 56px;
  }
  .chart-grid {
    left: 56px;
  }
}
@keyframes sheet {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
}
@media (max-width: 420px) {
  .field.half {
    grid-column: 1 / -1;
  }
  .stats {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .stat-value {
    font-size: 18px;
  }
  .page-actions .segmented {
    flex: 1;
  }
  .page-actions .segmented button {
    flex: 1;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Impressão (orçamentos e contratos) ---------- */

@media print {
  @page {
    margin: 18mm 16mm;
  }
  body {
    background: #fff;
    color: #000;
    font-size: 12pt;
  }
  .no-print,
  .sidebar,
  .topbar,
  .tabbar,
  #modals,
  #toasts,
  .banner-flat {
    display: none !important;
  }
  .main {
    margin: 0;
    padding: 0;
    min-height: 0;
  }
  .page {
    max-width: none;
    padding: 0;
  }
  .doc-cols {
    display: block;
  }
  .print-doc {
    padding: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    font-size: 11pt;
  }
  .contract-doc {
    font-size: 11.5pt;
    line-height: 1.55;
  }
  .doc-table tr {
    page-break-inside: avoid;
  }
}
