/* ── RESET & BASE ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0D0D0D;
  --surface:     #151515;
  --surface-2:   #1E1E1E;
  --surface-3:   #272727;
  --border:      #2E2E2E;
  --border-2:    #3C3C3C;
  --text:        #F0F0F0;
  --text-2:      #909090;
  --text-3:      #606060;

  --mj:          #1068F8;
  --mj-soft:     rgba(16,104,248,.15);
  --mj-border:   rgba(16,104,248,.35);
  --camp:        #C2185B;
  --camp-soft:   rgba(194,24,91,.15);
  --camp-border: rgba(194,24,91,.35);
  --gil:         #7C3AED;
  --gil-soft:    rgba(124,58,237,.15);
  --gil-border:  rgba(124,58,237,.35);

  --s-pendente:    #71717A;
  --s-producao:    #F59E0B;
  --s-aprovado:    #22C55E;
  --s-agendado:    #A855F7;
  --s-publicado:   #06B6D4;

  --radius:   8px;
  --radius-sm: 4px;
  --radius-lg: 12px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

html, body { height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: var(--font); border: none; background: none; }

/* ── LAYOUT ──────────────────────────────────────────── */
#app { display: flex; flex-direction: column; height: 100vh; }

/* ── HEADER ──────────────────────────────────────────── */
.header {
  display: flex; align-items: center; gap: 24px;
  padding: 0 24px; height: 52px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  flex-shrink: 0; z-index: 10;
}
.header-left { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.logo-mark {
  width: 28px; height: 28px; border-radius: 6px;
  background: linear-gradient(135deg, var(--mj), var(--camp));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; letter-spacing: .5px;
}
.brand-name { font-size: 13px; font-weight: 600; color: var(--text); }
.nav { display: flex; gap: 2px; }
.nav-btn {
  padding: 5px 14px; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text-2); transition: all .15s;
}
.nav-btn:hover { color: var(--text); background: var(--surface-2); }
.nav-btn.active { color: var(--text); background: var(--surface-3); font-weight: 500; }
.header-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.current-date { font-size: 12px; color: var(--text-3); }
.refresh-btn {
  width: 28px; height: 28px; border-radius: var(--radius-sm);
  font-size: 16px; color: var(--text-2); display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.refresh-btn:hover { color: var(--text); background: var(--surface-2); }

/* ── MAIN ────────────────────────────────────────────── */
.main { flex: 1; overflow: hidden; }
.view { display: none; height: 100%; overflow-y: auto; padding: 24px; }
.view.active { display: block; }

/* ── CALENDAR ────────────────────────────────────────── */
.cal-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; flex-wrap: wrap; gap: 12px;
}
.cal-nav { display: flex; align-items: center; gap: 12px; }
.month-label { font-size: 18px; font-weight: 600; min-width: 180px; text-align: center; }
.month-btn {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  font-size: 18px; color: var(--text-2); display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); transition: all .15s;
}
.month-btn:hover { color: var(--text); background: var(--surface-2); }

.cal-legend { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.legend-dot {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block;
}
.legend-dot.mj { background: var(--mj); }
.legend-dot.campitelli { background: var(--camp); }
.legend-dot.carlos-gil { background: var(--gil); }
.status-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}
.status-dot.s-pendente  { background: var(--s-pendente); }
.status-dot.s-em-producao { background: var(--s-producao); }
.status-dot.s-aprovado  { background: var(--s-aprovado); }
.status-dot.s-agendado  { background: var(--s-agendado); }
.status-dot.s-publicado { background: var(--s-publicado); }
.gcal-dot {
  width: 10px; height: 10px; border-radius: 3px; display: inline-block;
  border: 1px dashed var(--border-2); background: rgba(255,255,255,.04);
}
.legend-text { font-size: 12px; color: var(--text-2); }
.legend-sep { color: var(--border-2); padding: 0 4px; }

.cal-grid-wrapper {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  grid-template-rows: auto;
}
.cal-header-cell {
  padding: 10px 0; text-align: center;
  font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-3); border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.cal-cells-wrapper {
  display: contents;
}
.cal-cell {
  min-height: 110px; padding: 8px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  transition: background .1s;
}
.cal-cell:nth-child(7n) { border-right: none; }
.cal-cell.empty { background: var(--bg); }
.cal-cell:not(.empty):hover { background: var(--surface-2); }
.cal-cell.today { background: rgba(16,104,248,.04); }

.cal-day-num {
  display: inline-block; font-size: 12px; font-weight: 500;
  color: var(--text-3); margin-bottom: 4px; line-height: 1;
}
.today-num {
  background: var(--mj); color: #fff;
  width: 20px; height: 20px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600;
}
.cal-posts { display: flex; flex-direction: column; gap: 2px; }
.post-pill {
  display: flex; align-items: center; gap: 4px; justify-content: space-between;
  padding: 3px 6px; border-radius: var(--radius-sm);
  font-size: 11px; cursor: pointer; border-left: 2px solid;
  transition: opacity .1s;
  overflow: hidden;
}
.post-pill:hover { opacity: .85; }
.post-pill.mj {
  background: var(--mj-soft); border-color: var(--mj); color: #90b8ff;
}
.post-pill.campitelli {
  background: var(--camp-soft); border-color: var(--camp); color: #f09ab8;
}
.post-pill.carlos-gil {
  background: var(--gil-soft); border-color: var(--gil); color: #c4b5fd;
}
/* Status left-border override */
.post-pill.s-pendente    { border-left-color: var(--s-pendente); }
.post-pill.s-em-producao { border-left-color: var(--s-producao); }
.post-pill.s-aprovado    { border-left-color: var(--s-aprovado); }
.post-pill.s-agendado    { border-left-color: var(--s-agendado); }
.post-pill.s-publicado   { border-left-color: var(--s-publicado); }
.pill-fmt { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill-time { font-size: 10px; color: var(--text-3); flex-shrink: 0; }

/* ── KANBAN ──────────────────────────────────────────── */
.kanban {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
  align-items: start;
}
.kanban-col {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  border-top: 3px solid transparent;
}
.kanban-col:has(#col-pendente)  { border-top-color: var(--s-pendente); }
.kanban-col:has(#col-andamento) { border-top-color: var(--s-producao); }
.kanban-col:has(#col-feito)     { border-top-color: var(--s-aprovado); }
.kanban-col-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.kanban-col-title { font-size: 13px; font-weight: 600; }
.kanban-col-count {
  font-size: 11px; font-weight: 600; color: var(--text-3);
  background: var(--surface-3); border-radius: 100px;
  padding: 1px 7px;
}
.kanban-col-actions { display: flex; align-items: center; gap: 6px; }
.add-task-btn {
  width: 22px; height: 22px; border-radius: var(--radius-sm);
  font-size: 16px; line-height: 1; color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); transition: all .15s;
}
.add-task-btn:hover { color: var(--text); background: var(--surface-3); border-color: var(--border-2); }
.kanban-cards { padding: 12px; display: flex; flex-direction: column; gap: 8px; min-height: 80px; }
.task-card {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 6px;
  transition: border-color .15s;
}
.task-card:hover { border-color: var(--border-2); }
.task-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.task-client {
  font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 4px;
}
.task-client.mj          { background: var(--mj-soft); color: #90b8ff; border: 1px solid var(--mj-border); }
.task-client.campitelli  { background: var(--camp-soft); color: #f09ab8; border: 1px solid var(--camp-border); }
.task-client.carlos-gil  { background: var(--gil-soft); color: #c4b5fd; border: 1px solid var(--gil-border); }
.task-resp { font-size: 11px; color: var(--text-3); }
.task-title { font-size: 13px; font-weight: 500; line-height: 1.4; }
.task-deadline { font-size: 11px; color: var(--text-3); }
.task-obs { font-size: 11px; color: var(--text-2); line-height: 1.4; margin-top: 2px; }
.empty-col { padding: 16px 0; text-align: center; color: var(--text-3); font-size: 12px; }

/* ── CLIENTS ─────────────────────────────────────────── */
.clients-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.client-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
}
.client-card:has(.mj-bar) {
  background: linear-gradient(145deg, rgba(16,104,248,.22) 0%, rgba(16,104,248,.08) 45%, var(--surface) 80%);
  border-color: rgba(16,104,248,.35);
}
.client-card:has(.campitelli-bar) {
  background: linear-gradient(145deg, rgba(194,24,91,.22) 0%, rgba(194,24,91,.08) 45%, var(--surface) 80%);
  border-color: rgba(194,24,91,.35);
}
.client-card:has(.carlos-gil-bar) {
  background: linear-gradient(145deg, rgba(124,58,237,.22) 0%, rgba(124,58,237,.08) 45%, var(--surface) 80%);
  border-color: rgba(124,58,237,.35);
}
.client-bar { height: 4px; }
.client-bar.mj-bar { background: linear-gradient(90deg, var(--mj), #60a5fa); }
.client-bar.campitelli-bar { background: linear-gradient(90deg, var(--camp), #f472b6); }
.client-bar.carlos-gil-bar { background: linear-gradient(90deg, var(--gil), #a78bfa); }
.client-body { padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.client-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.client-name { font-size: 17px; font-weight: 700; margin-bottom: 3px; }
.client-handle { font-size: 12px; color: var(--text-3); }
.client-badge {
  font-size: 11px; font-weight: 600; padding: 3px 10px;
  border-radius: 100px; flex-shrink: 0;
}
.client-badge.ativo { background: rgba(16,185,129,.15); color: #34d399; border: 1px solid rgba(16,185,129,.3); }
.client-badge.prospecto { background: rgba(245,158,11,.15); color: #fbbf24; border: 1px solid rgba(245,158,11,.3); }

.client-meta-grid { display: flex; flex-direction: column; gap: 6px; }
.meta-item { display: flex; gap: 8px; align-items: baseline; }
.meta-label { font-size: 11px; color: var(--text-3); min-width: 80px; flex-shrink: 0; }
.meta-val { font-size: 13px; font-weight: 500; }

.client-links { display: flex; flex-wrap: wrap; gap: 6px; }
.link-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 10px; border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 500;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-2); transition: all .15s;
}
.link-chip:hover { background: var(--surface-3); border-color: var(--border-2); color: var(--text); }

.client-assets-section { border-top: 1px solid var(--border); padding-top: 16px; }
.assets-title { font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 10px; text-transform: uppercase; letter-spacing: .06em; }
.assets-list { display: flex; flex-direction: column; gap: 5px; }
.asset-row {
  display: grid; grid-template-columns: 16px 1fr auto;
  gap: 6px; align-items: baseline; font-size: 12px; padding: 3px 0;
  border-bottom: 1px solid var(--border);
}
.asset-row:last-child { border-bottom: none; }
.asset-row.pending { color: var(--text-2); }
.asset-row.urgent  { color: var(--text); }
.asset-row.done { color: var(--text-3); text-decoration: line-through; }
.asset-icon { font-size: 11px; color: var(--text-3); }
.asset-row.urgent .asset-icon { color: #F59E0B; font-weight: 700; }
.asset-row.done .asset-icon { color: var(--s-publicado); }
.asset-src { font-size: 11px; color: var(--text-3); text-align: right; }

/* ── MODAL ───────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,.65); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal.hidden { display: none; }
.modal-box {
  background: var(--surface-2); border: 1px solid var(--border-2);
  border-radius: var(--radius-lg); padding: 24px; width: 100%; max-width: 440px;
  position: relative; box-shadow: 0 24px 64px rgba(0,0,0,.5);
}
.modal-close {
  position: absolute; top: 12px; right: 14px;
  font-size: 20px; color: var(--text-3); line-height: 1;
  width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); transition: all .15s;
}
.modal-close:hover { color: var(--text); background: var(--surface-3); }

.modal-header { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.modal-client {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  padding: 3px 8px; border-radius: 4px;
}
.modal-client.mj        { background: var(--mj-soft); color: #90b8ff; border: 1px solid var(--mj-border); }
.modal-client.campitelli { background: var(--camp-soft); color: #f09ab8; border: 1px solid var(--camp-border); }
.modal-client.carlos-gil { background: var(--gil-soft); color: #c4b5fd; border: 1px solid var(--gil-border); }
.modal-status {
  font-size: 12px; padding: 3px 10px; border-radius: 100px; font-weight: 500;
}
.modal-status.s-pendente    { background: rgba(107,114,128,.2); color: var(--s-pendente); }
.modal-status.s-em-producao { background: rgba(245,158,11,.15); color: var(--s-producao); }
.modal-status.s-aprovado    { background: rgba(34,197,94,.15); color: var(--s-aprovado); }
.modal-status.s-agendado    { background: rgba(139,92,246,.15); color: var(--s-agendado); }
.modal-status.s-publicado   { background: rgba(6,182,212,.15); color: var(--s-publicado); }

.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 16px; line-height: 1.3; }
.modal-rows { display: flex; flex-direction: column; gap: 8px; }
.modal-row {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 13px; padding: 6px 0; border-bottom: 1px solid var(--border);
}
.modal-row:last-child { border-bottom: none; }
.modal-row span:first-child { color: var(--text-3); flex-shrink: 0; }
.modal-row a { color: var(--mj); word-break: break-all; }
.modal-obs {
  margin-top: 12px; padding: 10px 12px;
  background: var(--surface-3); border-radius: var(--radius-sm);
  font-size: 12px; color: var(--text-2); line-height: 1.5;
}

/* ── GCAL PILL ───────────────────────────────────────── */
.post-pill.gcal {
  background: rgba(255,255,255,.04);
  border-left: 2px solid var(--text-3);
  border-top: 1px dashed var(--border-2);
  border-right: 1px dashed var(--border-2);
  border-bottom: 1px dashed var(--border-2);
  color: var(--text-2);
}
.post-pill.gcal:hover { opacity: .7; }

/* ── GCAL MODAL CLIENT BADGE ─────────────────────────── */
.modal-client.gcal {
  background: rgba(255,255,255,.08);
  color: var(--text-2);
  border: 1px solid var(--border-2);
}

/* ── TASK FORM ───────────────────────────────────────── */
.task-form { display: flex; flex-direction: column; gap: 16px; }
.task-form .modal-title { margin-bottom: 0; }
.form-fields { display: flex; flex-direction: column; gap: 10px; }
.form-row { display: flex; flex-direction: column; gap: 4px; }
.form-row label { font-size: 11px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.form-row input,
.form-row select,
.form-row textarea {
  background: var(--surface-3); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text); font-family: var(--font);
  font-size: 13px; padding: 8px 10px; width: 100%;
  transition: border-color .15s;
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus { outline: none; border-color: var(--mj); }
.form-row textarea { resize: vertical; min-height: 60px; }
.form-row select { appearance: none; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.btn-primary {
  padding: 7px 18px; border-radius: var(--radius-sm);
  background: var(--mj); color: #fff; font-size: 13px; font-weight: 600;
  transition: opacity .15s;
}
.btn-primary:hover { opacity: .88; }
.btn-secondary {
  padding: 7px 18px; border-radius: var(--radius-sm);
  background: var(--surface-3); color: var(--text-2); font-size: 13px;
  border: 1px solid var(--border); transition: all .15s;
}
.btn-secondary:hover { color: var(--text); border-color: var(--border-2); }
.task-local-badge {
  font-size: 9px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  background: rgba(245,158,11,.15); color: #F59E0B; border: 1px solid rgba(245,158,11,.3);
  border-radius: 3px; padding: 1px 5px;
}
.task-card .task-delete {
  font-size: 14px; color: var(--text-3); line-height: 1; margin-left: auto;
  opacity: 0; transition: opacity .15s;
}
.task-card:hover .task-delete { opacity: 1; }
.task-card .task-delete:hover { color: #ef4444; }

/* ── CLIENT ACTIONS ─────────────────────────────────────── */
.assets-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.assets-header .assets-title { margin-bottom: 0; }
.add-action-btn {
  width: 22px; height: 22px; border-radius: 4px;
  background: var(--surface-3); border: 1px solid var(--border);
  color: var(--text-2); font-size: 16px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.add-action-btn:hover { background: var(--mj); border-color: var(--mj); color: #fff; }

.asset-row { position: relative; }
.asset-row .asset-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.action-btns {
  display: none; gap: 2px; flex-shrink: 0; margin-left: auto;
}
.asset-row:hover .action-btns { display: flex; }
.asset-row:hover .asset-src   { display: none; }
.action-edit-btn,
.action-del-btn {
  font-size: 12px; padding: 1px 5px; border-radius: 3px;
  border: 1px solid var(--border); color: var(--text-3);
  background: var(--surface-3); transition: all .12s;
}
.action-edit-btn:hover { color: var(--text); border-color: var(--border-2); }
.action-del-btn:hover  { color: #ef4444; border-color: rgba(239,68,68,.4); }

/* ── TOAST ───────────────────────────────────────────── */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--surface-3); border: 1px solid var(--border-2);
  color: var(--text); padding: 10px 20px; border-radius: 100px;
  font-size: 13px; z-index: 200; transition: opacity .2s;
}
.toast.hidden { display: none; }

/* ── LOADING ─────────────────────────────────────────── */
.loading-bar {
  position: fixed; top: 0; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--mj), var(--camp));
  z-index: 50; animation: loading-slide 1s ease-in-out infinite alternate;
}
@keyframes loading-slide {
  from { opacity: .6; transform: scaleX(.3); transform-origin: left; }
  to   { opacity: 1;  transform: scaleX(1);  transform-origin: left; }
}

/* ── SCROLLBAR ───────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }
