/* =====================================================
   PLANO EFICAZ — Design System (style.css)
   ===================================================== */

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

/* ── TOKENS ─────────────────────────────────────────── */
/* ==========================================================
   PLANO EFICAZ V3.6 — LAYOUT CONFIRMADO (SCROLL + RODAPE)
   ========================================================== */
:root {
  --bg:        #0b0e14;
  --bg2:       #111520;
  --bg3:       #171c28;
  --surface:   rgba(255,255,255,0.04);
  --surface2:  rgba(255,255,255,0.08);
  --border:    rgba(255,255,255,0.08);
  --border2:   rgba(255,255,255,0.14);

  --gold:      #f5c842;
  --gold-dim:  rgba(245,200,66,0.15);
  --gold-glow: rgba(245,200,66,0.3);

  --green:     #4ade80;
  --green-dim: rgba(74,222,128,0.12);
  --red:       #f87171;
  --red-dim:   rgba(248,113,113,0.12);
  --blue:      #60a5fa;
  --blue-dim:  rgba(96,165,250,0.12);
  --purple:    #a78bfa;

  --text:      #e8eaf0;
  --text2:     #9aa0b4;
  --text3:     #5a6278;

  --r-sm:      6px;
  --r-md:      10px;
  --r-lg:      16px;
  --r-xl:      22px;

  --shadow-sm: 0 2px 8px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.6);
  --shadow-gold: 0 0 20px rgba(245,200,66,0.2);

  --header-h: 58px;
  --panel-left-w: 280px;
  --panel-mid-w: 190px;
}

/* ── RESET & BASE ────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none; /* Impede seleção global */
  -webkit-user-select: none;
  touch-action: manipulation; /* Melhora resposta ao toque */
}

input, textarea, .meta-slot.filled .slot-text, [contenteditable="true"] {
  user-select: text !important; /* Permite seleção onde necessário */
  -webkit-user-select: text !important;
}

button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* ── SCREENS ─────────────────────────────────────────── */
.screen { display: none; width: 100%; height: 100dvh; }
.screen.active { display: flex; }

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

/* ════════════════════════════════════════════════════════
   AUTH SCREEN
   ════════════════════════════════════════════════════════ */
#screen-auth {
  background: radial-gradient(ellipse 80% 60% at 50% 0%, rgba(245,200,66,0.1) 0%, transparent 70%), var(--bg);
  align-items: center;
  justify-content: center;
}

.auth-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  width: 100%;
  max-width: 420px;
  padding: 24px;
}

.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.auth-logo-icon {
  width: 64px; height: 64px;
  background: linear-gradient(135deg, var(--gold) 0%, #e8a800 100%);
  border-radius: var(--r-xl);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  box-shadow: 0 0 40px var(--gold-glow);
}
.auth-logo h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}
.auth-logo p {
  font-size: 13px;
  color: var(--text2);
  text-align: center;
}

.auth-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 28px;
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-card label {
  font-size: 12px;
  color: var(--text2);
  font-weight: 500;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.auth-input-group { display: flex; flex-direction: column; gap: 6px; }
.auth-input {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  color: var(--text);
  font-size: 15px;
  transition: border-color 0.2s;
  outline: none;
}
.auth-input:focus { border-color: var(--gold); }

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--gold) 0%, #e8a800 100%);
  color: #1a1200;
  font-weight: 700;
  font-size: 15px;
  padding: 13px;
  border-radius: var(--r-md);
  transition: opacity 0.2s, transform 0.15s;
  letter-spacing: 0.2px;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.auth-divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text3); font-size: 12px;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.btn-google {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 13px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  transition: background 0.2s, border-color 0.2s;
}
.btn-google:hover { background: rgba(255,255,255,0.1); border-color: var(--border2); }

.auth-msg {
  text-align: center;
  font-size: 13px;
  padding: 12px;
  border-radius: var(--r-md);
  display: none;
}
.auth-msg.success { background: var(--green-dim); color: var(--green); display: block; }
.auth-msg.error   { background: var(--red-dim); color: var(--red); display: block; }

/* ════════════════════════════════════════════════════════
   ONBOARDING SCREEN
   ════════════════════════════════════════════════════════ */
#screen-onboarding {
  background: radial-gradient(ellipse 60% 40% at 50% 20%, rgba(245,200,66,0.08) 0%, transparent 70%), var(--bg);
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.onboard-wrap {
  width: 100%;
  max-width: 600px;
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: center;
}

.onboard-badge {
  background: var(--gold-dim);
  border: 1px solid rgba(245,200,66,0.3);
  color: var(--gold);
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.onboard-wrap h2 {
  font-size: 32px;
  font-weight: 800;
  color: var(--text);
  text-align: center;
  letter-spacing: -0.5px;
  line-height: 1.2;
}
.onboard-wrap p {
  color: var(--text2);
  font-size: 15px;
  text-align: center;
  line-height: 1.7;
  max-width: 480px;
}

.onboard-textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
  resize: vertical;
  min-height: 140px;
  outline: none;
  transition: border-color 0.2s;
}
.onboard-textarea:focus { border-color: var(--gold); }
.onboard-textarea::placeholder { color: var(--text3); }

.onboard-skip {
  color: var(--text3);
  font-size: 13px;
  padding: 8px;
  transition: color 0.2s;
}
.onboard-skip:hover { color: var(--text2); }

/* ════════════════════════════════════════════════════════
   MAIN SCREEN — STRUCTURE
   ════════════════════════════════════════════════════════ */
#screen-main {
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

/* ── APP HEADER ──────────────────────────────────────── */
#app-header {
  height: var(--header-h);
  min-height: var(--header-h);
  background: rgba(11,14,20,0.8);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 0 20px;
  gap: 12px;
  z-index: 100;
}

.header-brand {
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.header-brand-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--gold), #e8a800);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.header-brand-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}

.header-week-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 5px 10px;
}
.btn-week-nav {
  width: 28px; height: 28px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  color: var(--text2);
  transition: background 0.15s, color 0.15s;
}
.btn-week-nav:hover { background: var(--surface2); color: var(--text); }
#week-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  min-width: 180px;
  text-align: center;
}
#week-label span {
  font-size: 11px;
  font-weight: 400;
  color: var(--text3);
  display: block;
}

.header-actions {
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0;
}
.header-btn {
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text2);
  font-size: 16px;
  transition: all 0.15s;
}
.header-btn:hover { background: var(--surface2); color: var(--text); border-color: var(--border2); }

.save-indicator {
  font-size: 12px;
  color: var(--text3);
  display: flex; align-items: center; gap: 5px;
  opacity: 0;
  transition: opacity 0.3s;
}
.save-indicator.visible { opacity: 1; }
.save-indicator.saving { color: var(--gold); }
.save-indicator.saved  { color: var(--green); }

/* ════════════════════════════════════════════════════════
   DESKTOP LAYOUT
   ════════════════════════════════════════════════════════ */
#desktop-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  height: calc(100dvh - var(--header-h));
}

/* ── LEFT PANEL: PAPÉIS & METAS ──────────────────────── */
#panel-roles {
  width: var(--panel-left-w);
  min-width: var(--panel-left-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  height: 100% !important;
}

.panel-header {
  padding: 14px 14px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.panel-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text3);
}

.btn-add-small {
  width: 24px; height: 24px;
  border-radius: var(--r-sm);
  background: var(--gold-dim);
  color: var(--gold);
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
  font-weight: 300;
}
.btn-add-small:hover { background: rgba(245,200,66,0.25); }

#roles-list {
  flex: 1 !important;
  min-height: 0 !important;
  overflow-y: auto !important;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.papel-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: border-color 0.2s;
}
.papel-card:hover { border-color: var(--border2); }

.papel-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  cursor: pointer;
}
.papel-reorder {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex-shrink: 0;
}
.btn-ord {
  width: 16px; height: 13px;
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  font-size: 8px;
  color: var(--text3);
  transition: all 0.12s;
  line-height: 1;
}
.btn-ord:hover:not([disabled]) { background: var(--surface2); color: var(--text); }
.btn-ord[disabled] { opacity: 0.18; cursor: not-allowed; }

.papel-icone {
  width: 26px; height: 26px;
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
}
.papel-nome {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.papel-actions-grp {
  display: flex; gap: 2px;
  opacity: 0;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.papel-header:hover .papel-actions-grp { opacity: 1; }
.btn-edit-papel, .btn-del-papel {
  width: 20px; height: 20px;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px;
  color: var(--text3);
  transition: all 0.12s;
}
.btn-edit-papel:hover { background: var(--surface2); color: var(--text); }
.btn-del-papel:hover  { background: var(--red-dim); color: var(--red); }

/* ── 3 SLOTS DE METAS (Accordion Support) ──────────── */
.metas-slots {
  padding: 0 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: all 0.3s ease;
  overflow: hidden;
}
.metas-slots.collapsed {
  display: none !important;
}
/* Estilo para a setinha de expandir */
.papel-header::after {
  content: '▼';
  font-size: 8px;
  color: var(--text3);
  margin-left: auto;
  transition: transform 0.3s;
}
.papel-header.expanded::after {
  transform: rotate(180deg);
  color: var(--gold);
}
.meta-slot {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 8px;
  border-radius: var(--r-sm);
  min-height: 32px;
  transition: all 0.15s;
}
.meta-slot.filled {
  background: var(--bg3);
  border: 1px solid var(--border);
  cursor: grab;
}
.meta-slot.filled:hover {
  background: var(--surface2);
  border-color: var(--border2);
}
.meta-slot.filled.dragging { opacity: 0.4; cursor: grabbing; }
.meta-slot.filled.concluida .slot-text { text-decoration: line-through; opacity: 0.5; }
.meta-slot.empty {
  border: 1px dashed var(--border);
  cursor: pointer;
  opacity: 0.6;
}
.meta-slot.empty:hover {
  border-color: var(--gold);
  opacity: 1;
  background: var(--gold-dim);
}
.slot-num {
  width: 17px; height: 17px;
  border-radius: 50%;
  background: var(--gold-dim);
  color: var(--gold);
  font-size: 9px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.meta-slot.empty .slot-num { background: var(--surface); color: var(--text3); }
.slot-text {
  flex: 1; font-size: 12px; color: var(--text); line-height: 1.35;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.slot-add { flex: 1; font-size: 12px; color: var(--text3); }
.slot-actions {
  display: flex; gap: 2px;
  opacity: 0; transition: opacity 0.15s; flex-shrink: 0;
}
.meta-slot.filled:hover .slot-actions { opacity: 1; }
.slot-btn {
  width: 17px; height: 17px;
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; color: var(--text3);
  transition: all 0.12s;
  line-height: 1;
}
.slot-btn:hover:not([disabled]) { background: var(--surface2); color: var(--text); }
.slot-btn[disabled] { opacity: 0.18; cursor: not-allowed; }
.slot-btn.sc:hover { color: var(--green); }
.slot-btn.sx:hover { color: var(--red); }

/* antigos .meta-chip removidos — substituídos por .meta-slot */

/* Afine o Instrumento */
.sharpen-saw {
  margin-top: auto !important;
  padding: 15px;
  background: var(--bg) !important;
  border-top: 1px solid var(--border);
  flex-shrink: 0 !important;
  max-height: 200px; /* Garante que nunca cresça demais */
  overflow: hidden;
}
.sharpen-title { 
  font-size: 11px; 
  font-weight: 700; 
  color: var(--text2); 
  margin-bottom: 0px; 
  text-transform: uppercase; 
  letter-spacing: 0.5px;
  transition: color 0.2s;
}
.sharpen-title::after {
  content: '▲';
  font-size: 8px;
  transition: transform 0.3s;
}
.sharpen-title.collapsed::after {
  transform: rotate(180deg);
}

.saw-items { 
  display: flex !important; 
  flex-direction: column; 
  gap: 8px; 
  margin-top: 12px;
  transition: all 0.3s ease;
}
.saw-items.collapsed {
  display: none !important;
}
.saw-item { display: flex; flex-direction: column; gap: 4px; }
.saw-label { font-size: 10px; color: var(--text3); font-weight: 600; }
.saw-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  color: var(--text);
  font-size: 12px;
  transition: all 0.2s;
}
.saw-input:focus { border-color: var(--gold); outline: none; background: var(--bg); }

/* ── CENTER PANEL: PRIORIDADES DA SEMANA ─────────────── */
#panel-priorities {
  width: var(--panel-mid-w);
  min-width: var(--panel-mid-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#week-priorities-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.priority-drop-zone {
  flex: 1;
  min-height: 60px;
  border-radius: var(--r-md);
  border: 2px dashed transparent;
  transition: border-color 0.2s, background 0.2s;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px;
}
.priority-drop-zone.drag-over {
  border-color: var(--gold);
  background: var(--gold-dim);
}

.priority-item {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  padding: 8px 9px;
  border-radius: var(--r-sm);
  background: var(--bg3);
  border: 1px solid var(--border);
  cursor: grab;
  transition: background 0.15s;
}
.priority-item:hover { background: var(--surface2); }
.priority-item-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--gold);
  min-width: 16px;
  margin-top: 1px;
}
.priority-item-text {
  flex: 1;
  font-size: 12px;
  color: var(--text);
  line-height: 1.4;
}
.priority-item-del {
  opacity: 0;
  color: var(--text3);
  font-size: 12px;
  width: 16px; height: 16px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 3px;
  transition: all 0.15s;
}
.priority-item:hover .priority-item-del { opacity: 1; }
.priority-item-del:hover { color: var(--red); background: var(--red-dim); }

.priority-empty-slot {
  height: 32px;
  border: 1px dashed var(--border);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text3);
  font-size: 11px;
}

/* ── RIGHT PANEL: CALENDAR ───────────────────────────── */
#panel-calendar {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.calendar-grid-wrap {
  flex: 1;
  overflow: auto;
}

.calendar-grid {
  display: grid;
  grid-template-columns: 44px repeat(7, 1fr);
  min-width: 680px;
}

/* Day headers */
.cal-corner { 
  position: sticky; top: 0; left: 0; z-index: 12;
  background: var(--bg2); border-bottom: 1px solid var(--border); border-right: 1px solid var(--border);
}
.cal-day-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: 10px 6px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.cal-day-name {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text3);
}
.cal-day-date {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.cal-day-header.today .cal-day-date {
  color: var(--gold);
  text-shadow: var(--shadow-gold);
}
.cal-day-header.today .cal-day-name { color: var(--gold); }
.cal-day-header.past { opacity: 0.5; }

/* Prioridade do Dia row */
.cal-section-label {
  grid-column: 1;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  position: sticky; left: 0; z-index: 8;
  display: flex; align-items: center; justify-content: center;
  padding: 4px 2px;
}
.cal-section-label span {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text3);
  writing-mode: vertical-rl;
  text-orientation: mixed;
}

.cal-priority-row {
  grid-column: span 1;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border2);
  min-height: 72px;
  background: rgba(245,200,66,0.02);
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.cal-priority-row.drag-over {
  background: var(--gold-dim);
  outline: 2px dashed var(--gold);
  outline-offset: -2px;
}

.cal-priority-chip {
  background: var(--gold-dim);
  border: 1px solid rgba(245,200,66,0.2);
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 11px;
  color: var(--gold);
  line-height: 1.3;
  cursor: pointer;
  transition: background 0.15s;
  display: flex; align-items: flex-start; gap: 5px;
}
.cal-priority-chip:hover { background: rgba(245,200,66,0.25); }
.cal-priority-chip.concluida { opacity: 0.5; text-decoration: line-through; }
.cal-priority-chip .chip-del {
  opacity: 0;
  color: var(--gold);
  font-size: 10px;
  margin-left: auto;
  transition: opacity 0.15s;
}
.cal-priority-chip:hover .chip-del { opacity: 1; }

/* Reuniões row label */
.cal-meetings-row {
  grid-column: 1 / -1;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 4px 10px;
  display: flex; align-items: center; gap: 6px;
}
.cal-meetings-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text3);
}

/* Hour rows */
.cal-time-label {
  grid-column: 1;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  position: sticky; left: 0; z-index: 8;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 4px 0;
  font-size: 10px;
  font-weight: 600;
  color: var(--text3);
  padding-top: 6px;
}

.cal-hour-slot {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  min-height: 52px;
  padding: 3px;
  position: relative;
  transition: background 0.15s;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
}
.cal-hour-slot:hover { background: var(--surface); }
.cal-hour-slot.drag-over {
  background: var(--blue-dim);
  outline: 2px dashed var(--blue);
  outline-offset: -2px;
}
.cal-hour-slot.now-line::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--red);
  z-index: 5;
}

.cal-event {
  border-radius: 4px;
  padding: 3px 6px;
  font-size: 11px;
  line-height: 1.3;
  cursor: pointer;
  display: flex; align-items: flex-start; gap: 4px;
  transition: opacity 0.15s;
  position: relative;
}
.cal-event.meta-link { 
  background: var(--blue-dim);
  border: 1px solid rgba(96,165,250,0.25);
  color: var(--blue);
}
.cal-event.free-text {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}
.cal-event.concluido { opacity: 0.45; }
.cal-event.concluido .ev-text { text-decoration: line-through; }
.cal-event.late .ev-text { color: var(--red); }
.ev-check { font-size: 10px; margin-top: 1px; flex-shrink: 0; }
.ev-text { flex: 1; }
.ev-del {
  opacity: 0;
  font-size: 10px;
  margin-left: auto;
  transition: opacity 0.15s;
  flex-shrink: 0;
}
.cal-event:hover .ev-del { opacity: 1; }

/* Noite row */
.cal-noite-slot {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  min-height: 60px;
  padding: 3px;
  background: rgba(96,165,250,0.02);
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
}
.cal-noite-slot:hover { background: rgba(96,165,250,0.05); }
.cal-noite-slot.drag-over {
  background: var(--blue-dim);
  outline: 2px dashed var(--blue);
  outline-offset: -2px;
}
.cal-noite-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-top: 4px;
  display: flex; align-items: center; justify-content: center;
}

/* ════════════════════════════════════════════════════════
   MOBILE LAYOUT
   ════════════════════════════════════════════════════════ */
#mobile-layout {
  display: none;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
}

/* ── DAY TABS ─────────────────────────────────────────── */
.mobile-day-tabs {
  display: flex;
  overflow-x: auto;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  scrollbar-width: none;
  flex-shrink: 0;
}
.mobile-day-tabs::-webkit-scrollbar { display: none; }

.mobile-day-tab {
  flex-shrink: 0;
  flex: 1;
  min-width: 52px;
  display: flex; flex-direction: column; align-items: center;
  padding: 10px 6px;
  gap: 3px;
  border-bottom: 2px solid transparent;
  transition: border-color 0.2s;
  cursor: pointer;
}
.mobile-day-tab.active { border-bottom-color: var(--gold); }
.mobile-day-tab.today .tab-date { color: var(--gold); }
.tab-name { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text3); font-weight: 600; }
.mobile-day-tab.active .tab-name { color: var(--gold); }
.tab-date { font-size: 18px; font-weight: 700; color: var(--text); line-height: 1; }
.tab-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--text3); opacity: 0;
}
.tab-dot.has-items { opacity: 1; background: var(--gold); }

/* ── PROGRESS BAR ─────────────────────────────────────── */
.mobile-progress {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.progress-bar-wrap {
  flex: 1;
  height: 5px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), #e8a800);
  border-radius: 99px;
  transition: width 0.5s ease;
}
.progress-text {
  font-size: 12px;
  color: var(--text2);
  white-space: nowrap;
}
.progress-status {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 99px;
}
.progress-status.on-track { background: var(--green-dim); color: var(--green); }
.progress-status.late     { background: var(--red-dim); color: var(--red); }
.progress-status.ahead    { background: var(--blue-dim); color: var(--blue); }

/* ── MOBILE DAY VIEW ──────────────────────────────────── */
.mobile-day-view {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.mobile-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text3);
  margin-bottom: 6px;
  display: flex; align-items: center; gap: 6px;
}
.mobile-section-title::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.mobile-priority-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: all 0.15s;
}
.mobile-priority-item.concluido {
  opacity: 0.5;
  border-color: var(--green);
  background: var(--green-dim);
}
.mobile-priority-item.late {
  border-left: 3px solid var(--red);
}
.mobile-priority-checkbox {
  width: 20px; height: 20px;
  border: 2px solid var(--border2);
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.15s;
}
.mobile-priority-item.concluido .mobile-priority-checkbox {
  background: var(--green);
  border-color: var(--green);
  color: white;
}
.mobile-priority-info { flex: 1; }
.mobile-priority-role {
  font-size: 10px;
  color: var(--text3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.mobile-priority-text {
  font-size: 14px;
  color: var(--text);
  line-height: 1.4;
  margin-top: 2px;
}
.mobile-priority-item.concluido .mobile-priority-text { text-decoration: line-through; }

.mobile-hour-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.mobile-hour-label {
  width: 36px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text3);
  padding-top: 11px;
  text-align: right;
  flex-shrink: 0;
}
.mobile-hour-content {
  flex: 1;
  min-height: 42px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 8px 11px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mobile-hour-content.now-highlight {
  border-color: var(--red);
  background: var(--red-dim);
}
.mobile-hour-content.empty { opacity: 0.4; }
.mobile-event-item {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  padding: 2px 0;
}
.mobile-event-item.concluido { text-decoration: line-through; opacity: 0.5; }
.mobile-event-check { font-size: 12px; }
.mobile-empty-hint { font-size: 12px; color: var(--text3); }

/* ════════════════════════════════════════════════════════
   MODALS
   ════════════════════════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 24px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 16px;
  animation: slideUp 0.2s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}

.modal-field { display: flex; flex-direction: column; gap: 6px; }
.modal-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.modal-input {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  width: 100%;
}
.modal-input:focus { border-color: var(--gold); }

.modal-actions {
  display: flex; gap: 10px; justify-content: flex-end;
}
.btn-cancel {
  padding: 9px 16px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text2);
  font-size: 14px;
  transition: all 0.15s;
}
.btn-cancel:hover { border-color: var(--border2); color: var(--text); }
.btn-confirm {
  padding: 9px 20px;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--gold), #e8a800);
  color: #1a1200;
  font-size: 14px;
  font-weight: 700;
  transition: opacity 0.15s;
}
.btn-confirm:hover { opacity: 0.9; }

/* Emoji grid for icons */
.emoji-grid {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.emoji-opt {
  width: 34px; height: 34px;
  border-radius: var(--r-sm);
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  cursor: pointer;
  transition: all 0.15s;
}
.emoji-opt:hover, .emoji-opt.selected {
  background: var(--gold-dim);
  border-color: var(--gold);
}

/* Color picker */
.color-picker-row { display: flex; gap: 8px; }
.color-opt {
  width: 26px; height: 26px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s;
}
.color-opt.selected { border-color: white; transform: scale(1.15); }

/* ════════════════════════════════════════════════════════
   TOAST
   ════════════════════════════════════════════════════════ */
#toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 2000;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--r-md);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text);
  box-shadow: var(--shadow-md);
  animation: slideIn 0.25s ease;
  display: flex; align-items: center; gap: 8px;
}
.toast.success { border-color: var(--green); }
.toast.error { border-color: var(--red); }
.toast.info { border-color: var(--blue); }
@keyframes slideIn {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ════════════════════════════════════════════════════════
   DRAG GHOST
   ════════════════════════════════════════════════════════ */
.drag-ghost {
  position: fixed;
  pointer-events: none;
  z-index: 9999;
  background: var(--bg2);
  border: 1px solid var(--gold);
  border-radius: var(--r-sm);
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text);
  box-shadow: 0 4px 20px rgba(245,200,66,0.3);
  max-width: 180px;
  opacity: 0.92;
  transform: rotate(2deg);
}

/* ════════════════════════════════════════════════════════
   RESPONSIVE BREAKPOINTS
   ════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  #desktop-layout { display: none !important; }
  #mobile-layout  { display: flex !important; }

  #app-header {
    padding: 0 12px;
  }
  #week-label { font-size: 13px; min-width: 140px; }
  .header-brand-name { display: none; }
  
  /* Mobile Specific Layout Fix */
  #panel-roles {
    height: auto;
    max-height: none;
    overflow: visible;
  }
  #roles-list {
    display: flex;
    flex-direction: row; /* Metas em linha no mobile para scroll lateral */
    overflow-x: auto;
    gap: 15px;
    padding: 10px;
    -webkit-overflow-scrolling: touch;
  }
  .papel-card {
    min-width: 250px;
    flex-shrink: 0;
  }
  .sharpen-saw {
    margin-top: 30px;
    padding: 20px;
    border-radius: var(--r-md);
    background: var(--surface2);
  }
}

@media (min-width: 769px) {
  #desktop-layout { display: flex !important; }
  #mobile-layout  { display: none !important; }
}

/* ── UTILITY ──────────────────────────────────────────── */
.hidden { display: none !important; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }

/* Inline edit */
.inline-input {
  background: var(--bg3);
  border: 1px solid var(--gold);
  border-radius: var(--r-sm);
  padding: 3px 7px;
  color: var(--text);
  font-size: 12px;
  outline: none;
  width: 100%;
}

/* Missão pessoal display */
.missao-chip {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--gold);
  border-radius: var(--r-md);
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text2);
  line-height: 1.5;
  font-style: italic;
  cursor: pointer;
  transition: border-color 0.2s;
  margin: 8px 10px;
}
.missao-chip:hover { border-color: var(--gold); }
/* ── HISTORY VIEW (+ v3) ────────────────────────────── */
.history-view {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg);
  z-index: 50;
  overflow-y: auto;
  padding: 30px;
  animation: fadeIn 0.3s ease;
}
.history-view.hidden { display: none; }

.history-content {
  max-width: 800px;
  margin: 0 auto;
}
.history #view-history { padding-bottom: 80px; }
.history-header { margin-bottom: 30px; }
.history-header h2 { font-size: 24px; color: var(--gold); margin-bottom: 8px; }
.history-header p { color: var(--text3); font-size: 14px; }

#history-list { display: flex; flex-direction: column; gap: 16px; }

.history-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.history-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.history-card-title { font-weight: 600; color: var(--text); font-size: 15px; }
.history-card-date { font-size: 12px; color: var(--text3); }
.history-card-relatorio {
  background: var(--bg2);
  border-left: 2px solid var(--gold);
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--text2);
  line-height: 1.5;
  font-style: italic;
}

/* Modal meta inputs */
.modal-meta-inputs {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Report textarea (Mobile/Desktop dynamic) */
.report-area {
  margin-top: 10px;
  animation: slideDown 0.3s ease;
}
.report-input {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--gold-dim);
  border-radius: var(--r-sm);
  padding: 10px;
  color: var(--text);
  font-size: 13px;
  resize: vertical;
  min-height: 80px;
  outline: none;
}
.report-input:focus { border-color: var(--gold); }

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Tabs styles (already added but ensuring icons grid part) */
.icon-tab-bar { display: flex; gap: 4px; margin-bottom: 10px; }
.icon-tab-btn {
  flex: 1; padding: 8px; font-size: 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-sm); color: var(--text3);
}
.icon-tab-btn.active { background: var(--gold-dim); color: var(--gold); border-color: var(--gold); }

/* SVG Icons grid logic */
#svg-icon-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}
.svg-opt {
  display: flex; align-items: center; justify-content: center;
  padding: 10px; border: 1px solid var(--border); border-radius: var(--r-sm);
  cursor: pointer; color: var(--text2); transition: all 0.2s;
}
.svg-opt:hover { background: var(--surface2); border-color: var(--border2); color: var(--text); }
.svg-opt.selected { background: var(--gold-dim); border-color: var(--gold); color: var(--gold); }
.svg-opt svg { width: 24px; height: 24px; }
/* ── GUIA DE USO (v3.2) ────────────────────────────── */
.guia-modal {
  max-width: 450px;
  padding: 40px;
  text-align: center;
  min-height: 400px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.guia-icon {
  font-size: 64px;
  margin-bottom: 20px;
  filter: drop-shadow(0 0 10px var(--gold-dim));
}
.guia-slide {
  display: none;
  animation: slideIn 0.4s ease forwards;
}
.guia-slide.active {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.guia-slide h2 { color: var(--gold); margin-bottom: 15px; font-size: 22px; }
.guia-slide p { color: var(--text2); line-height: 1.6; font-size: 15px; margin: 0; }
.guia-slide strong { color: var(--text); }

.guia-footer {
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}
.guia-dots { display: flex; gap: 8px; }
.guia-dots .dot {
  width: 8px; height: 8px;
  background: var(--border);
  border-radius: 50%;
  transition: all 0.3s;
}
.guia-dots .dot.active {
  background: var(--gold);
  transform: scale(1.3);
  box-shadow: 0 0 8px var(--gold-dim);
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
