.mobile-deals-shell { display: none; }

@media (max-width: 920px) {
  body[data-current-view="deals"] #globalSearch { display: none !important; }
  #dealsView > .panel { display: none !important; }
  .mobile-deals-shell { display: block; min-width: 0; padding: 0 0 calc(92px + env(safe-area-inset-bottom)); }
  .md-page { min-width: 0; color: #172033; }
  .md-page button, .md-page input, .md-page select, .md-page textarea { font: inherit; }
  .md-page button { min-height: 44px; touch-action: manipulation; }
  .md-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px 10px; }
  .md-toolbar div { min-width: 0; }
  .md-toolbar small { color: #64748b; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
  .md-toolbar h2 { margin: 2px 0 0; color: #101b3f; font-size: 24px; line-height: 1.1; }
  .md-primary, .md-secondary, .md-filter, .md-load-more, .md-link, .md-action-grid button, .md-client-line button, .md-empty button, .md-error button { border: 0; border-radius: 12px; padding: 10px 14px; font-weight: 800; cursor: pointer; }
  .md-primary { background: #6f2c91; color: #fff; box-shadow: 0 7px 18px rgba(111, 44, 145, .2); }
  .md-secondary, .md-filter, .md-action-grid button, .md-client-line button, .md-empty button, .md-error button { border: 1px solid #d8ddea; background: #fff; color: #25304a; }
  .md-readonly { padding: 7px 10px; border-radius: 999px; background: #edf2f7; color: #475569; font-size: 12px; font-weight: 800; }
  .md-search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; padding: 0 14px 12px; }
  .md-search-row label { min-width: 0; }
  .md-search-row input { width: 100%; min-height: 46px; box-sizing: border-box; border: 1px solid #d8ddea; border-radius: 13px; background: #fff; padding: 0 13px; color: #172033; }
  .md-filter { position: relative; min-width: 86px; }
  .md-filter b { position: absolute; top: -7px; right: -5px; display: grid; place-items: center; min-width: 20px; height: 20px; border: 2px solid #fff; border-radius: 999px; background: #6f2c91; color: #fff; font-size: 10px; }
  .md-overview-scroll { display: flex; gap: 8px; overflow-x: auto; overscroll-behavior-inline: contain; scroll-snap-type: x proximity; padding: 2px 14px 12px; scrollbar-width: none; }
  .md-overview-scroll::-webkit-scrollbar, .md-section-nav::-webkit-scrollbar { display: none; }
  .md-funnel-chip { flex: 0 0 auto; min-width: 112px; max-width: 158px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; align-items: center; scroll-snap-align: start; border: 1px solid #dfe3ed; border-left: 4px solid #94a3b8; border-radius: 13px; background: #fff; padding: 8px 10px; color: #334155; text-align: left; }
  .md-funnel-chip span { overflow: hidden; font-size: 11px; font-weight: 800; line-height: 1.15; }
  .md-funnel-chip strong { font-size: 17px; }
  .md-funnel-chip small { grid-column: 1 / -1; color: #64748b; font-size: 10px; }
  .md-funnel-chip.active { border-color: #6f2c91; box-shadow: 0 0 0 2px rgba(111,44,145,.14); }
  .md-admin-summary { display: flex; gap: 9px; overflow-x: auto; margin: 0 14px 12px; padding: 9px 11px; border: 1px solid #e9d5ff; border-radius: 12px; background: #faf5ff; font-size: 11px; white-space: nowrap; }
  .md-admin-summary strong { color: #6f2c91; }
  .md-overview-loading, .md-list-status, .md-list-end { padding: 8px 14px; color: #64748b; font-size: 12px; }
  .md-list-status { min-height: 34px; display: flex; align-items: center; gap: 8px; }
  .md-list-status button { min-height: 34px; border: 0; background: transparent; color: #6f2c91; font-weight: 800; }
  .md-notice { margin: 0 14px 8px; padding: 10px 12px; border-radius: 11px; background: #ecfdf5; color: #166534; font-size: 12px; font-weight: 700; }
  .md-deal-list { display: grid; gap: 11px; min-width: 0; padding: 0 14px; }
  .md-deal-card { min-width: 0; overflow: hidden; border: 1px solid #e0e4ec; border-left: 5px solid #94a3b8; border-radius: 16px; background: #fff; box-shadow: 0 5px 16px rgba(15, 23, 42, .06); }
  .md-deal-card > header { display: flex; align-items: center; gap: 9px; padding: 12px 12px 8px; }
  .md-deal-card > header strong { min-width: 0; overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
  .md-status { flex: 0 0 auto; display: inline-flex; align-items: center; min-height: 24px; border-radius: 999px; padding: 3px 8px; background: #eef2f7; color: #334155; font-size: 10px; font-weight: 900; line-height: 1.1; }
  .md-card-priority { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; padding: 4px 12px 10px; }
  .md-card-priority > div { min-width: 0; display: grid; gap: 2px; }
  .md-card-priority small, .md-card-grid span, .md-next-action span, .md-detail-grid span { color: #64748b; font-size: 10px; font-weight: 800; letter-spacing: .02em; text-transform: uppercase; }
  .md-card-priority b, .md-card-priority span { overflow-wrap: anywhere; }
  .md-card-priority span { color: #64748b; font-size: 12px; }
  .md-card-value { align-content: start; text-align: right; }
  .md-card-value strong { color: #0f5132; font-size: 15px; white-space: nowrap; }
  .md-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; padding: 10px 12px; border-top: 1px solid #edf0f5; background: #fbfcfe; }
  .md-card-grid p { min-width: 0; display: grid; gap: 2px; margin: 0; }
  .md-card-grid strong { overflow-wrap: anywhere; font-size: 12px; }
  .md-next-action { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 9px 12px; border-top: 1px solid #edf0f5; }
  .md-next-action span { grid-column: 1 / -1; }
  .md-next-action strong, .md-next-action time { font-size: 12px; }
  .md-alerts { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 12px 8px; }
  .md-alert { display: inline-flex; align-items: center; min-height: 25px; border-radius: 999px; padding: 3px 8px; background: #fff7ed; color: #9a3412; font-size: 10px; font-weight: 900; }
  .md-alert.sla, .md-alert.next { background: #fef2f2; color: #b91c1c; }
  .md-deal-card footer { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; padding: 0 12px 12px; }
  .md-deal-card footer button { min-height: 44px; }
  .md-link { border: 1px solid transparent; background: #f4f1f7; color: #6f2c91; }
  .md-load-more { display: block; width: calc(100% - 28px); min-height: 48px; margin: 14px; border: 1px solid #d8b4fe; background: #faf5ff; color: #6f2c91; }
  .md-empty, .md-error { min-height: 190px; display: grid; place-content: center; gap: 8px; border: 1px dashed #cbd5e1; border-radius: 16px; background: #fff; padding: 24px; color: #64748b; text-align: center; }
  .md-empty strong, .md-error strong { color: #172033; }
  .md-overlay { position: fixed; z-index: 1200; inset: 0; display: flex; align-items: flex-end; justify-content: center; background: rgba(15, 23, 42, .58); backdrop-filter: blur(2px); }
  .md-overlay > section { width: 100%; max-width: 920px; max-height: 94dvh; overflow-y: auto; overscroll-behavior: contain; border-radius: 20px 20px 0 0; background: #f7f8fb; box-shadow: 0 -16px 40px rgba(15,23,42,.22); }
  .md-overlay.panel { align-items: stretch; }
  .md-overlay.panel > section { max-height: none; height: 100dvh; border-radius: 0; padding-top: env(safe-area-inset-top); }
  .md-overlay-header { position: sticky; z-index: 4; top: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px; border-bottom: 1px solid #e2e6ee; background: rgba(255,255,255,.97); }
  .md-overlay-header h2 { margin: 2px 0; color: #101b3f; font-size: 20px; }
  .md-overlay-header small { color: #64748b; }
  .md-overlay-header > button { min-width: 44px; border: 0; border-radius: 12px; background: #eef2f7; color: #334155; font-size: 24px; }
  .md-deal-panel-title > div { min-width: 0; }
  .md-deal-panel-title h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .md-section-nav { position: sticky; z-index: 3; top: 79px; display: flex; gap: 7px; overflow-x: auto; padding: 8px 12px; border-bottom: 1px solid #e2e6ee; background: #fff; scrollbar-width: none; }
  .md-section-nav a { flex: 0 0 auto; min-height: 40px; display: inline-flex; align-items: center; border-radius: 999px; background: #f1f5f9; padding: 0 12px; color: #334155; font-size: 11px; font-weight: 800; text-decoration: none; }
  .md-panel-body { display: grid; gap: 10px; padding: 12px 12px calc(94px + env(safe-area-inset-bottom)); }
  .md-panel-body > section { scroll-margin-top: 132px; border: 1px solid #e1e5ed; border-radius: 15px; background: #fff; padding: 13px; }
  .md-panel-body h3 { margin: 0 0 10px; color: #101b3f; font-size: 15px; }
  .md-detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .md-detail-grid p { min-width: 0; display: grid; gap: 3px; margin: 0; padding: 9px; border-radius: 10px; background: #f8fafc; }
  .md-detail-grid strong { overflow-wrap: anywhere; font-size: 12px; }
  .md-action-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin-top: 8px; }
  .md-notes { margin: 0; color: #334155; line-height: 1.55; overflow-wrap: anywhere; white-space: pre-wrap; }
  .md-history-card { display: grid; gap: 6px; padding: 10px 0; border-top: 1px solid #edf0f5; }
  .md-history-card:first-of-type { border-top: 0; }
  .md-history-card header { display: flex; justify-content: space-between; gap: 9px; }
  .md-history-card header strong { font-size: 12px; }
  .md-history-card time, .md-history-card small { flex: 0 0 auto; color: #64748b; font-size: 10px; }
  .md-history-card p { margin: 0; color: #475569; font-size: 11px; overflow-wrap: anywhere; }
  .md-client-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0; }
  .md-panel-loading { min-height: 100dvh; display: grid; place-content: center; color: #64748b; }
  .md-form { display: grid; gap: 12px; padding: 14px 14px calc(92px + env(safe-area-inset-bottom)); }
  .md-form label { min-width: 0; display: grid; gap: 5px; color: #334155; font-size: 12px; font-weight: 800; }
  .md-form input, .md-form select, .md-form textarea { width: 100%; min-height: 46px; box-sizing: border-box; border: 1px solid #ccd3df; border-radius: 11px; background: #fff; padding: 10px 11px; color: #172033; font-size: 16px; }
  .md-form textarea { min-height: 96px; resize: vertical; }
  .md-form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .md-check { grid-template-columns: auto 1fr; align-items: center; min-height: 44px; }
  .md-check input { width: 22px; min-height: 22px; }
  .md-sticky-actions { position: sticky; z-index: 5; bottom: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 8px; margin: 4px -14px calc(-92px - env(safe-area-inset-bottom)); padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid #dde2eb; background: rgba(255,255,255,.98); }
  .md-sticky-actions button { min-height: 48px; }
  .md-form-message { min-height: 18px; color: #166534; font-size: 12px; font-weight: 700; }
  .md-form-message.error, .md-client-search-status.error { color: #b91c1c; }
  .md-form-message button { display: block; width: 100%; margin-top: 8px; border: 1px solid #fecaca; border-radius: 10px; background: #fff; color: #b91c1c; }
  .md-client-results { max-height: 260px; overflow-y: auto; display: grid; gap: 6px; }
  .md-client-results button { min-height: 54px; display: grid; gap: 2px; border: 1px solid #dce1ea; border-radius: 11px; background: #fff; padding: 9px 11px; color: #172033; text-align: left; }
  .md-client-results span, .md-selected-client span { color: #64748b; font-size: 11px; }
  .md-selected-client { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid #c4b5fd; border-radius: 12px; background: #faf5ff; padding: 10px; }
  .md-selected-client div { min-width: 0; display: grid; gap: 2px; }
  .md-selected-client button { border: 0; border-radius: 9px; background: #fff; color: #6f2c91; font-weight: 800; }
  .md-client-search-status, .md-confirm-note, .md-empty-line { margin: 0; color: #64748b; font-size: 12px; }
  .md-confirm-note { padding: 10px; border-radius: 10px; background: #fff7ed; color: #9a3412; }
  .md-deal-card.status-aguardando_analise_banco, .md-funnel-chip.status-aguardando_analise_banco { border-left-color: #2563eb; }
  .status-aguardando_analise_banco.md-status { background: #dbeafe; color: #1d4ed8; }
  .md-deal-card.status-aguardando_saldo_devedor, .md-funnel-chip.status-aguardando_saldo_devedor { border-left-color: #7c3aed; }
  .status-aguardando_saldo_devedor.md-status { background: #ede9fe; color: #6d28d9; }
  .md-deal-card.status-pendente, .md-funnel-chip.status-pendente { border-left-color: #ca8a04; }
  .status-pendente.md-status { background: #fef9c3; color: #854d0e; }
  .md-deal-card.status-aguardando_averbacao, .md-funnel-chip.status-aguardando_averbacao { border-left-color: #0891b2; }
  .status-aguardando_averbacao.md-status { background: #cffafe; color: #0e7490; }
  .md-deal-card.status-aguardando_pagamento, .md-funnel-chip.status-aguardando_pagamento { border-left-color: #ea580c; }
  .status-aguardando_pagamento.md-status { background: #ffedd5; color: #c2410c; }
  .md-deal-card.status-pago_ao_cliente, .md-funnel-chip.status-pago_ao_cliente { border-left-color: #059669; }
  .status-pago_ao_cliente.md-status { background: #d1fae5; color: #047857; }
  .md-deal-card.status-aguardando_comissao, .md-funnel-chip.status-aguardando_comissao { border-left-color: #c026d3; }
  .status-aguardando_comissao.md-status { background: #fae8ff; color: #a21caf; }
  .md-deal-card.status-concluido, .md-funnel-chip.status-concluido { border-left-color: #15803d; }
  .status-concluido.md-status { background: #dcfce7; color: #166534; }
  .md-deal-card.status-reprovado, .md-funnel-chip.status-reprovado { border-left-color: #dc2626; }
  .status-reprovado.md-status { background: #fee2e2; color: #b91c1c; }
  .md-deal-card.status-cancelado, .md-funnel-chip.status-cancelado { border-left-color: #475569; }
  .status-cancelado.md-status { background: #e2e8f0; color: #334155; }
  .md-deal-card.status-outros, .md-funnel-chip.status-outros { border-left-color: #64748b; }
  .md-page :focus-visible { outline: 3px solid rgba(111,44,145,.28); outline-offset: 2px; }
}

@media (max-width: 430px) {
  .md-card-priority, .md-detail-grid, .md-form-row { grid-template-columns: minmax(0, 1fr); }
  .md-card-value { text-align: left; }
  .md-action-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (min-width: 921px) {
  .mobile-deals-shell { display: none !important; }
  #dealsView > .panel { display: block; }
}
