/* =====================================================
   TRADE MANAGER · APP CORE
   Base visual global · Tablet / PC first
===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

:root{
  --bg:#f7f8fa;
  --surface:#ffffff;
  --surface-2:#fbfdfb;

  --primary:#0f6b57;
  --primary-dark:#084c3f;
  --primary-soft:#e8f5f1;
  --primary-2:#19a57d;

  --gold:#c9a34a;
  --gold-soft:#fff7df;

  --blue:#2f6fed;
  --blue-soft:#eef4ff;

  --success:#16a34a;
  --success-soft:#ecfdf5;

  --warning:#d97706;
  --warning-soft:#fff7ed;

  --danger:#dc2626;
  --danger-soft:#fee2e2;

  --text:#102027;
  --heading:#08241d;
  --muted:#64748b;
  --muted-2:#94a3b8;

  --line:rgba(15,23,42,.09);
  --line-soft:rgba(15,23,42,.06);

  --radius-sm:12px;
  --radius-md:16px;
  --radius-lg:20px;
  --radius-xl:24px;
  --radius-2xl:28px;

  --shadow-sm:0 8px 20px rgba(15,23,42,.055);
  --shadow:0 12px 30px rgba(15,23,42,.08);
  --shadow-lg:0 20px 50px rgba(15,23,42,.10);

  --sidebar-w:250px;
  --content-max:1360px;

  --sf-blue:var(--primary);
  --sf-blue-dark:var(--heading);
  --sf-cloud:var(--primary-soft);
  --sf-bg:var(--bg);

  --panel:var(--surface);
  --card:var(--surface);
  --ink:var(--text);
  --green:var(--primary);
  --green-2:var(--primary-2);
}

/* RESET */
*,
*::before,
*::after{
  box-sizing:border-box;
}

html,
body{
  width:100%;
  max-width:100%;
  min-height:100%;
  margin:0;
  overflow-x:hidden;
}

body{
  font-family:"Inter",system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  color:var(--text);
  background:
    radial-gradient(circle at 12% 0%,rgba(25,165,125,.13),transparent 30%),
    radial-gradient(circle at 82% 4%,rgba(201,163,74,.10),transparent 28%),
    linear-gradient(180deg,#f8faf9 0%,var(--bg) 100%);
  letter-spacing:-.01em;
}

button,
input,
select,
textarea{
  font-family:inherit;
}

button{
  cursor:pointer;
}

/* LAYOUT */
.app-shell{
  min-height:100vh;
  display:grid;
  grid-template-columns:var(--sidebar-w) minmax(0,1fr);
}

.main{
  min-width:0;
  padding:26px 28px;
}

.view-root{
  width:100%;
  max-width:100%;
  margin:0 auto;
}

.topbar{
  display:none;
}

/* SIDEBAR */
.sidebar,
.pro-sidebar{
  position:sticky;
  top:0;
  height:100vh;
  overflow:auto;
  width:var(--sidebar-w);
  min-width:var(--sidebar-w);
  padding:22px 18px;
  color:#fff;
  background:
    radial-gradient(circle at 18% 0%,rgba(255,255,255,.18),transparent 30%),
    linear-gradient(180deg,var(--primary) 0%,var(--primary-dark) 100%);
  box-shadow:16px 0 40px rgba(15,23,42,.12);
}

.brand,
.pro-brand{
  display:flex;
  align-items:center;
  gap:14px;
  margin-bottom:28px;
}

.brand-icon-wrap{
  width:58px;
  height:58px;
  display:grid;
  place-items:center;
  border-radius:18px;
  background:rgba(255,255,255,.96);
  box-shadow:0 14px 28px rgba(8,76,63,.20);
}

.brand img,
.pro-brand img{
  width:40px;
  height:40px;
  border-radius:13px;
}

.brand strong,
.pro-brand strong{
  display:block;
  color:#fff;
  font-size:23px;
  line-height:1;
  font-weight:950;
  letter-spacing:-.055em;
  text-transform:uppercase;
}

.brand span,
.pro-brand span{
  display:block;
  margin-top:7px;
  color:rgba(255,255,255,.72);
  font-size:11px;
  line-height:1.2;
  font-weight:800;
  letter-spacing:.11em;
  text-transform:uppercase;
}

.nav,
.pro-nav{
  display:grid;
  gap:9px;
}

.nav-btn,
.pro-nav .nav-btn{
  width:100%;
  min-height:46px;
  display:flex;
  align-items:center;
  gap:11px;
  padding:11px 14px;
  border:0;
  border-radius:15px;
  background:rgba(255,255,255,.08);
  color:rgba(255,255,255,.88);
  text-align:left;
  font-size:14px;
  font-weight:850;
  transition:.18s ease;
}

.nav-btn span{
  width:24px;
  display:inline-grid;
  place-items:center;
}

.nav-btn:hover{
  background:rgba(255,255,255,.14);
}

.nav-btn.active{
  position:relative;
  background:#fff;
  color:var(--primary-dark);
  box-shadow:0 16px 34px rgba(8,76,63,.24);
}

.nav-btn.active::before{
  content:"";
  position:absolute;
  left:-8px;
  top:12px;
  bottom:12px;
  width:4px;
  border-radius:999px;
  background:var(--gold);
}

.sidebar-footer-pro{
  margin-top:32px;
  padding-top:24px;
  border-top:1px solid rgba(255,255,255,.16);
}

.sidebar-footer-pro span{
  display:block;
  color:rgba(255,255,255,.58);
  font-size:10px;
  font-weight:900;
  letter-spacing:.18em;
}

.sidebar-footer-pro strong{
  display:block;
  margin-top:8px;
  color:#fff;
  font-size:12px;
  font-weight:850;
}

/* HERO GLOBAL */
.pro-hero,
.radar-sf-header,
.crm-dashboard-hero,
.panel-ops-head,
.suite-actas .crm-hero.pro-hero{
  min-height:128px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:24px;
  margin:0 0 18px;
  padding:24px 30px;
  border:1px solid var(--line-soft);
  border-radius:var(--radius-xl);
  background:
    radial-gradient(circle at 88% 12%,rgba(25,165,125,.14),transparent 32%),
    linear-gradient(135deg,var(--surface),var(--surface-2));
  box-shadow:var(--shadow);
}

.pro-eyebrow,
.radar-sf-title span,
.crm-dashboard-hero span,
.crm-section-head span,
.sf-field-label{
  display:block;
  margin:0 0 7px;
  color:var(--primary);
  font-size:11px;
  line-height:1;
  font-weight:950;
  letter-spacing:.18em;
  text-transform:uppercase;
}

.pro-hero h1,
.radar-sf-title h1,
.crm-dashboard-hero h2,
.panel-ops-head h1,
.suite-actas .crm-hero h1{
  margin:0;
  color:var(--heading);
  font-size:38px;
  line-height:1;
  font-weight:950;
  letter-spacing:-.055em;
}

.pro-hero p,
.radar-sf-title p,
.crm-dashboard-hero p,
.panel-ops-head p,
.suite-actas .crm-hero p{
  max-width:740px;
  margin:10px 0 0;
  color:var(--muted);
  font-size:15px;
  line-height:1.42;
  font-weight:650;
}

.radar-sf-title{
  display:flex;
  align-items:center;
  gap:16px;
}

.radar-sf-icon{
  width:64px;
  height:64px;
  display:grid;
  place-items:center;
  border-radius:21px;
  background:var(--primary-soft);
  color:var(--primary);
  font-size:28px;
}

/* BUTTONS */
.pro-btn,
.actas-primary-btn,
.panel-ops-btn.active{
  min-height:44px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:0 18px;
  border:0;
  border-radius:var(--radius-md);
  background:linear-gradient(135deg,var(--primary),var(--primary-2));
  color:#fff;
  font-size:14px;
  font-weight:900;
  box-shadow:0 14px 30px rgba(15,107,87,.22);
}

.ghost-btn,
.actas-secondary-btn,
.mini-btn,
.panel-ops-btn{
  min-height:42px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  padding:0 15px;
  border:1px solid var(--line);
  border-radius:var(--radius-md);
  background:#fff;
  color:var(--primary);
  font-size:13px;
  font-weight:850;
  box-shadow:var(--shadow-sm);
}

/* CARDS BASE */
.card,
.crm-client-filter-card,
.crm-client-table-card,
.radar-pro-card,
.panel-ops-card,
.panel-ops-left,
.panel-ops-right,
.panel-ops-center,
.actas-card,
.crm-dashboard-card,
.crm-route-block,
.crm-agenda-card,
.clientes-insight-pro{
  border:1px solid var(--line-soft);
  border-radius:var(--radius-lg);
  background:linear-gradient(180deg,var(--surface),var(--surface-2));
  box-shadow:var(--shadow);
}

.card{
  padding:18px;
}

.card-title{
  margin:0 0 10px;
  color:var(--heading);
  font-size:18px;
  font-weight:900;
}

/* CRM BASE */
.radar-salesforce-page,
.clientes-pro-page{
  display:grid;
  gap:18px;
}

.radar-sf-tabs{
  display:flex;
  justify-content:flex-end;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.crm-search,
.panel-ops-input{
  width:100%;
  min-height:54px;
  padding:0 16px;
  border:1px solid var(--line);
  border-radius:18px;
  background:#fff;
  color:var(--text);
  font-size:15px;
  font-weight:750;
  outline:none;
}

.crm-search:focus,
.panel-ops-input:focus,
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus{
  border-color:rgba(15,107,87,.35);
  box-shadow:0 0 0 4px rgba(15,107,87,.09);
}

.crm-filter-chips{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:14px;
}

.crm-filter-chip{
  min-height:40px;
  padding:0 15px;
  border:1px solid var(--line);
  border-radius:999px;
  background:#fff;
  color:var(--primary);
  font-size:13px;
  font-weight:900;
}

.crm-filter-chip.active{
  background:var(--primary);
  border-color:var(--primary);
  color:#fff;
}

.crm-section-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  margin-bottom:16px;
}

.crm-section-head h3{
  margin:0;
  color:var(--heading);
  font-size:20px;
  font-weight:950;
  letter-spacing:-.03em;
}

.crm-section-head strong{
  display:inline-flex;
  align-items:center;
  min-height:34px;
  padding:0 12px;
  border-radius:999px;
  background:var(--primary-soft);
  color:var(--primary);
  font-size:12px;
  font-weight:950;
}

/* TABLES */
.table-wrap{
  overflow:auto;
  border-radius:var(--radius-lg);
}

.table,
.crm-table,
.radar-table{
  width:100%;
  min-width:1120px;
  border-collapse:separate;
  border-spacing:0 10px;
}

.table th,
.crm-table thead th{
  padding:0 14px 8px;
  text-align:left;
  color:var(--muted);
  font-size:11px;
  font-weight:950;
  letter-spacing:.08em;
  text-transform:uppercase;
}

.table tbody tr,
.crm-table tbody tr{
  background:#fff;
  box-shadow:var(--shadow-sm);
}

.table td,
.crm-table tbody td{
  padding:15px 14px;
  border-top:1px solid var(--line-soft);
  border-bottom:1px solid var(--line-soft);
  color:var(--text);
  font-size:14px;
  font-weight:750;
  vertical-align:middle;
}

.table td:first-child,
.crm-table tbody td:first-child{
  border-left:1px solid var(--line-soft);
  border-radius:16px 0 0 16px;
}

.table td:last-child,
.crm-table tbody td:last-child{
  border-right:1px solid var(--line-soft);
  border-radius:0 16px 16px 0;
}

/* CLIENTE ROW BASE */
.cliente-pro-main{
  display:flex;
  align-items:center;
  gap:12px;
}

.cliente-pro-avatar{
  width:48px;
  height:48px;
  display:grid;
  place-items:center;
  border-radius:17px;
  background:var(--primary-soft);
  color:var(--primary);
  font-size:21px;
}

.cliente-pro-main strong{
  display:block;
  color:var(--heading);
  font-size:15px;
  font-weight:950;
}

.cliente-pro-main small{
  display:block;
  margin-top:3px;
  color:var(--muted);
  font-size:12px;
  font-weight:750;
}

.cliente-pro-chips,
.chip-list{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
}

.brand-chip,
.chip,
.badge,
.cliente-status-chip,
.cliente-potencial-chip,
.radar-status{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:27px;
  padding:5px 9px;
  border-radius:999px;
  background:var(--primary-soft);
  color:var(--primary);
  font-size:11px;
  font-weight:950;
  white-space:nowrap;
}

.radar-status.up,
.cliente-status-chip{
  background:var(--success-soft);
  color:var(--success);
}

.radar-status.same,
.cliente-potencial-chip{
  background:var(--warning-soft);
  color:var(--warning);
}

/* FORMS */
.form-grid,
.actas-form-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:12px;
}

.form-full,
.actas-field.form-full{
  grid-column:1 / -1;
}

.form-field,
.actas-field{
  display:grid;
  gap:6px;
}

.form-field label,
.actas-field label{
  color:var(--muted);
  font-size:11px;
  font-weight:950;
  letter-spacing:.08em;
  text-transform:uppercase;
}

.form-field input,
.form-field select,
.form-field textarea,
.actas-field input,
.actas-field select,
.actas-field textarea,
textarea{
  width:100%;
  min-height:50px;
  padding:0 14px;
  border:1px solid var(--line);
  border-radius:var(--radius-md);
  background:#fff;
  color:var(--text);
  font-size:14px;
  font-weight:750;
  outline:none;
}

textarea,
.form-field textarea,
.actas-field textarea{
  min-height:98px;
  padding:13px 14px;
  resize:vertical;
}

/* DRAWER BASE */
.drawer-backdrop{
  position:fixed;
  inset:0;
  z-index:50;
  background:rgba(15,32,39,.38);
  opacity:0;
  pointer-events:none;
  transition:.2s ease;
}

.drawer-backdrop.show{
  opacity:1;
  pointer-events:auto;
}

.drawer{
  position:fixed;
  top:0;
  right:0;
  z-index:60;
  width:min(760px,100%);
  height:100vh;
  padding:24px;
  overflow:auto;
  background:var(--surface);
  box-shadow:-24px 0 70px rgba(15,23,42,.22);
  transform:translateX(100%);
  transition:.24s ease;
}

.drawer.show{
  transform:translateX(0);
}

.drawer-head{
  display:flex;
  justify-content:space-between;
  gap:16px;
  align-items:flex-start;
  margin-bottom:18px;
}

.drawer-title{
  margin:0;
  color:var(--heading);
  font-size:30px;
  font-weight:950;
  letter-spacing:-.05em;
}

.drawer-subtitle{
  margin:6px 0 0;
  color:var(--muted);
  font-weight:750;
}

.drawer-close{
  width:42px;
  height:42px;
  border:1px solid var(--line);
  border-radius:14px;
  background:#fff;
  color:var(--primary);
  font-size:24px;
  font-weight:900;
}

/* ACTAS BASE */
.suite-actas{
  max-width:var(--content-max);
  margin:0 auto;
  display:grid;
  gap:18px;
}

.actas-subnav,
.crm-subnav{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  padding:8px;
  border:1px solid var(--line-soft);
  border-radius:var(--radius-lg);
  background:#fff;
  box-shadow:var(--shadow);
}

.actas-subnav-btn{
  min-height:44px;
  padding:0 16px;
  border:0;
  border-radius:14px;
  background:transparent;
  color:var(--primary);
  font-size:13px;
  font-weight:900;
}

.actas-subnav-btn.active{
  background:var(--primary);
  color:#fff;
}

.actas-chips,
.crm-chip-grid{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
}

.acta-chip,
.actas-chip{
  min-height:38px;
  padding:8px 11px;
  border:1px solid var(--line);
  border-radius:999px;
  background:#fff;
  color:var(--primary);
  font-size:12px;
  font-weight:900;
}

.acta-chip.active,
.actas-chip.active{
  background:var(--primary);
  border-color:var(--primary);
  color:#fff;
}

.actas-preview,
.acta-output{
  white-space:pre-wrap;
  min-height:240px;
  padding:16px;
  border-radius:18px;
  background:#102027;
  color:#f8fafc;
  font-family:ui-monospace,SFMono-Regular,Menlo,monospace;
  font-size:13px;
  line-height:1.6;
}

/* PANEL ANDALUCÍA BASE */
.panel-ops{
  max-width:var(--content-max);
  margin:0 auto;
}

.panel-ops-shell{
  display:grid;
  grid-template-columns:280px minmax(520px,1fr) 340px;
  gap:16px;
  align-items:stretch;
}

.panel-ops-left,
.panel-ops-right{
  padding:20px;
}

.panel-ops-center{
  overflow:hidden;
  min-height:650px;
}

.panel-ops-map{
  width:100%;
  height:650px;
}

/* TOAST */
.toast{
  position:fixed;
  right:22px;
  bottom:22px;
  z-index:100;
  max-width:420px;
  padding:14px 16px;
  border-radius:16px;
  background:var(--heading);
  color:#fff;
  font-weight:850;
  box-shadow:var(--shadow-lg);
  opacity:0;
  transform:translateY(10px);
  pointer-events:none;
  transition:.2s ease;
}

.toast.show{
  opacity:1;
  transform:translateY(0);
}

/* TABLET / PC */
@media(max-width:1200px){
  :root{
    --sidebar-w:230px;
  }

  .main{
    padding:22px;
  }

  .radar-sf-kpis,
  .crm-dashboard-kpis,
  .panel-ops-kpis{
    grid-template-columns:repeat(3,minmax(0,1fr));
  }

  .panel-ops-shell{
    grid-template-columns:260px minmax(0,1fr);
  }

  .panel-ops-right{
    grid-column:1 / -1;
  }
}

@media(max-width:900px){
  .app-shell{
    grid-template-columns:1fr;
  }

  .sidebar,
  .pro-sidebar{
    position:static;
    width:100%;
    min-width:100%;
    height:auto;
  }

  .nav,
  .pro-nav{
    display:flex;
    overflow:auto;
    padding-bottom:4px;
  }

  .nav-btn{
    white-space:nowrap;
  }

  .main{
    padding:18px;
  }

  .pro-hero,
  .radar-sf-header,
  .crm-dashboard-hero,
  .panel-ops-head{
    flex-direction:column;
    align-items:flex-start;
  }

  .pro-hero h1,
  .radar-sf-title h1,
  .crm-dashboard-hero h2,
  .panel-ops-head h1{
    font-size:32px;
  }

  .radar-sf-kpis,
  .crm-dashboard-kpis,
  .panel-ops-kpis{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

  .form-grid,
  .actas-form-grid,
  .panel-ops-shell{
    grid-template-columns:1fr;
  }
}