/* ============================================================
   MKT HUB — Stylesheet Principal
   ============================================================ */

:root {
  --purple:    #534AB7; --purple-bg: #EEEDFE; --purple-text: #3C3489;
  --blue:      #185FA5; --blue-bg:   #E6F1FB; --blue-text:   #0C447C;
  --teal:      #0F6E56; --teal-bg:   #E1F5EE; --teal-text:   #085041;
  --coral:     #993C1D; --coral-bg:  #FAECE7; --coral-text:  #711B13;
  --amber:     #854F0B; --amber-bg:  #FAEEDA; --amber-text:  #633806;
  --green:     #3B6D11; --green-bg:  #EAF3DE; --green-text:  #27500A;
  --red:       #A32D2D; --red-bg:    #FCEBEB; --red-text:    #791F1F;
  --gray:      #5F5E5A; --gray-bg:   #F1EFE8; --gray-text:   #2C2C2A;

  --bg:        #F5F4F0;
  --surface:   #FFFFFF;
  --surface2:  #F8F7F4;
  --border:    rgba(60,58,55,.12);
  --border2:   rgba(60,58,55,.24);
  --text:      #1A1917;
  --text2:     #6B6A65;
  --text3:     #9B9A96;

  --radius:    10px;
  --radius-sm: 6px;
  --shadow:    0 1px 3px rgba(0,0,0,.08), 0 1px 6px rgba(0,0,0,.04);
  --sidebar-w: 220px;
  --topbar-h:  56px;
  --font:      -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #18181A; --surface: #222224; --surface2: #2A2A2C;
    --border: rgba(255,255,255,.09); --border2: rgba(255,255,255,.16);
    --text: #ECEAE6; --text2: #9B9A96; --text3: #6B6A65;
  }
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { font-family: var(--font); background: var(--bg); color: var(--text); line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
img { max-width: 100%; display: block; }

/* ---- SCROLLBAR ---- */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ============================================================
   LAYOUT
   ============================================================ */
.app-layout { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  background: var(--surface); border-right: .5px solid var(--border);
  display: flex; flex-direction: column; position: fixed;
  top: 0; left: 0; height: 100vh; z-index: 200; overflow-y: auto;
  transition: transform .25s;
}
.sidebar-logo { padding: 20px 16px 14px; border-bottom: .5px solid var(--border); }
.logo-mark { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.logo-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--purple); flex-shrink: 0; }
.logo-sub { font-size: 10px; color: var(--text3); margin-top: 2px; }
.sidebar-nav { flex: 1; padding: 8px 0; }
.nav-section { padding: 14px 16px 4px; font-size: 10px; font-weight: 600; color: var(--text3); letter-spacing: .07em; text-transform: uppercase; }
.nav-item { display: flex; align-items: center; gap: 9px; padding: 8px 12px; border-radius: var(--radius-sm); color: var(--text2); margin: 1px 8px; font-size: 13px; transition: all .14s; }
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--purple-bg); color: var(--purple-text); font-weight: 500; }
.nav-item i { font-size: 16px; width: 18px; flex-shrink: 0; }
.nav-badge { margin-left: auto; background: var(--red-bg); color: var(--red-text); border-radius: 10px; padding: 1px 7px; font-size: 10px; font-weight: 600; }
.sidebar-user { padding: 12px 14px; border-top: .5px solid var(--border); display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex-shrink: 0; }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 10px; color: var(--text3); }
.user-logout { color: var(--text3); font-size: 17px; padding: 4px; border-radius: 6px; transition: all .14s; display: flex; align-items: center; }
.user-logout:hover { background: var(--surface2); color: var(--red); }
.sidebar-toggle { display: none; background: none; border: none; font-size: 20px; color: var(--text2); padding: 6px; border-radius: 6px; }

/* MAIN AREA */
.main-area { margin-left: var(--sidebar-w); flex: 1; min-height: 100vh; display: flex; flex-direction: column; }

/* TOPBAR */
.topbar { height: var(--topbar-h); background: var(--surface); border-bottom: .5px solid var(--border); display: flex; align-items: center; gap: 12px; padding: 0 24px; position: sticky; top: 0; z-index: 100; }
.topbar-title { font-size: 15px; font-weight: 500; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.notif-btn { position: relative; font-size: 19px; color: var(--text2); padding: 6px; border-radius: 8px; display: flex; align-items: center; transition: all .14s; }
.notif-btn:hover { background: var(--surface2); color: var(--text); }
.notif-count { position: absolute; top: 2px; right: 2px; width: 15px; height: 15px; background: var(--red); color: white; border-radius: 50%; font-size: 9px; display: flex; align-items: center; justify-content: center; font-weight: 700; }

/* PAGE CONTENT */
.page-content { padding: 24px; flex: 1; }

/* FLASH */
.flash { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 24px; font-size: 13px; }
.flash button { background: none; border: none; font-size: 16px; opacity: .5; cursor: pointer; }
.flash-success { background: var(--green-bg); color: var(--green-text); border-bottom: 1px solid #C0DD97; }
.flash-error   { background: var(--red-bg); color: var(--red-text); border-bottom: 1px solid #F7C1C1; }
.flash-warning { background: var(--amber-bg); color: var(--amber-text); border-bottom: 1px solid #FAC775; }

/* ============================================================
   COMPONENTES
   ============================================================ */

/* BADGES */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 500; }
.badge-purple { background: var(--purple-bg); color: var(--purple-text); }
.badge-blue   { background: var(--blue-bg);   color: var(--blue-text); }
.badge-teal   { background: var(--teal-bg);   color: var(--teal-text); }
.badge-coral  { background: var(--coral-bg);  color: var(--coral-text); }
.badge-amber  { background: var(--amber-bg);  color: var(--amber-text); }
.badge-green  { background: var(--green-bg);  color: var(--green-text); }
.badge-red    { background: var(--red-bg);    color: var(--red-text); }
.badge-gray   { background: var(--gray-bg);   color: var(--gray-text); }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; cursor: pointer; border: .5px solid var(--border2); background: var(--surface2); color: var(--text); transition: all .14s; text-decoration: none; }
.btn:hover { background: var(--surface); box-shadow: var(--shadow); }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--purple-bg); color: var(--purple-text); border-color: #AFA9EC; }
.btn-primary:hover { background: #CECBF6; }
.btn-danger  { background: var(--red-bg); color: var(--red-text); border-color: #F7C1C1; }
.btn-danger:hover { background: #F7C1C1; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-icon { padding: 7px; }
.btn i { font-size: 15px; }

/* CARDS */
.card { background: var(--surface); border: .5px solid var(--border); border-radius: var(--radius); }
.card-header { padding: 16px 20px; border-bottom: .5px solid var(--border); display: flex; align-items: center; gap: 10px; }
.card-title { font-size: 14px; font-weight: 500; flex: 1; }
.card-body { padding: 20px; }

/* KPI GRID */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.kpi-card { background: var(--surface); border: .5px solid var(--border); border-radius: var(--radius); padding: 16px; }
.kpi-label { font-size: 11px; font-weight: 600; color: var(--text3); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.kpi-value { font-size: 28px; font-weight: 500; line-height: 1; }
.kpi-sub { font-size: 11px; color: var(--text3); margin-top: 6px; }

/* PROGRESS BAR */
.progress { background: var(--surface2); border-radius: 4px; height: 6px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; transition: width .5s; }

/* CLIENT GRID */
.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.client-card { background: var(--surface); border: .5px solid var(--border); border-radius: var(--radius); padding: 18px; transition: all .14s; cursor: pointer; }
.client-card:hover { box-shadow: var(--shadow); border-color: var(--border2); }
.client-avatar { width: 42px; height: 42px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; flex-shrink: 0; }

/* SERVICE PILLS */
.service-pills { display: flex; flex-wrap: wrap; gap: 5px; }
.service-pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 20px; font-size: 11px; font-weight: 500; }

/* TABLE */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data-table th { padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 600; color: var(--text3); border-bottom: .5px solid var(--border); text-transform: uppercase; letter-spacing: .05em; }
table.data-table td { padding: 12px 14px; border-bottom: .5px solid var(--border); vertical-align: middle; }
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr:hover td { background: var(--surface2); }

/* FLOW STEPS */
.flow-steps { display: flex; flex-direction: column; }
.step-row { display: flex; align-items: flex-start; gap: 14px; padding: 14px 0; border-bottom: .5px solid var(--border); position: relative; }
.step-row:last-child { border-bottom: none; }
.step-num { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex-shrink: 0; color: white; }
.step-connector { position: absolute; left: 13px; top: 42px; bottom: 0; width: 1.5px; background: var(--border2); }
.step-row:last-child .step-connector { display: none; }
.step-body { flex: 1; min-width: 0; }
.step-name { font-size: 13px; font-weight: 500; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.step-meta { font-size: 11px; color: var(--text3); display: flex; gap: 14px; flex-wrap: wrap; }

/* KANBAN */
.kanban-board { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.kanban-col { min-width: 250px; max-width: 280px; background: var(--surface2); border-radius: var(--radius); padding: 14px; flex-shrink: 0; }
.kanban-col-header { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; font-size: 12px; font-weight: 600; color: var(--text2); }
.kanban-count { background: var(--surface); border: .5px solid var(--border); border-radius: 10px; padding: 0 7px; font-size: 10px; font-weight: 500; color: var(--text3); }
.kanban-card { background: var(--surface); border: .5px solid var(--border); border-radius: var(--radius-sm); padding: 12px; margin-bottom: 8px; cursor: pointer; transition: all .14s; }
.kanban-card:hover { box-shadow: var(--shadow); border-color: var(--border2); }
.kanban-card-title { font-size: 12px; font-weight: 500; margin-bottom: 8px; }
.kanban-card-meta { font-size: 11px; color: var(--text3); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mini-avatar { width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 600; flex-shrink: 0; }

/* ALERTS */
.alerts-list { display: flex; flex-direction: column; gap: 10px; }
.alert-card { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; background: var(--surface); border: .5px solid var(--border); border-radius: var(--radius); border-left: 3px solid; transition: all .14s; }
.alert-card:hover { box-shadow: var(--shadow); }
.alert-card.danger  { border-left-color: var(--red); }
.alert-card.warning { border-left-color: #EF9F27; }
.alert-card.info    { border-left-color: var(--blue); }
.alert-icon { font-size: 17px; margin-top: 1px; flex-shrink: 0; }
.alert-card.danger  .alert-icon { color: var(--red); }
.alert-card.warning .alert-icon { color: #BA7517; }
.alert-card.info    .alert-icon { color: var(--blue); }
.alert-title { font-size: 13px; font-weight: 500; margin-bottom: 2px; }
.alert-sub { font-size: 11px; color: var(--text3); }

/* TIMELINE */
.timeline { display: flex; flex-direction: column; }
.tl-row { display: flex; gap: 12px; padding: 8px 0; }
.tl-dot-wrap { display: flex; flex-direction: column; align-items: center; width: 22px; flex-shrink: 0; }
.tl-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.tl-line { flex: 1; width: 1.5px; background: var(--border); min-height: 12px; }
.tl-body { flex: 1; padding-bottom: 4px; }
.tl-title { font-size: 12px; font-weight: 500; }
.tl-sub { font-size: 11px; color: var(--text3); }
.tl-time { font-size: 10px; color: var(--text3); margin-top: 2px; }

/* TWO-COL */
.two-col { display: grid; grid-template-columns: 1fr 340px; gap: 20px; }

/* FORMS */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--text2); margin-bottom: 5px; }
.form-control { width: 100%; border: .5px solid var(--border2); border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13px; background: var(--surface2); color: var(--text); outline: none; transition: border .14s; }
.form-control:focus { border-color: var(--purple); background: var(--surface); }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6' stroke='%23888' stroke-width='1.5' fill='none'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; padding: 6px 12px; border: .5px solid var(--border); border-radius: 20px; }
.form-check input { cursor: pointer; }
.form-footer { display: flex; gap: 10px; justify-content: flex-end; padding-top: 8px; }

/* MODAL */
.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 500; align-items: center; justify-content: center; padding: 16px; }
.modal-backdrop.open { display: flex; }
.modal-box { background: var(--surface); border-radius: 14px; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: 0 8px 32px rgba(0,0,0,.18); }
.modal-header { padding: 18px 22px; border-bottom: .5px solid var(--border); display: flex; align-items: center; gap: 12px; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-title { font-size: 15px; font-weight: 500; flex: 1; }
.modal-close { background: none; border: none; font-size: 20px; color: var(--text3); padding: 4px 8px; border-radius: 6px; transition: all .14s; line-height: 1; }
.modal-close:hover { background: var(--surface2); color: var(--text); }
.modal-body { padding: 20px 22px; }

/* UPLOAD AREA */
.upload-area { border: 1.5px dashed var(--border2); border-radius: var(--radius); padding: 24px; text-align: center; cursor: pointer; transition: all .14s; color: var(--text3); }
.upload-area:hover, .upload-area.drag-over { border-color: var(--purple); background: var(--purple-bg); color: var(--purple-text); }
.upload-area i { font-size: 24px; margin-bottom: 6px; }

/* CALENDAR */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-day-label { text-align: center; font-size: 10px; font-weight: 600; color: var(--text3); padding: 8px 4px; text-transform: uppercase; }
.cal-cell { padding: 6px; min-height: 70px; border-right: .5px solid var(--border); border-top: .5px solid var(--border); }
.cal-cell:nth-child(7n) { border-right: none; }
.cal-num { font-size: 11px; color: var(--text3); margin-bottom: 3px; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.cal-num.today { background: var(--purple); color: white; font-weight: 700; }
.cal-event { font-size: 9px; padding: 2px 5px; border-radius: 3px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }

/* PAGE HEADER */
.page-header { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.page-header-title { font-size: 20px; font-weight: 500; flex: 1; }
.page-header-sub { font-size: 13px; color: var(--text3); }

/* SECTION HEADER */
.section-header { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.section-title { font-size: 14px; font-weight: 500; flex: 1; }

/* COMMENT */
.comment-item { display: flex; gap: 10px; margin-bottom: 14px; }
.comment-bubble { flex: 1; background: var(--surface2); border-radius: 0 8px 8px 8px; padding: 10px 12px; }
.comment-bubble.internal { border-left: 3px solid var(--amber); }
.comment-header { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.comment-author { font-size: 12px; font-weight: 600; }
.comment-time { font-size: 11px; color: var(--text3); }
.comment-text { font-size: 13px; color: var(--text2); }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text3); }
.empty-state i { font-size: 36px; margin-bottom: 10px; opacity: .4; }
.empty-state p { font-size: 14px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.15); }
  .main-area { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .client-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .page-content { padding: 14px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi-value { font-size: 22px; }
  .topbar { padding: 0 14px; gap: 8px; }
}
