/* Satoshi font — ficheiros locais */
@font-face {
  font-family: 'Satoshi';
  font-style: normal;
  font-weight: 300 500;
  src: url('../assets/fonts/Satoshi-Regular.woff2') format('woff2');
  font-display: swap;
}
@font-face {
  font-family: 'Satoshi';
  font-style: normal;
  font-weight: 600 900;
  src: url('../assets/fonts/Satoshi-Bold.woff2') format('woff2');
  font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  --bg:       #101010;
  --surface:  #1a1a1a;
  --surface2: #242424;
  --surface3: #2e2e2e;
  --brand:    #FFCE1B;
  --brand-dk: #c9a100;
  --text:     #f4f4f4;
  --muted:    #888;
  --hint:     #555;
  --danger:   #e74c3c;
  --border:   #2e2e2e;
  --radius:   12px;
  --radius-sm: 8px;
  --topbar-h: 68px;
  --nav-h:    48px;
  --bottom-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top:    env(safe-area-inset-top, 0px);

  /* Extended — used by crm.css (loads after app.css) */
  --success:     #5cb85c;  /* green status / paid */
  --info:        #5b9bd5;  /* blue status / link */
  --border-m:    #333;     /* medium border */
  --text-dim:    #666;     /* dimmed text */
  --text-mid:    #444;     /* mid-weight text */
  --muted2:      #777;     /* lighter muted */
  --surface-b:   #1e1e1e;  /* slightly above surface */
  --surface-c:   #2a2a2a;  /* CRM mid surface */
  --surface-d:   #3a3a3a;  /* CRM hover surface */
  --brand-tint:  #1a1600;  /* deep yellow background tint */
  --danger-tint: #2e1a1a;  /* dark red background tint */
  --success-tint:#1a2e1a;  /* dark green background tint */
  --info-tint:   #1a2433;  /* dark blue background tint */
  --bg-deep:     #111;     /* deepest background */

  /* Brand with alpha (CSS doesn't allow var() inside hex, use rgba or color-mix) */
  --brand-a20:   rgba(255, 206, 27, 0.20);  /* brand at 20% opacity (~#FFCE1B33) */
  --brand-a27:   rgba(255, 206, 27, 0.27);  /* brand at 27% opacity (~#FFCE1B44) */
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'Satoshi', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* ── Preloader ── */
#preloader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.6s ease;
}
#preloader.done {
  opacity: 0;
  pointer-events: none;
}
.preloader-spin {
  animation: spin 1.2s linear infinite;
  transform-origin: center;
}
.preloader-pulse {
  animation: pulse 1.2s ease-in-out infinite;
  transform-origin: 24.43px 24.43px;
}
@keyframes spin  { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(0.88); opacity: 0.7; } }

/* ── Screens ── */
.screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ── Login ── */
.login-wrap {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-top) + 40px) 32px calc(var(--safe-bottom) + 40px);
  gap: 0;
}
.login-logo {
  width: 160px;
  height: auto;
  margin-bottom: 36px;
}
.login-title {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 36px;
  text-align: center;
  color: var(--text);
}
.login-title span { color: var(--brand); }
.login-anim {
  width: 100%;
  max-width: 320px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-form {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ── Form elements ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.form-group input,
.form-group textarea,
.form-group select {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 12px 14px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.15s;
  width: 100%;
  -webkit-appearance: none;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--brand);
}
.color-palette {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 4px 0;
}
.color-swatch {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
  flex-shrink: 0;
  outline: none;
}
.color-swatch:hover { transform: scale(1.15); }
.color-swatch.active { border-color: #fff; transform: scale(1.15); }
.form-group textarea { resize: none; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── Buttons ── */
.btn-primary {
  background: var(--brand);
  color: #101010;
  font-weight: 800;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 50px;
  padding: 14px 24px;
  width: 100%;
  transition: opacity 0.18s;
  margin-top: 4px;
}
.btn-primary:active { opacity: 0.8; }
.btn-primary:disabled { opacity: 0.5; cursor: default; }
.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 50px;
  padding: 12px 24px;
  width: 100%;
  margin-top: 8px;
  transition: background 0.15s, color 0.15s;
}
.btn-danger:active { background: var(--danger); color: #fff; }

/* ── Messages ── */
.form-msg {
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  display: none;
}
.form-msg.error   { background: #2e1a1a; color: #e74c3c; display: block; }
.form-msg.success { background: #1a2e1a; color: #2ecc71; display: block; }

/* ── App container ── */
#app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* ── Top bar ── */
.app-topbar {
  height: calc(var(--topbar-h) + var(--safe-top));
  padding-top: var(--safe-top);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding-left: 16px;
  padding-right: 16px;
  gap: 12px;
  flex-shrink: 0;
  z-index: 10;
}
.topbar-logo {
  height: 26px;
  width: auto;
  flex-shrink: 0;
}
.topbar-center {
  flex: 1;
  text-align: center;
}
.topbar-label {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}
.topbar-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}
.topbar-btn:active { background: var(--surface2); color: var(--text); }
#btn-logout, #btn-logout-pdf { color: var(--brand); }
.topbar-user-name {
  font-size: 12px;
  color: var(--muted);
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Calendar header ── */
.cal-header {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 16px 16px 0;
  border-bottom: 0.5px solid var(--border);
  background: #1B1B1B;
  flex-shrink: 0;
}
.cal-header-logo-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding-bottom: 25px;
  width: 100%;
}
.cal-header-logo {
  width: 160px;
  max-width: 55%;
  height: auto;
  display: block;
}
.cal-fullscreen-btn {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: #FFCE1B;
  padding: 6px;
  cursor: pointer;
  transition: opacity .15s;
}
.cal-fullscreen-btn:hover { opacity: .7; }
.cal-fullscreen-btn svg { stroke: #FFCE1B; flex-shrink: 0; }

/* Fullscreen mode */
#screen-calendar:fullscreen,
#screen-calendar:-webkit-full-screen,
#screen-calendar:-moz-full-screen {
  background: #1b1b1b;
  overflow-y: auto;
}
#screen-calendar:fullscreen .cal-header,
#screen-calendar:-webkit-full-screen .cal-header,
#screen-calendar:-moz-full-screen .cal-header {
  padding-top: 35px;
}

/* ── Calendar nav ── */
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow: visible;
  box-sizing: border-box;
  width: 100%;
  position: relative;
}
.cal-nav-left {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
}
.cal-nav-center {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
}
.cal-nav-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex: 1;
}
.cal-nav-arrows {
  display: flex;
  align-items: center;
  gap: 4px;
}
/* ── Email button in cal-nav ── */
.cal-email-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #1a1a1a;
  border: 1px solid #2e2e2e;
  border-radius: 8px;
  padding: 7px 14px;
  cursor: pointer;
  text-decoration: none;
  transition: border-color .2s;
  color: #f4f4f4;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  flex-shrink: 0;
  white-space: nowrap;
}
.cal-email-btn:hover  { border-color: #FFCE1B; }
.cal-email-btn:active { border-color: #FFCE1B; }
.cal-email-btn svg { stroke: #f4f4f4; flex-shrink: 0; }
/* badge: círculo vermelho (não lidos) ou verde com check (lidos) */
.cal-email-badge {
  background: #e74c3c;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  transition: background .3s;
  line-height: 1;
  flex-shrink: 0;
}
.cal-email-badge.read { background: #27ae60; }

.cal-arrow {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--muted);
  transition: background 0.15s;
}
.cal-arrow:active { background: var(--surface2); color: var(--text); }
.cal-today {
  font-size: 14px;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 50px;
  border: 1px solid var(--border);
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}
.cal-today:active { background: var(--surface2); color: var(--text); }
.cal-views {
  display: flex;
  background: var(--surface2);
  border-radius: 50px;
  padding: 4px;
  gap: 2px;
}
.cal-view-btn {
  font-size: 14px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 50px;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}
.cal-view-btn.active {
  background: var(--brand);
  color: #101010;
}

/* ── Calendar body ── */
.cal-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* ── Month grid ── */
.sc-month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  width: 100%;
}
.sc-day-header {
  padding: 8px 4px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.sc-day-cell {
  min-height: 72px;
  padding: 4px 3px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
}
.sc-day-cell:nth-child(7n) { border-right: none; }
.sc-day-cell:active { background: var(--surface2); }
.sc-day-cell.other-month .sc-day-num { color: var(--hint); }
.sc-day-cell.today .sc-day-num {
  background: var(--brand);
  color: #101010;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}
.sc-day-num {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 2px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sc-event-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  color: #101010;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 2px;
  cursor: pointer;
}

/* ── Week grid ── */
.sc-week-grid {
  display: grid;
  grid-template-columns: 40px repeat(7, 1fr);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  height: 100%;
}
.sc-week-day-header {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-left: 1px solid var(--border);
  padding: 8px 4px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}
.sc-week-day-header.today { color: var(--brand); }
.sc-time-label {
  font-size: 10px;
  color: var(--hint);
  text-align: right;
  padding: 2px 6px 0 0;
  height: 48px;
  border-bottom: 1px solid var(--border);
}
.sc-week-cell {
  height: 48px;
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.sc-week-event {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 4px;
  border-radius: 3px;
  color: #101010;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  margin: 1px;
}

/* ── Day view ── */
.sc-day-view {
  display: grid;
  grid-template-columns: 40px 1fr;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  height: 100%;
}
.sc-day-cell-col {
  height: 48px;
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.sc-day-event {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  color: #101010;
  margin: 2px 4px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── FAB ── */
.fab {
  position: fixed;
  bottom: calc(var(--bottom-h) + var(--safe-bottom) + 16px);
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--brand);
  color: #101010;
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(255,206,27,0.35);
  z-index: 50;
  transition: transform 0.15s, opacity 0.15s, bottom 0.3s ease;
}
.fab:active { transform: scale(0.92); }
/* FAB sobe quando o drawer está aberto */
.fab.drawer-open {
  bottom: calc(var(--bottom-h) + var(--safe-bottom) + var(--drawer-h, 260px) + 16px);
}

/* ── Bottom nav ── */
.bottom-nav {
  height: calc(var(--bottom-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  flex-shrink: 0;
  z-index: 10;
}
.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 10px 8px;
  color: var(--hint);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: color 0.15s;
}
.bottom-nav-item.active { color: var(--brand); }
.bottom-nav-item.disabled { opacity: 0.4; pointer-events: none; }
.bottom-nav-item:active:not(.disabled) { color: var(--text); }

/* ── Modals ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.modal-sheet {
  width: 100%;
  max-height: 90dvh;
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.25s ease-out;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
@media (min-width: 768px) {
  .modal-overlay { align-items: center; }
  .modal-sheet {
    width: 50%;
    min-width: 400px;
    border-radius: var(--radius);
    max-height: 80dvh;
    animation: none;
  }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--muted);
  transition: background 0.15s;
}
.modal-close:active { background: var(--surface2); }
.modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: calc(20px + var(--safe-bottom));
}

/* ── Event detail ── */
.event-detail-time {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}
.event-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.event-detail-desc {
  font-size: 14px;
  color: var(--text);
  line-height: 1.6;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.event-detail-author {
  font-size: 12px;
  color: var(--hint);
  font-style: italic;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* ── Loading skeleton ── */
.cal-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--hint);
  font-size: 14px;
  gap: 10px;
}
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: calc(var(--bottom-h) + var(--safe-bottom) + 80px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface2);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
  border: 1px solid var(--border);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.success { border-color: var(--success); color: var(--success); }
.toast.error   { border-color: var(--danger);  color: var(--danger); }

/* ── Swipe hint ── */
.swipe-area {
  touch-action: pan-y;
}

/* ── Input datetime color fix ── */
input[type="datetime-local"],
input[type="date"],
input[type="time"] {
  color-scheme: dark;
}

/* ── Scrollbar — oculta em toda a app (comportamento nativo PWA) ── */
* { scrollbar-width: none; }
::-webkit-scrollbar { display: none; }

/* ══════════════════════════════════════════════
   PDF BUDGET SCREEN
   ══════════════════════════════════════════════ */

#screen-pdf {
  position: fixed;
  inset: 0;
  background: var(--bg);
  flex-direction: column;
}

.pdf-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px calc(var(--bottom-h) + var(--safe-bottom) + 16px);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.pdf-section {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pdf-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--brand);
  margin-bottom: 2px;
}

.req { color: var(--brand); font-weight: 700; margin-left: 2px; }

.pdf-item-row {
  background: var(--surface2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.pdf-item-row-top {
  display: grid;
  grid-template-columns: 1fr 70px 90px;
  gap: 8px;
  align-items: start;
}

.pdf-item-remove {
  width: 100%;
  padding: 6px;
  border: 1px dashed var(--hint);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 12px;
  text-align: center;
  margin-top: 4px;
  transition: background 0.15s;
}
.pdf-item-remove:active { background: rgba(231,76,60,0.1); }

.pdf-item-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--hint);
  margin-bottom: 3px;
}

/* inputs inside item rows — replaces repetitive inline styles */
.item-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 8px 10px;
  font-size: 13px;
  width: 100%;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s;
}
.item-input:focus { border-color: var(--brand); }

.pdf-add-item-btn {
  width: 100%;
  padding: 10px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  transition: border-color 0.15s, color 0.15s;
}
.pdf-add-item-btn:active { border-color: var(--brand); color: var(--brand); }

.pdf-totals {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pdf-total-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}

.pdf-total-grand {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  border-top: 1px solid var(--border);
  padding-top: 8px;
  margin-top: 2px;
}

.pdf-total-grand span:last-child { color: var(--brand); }

.pdf-font-status {
  font-size: 12px;
  text-align: center;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  display: none;
}
.pdf-font-status.loading { background: #1e1c10; color: var(--brand); display: block; }
.pdf-font-status.ok      { background: #1a2e1a; color: var(--success); display: block; }
.pdf-font-status.err     { background: #2e1a1a; color: var(--danger); display: block; }

.pdf-body > * { width: 100%; }
@media (min-width: 768px) { .pdf-body > * { width: 75%; } }
@media (min-width: 1024px) { .pdf-body > * { width: 50%; } }

/* ── Screen title ── */
.screen-title-row {
  display: flex;
  align-items: center;
  padding: 8px 16px 4px;
  background: var(--bg);
  flex-shrink: 0;
  gap: 8px;
}
.screen-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
  flex: 1;
}
.screen-title span { color: var(--brand); }

/* ── Responsive ── */
@media (max-width: 1292px) {
  #cal-prev, #cal-next { display: none; }
}
@media (max-width: 480px) {
  .cal-nav { padding: 8px 12px; gap: 6px; }
  .cal-view-btn { font-size: 13px; padding: 7px 10px; }
  .cal-today { font-size: 13px; padding: 8px 12px; }
  .cal-header-logo { width: 150px; max-width: 55%; }
}
@media (max-width: 360px) {
  .cal-header-logo { width: 115px; max-width: 50%; }
}

/* ── Drawer de Resumo ── */
.sc-drawer-toggle {
  position: fixed;
  bottom: calc(var(--bottom-h) + var(--safe-bottom) + 12px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--surface);
  border: 0.5px solid var(--brand);
  border-radius: 20px;
  color: var(--brand);
  font-size: 11px;
  font-weight: 700;
  padding: 7px 16px;
  cursor: pointer;
  letter-spacing: .03em;
  transition: background .15s;
  font-family: inherit;
  z-index: 40;
  white-space: nowrap;
}
.sc-drawer-toggle:active { background: #2a2200; }
.sc-drawer-toggle svg { stroke: var(--brand); flex-shrink: 0; }
.sc-drawer-badge {
  background: var(--brand);
  color: var(--bg);
  font-size: 9px;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}
.sc-drawer {
  position: fixed;
  bottom: calc(var(--bottom-h) + var(--safe-bottom));
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 0.5px solid var(--surface3);
  border-radius: 12px 12px 0 0;
  display: none;
  z-index: 45;
  max-height: 60vh;
  overflow: hidden;
}
.sc-drawer.open { display: block; }
.sc-drawer-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0 4px;
  cursor: pointer;
  gap: 5px;
}
.sc-drawer-handle {
  width: 36px;
  height: 4px;
  background: var(--brand);
  border-radius: 2px;
}
.sc-drawer-close-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.sc-drawer-tabs {
  display: flex;
  border-bottom: 0.5px solid var(--surface3);
  margin-top: 4px;
}
.sc-drawer-tab {
  flex: 1;
  text-align: center;
  padding: 9px 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  letter-spacing: .03em;
  text-transform: uppercase;
  transition: color .15s, border-color .15s;
  font-family: inherit;
}
.sc-drawer-tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.sc-drawer-content {
  padding: 10px 14px 16px;
  max-height: 40vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.sc-drawer-empty { color: var(--hint); font-size: 12px; text-align: center; padding: 20px 0; }
.sc-drawer-event {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 0.5px solid var(--surface2);
}
.sc-drawer-event:last-child { border-bottom: none; }
.sc-drawer-event-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 4px;
}
.sc-drawer-event-info { flex: 1; min-width: 0; }
.sc-drawer-event-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sc-drawer-event-time { font-size: 11px; color: var(--hint); margin-top: 2px; }

/* ════════════════════════════════════════════════
   PWA — Banner de actualização
   ════════════════════════════════════════════════ */
#app-update-banner {
  position: fixed;
  bottom: 80px; /* acima da bottom nav */
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 10px;
  background: #1e1e1e;
  border: 1px solid #FFCE1B;
  border-radius: 50px;
  padding: 10px 14px;
  box-shadow: 0 8px 32px rgba(0,0,0,.7);
  white-space: nowrap;
  transition: border-color .3s, opacity .3s, transform .3s;
  animation: banner-slide-in .4s cubic-bezier(.34,1.56,.64,1) both;
  font-family: -apple-system, 'Satoshi', sans-serif;
}
@keyframes banner-slide-in {
  from { opacity: 0; transform: translateX(-50%) translateY(16px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.app-update-icon {
  width: 32px; height: 32px; flex-shrink: 0;
  background: #1a1600;
  border: 1px solid rgba(255,206,27,.3);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: background .3s, border-color .3s;
}
.app-update-text { flex: 1; }
.app-update-title {
  display: block;
  font-size: 13px; font-weight: 700; color: #f4f4f4;
  transition: color .3s;
}
.app-update-sub {
  display: block;
  font-size: 11px; color: #666; margin-top: 1px;
}
#app-update-btn {
  flex-shrink: 0;
  background: #FFCE1B; border: none; border-radius: 50px;
  color: #111; font-size: 11px; font-weight: 700;
  padding: 7px 16px; cursor: pointer;
  font-family: inherit;
  text-transform: uppercase; letter-spacing: .04em;
  transition: opacity .15s;
}
#app-update-btn:disabled { opacity: .4; cursor: not-allowed; }
#app-update-dismiss {
  flex-shrink: 0;
  background: none; border: none; color: #555;
  cursor: pointer; font-size: 16px; padding: 2px 4px; line-height: 1;
  transition: color .15s;
}
#app-update-dismiss:hover { color: #f4f4f4; }

/* ── CRM nativo — layout no contexto da App ──────────────────────────
   O #scrm-wrap foi desenhado para scroll de página inteira (WordPress).
   Na App vive dentro de um flex container com altura fixa, por isso
   precisa de flex:1 + overflow-y:auto para ocupar o espaço e scrollar. */
#screen-crm {
  flex-direction: column;
}
#screen-crm > #scrm-wrap {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

/* ── Flatpickr — Tema Dark Salamandra ────────────────────────────────── */
.flatpickr-calendar {
  background: var(--surface) !important;
  border: 1px solid var(--surface-c) !important;
  border-radius: 12px !important;
  box-shadow: 0 8px 32px rgba(0,0,0,.6) !important;
  font-family: 'Satoshi', system-ui, sans-serif !important;
  color: var(--text) !important;
}
.flatpickr-calendar.arrowTop::before,
.flatpickr-calendar.arrowTop::after { border-bottom-color: var(--surface-c) !important; }
.flatpickr-calendar.arrowBottom::before,
.flatpickr-calendar.arrowBottom::after { border-top-color: var(--surface-c) !important; }

.flatpickr-months { background: var(--surface2) !important; border-radius: 12px 12px 0 0; padding: 4px 0; }
.flatpickr-month { color: var(--text) !important; fill: var(--text) !important; }
.flatpickr-current-month { font-size: 14px !important; font-weight: 700 !important; color: var(--text) !important; }
.flatpickr-current-month .numInputWrapper span.arrowUp::after { border-bottom-color: var(--text-dim) !important; }
.flatpickr-current-month .numInputWrapper span.arrowDown::after { border-top-color: var(--text-dim) !important; }
.flatpickr-current-month select.flatpickr-monthDropdown-months {
  background: var(--surface2) !important;
  color: var(--text) !important;
  border: none !important;
  font-weight: 700 !important;
}
.flatpickr-prev-month, .flatpickr-next-month {
  color: var(--text-dim) !important;
  fill: var(--text-dim) !important;
  padding: 8px !important;
}
.flatpickr-prev-month:hover, .flatpickr-next-month:hover {
  color: var(--brand) !important;
  fill: var(--brand) !important;
}

.flatpickr-weekdays { background: var(--surface2) !important; }
span.flatpickr-weekday { color: var(--hint) !important; font-size: 11px !important; font-weight: 700 !important; background: transparent !important; }

.flatpickr-day {
  color: var(--text) !important;
  border-radius: 6px !important;
  border: none !important;
}
.flatpickr-day:hover {
  background: var(--surface-d) !important;
  border-color: transparent !important;
}
.flatpickr-day.today {
  border: 1px solid var(--brand) !important;
  color: var(--brand) !important;
}
.flatpickr-day.today:hover { background: var(--surface-d) !important; }
.flatpickr-day.selected,
.flatpickr-day.selected:hover {
  background: var(--brand) !important;
  border-color: var(--brand) !important;
  color: #111 !important;
  font-weight: 700 !important;
}
.flatpickr-day.flatpickr-disabled,
.flatpickr-day.prevMonthDay,
.flatpickr-day.nextMonthDay { color: var(--hint) !important; opacity: .4; }

.flatpickr-time {
  background: var(--surface2) !important;
  border-top: 1px solid var(--surface-c) !important;
  border-radius: 0 0 12px 12px !important;
}
.flatpickr-time input,
.flatpickr-time .flatpickr-am-pm {
  background: transparent !important;
  color: var(--text) !important;
  font-size: 16px !important;
  font-weight: 700 !important;
  border: none !important;
}
.flatpickr-time input:hover,
.flatpickr-time input:focus {
  background: var(--surface-d) !important;
  border-radius: 6px !important;
}
.flatpickr-time .numInputWrapper span.arrowUp::after { border-bottom-color: var(--text-dim) !important; }
.flatpickr-time .numInputWrapper span.arrowDown::after { border-top-color: var(--text-dim) !important; }
.flatpickr-time .flatpickr-time-separator { color: var(--brand) !important; font-weight: 700 !important; }
.flatpickr-innerContainer { border-bottom: none !important; }

.flatpickr-input[readonly] { cursor: pointer; }
.flatpickr-input:focus { border-color: var(--brand) !important; }
