/* Readable Frox controls and Tecnilor catalogue. Loaded after brand styles. */
.crm { --muted: #536859; --faint: #536859; --control-border: #738579; --focus: #173e27; font-size: 16px; line-height: 1.6; }
.crm.dark { --muted: #c0cec4; --faint: #c0cec4; --control-border: #82998a; --focus: #f4d531; }
.crm h2 { font-size: 21px; line-height: 1.35; }
.crm h3 { font-size: 18px; line-height: 1.4; }
.crm .page-heading p, .crm .card-heading p, .crm .dashboard-hero p, .crm .subtle { font-size: 16px; }
.crm .nav-item, .crm .button, .crm .entity strong, .crm .data-table td { font-size: 16px; }
.crm .nav-label { font-size: 14px; letter-spacing: .6px; }
.crm .app-layout { grid-template-columns: 270px minmax(0, 1fr); grid-template-rows: auto 1fr auto; }
.crm .topbar { min-height: 86px; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
.crm .sidebar-create { margin: 0 22px 24px; }
.crm .sidebar-create .button { width: 100%; }
.crm .nav-item { min-height: 48px; }
.crm .heading-actions { flex-wrap: wrap; justify-content: flex-end; flex-shrink: 1; }
.crm .page-heading > div:first-child { min-width: 0; }
.crm h1 { overflow-wrap: anywhere; }
.crm .button { min-height: 48px; white-space: normal; text-align: center; }
.crm .icon-button, .crm .row-actions a, .crm .row-actions button, .crm .pagination button { width: 44px; height: 44px; min-width: 44px; }
.crm .row-actions .icon { width: 19px; height: 19px; }
.crm .logout, .crm .login-options button, .crm .tab-button { min-height: 44px; }
.crm .role-switch select { font-size: 16px; min-height: 44px; width: 205px; border-color: var(--control-border); }
.crm .field label { font-size: 16px; }
.crm .field input, .crm .field select, .crm .field textarea, .crm .search-field input,
.crm .manual-value, .crm .order-lines input, .crm .chat-compose textarea { font-size: 16px; min-height: 48px; border-color: var(--control-border); }
.crm input::placeholder, .crm textarea::placeholder { color: var(--muted); opacity: 1; }
.crm .field input[readonly] { border-color: var(--border); }
.crm input[type="checkbox"], .crm input[type="radio"] { width: 24px; height: 24px; }
.crm .check-label { font-size: 15px; min-height: 44px; }
.crm .field small, .crm .cell-note, .crm .summary-note, .crm .section-caption { font-size: 14px; line-height: 1.6; }
.crm .data-table th { font-size: 14px; text-transform: none; letter-spacing: 0; }
.crm .table-scroll { max-width: 100%; overscroll-behavior-inline: contain; }
.crm .table-footer { flex-wrap: wrap; gap: 12px; }
.crm .notice { font-size: 15px; }
.crm .detail-list dd { font-size: 16px; overflow-wrap: anywhere; }
.crm .brand-subtitle { font-size: 14px; letter-spacing: 1.2px; }
.crm .brand-mark, .crm.dark .brand-mark { background: #fff; padding: 8px 0; width: 210px; }
.crm .brand-logo { height: 84px; }
.crm .brand-fallback { color: #075b34; }
.crm .login-form-side { width: min(100%, 520px); padding: 24px 0 0; gap: 0; background: #fff; border-radius: 18px; box-shadow: 0 18px 55px #032e2040; }
.crm .login-brand .brand-mark { width: 300px; padding: 0; background: #fff; }
.crm .login-brand .brand-logo { height: 120px; }
.crm .login-brand .brand-subtitle { color: #536859; }
.crm .login-form-card { border: 0; box-shadow: none; padding-top: 26px; }
.crm .login-form-card > p { font-size: 16px; }
.crm .login-form-card .login-disclaimer { font-size: 14px; }
.crm .demo-role-options label { font-size: 14px; min-width: 0; }
.crm .login-options { flex-wrap: wrap; gap: 8px; }
.crm .dashboard-hero .button { margin: 4px 8px 0 0; }
.crm .badge-green, .crm .avatar-green { color: #226044; background: #e6f5ee; }
.crm .badge-amber, .crm .avatar-orange { color: #72500c; background: #fff4db; }
.crm .badge-blue, .crm .avatar-blue { color: #27538f; background: #e9f0ff; }
.crm .badge-red, .crm .button-danger { color: #9c344a; background: #fcecef; }
.crm .badge-gray { color: #575766; background: #f0f0f6; }
.crm .campaign-banner.green { color: #685517; }
.crm .campaign-banner.orange { color: #96383a; }
.crm .text-link { text-decoration: underline; text-underline-offset: 3px; }
.crm :focus-visible, .crm .field input:focus-visible, .crm .field select:focus-visible, .crm .field textarea:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 3px; box-shadow: 0 0 0 6px var(--surface);
}
.crm .sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0,0,0,0) !important; white-space: nowrap !important; border: 0 !important; }

/* Genuine Select2, styled to match the Frox fields and Tecnilor colours. */
.crm .select2-container { min-width: 0; font-size: 16px; vertical-align: top; }
.crm .filter-search { flex: 1 1 320px; min-width: 0; }
.crm .filter-bar > .select2-container { flex: 0 1 260px; }
.crm .filter-bar { flex-wrap: wrap; align-items: flex-start; }
.crm .select2-container--default .select2-selection--single,
.crm .select2-container--default .select2-selection--multiple {
  min-height: 48px; height: auto; border: 1px solid var(--control-border); border-radius: 8px; background: var(--surface); color: var(--text);
}
.crm .select2-container--default .select2-selection--single .select2-selection__rendered {
  line-height: 1.5; padding: 11px 40px 11px 12px; color: var(--text); white-space: normal; overflow-wrap: anywhere;
}
.crm .select2-container--default .select2-selection--single .select2-selection__placeholder { color: var(--muted); }
.crm .select2-container--default .select2-selection--single .select2-selection__arrow { width: 32px; height: 46px; }
.crm .select2-container--default .select2-selection--single .select2-selection__arrow b { border-color: var(--muted) transparent transparent; }
.crm .select2-container--default .select2-selection--single .select2-selection__clear {
  min-width: 32px; height: 32px; line-height: 32px; margin: -4px 0 -4px 8px; text-align: center; color: var(--text);
}
.crm .select2-dropdown { background: var(--surface); border: 1px solid var(--control-border); border-radius: 8px; color: var(--text); box-shadow: 0 12px 30px #173e2720; overflow: hidden; }
.crm .select2-search--dropdown { padding: 10px; }
.crm .select2-container--default .select2-search--dropdown .select2-search__field {
  height: 48px; padding: 10px 12px; border: 1px solid var(--control-border); border-radius: 6px; background: var(--surface); color: var(--text); font: inherit;
}
.crm .select2-container--default .select2-results > .select2-results__options { max-height: 320px; }
.crm .select2-results__option { padding: 12px 14px; min-height: 48px; line-height: 1.5; }
.crm .select2-container--default .select2-results__option[aria-selected="true"] { background: var(--brand-soft); color: var(--text); }
.crm .select2-container--default .select2-results__option--highlighted[aria-selected] { background: var(--brand); color: #fff; }
.crm.dark .select2-container--default .select2-results__option--highlighted[aria-selected] { color: #14331e; }
.crm .select2-container--default.select2-container--focus .select2-selection--multiple,
.crm .select2-container--open .select2-selection { border-color: var(--focus); }
.crm .select2-container--default .select2-selection--multiple .select2-selection__choice { background: var(--brand-soft); border-color: var(--control-border); color: var(--text); padding: 5px 8px; white-space: normal; }
.crm .select2-container--default .select2-selection--multiple .select2-selection__choice__remove { color: var(--text); min-width: 28px; padding: 0 6px; }
.crm .select2-container .select2-search--inline .select2-search__field { font: inherit; min-height: 36px; color: var(--text); background: transparent; margin-top: 5px; padding: 4px; border: none; box-shadow: none; }
.crm .select-product-result { display: flex; align-items: center; gap: 14px; }
.crm .select-product-result img { width: 48px; height: 48px; flex: 0 0 48px; object-fit: contain; border-radius: 5px; background: #fff; }
.crm .select-product-result strong { display: block; font-size: 16px; }
.crm .select-product-result small { display: block; font-size: 14px; color: inherit; }
.crm .chat-context .select2-container { flex: 1 1 200px; }

/* Real product photographs, with equal space for different packaging. */
.crm .product-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.crm .product-card { display: flex; flex-direction: column; }
.crm .product-card > .card-body { flex: 1; display: flex; flex-direction: column; }
.crm .product-photo { display: grid; place-items: center; height: 230px; padding: 18px; background: #fff; }
.crm .product-photo img { width: 100%; height: 100%; max-height: 194px; object-fit: contain; }
.crm .product-photo-small { height: 130px; padding: 8px; }
.crm .product-photo-small img { max-height: 114px; }
.crm .product-image-fallback { text-align: center; color: #536859; }
.crm .product-image-fallback small { display: block; }
.crm .product-category { font-size: 14px; color: var(--muted); }
.crm .product-card h3 { font-size: 19px; margin: 10px 0 8px; }
.crm .product-meta { font-size: 14px; line-height: 1.7; margin-bottom: 20px; }
.crm .product-order-action { margin-top: auto; }
.crm .product-order-action .button { width: 100%; }
.crm .product-card-footer { flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.crm .product-card-footer .button { font-size: 14px; }

/* Fast entry: quantities stay visible; commercial fields expand per product. */
.crm .order-client-grid { display: grid; grid-template-columns: minmax(0, 1fr) 180px; gap: 20px; align-items: start; }
.crm .order-layout { grid-template-columns: minmax(0, 1fr) 310px; }
.crm .order-layout > *, .crm .order-layout .stack { min-width: 0; }
.crm .order-lines { min-width: 600px; }
.crm .order-lines strong { font-size: 16px; min-width: 150px; }
.crm .order-lines .cell-note { white-space: normal; min-width: 150px; }
.crm .order-lines input { width: 78px; }
.crm .order-lines th, .crm .order-lines td { padding: 14px 10px; }
.crm .order-lines .line-conditions-button { font-size: 14px; min-height: 44px; padding: 8px 10px; }
.crm .order-empty { display: grid; justify-items: center; gap: 8px; padding: 18px 24px 32px; text-align: center; color: var(--muted); }
.crm .order-empty .icon { width: 32px; height: 32px; margin-bottom: 5px; color: var(--brand); }
.crm .order-empty p { font-size: 14px; }
.crm .line-commercial-row { background: var(--surface-muted); }
.crm .line-commercial-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; white-space: normal; text-align: left; padding: 8px 12px; }
.crm .line-commercial-grid input { width: 100%; }
.crm .line-commercial-grid label { font-size: 14px; }
.crm .order-extra > summary { padding: 20px 23px; cursor: pointer; font-weight: 600; font-size: 18px; }
.crm .order-extra > summary > span { display: block; font-size: 14px; font-weight: 400; color: var(--muted); padding-left: 21px; }
.crm .order-extra .card-body { padding-top: 0; }
.crm .order-extra h3 { margin: 24px 0 16px; }
.crm .order-extra h3:first-child { margin-top: 0; }
.crm .order-review .card-body { display: flex; flex-direction: column; align-items: stretch; gap: 14px; }
.crm .order-review .badge-status { align-self: flex-start; }
.crm .order-review .button { width: 100%; }
.crm .order-summary-client small, .crm .order-summary-client strong { display: block; }
.crm .order-summary-client small { color: var(--muted); font-size: 14px; }
.crm .order-summary-client strong { font-size: 18px; }
.crm .manual-totals summary { cursor: pointer; min-height: 44px; padding: 8px 0; font-weight: 600; }
.crm .summary-row { align-items: center; gap: 12px; }
.crm .summary-row label { font-size: 14px; }
.crm .manual-value { flex-shrink: 0; }
.crm #order-summary { scroll-margin-top: 24px; }

@media (max-width: 1440px) {
  .crm .topbar-location { display: none; }
}
@media (max-width: 1280px) {
  .crm .order-layout { grid-template-columns: minmax(0, 1fr); }
  .crm .order-layout .summary-sticky { position: static; }
}
@media (max-width: 1100px) {
  .crm .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 800px) {
  .crm .app-layout { grid-template-columns: minmax(0, 1fr); }
  .crm .sidebar { width: 270px; left: -280px; }
  .crm:not(.sidebar-open) .sidebar { visibility: hidden; }
  .crm .topbar { min-height: 76px; flex-wrap: nowrap; gap: 8px; }
  .crm .main-content { padding: 24px 18px; }
}
@media (max-width: 700px) {
  .crm .order-client-grid { grid-template-columns: minmax(0, 1fr); }
  .crm .order-client-grid .field:last-child { max-width: 220px; }
  .crm .order-lines { min-width: 0; white-space: normal; }
  .crm .order-lines thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  .crm .order-lines tbody { display: block; }
  .crm .order-lines [data-order-line] { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); padding: 14px; gap: 12px; border-top: 1px solid var(--border); }
  .crm .order-lines [data-order-line] td { display: block; padding: 0; border: 0; }
  .crm .order-lines [data-order-line] td:first-child { grid-column: 1/-1; }
  .crm .order-lines [data-order-line] td:nth-child(2)::before { content: 'Venda'; display: block; margin-bottom: 6px; font-size: 14px; }
  .crm .order-lines [data-order-line] td:nth-child(3)::before { content: 'Bónus'; display: block; margin-bottom: 6px; font-size: 14px; }
  .crm .order-lines [data-order-line] input { width: 100%; }
  .crm .order-lines [data-order-line] td:last-child { text-align: right; }
  .crm .line-commercial-row, .crm .line-commercial-row > td { display: block; width: 100%; }
  .crm .line-commercial-grid { grid-template-columns: minmax(0, 1fr); padding: 8px 4px; }
  .crm .filter-search { flex-basis: 100%; }
  .crm .filter-bar > .select2-container { flex-basis: 100%; }
}
@media (max-width: 540px) {
  .crm .topbar { padding: 10px 12px; }
  .crm .topbar-right { gap: 6px; }
  .crm .topbar .notification-button { display: none; }
  .crm .role-switch select { width: min(46vw, 205px); padding: 9px 7px; font-size: 14px; }
  .crm .heading-actions { justify-content: flex-start; }
  .crm .heading-actions .button { font-size: 15px; }
  .crm .card-body, .crm .card-heading { padding-left: 18px; padding-right: 18px; }
  .crm .login-layout { padding: 20px 12px; }
  .crm .login-form-side { padding: 18px 0 0; }
  .crm .login-brand .brand-mark { width: 260px; max-width: calc(100% - 32px); }
  .crm .login-brand .brand-logo { height: 104px; }
  .crm .login-form-card { padding: 24px 18px 20px; }
  .crm .demo-role-options { grid-template-columns: 1fr; gap: 8px; }
  .crm .demo-role-options label { flex-direction: row; justify-content: flex-start; gap: 12px; text-align: left; padding: 12px; }
  .crm .demo-role-options label br { display: none; }
  .crm .demo-role-options label br::after { content: ' '; }
  .crm .login-form-card > p { margin-bottom: 20px; }
  .crm .stats-grid { grid-template-columns: minmax(0,1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .crm *, .crm *::before, .crm *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
