/* Auto-generated by scripts/css_mechanical_split.py
   Source: crm-ui.css
   Part 2/2 - load order critical.
   Do not reorder or merge without re-running the splitter. */

@media (max-width: 480px){
  .ui-card{
    padding:14px !important;
  }

  .ui-panel,
  .ui-kpi{
    padding:12px !important;
  }

  .ui-btn{
    width:100%;
    justify-content:center;
  }

  .flex.flex-wrap.gap-2 > .ui-btn,
  .flex.flex-wrap.gap-3 > .ui-btn{
    flex:1 1 100%;
  }
}


/* ===== CRM MOBILE BASELINE ===== */
@media (max-width: 768px){
  html,
  body{
    overflow-x:hidden !important;
  }

  main{
    width:100% !important;
    max-width:100% !important;
  }

  .ui-card,
  .ui-panel,
  .ui-kpi{
    border-radius:18px !important;
  }

  .ui-card{
    padding:16px !important;
  }

  .ui-panel,
  .ui-kpi{
    padding:14px !important;
  }

  .ui-btn{
    min-height:40px !important;
    white-space:normal !important;
    text-align:center !important;
  }

  .ui-btn-sm{
    min-height:34px !important;
  }

  table{
    min-width:720px;
  }

  .overflow-x-auto{
    -webkit-overflow-scrolling:touch;
  }

  .app-page-hero{
    margin-bottom:10px !important;
  }

  .page-intro-title,
  .app-page-hero-title{
    font-size:22px !important;
    line-height:1.15 !important;
  }

  .page-intro-subtitle{
    line-height:1.55 !important;
  }

  .ui-badge{
    max-width:100%;
    white-space:normal !important;
  }

  input,
  select,
  textarea{
    font-size:16px !important;
  }
}

@media (max-width: 480px){
  .ui-card{
    padding:14px !important;
  }

  .ui-panel,
  .ui-kpi{
    padding:12px !important;
  }

  .ui-btn{
    width:100%;
    justify-content:center;
  }

  .flex.flex-wrap.gap-2 > .ui-btn,
  .flex.flex-wrap.gap-3 > .ui-btn{
    flex:1 1 100%;
  }
}



/* ===== CRM MOBILE MENU + BUTTON WIDTH FIX ===== */
@media (max-width: 768px){
  .app-mobile-menu{
    position:relative;
    z-index:80;
  }

  .app-mobile-menu summary{
    list-style:none;
    cursor:pointer;
    user-select:none;
  }

  .app-mobile-menu summary::-webkit-details-marker{
    display:none;
  }

  .app-mobile-menu-trigger{
    width:auto !important;
    min-width:86px !important;
    justify-content:center !important;
  }

  .app-mobile-menu-panel{
    position:absolute;
    top:calc(100% + 10px);
    right:0;
    width:min(82vw, 320px);
    display:grid;
    gap:6px;
    padding:10px;
    border-radius:18px;
    background:var(--surface-1);
    border:1px solid var(--border-1);
    box-shadow:var(--shadow-2);
    -webkit-backdrop-filter:var(--crm-blur);
    backdrop-filter:var(--crm-blur);
  }

  .app-mobile-menu-panel a{
    display:block;
    padding:11px 12px;
    border-radius:12px;
    color:var(--text-1) !important;
    text-decoration:none !important;
    font-size:14px;
    font-weight:700;
    background:var(--surface-2);
    border:1px solid var(--border-1);
  }

  .app-mobile-menu-panel a:active{
    transform:scale(.99);
  }

  .app-bottom-nav{
    display:none !important;
  }

  main{
    padding-bottom:24px !important;
  }

  .ui-card .flex.items-center.justify-between .ui-btn,
  .ui-card .flex.items-start.justify-between .ui-btn,
  .ui-panel .flex.items-center.justify-between .ui-btn,
  .ui-panel .flex.items-start.justify-between .ui-btn{
    width:auto !important;
    flex:0 0 auto !important;
    min-width:auto !important;
    padding-left:12px !important;
    padding-right:12px !important;
  }
}

@media (max-width: 480px){
  .ui-btn{
    width:auto !important;
  }

  .flex.flex-wrap.gap-2 > .ui-btn,
  .flex.flex-wrap.gap-3 > .ui-btn{
    flex:0 0 auto !important;
  }

  form.w-full .ui-btn,
  form.w-full button.ui-btn,
  .lg\:w-56 .ui-btn{
    width:100% !important;
  }
}


/* ===== CRM MOBILE CLEAN OPAQUE HEADER ===== */
@media (max-width: 768px){
  .app-topbar{
    background:rgba(7,12,24,.96) !important;
    border-bottom:1px solid rgba(255,255,255,.10) !important;
    box-shadow:0 10px 28px rgba(2,6,23,.18) !important;
    -webkit-backdrop-filter:none !important;
    backdrop-filter:none !important;
  }

  html[data-preset="light"] .app-topbar,
  body[data-preset="light"] .app-topbar{
    background:#ffffff !important;
    border-bottom:1px solid rgba(15,23,42,.10) !important;
  }

  .app-mobile-menu-panel{
    background:rgba(7,12,24,.98) !important;
    -webkit-backdrop-filter:none !important;
    backdrop-filter:none !important;
  }

  html[data-preset="light"] .app-mobile-menu-panel,
  body[data-preset="light"] .app-mobile-menu-panel{
    background:#ffffff !important;
  }

  .app-mobile-menu-panel a{
    background:rgba(255,255,255,.06) !important;
  }

  html[data-preset="light"] .app-mobile-menu-panel a,
  body[data-preset="light"] .app-mobile-menu-panel a{
    background:#f8fafc !important;
  }

  body.app-shell{
    background:#070a12 !important;
  }

  html[data-preset="light"] body.app-shell,
  body[data-preset="light"].app-shell{
    background:#f6f8fb !important;
  }

  .app-bg{
    background:transparent !important;
  }
}


/* ===== CRM MOBILE FIXED TOPBAR ===== */
@media (max-width: 768px){
  .app-topbar{
    position:fixed !important;
    top:0 !important;
    left:0 !important;
    right:0 !important;
    z-index:1000 !important;
  }

  main{
    padding-top:76px !important;
  }

  .app-mobile-menu-panel{
    z-index:1100 !important;
  }
}


/* ============================================================
   CRM THEME CONTROL — CLEAN FINAL LAYER
   Unico livello finale.
   Il tema reale è body[data-theme="light-soft"] oppure body[data-theme="dark"].
   data-preset governa il colore/palette, NON chiaro/scuro.
   ============================================================ */

/* ---------- TOKEN TEMA ---------- */

body[data-theme="light-soft"]{
  --crm-surface-1:
    radial-gradient(circle at 12% 0%, rgba(15,107,75,.055), transparent 36%),
    radial-gradient(circle at 92% 90%, rgba(37,99,235,.040), transparent 36%),
    linear-gradient(135deg, rgba(255,255,255,.46), rgba(241,245,249,.24)),
    rgba(255,255,255,.18);

  --crm-surface-2:
    linear-gradient(135deg, rgba(255,255,255,.34), rgba(241,245,249,.18)),
    rgba(255,255,255,.12);

  --crm-surface-3:
    linear-gradient(135deg, rgba(255,255,255,.28), rgba(241,245,249,.14)),
    rgba(255,255,255,.09);

  --crm-border-1: rgba(255,255,255,.46);
  --crm-border-2: rgba(255,255,255,.32);
  --crm-shadow-1: 0 16px 42px rgba(15,23,42,.085), inset 0 1px 0 rgba(255,255,255,.54);
  --crm-shadow-2: 0 10px 24px rgba(15,23,42,.055), inset 0 1px 0 rgba(255,255,255,.42);

  --crm-text-1: #0f172a;
  --crm-text-2: #334155;
  --crm-text-3: #64748b;

  --crm-input-bg: rgba(255,255,255,.32);
}

body[data-theme="dark"]{
  --crm-surface-1:
    radial-gradient(circle at 12% 0%, rgba(15,107,75,.18), transparent 36%),
    radial-gradient(circle at 92% 90%, rgba(37,99,235,.10), transparent 36%),
    linear-gradient(135deg, rgba(15,23,42,.76), rgba(2,6,23,.84)),
    rgba(15,23,42,.72);

  --crm-surface-2:
    linear-gradient(135deg, rgba(15,23,42,.64), rgba(2,6,23,.70)),
    rgba(15,23,42,.56);

  --crm-surface-3:
    linear-gradient(135deg, rgba(15,23,42,.50), rgba(2,6,23,.58)),
    rgba(15,23,42,.42);

  --crm-border-1: rgba(148,163,184,.18);
  --crm-border-2: rgba(148,163,184,.12);
  --crm-shadow-1: 0 18px 46px rgba(0,0,0,.32), inset 0 1px 0 rgba(255,255,255,.045);
  --crm-shadow-2: 0 10px 26px rgba(0,0,0,.24), inset 0 1px 0 rgba(255,255,255,.035);

  --crm-text-1: #f8fafc;
  --crm-text-2: #cbd5e1;
  --crm-text-3: #94a3b8;

  --crm-input-bg: rgba(2,6,23,.34);
}

/* ---------- LIVELLO 1: contenitori principali ---------- */

body[data-theme] .app-topbar,
body[data-theme] .ui-card,
body[data-theme] .dashboard-hero,
body[data-theme] .dashboard-panel,
body[data-theme] .pe-hero,
body[data-theme] .pe-row,
body[data-theme] .pe-super,
body[data-theme] .pe-filters,
body[data-theme] .import-wizard-card,
body[data-theme] .theme-preset-card,
body[data-theme] .agency-card,
body[data-theme] .agency-list-card{
  background: var(--crm-surface-1) !important;
  border: 1px solid var(--crm-border-1) !important;
  box-shadow: var(--crm-shadow-1) !important;
  color: var(--crm-text-1) !important;
  border-radius: 28px !important;
  backdrop-filter: blur(24px) saturate(1.08) !important;
  -webkit-backdrop-filter: blur(24px) saturate(1.08) !important;
}

/* ---------- LIVELLO 2: box interni / kpi / celle ---------- */

body[data-theme] .ui-panel,
body[data-theme] .ui-kpi,
body[data-theme] .ui-soft,
body[data-theme] .dashboard-kpi,
body[data-theme] .pe-stat,
body[data-theme] .pe-toolbar,
body[data-theme] .pe-box,
body[data-theme] .pe-portal-card,
body[data-theme] .pe-switch,
body[data-theme] .pe-notebox,
body[data-theme] .pe-breakdown,
body[data-theme] .pe-components,
body[data-theme] .import-wizard-soft,
body[data-theme] .cometa-section-toggle,
body[data-theme] .cometa-preview-table thead tr,
body[data-theme] .cometa-preview-table tbody tr,
body[data-theme] .pipeline-card,
body[data-theme] .pipeline-summary-pill,
body[data-theme] .theme-preset-card .ui-panel{
  background: var(--crm-surface-2) !important;
  border: 1px solid var(--crm-border-2) !important;
  box-shadow: var(--crm-shadow-2) !important;
  color: var(--crm-text-1) !important;
  border-radius: 22px !important;
  backdrop-filter: blur(18px) saturate(1.05) !important;
  -webkit-backdrop-filter: blur(18px) saturate(1.05) !important;
}

/* ---------- Testi ---------- */

body[data-theme] h1,
body[data-theme] h2,
body[data-theme] h3,
body[data-theme] h4,
body[data-theme] .ui-title,
body[data-theme] .dashboard-title,
body[data-theme] .dashboard-kpi-value,
body[data-theme] .pipeline-title,
body[data-theme] .pipeline-card-title,
body[data-theme] .pipeline-card-count,
body[data-theme] .pe-title,
body[data-theme] .pe-stat-v,
body[data-theme] .pe-annuncio-title,
body[data-theme] .pe-quality-percent,
body[data-theme] .pe-date,
body[data-theme] .pe-count,
body[data-theme] .pe-portal-name,
body[data-theme] .pe-notebox-title{
  color: var(--crm-text-1) !important;
}

body[data-theme] .ui-muted,
body[data-theme] .ui-subtle,
body[data-theme] .dashboard-subtitle,
body[data-theme] .dashboard-kpi-label,
body[data-theme] .pipeline-subtitle,
body[data-theme] .pipeline-card-count-label,
body[data-theme] .pipeline-card-value-label,
body[data-theme] .pe-sub,
body[data-theme] .pe-eyebrow,
body[data-theme] .pe-stat-k,
body[data-theme] .pe-annuncio-addr,
body[data-theme] .text-slate-400,
body[data-theme] .text-slate-500,
body[data-theme] .text-slate-300{
  color: var(--crm-text-2) !important;
}

/* ---------- Input / select ---------- */

body[data-theme] input,
body[data-theme] select,
body[data-theme] textarea,
body[data-theme] .ui-input,
body[data-theme] .pe-input,
body[data-theme] .pe-select,
body[data-theme] .import-wizard-field{
  background: var(--crm-input-bg) !important;
  color: var(--crm-text-1) !important;
  border: 1px solid var(--crm-border-2) !important;
  box-shadow: var(--crm-shadow-2) !important;
  border-radius: 16px !important;
}

body[data-theme="light-soft"] input::placeholder,
body[data-theme="light-soft"] textarea::placeholder{
  color:#64748b !important;
}

body[data-theme="dark"] input::placeholder,
body[data-theme="dark"] textarea::placeholder{
  color:#94a3b8 !important;
}

/* ---------- Bottoni / badge ---------- */

body[data-theme] .ui-btn-primary,
body[data-theme] .crm-mini-btn.primary,
body[data-theme] button[type="submit"].ui-btn-primary{
  color:#fff !important;
  background:linear-gradient(180deg,#2563eb,#1d4ed8) !important;
  border-color:rgba(255,255,255,.20) !important;
  box-shadow:0 12px 28px rgba(37,99,235,.24) !important;
}

body[data-theme] .ui-btn-ghost,
body[data-theme] .ui-btn-muted,
body[data-theme] .crm-mini-btn:not(.primary){
  background:var(--crm-surface-2) !important;
  color:var(--crm-text-1) !important;
  border:1px solid var(--crm-border-2) !important;
  box-shadow:var(--crm-shadow-2) !important;
}

body[data-theme] .crm-property-chip,
body[data-theme] .crm-property-deal,
body[data-theme] .crm-property-state-pill,
body[data-theme] .ui-badge{
  color:#fff !important;
  text-shadow:none !important;
}

/* ---------- Import card: sempre stondato ---------- */

body[data-theme] .import-wizard-card,
body[data-theme] section.import-wizard-card{
  border-radius:28px !important;
  overflow:hidden !important;
}



/* CRM GLOBAL CONTRAST FINAL GUARD
   Non governa le row immobili: quelle sono nel template, dopo questo file.
   Qui si correggono solo testi generali. */
body[data-theme="dark"]{
  --crm-text-1:#f8fafc;
  --crm-text-2:#cbd5e1;
  --crm-text-3:#94a3b8;
}

body[data-theme="light-soft"]{
  --crm-text-1:#0f172a;
  --crm-text-2:#334155;
  --crm-text-3:#64748b;
}
