:root {
    --bg: #F3F6F8;
    --surface: #FFFFFF;
    --surface-alt: #EAEEF2;
    --border: #DCE2E7;
    --ink: #16212C;
    --ink-soft: #56636F;
    --teal: #163A5C;
    --teal-soft: #E4EAF0;
    --amber: #F5821F;
    --amber-soft: #FCE7D2;
    --green: #2F7A4D;
    --green-soft: #E3EFE6;
    --navy-deep: #10283F;
    --on-navy: #FFFFFF;
    --on-navy-soft: rgba(255,255,255,0.7);
    --on-navy-line: rgba(255,255,255,0.1);
    --shadow: 0 1px 2px rgba(16,24,32,0.08);
    --backdrop: rgba(19,28,24,0.55);
    color-scheme: light;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      color-scheme: dark;
      --backdrop: rgba(0,0,0,0.65);
      --bg: #0F1B27;
      --surface: #16283A;
      --surface-alt: #1C2F42;
      --border: #26384A;
      --ink: #EEF3F6;
      --ink-soft: #9FB0BE;
      --teal: #6FA8DC;
      --teal-soft: #1E3550;
      --amber: #FF9A44;
      --amber-soft: #3A2A18;
      --green: #6FC28E;
      --green-soft: #1F3126;
      --shadow: 0 1px 2px rgba(0,0,0,0.4);
    }
  }
  :root[data-theme="dark"] {
    color-scheme: dark;
    --backdrop: rgba(0,0,0,0.65);
    --bg: #0F1B27;
    --surface: #16283A;
    --surface-alt: #1C2F42;
    --border: #26384A;
    --ink: #EEF3F6;
    --ink-soft: #9FB0BE;
    --teal: #6FA8DC;
    --teal-soft: #1E3550;
    --amber: #FF9A44;
    --amber-soft: #3A2A18;
    --green: #6FC28E;
    --green-soft: #1F3126;
    --shadow: 0 1px 2px rgba(0,0,0,0.4);
  }

  * { box-sizing: border-box; }
  html, body { height: 100%; }
  body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: 'Source Sans 3', ui-sans-serif, system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
  }
  h1, h2, h3 { font-family: 'Fraunces', Georgia, serif; margin: 0; text-wrap: balance; }
  p { margin: 0; }
  button { font-family: inherit; cursor: pointer; }
  a { color: inherit; text-decoration: none; }
  img { max-width: 100%; }
  [hidden] { display: none !important; }
  :focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; border-radius: 6px; }
  @media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

  /* ---------- login screen ---------- */
  .login-screen { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 32px 16px; background: var(--navy-deep); }
  .login-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: 22px; padding: 30px 24px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 12px 40px rgba(0,0,0,0.3); }
  .login-brand { display: flex; flex-direction: column; align-items: center; gap: 3px; margin-bottom: 2px; }
  .login-brand .brand-name { font-size: 23px; color: var(--amber); }
  .login-brand .brand-sub { font-size: 11px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .08em; }
  .login-lead { font-size: 13.5px; color: var(--ink-soft); text-align: center; margin-top: 2px; }
  .login-divider { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); font-size: 11.5px; margin: 2px 0; }
  .login-divider::before, .login-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
  .login-search {
    width: 100%; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--border);
    background: var(--bg); color: var(--ink); font-size: 13.5px; font-family: inherit;
  }
  .login-client-list-wrap { max-height: 236px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
  .login-client-row {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--surface);
    border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; width: 100%; text-align: left; font: inherit; color: inherit;
  }
  .login-client-row:hover { border-color: var(--teal); }
  .login-note { font-size: 11px; color: var(--ink-soft); text-align: center; line-height: 1.45; }
  .login-status { font-size: 12.5px; color: var(--ink-soft); text-align: center; }

  /* ---------- account bar (replaces the old mode switch) ---------- */
  .account-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: rgba(255,255,255,0.1); border-radius: 10px; padding: 9px 12px; }
  .account-name { font-size: 12px; color: var(--on-navy); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .account-role { display: block; font-size: 9.5px; color: var(--on-navy-soft); text-transform: uppercase; letter-spacing: .06em; margin-top: 1px; }
  .logout-btn { background: none; border: none; color: var(--amber); font-size: 11.5px; font-weight: 700; padding: 4px 6px; flex-shrink: 0; }

  .app-shell { display: flex; flex-direction: column; min-height: 100%; }

  .topbar {
    display: flex; flex-direction: column; gap: 12px;
    padding: 14px 16px; padding-top: calc(14px + env(safe-area-inset-top, 0px));
    background: var(--navy-deep); border-bottom: 1px solid var(--on-navy-line);
    position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  }
  .brand-name { font-family: 'Source Sans 3', ui-sans-serif, sans-serif; font-size: 17px; font-weight: 700; letter-spacing: .02em; display: block; color: var(--amber); }
  .brand-sub { font-size: 10.5px; color: var(--on-navy-soft); display: block; margin-top: 2px; text-transform: uppercase; letter-spacing: .08em; }

  .content { flex: 1; min-width: 0; padding: 20px 16px 104px; display: flex; flex-direction: column; gap: 28px; }
  body.mode-escritorio .content { padding-bottom: 24px; }

  .nav {
    display: flex; gap: 2px;
    position: fixed; left: 0; right: 0; bottom: 0;
    background: var(--navy-deep); border-top: 1px solid var(--on-navy-line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px)); z-index: 30;
  }
  .nav-brand, .nav-account-wrap { display: none; }
  .nav-links { display: contents; }
  .nav-btn {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 7px 2px; background: none; border: none; color: var(--on-navy-soft);
    font-size: 10.5px; font-weight: 600; border-radius: 10px; transition: color .15s ease;
  }
  .nav-btn svg { width: 20px; height: 20px; }
  .nav-btn.active { color: var(--amber); }
  body.mode-escritorio .nav { display: none; }

  .view-head { display: flex; flex-direction: column; gap: 6px; }
  .eyebrow { font-size: 12.5px; color: var(--ink-soft); }
  .view-head h1 { font-size: 26px; font-weight: 600; }
  .lead { font-size: 15px; color: var(--ink-soft); }

  .callout {
    display: flex; align-items: center; gap: 14px; background: var(--surface);
    border: 1px solid var(--border); border-radius: 16px; padding: 16px 18px; box-shadow: var(--shadow);
  }
  .callout-icon { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
  .callout-icon.warn { background: var(--amber-soft); color: var(--amber); }
  .callout-icon.ok { background: var(--green-soft); color: var(--green); }
  .callout-icon svg { width: 19px; height: 19px; }
  .callout-body { flex: 1; min-width: 0; }
  .callout-title { font-weight: 600; font-size: 14.5px; }
  .callout-sub { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
  .callout > svg.chev { width: 16px; height: 16px; color: var(--ink-soft); flex-shrink: 0; }

  .section { display: flex; flex-direction: column; gap: 12px; }
  .section-head { display: flex; align-items: center; justify-content: space-between; }
  .section-head h2 { font-size: 16px; font-weight: 600; }
  .section-head a { font-size: 13px; color: var(--teal); font-weight: 600; }

  .stack { display: flex; flex-direction: column; gap: 10px; }
  .row {
    display: flex; align-items: center; gap: 12px; background: var(--surface);
    border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
  }
  .row-date {
    width: 46px; height: 46px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border);
    display: flex; flex-direction: column; align-items: center; justify-content: center; flex-shrink: 0;
  }
  .row-date b { font-size: 15px; line-height: 1; font-weight: 600; }
  .row-date span { font-size: 8.5px; color: var(--ink-soft); text-transform: uppercase; margin-top: 2px; }
  .row-info { flex: 1; min-width: 0; }
  .row-title { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .row-sub { font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
  .badge {
    font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 999px; white-space: nowrap; flex-shrink: 0;
  }
  .badge.amber { background: var(--amber-soft); color: var(--amber); }
  .badge.teal { background: var(--teal-soft); color: var(--teal); }
  .badge.green { background: var(--green-soft); color: var(--green); }

  .card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; }
  .mini-row { display: flex; align-items: flex-start; gap: 10px; }
  .mini-row + .mini-row { margin-top: 12px; }
  .mini-dot {
    width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; margin-top: 1px;
  }
  .mini-dot svg { width: 12px; height: 12px; }
  .mini-title { font-size: 13.5px; font-weight: 600; }
  .mini-sub { font-size: 12px; color: var(--ink-soft); margin-top: 1px; }

  .primary-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px; background: var(--amber); color: #fff;
    border: none; border-radius: 12px; padding: 14px; font-size: 14.5px; font-weight: 600; width: 100%;
  }
  .primary-btn svg { width: 18px; height: 18px; }
  .primary-btn:disabled { opacity: .55; cursor: default; }

  .pill-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
  .filter-pill {
    background: var(--surface); color: var(--ink-soft); border: 1px solid var(--border);
    padding: 7px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; flex-shrink: 0;
  }
  .filter-pill.active { background: var(--amber); color: #fff; border-color: var(--amber); }

  .doc-row { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
  .doc-icon { width: 38px; height: 38px; border-radius: 10px; background: var(--bg); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--ink-soft); flex-shrink: 0; }
  .doc-icon svg { width: 17px; height: 17px; }
  .doc-action-btn {
    background: var(--teal-soft); color: var(--teal); border: none; border-radius: 8px;
    padding: 7px 10px; font-size: 11.5px; font-weight: 700; white-space: nowrap; flex-shrink: 0;
  }

  .grid-cards { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
  .action-card {
    display: flex; flex-direction: column; gap: 10px; background: var(--surface); border: 1px solid var(--border);
    border-radius: 14px; padding: 14px; text-align: left; width: 100%;
  }
  .action-icon { width: 34px; height: 34px; border-radius: 10px; background: var(--teal-soft); color: var(--teal); display: flex; align-items: center; justify-content: center; }
  .action-icon svg { width: 17px; height: 17px; }
  .action-label { font-size: 13px; font-weight: 600; line-height: 1.3; }

  .timeline-list { display: flex; flex-direction: column; }
  .tl-step { display: flex; gap: 14px; }
  .tl-marker { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; }
  .tl-circle { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
  .tl-circle.done { background: var(--teal); color: #fff; }
  .tl-circle.current { background: var(--surface); border: 2px solid var(--amber); }
  .tl-circle.pending { background: var(--bg); border: 2px solid var(--border); }
  .tl-circle svg { width: 13px; height: 13px; }
  .tl-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--amber); }
  .tl-line { width: 2px; flex: 1; min-height: 22px; background: var(--border); }
  .tl-body { padding-bottom: 26px; flex: 1; }
  .tl-title { font-size: 14px; font-weight: 600; }
  .tl-sub { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }

  .cal-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px; }
  .cal-heads { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 2px; margin-bottom: 6px; }
  .cal-heads span { text-align: center; font-size: 10.5px; color: var(--ink-soft); font-weight: 600; }
  .cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0,1fr)); gap: 2px; }
  .cal-cell { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border-radius: 8px; font-size: 12.5px; }
  .cal-cell.today { background: var(--teal-soft); color: var(--teal); font-weight: 700; }
  .cal-cell .dot { width: 5px; height: 5px; border-radius: 50%; }

  .toggle-row { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
  .toggle-btn { width: 42px; height: 24px; border-radius: 999px; border: none; padding: 2px; display: flex; flex-shrink: 0; }
  .toggle-knob { width: 20px; height: 20px; border-radius: 50%; background: #fff; display: block; }

  .mode-badge {
    display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 700; color: var(--teal);
    background: var(--teal-soft); border-radius: 999px; padding: 6px 12px; width: fit-content; text-transform: uppercase; letter-spacing: .02em;
  }
  .mode-badge svg { width: 14px; height: 14px; }
  .example-note { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-soft); background: var(--surface-alt); border-radius: 999px; padding: 6px 12px; width: fit-content; }
  .example-note.live { color: var(--green); background: var(--green-soft); }
  .example-note .pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex-shrink: 0; }

  .stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
  .stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; }
  .stat-label { font-size: 12px; color: var(--ink-soft); }
  .stat-value { font-family: 'Fraunces', Georgia, serif; font-size: 24px; font-weight: 600; margin-top: 4px; }

  .kanban-scroll { overflow-x: auto; padding-bottom: 6px; }
  .kanban-board { display: flex; gap: 14px; min-width: 920px; }
  .kanban-col { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 10px; }
  .kanban-col-head { display: flex; align-items: center; justify-content: space-between; padding: 0 2px; }
  .kanban-col-head span:first-child { font-size: 11.5px; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .03em; }
  .kanban-count { font-size: 11px; color: var(--ink-soft); background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; }
  .kanban-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
  .kanban-client { font-size: 13px; font-weight: 600; }
  .kanban-type { font-size: 12px; color: var(--ink-soft); margin-top: 3px; }
  .kanban-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
  .kanban-foot span { font-size: 11px; color: var(--ink-soft); }
  .kanban-foot span.urgent { color: var(--amber); font-weight: 600; }
  .kanban-advance {
    margin-top: 10px; width: 100%; background: var(--surface-alt); color: var(--teal); border: none;
    border-radius: 8px; padding: 7px; font-size: 11px; font-weight: 700;
  }
  .kanban-meta { display: flex; align-items: center; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
  .resp-chip {
    background: var(--teal-soft); color: var(--teal); border: none; border-radius: 999px;
    padding: 4px 10px; font-size: 10.5px; font-weight: 700;
  }
  .channel-chip {
    font-size: 10px; font-weight: 700; padding: 4px 9px; border-radius: 999px;
    background: var(--bg); border: 1px solid var(--border); color: var(--ink-soft);
  }
  .workload-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
  .workload-chip {
    display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--border);
    border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 600; white-space: nowrap; flex-shrink: 0;
  }
  .workload-chip b { font-family: 'Fraunces', Georgia, serif; color: var(--teal); }
  .stat-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
  .due-alert { font-size: 12px; font-weight: 700; margin-top: 3px; }
  .due-alert.warn { color: var(--amber); }
  .integration-row { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
  .integration-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex-shrink: 0; }
  .pend-type { font-size: 10.5px; color: var(--ink-soft); background: var(--surface-alt); border-radius: 999px; padding: 1px 8px; flex-shrink: 0; }

  .client-row { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; width: 100%; text-align: left; font: inherit; color: inherit; }
  .client-row:hover { border-color: var(--teal); }
  .client-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--teal-soft); color: var(--teal); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
  .client-info { flex: 1; min-width: 0; }
  .client-name-row { display: flex; align-items: center; gap: 8px; }
  .client-name { font-size: 14px; font-weight: 600; }
  .client-segment { font-size: 10.5px; color: var(--ink-soft); background: var(--surface-alt); border-radius: 999px; padding: 1px 8px; flex-shrink: 0; }
  .client-meta { font-size: 12.5px; color: var(--ink-soft); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .client-right { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; flex-shrink: 0; }
  .client-activity { font-size: 11px; color: var(--ink-soft); }
  .client-activity.urgent { color: var(--amber); font-weight: 600; }

  .modal-backdrop {
    position: fixed; inset: 0; background: var(--backdrop); z-index: 50;
    display: flex; align-items: flex-end; justify-content: center; padding: 0;
  }
  .client-modal {
    background: var(--bg); border-radius: 20px 20px 0 0; width: 100%; max-width: 480px;
    max-height: 88vh; overflow-y: auto; padding: 24px 20px calc(28px + env(safe-area-inset-bottom, 0px));
    display: flex; flex-direction: column; gap: 22px;
  }
  .modal-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
  .modal-close {
    width: 32px; height: 32px; border-radius: 50%; background: var(--surface-alt); border: none;
    color: var(--ink-soft); display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  }
  .modal-close svg { width: 16px; height: 16px; }
  .modal-client { display: flex; align-items: center; gap: 14px; }
  .modal-avatar {
    width: 52px; height: 52px; border-radius: 50%; background: var(--teal-soft); color: var(--teal);
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 16px; flex-shrink: 0;
  }
  @media (min-width: 768px) {
    .modal-backdrop { align-items: center; padding: 24px; }
    .client-modal { border-radius: 20px; max-height: 82vh; }
  }

  @media (min-width: 768px) {
    .app-shell { flex-direction: row; }
    .topbar { display: none; }
    .nav {
      position: sticky; top: 0; left: auto; right: auto; bottom: auto;
      flex-direction: column; width: 248px; height: 100vh; border-top: none; border-right: 1px solid var(--on-navy-line);
      padding: 26px 14px; gap: 2px; align-items: stretch; flex-shrink: 0;
    }
    body.mode-escritorio .nav { display: flex; }
    .nav-brand { display: flex; flex-direction: column; gap: 2px; padding: 0 10px 18px; }
    .nav-account-wrap { display: block; padding: 0 2px 18px; }
    .nav-links[hidden] { display: none; }
    .nav-links { display: flex; flex-direction: column; gap: 2px; }
    .nav-btn { flex-direction: row; justify-content: flex-start; gap: 12px; font-size: 14px; padding: 10px 12px; }
    .nav-btn svg { width: 19px; height: 19px; }
    .content { padding: 44px 56px 56px; max-width: 1120px; gap: 36px; }
    .view-head h1 { font-size: 32px; }
    .grid-cards { grid-template-columns: repeat(3, minmax(0,1fr)); }
    .stat-grid { grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); }
    .kanban-board { min-width: 0; }
  }

  /* ---------- additions for the production build ---------- */
  .login-form { display: flex; flex-direction: column; gap: 12px; }
  .login-label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
  .login-status.error { color: var(--amber); font-weight: 600; }
  /* cadastro pelo site (teste grátis) */
  .signup-intro { font-size: 12.5px; color: var(--ink-soft); text-align: center; background: var(--amber-soft); border-radius: 10px; padding: 9px 12px; margin: 0; }
  .signup-terms { display: flex; gap: 8px; align-items: flex-start; font-size: 12px; color: var(--ink-soft); line-height: 1.45; }
  .signup-terms input { margin-top: 2px; flex: none; }
  .signup-terms a { color: var(--teal); }
  .signup-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
  .login-screen .secondary-btn { width: 100%; }
  .kanban-card[draggable="true"] { cursor: grab; }
  .kanban-card.dragging { opacity: .45; }
  .kanban-col.drop-target { outline: 2px dashed var(--amber); outline-offset: 4px; border-radius: 12px; }
  .toast {
    position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
    background: var(--navy-deep); color: #fff; font-size: 13px; font-weight: 600; padding: 10px 16px;
    border-radius: 999px; z-index: 60; box-shadow: 0 6px 20px rgba(0,0,0,0.3); max-width: calc(100% - 32px); text-align: center;
  }
  a.row-title { display: block; color: var(--teal); text-decoration: underline; text-underline-offset: 2px; }

  /* ---------- cadastros ---------- */
  .toolbar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-bottom: 14px; }
  .secondary-btn {
    background: var(--surface); color: var(--teal); border: 1px solid var(--border); border-radius: 10px;
    padding: 9px 14px; font-size: 13px; font-weight: 700;
  }
  .secondary-btn:hover { border-color: var(--teal); }
  .secondary-btn.danger { color: var(--amber); }
  .form-fields { display: flex; flex-direction: column; gap: 12px; }
  .form-fields select { appearance: auto; }
  .form-row { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
  .check-list { max-height: 220px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--surface); }
  .check-list label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
  .check-all { font-weight: 700; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
  .form-hint { font-size: 12px; color: var(--ink-soft); }
  .form-error { font-size: 13px; font-weight: 600; color: var(--amber); }
  .invite-box { display: flex; flex-direction: column; gap: 10px; background: var(--green-soft); border-radius: 12px; padding: 14px; }
  .invite-box p { font-size: 13.5px; }
  .invite-box input { font-size: 12px; }
  .row-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; flex-shrink: 0; }
  .empty-note { font-size: 13.5px; color: var(--ink-soft); background: var(--surface); border: 1px dashed var(--border); border-radius: 12px; padding: 16px; text-align: center; }
  @media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }

/* ---------- conversa das solicitações ---------- */
.thread { display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 88%; border-radius: 14px; padding: 10px 13px; font-size: 14px; line-height: 1.45; white-space: pre-wrap; word-wrap: break-word; }
.msg.entrada { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); }
.msg.saida { align-self: flex-end; background: var(--teal-soft); color: var(--ink); }
.msg.interna { align-self: stretch; max-width: 100%; background: var(--amber-soft); border: 1px dashed var(--amber); }
.msg-meta { font-size: 11px; color: var(--ink-soft); margin-top: 6px; white-space: normal; }
.msg-meta .failed { color: var(--amber); font-weight: 700; }
.msg-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.msg-files a { font-size: 12px; font-weight: 600; color: var(--teal); text-decoration: underline; }
.reply-box { display: flex; flex-direction: column; gap: 8px; }
.reply-box textarea { width: 100%; min-height: 84px; resize: vertical; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--bg); color: var(--ink); font: inherit; font-size: 14px; }
.reply-row { display: flex; gap: 8px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.reply-row select { width: auto; }
.reply-row .primary-btn { width: auto; padding: 10px 18px; }

/* ---------- painel: abas com contador, alertas nos cartões ---------- */
.tab-count { display: inline-block; min-width: 18px; margin-left: 6px; padding: 0 6px; border-radius: 999px; background: var(--amber); color: #fff; font-size: 10.5px; line-height: 18px; text-align: center; }
.filter-pill.active .tab-count { background: #fff; color: var(--amber); }
.kanban-card { cursor: pointer; }
.kanban-flags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.flag { font-size: 10.5px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--amber-soft); color: var(--amber); }
.flag.info { background: var(--teal-soft); color: var(--teal); }
.stat-value.warn { color: var(--amber); }
.panel-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .panel-grid.two { grid-template-columns: 1fr 1fr; } }
.check-row { display: flex; align-items: flex-start; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.check-row input[type=checkbox] { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--green); flex-shrink: 0; }
.check-row.done .row-title { text-decoration: line-through; color: var(--ink-soft); }
.mini-select { padding: 6px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg); color: var(--ink); font: inherit; font-size: 12.5px; }
.inline-fields { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.inline-fields .login-label { flex: 1; min-width: 150px; }

/* ---------- janela lateral (detalhe da solicitação no painel) ---------- */
.drawer { max-width: 640px; }
.drawer-controls { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; }
@media (max-width: 560px) { .drawer-controls { grid-template-columns: 1fr; } }

/* ---------- tabelas de relatório ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table th { font-size: 11.5px; color: var(--ink-soft); font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.data-table td.num, .data-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tr:last-child td { border-bottom: none; }
.bar { height: 8px; border-radius: 999px; background: var(--teal); min-width: 2px; }

/* ---------- configurações ---------- */
.settings-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.settings-card h2 { font-size: 16px; }
.status-line { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.dot-ok, .dot-off { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.dot-ok { background: var(--green); }
.dot-off { background: var(--border); }
code.copyable { display: block; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 12px; word-break: break-all; }

/* ---------- relatório mensal (tela e impressão) ---------- */
.report-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.report-section h2 { font-size: 16px; margin-bottom: 8px; }
.report-list { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.7; }
@media print {
  .nav, .topbar, .toolbar, .no-print, #toast { display: none !important; }
  body, .content { background: #fff !important; color: #000 !important; padding: 0 !important; }
  .stat-tile, .settings-card, .table-wrap { border-color: #ccc !important; }
}

/* ---------- login: links ---------- */
.link-btn { background: none; border: none; padding: 0; color: var(--teal); font-weight: 600; font-size: 13px; text-decoration: underline; text-underline-offset: 2px; }
.login-links { display: flex; justify-content: center; gap: 14px; font-size: 11.5px; }
.login-links a { color: var(--ink-soft); text-decoration: underline; }

/* ---------- tema: controles nativos e barras de rolagem seguem o modo claro/escuro ---------- */
html { scrollbar-color: var(--border) transparent; }
.kanban-scroll, .table-wrap, .pill-row { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.login-links .link-btn { font-size: 11.5px; color: var(--ink-soft); text-decoration: underline; background: none; border: 0; padding: 0; }
.theme-options { display: flex; flex-wrap: wrap; gap: 8px; }
.theme-option { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-alt); font-size: 14px; cursor: pointer; }
.theme-option:has(input:checked) { border-color: var(--amber); background: var(--amber-soft); }

/* ---------- portal: boas-vindas, avaliação, honorários, busca e documentos ---------- */
.welcome-card { margin-bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.welcome-text { white-space: pre-wrap; color: var(--ink-soft); font-size: 14px; }
.progress { height: 8px; border-radius: 999px; background: var(--surface-alt); overflow: hidden; }
.progress-bar { height: 100%; background: var(--green); border-radius: 999px; }
.rating-callout { margin-top: 12px; }
.rating-box { margin: 16px 0; display: flex; flex-direction: column; gap: 6px; }
.stars { display: flex; gap: 4px; margin-top: 6px; }
.star { background: none; border: 0; padding: 2px; font-size: 28px; line-height: 1; color: var(--border); }
.star.on, .stars:not(:has(.star[disabled])) .star:hover, .stars:not(:has(.star[disabled])) .star:has(~ .star:hover) { color: var(--amber); }
.star[disabled] { cursor: default; }
.pix-box { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 14px; border-radius: 10px; background: var(--teal-soft); font-size: 14px; margin-bottom: 10px; }
.search-box { margin: 12px 0 4px; }
.doc-tags { display: block; font-size: 11.5px; font-weight: 600; color: var(--teal); margin-top: 2px; }
.doc-desc { font-style: italic; }

/* ---------- painel: busca, comercial, financeiro, IA ---------- */
.office-search { margin: 4px 0 8px; max-width: 560px; }
.search-results { margin-bottom: 16px; display: flex; flex-direction: column; gap: 6px; }
.search-results .row { width: 100%; text-align: left; font: inherit; color: inherit; }
.badge-row { display: inline-flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.lead-actions { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.lead-actions .kanban-advance { margin-top: 0; }
.kanban-advance.muted { color: var(--ink-soft); }
.extra-service { margin-top: 8px; padding: 10px 12px; border: 1px dashed var(--border); border-radius: 10px; }
.extra-service .inline-fields { align-items: flex-end; }
.rating-staff { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--green-soft); display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.rating-staff.low { background: var(--amber-soft); }
.onb-line { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; max-width: 360px; }
.ai-btn::before { content: "✦ "; color: var(--amber); }
.ai-lead { font-size: 15px; line-height: 1.5; margin-bottom: 8px; }
.ai-h { font-family: inherit; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-soft); margin: 14px 0 6px; }
.ai-note { margin-top: 14px; font-style: italic; }
.ai-loading { animation: ai-pulse 1.4s ease-in-out infinite; }
@keyframes ai-pulse { 50% { opacity: .45; } }
.ai-box { margin-bottom: 16px; }
@media print { .ai-box .ai-note { display: none; } }

/* ---------- planos, uso e WhatsApp ---------- */
.usage-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin: 8px 0 2px; font-size: 14px; }
.usage-row .progress { flex-basis: 100%; }
.progress.meter { height: 6px; }
.progress.meter.hot .progress-bar { background: var(--amber); }
.feature-list { list-style: none; margin: 12px 0 8px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 12px; font-size: 14px; }
.feature-list .on { color: var(--green); }
.feature-list .off { color: var(--ink-soft); text-decoration: line-through; }
.settings-card.locked { opacity: .75; border-style: dashed; }
.warn-note { padding: 8px 10px; border-radius: 8px; background: var(--amber-soft); }
.plan-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.usage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 16px; margin: 8px 0; }
.usage-grid > div { display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.office-row .row-actions { flex-direction: column; align-items: stretch; }

/* ---------- ajuda ---------- */
.help-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 4px 16px; box-shadow: var(--shadow); }
.help-card summary { cursor: pointer; padding: 12px 0; font-weight: 700; font-size: 16px; list-style-position: outside; }
.help-card[open] summary { border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.help-steps { margin: 6px 0 14px; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; font-size: 14.5px; line-height: 1.5; }
.help-steps li::marker { color: var(--amber); font-weight: 700; }

/* ---------- marca do escritório ---------- */
.office-logo { display: block; max-width: 140px; max-height: 44px; object-fit: contain; background: #fff; border-radius: 8px; padding: 4px 8px; margin-bottom: 8px; }
.logo-preview { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.logo-preview .logo-box { width: 120px; height: 72px; display: flex; align-items: center; justify-content: center; background: #fff; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; color: #56636F; font-size: 12px; text-align: center; padding: 4px; }
.logo-preview .logo-box img { max-width: 100%; max-height: 100%; object-fit: contain; }
.workload-chip.late { border-color: var(--amber); }
.chip-late { margin-left: 6px; font-size: 11px; font-weight: 700; color: var(--amber); }

/* ---------- indicadores e rentabilidade ---------- */
.delta { display: block; font-size: 12px; font-weight: 700; margin-top: 4px; }
.delta.good { color: var(--green); }
.delta.bad { color: var(--amber); }
.data-table tr.row-warn td { background: var(--amber-soft); }
.workload-chip.away { opacity: .7; font-style: italic; }
.delivered-list li { margin-bottom: 6px; }

#audit-body .data-table td { white-space: normal; vertical-align: top; }
#audit-filters .login-search { width: auto; min-width: 140px; }

.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 10px; }
.plan-option { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.plan-option.current { border-color: var(--teal); box-shadow: 0 0 0 1px var(--teal); }
.plan-option h3 { font-size: 16px; margin: 0; }
.plan-price { font-size: 24px; font-weight: 700; }
.plan-price small { font-size: 13px; font-weight: 400; color: var(--text-muted, inherit); }
.plan-option .feature-list { flex: 1; }

/* ---------- responsivo: celular, tablet e telas grandes ---------- */
/* Celular: linhas com muitos botões quebram em duas, em vez de empurrar a página para o lado. */
@media (max-width: 640px) {
  .row { flex-wrap: wrap; }
  .row-info { flex: 1 1 140px; }
  .row-actions { flex-shrink: 1; flex-basis: 100%; justify-content: flex-start; }
  .office-row .row-actions { flex-direction: row; align-items: center; }
  .toolbar { justify-content: flex-start; }
  .toolbar > .primary-btn, .toolbar > .secondary-btn, .toolbar .login-search, .toolbar .mini-select { flex: 1 1 auto; }
  #audit-filters .login-search { flex: 1 1 100%; width: 100%; }
}
/* Tablet e computador: as abas do painel quebram de linha em vez de rolar para o lado escondendo opções. */
@media (min-width: 768px) {
  #office-tabs { flex-wrap: wrap; overflow-x: visible; }
}
/* Telas grandes: o conteúdo usa o espaço que sobra em vez de parar em 1120px. */
@media (min-width: 1400px) { .content { max-width: 1400px; } }
@media (min-width: 1800px) { .content { max-width: 1680px; } .plan-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
/* Tablet e notebook pequeno (menu lateral + conteúdo mais estreito): mesma quebra de linha e menos espaço nas laterais. */
@media (min-width: 768px) and (max-width: 1100px) {
  .row { flex-wrap: wrap; }
  .row-info { flex: 1 1 200px; }
  .row-actions { flex-shrink: 1; flex-basis: 100%; justify-content: flex-start; }
  .office-row .row-actions { flex-direction: row; align-items: center; }
  .content { padding: 32px 28px 48px; gap: 28px; }
}

#trial-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; justify-content: space-between; margin-bottom: 10px; }
#trial-banner[hidden] { display: none; }
