/* ============================================================
   PILHA 2.0 — Estilos globais
   ============================================================ */

:root {
  --bg:        #0f1117;
  --surface:   #1a1d27;
  --surface2:  #22263a;
  --border:    #2e3248;
  --primary:   #4f8ef7;
  --primary2:  #3a6fd8;
  --green:     #27ae60;
  --yellow:    #f39c12;
  --red:       #e74c3c;
  --text:      #e8eaf0;
  --text2:     #9aa0b8;
  --radius:    10px;
  --shadow:    0 4px 24px rgba(0,0,0,.45);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

/* ── AUTH PAGE ──────────────────────────────────────────────── */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #0f1117 0%, #1a1d27 100%);
}

.auth-container { width: 100%; max-width: 440px; padding: 16px; }

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px;
  box-shadow: var(--shadow);
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}
.auth-logo .logo-icon {
  font-size: 40px;
  display: block;
  margin-bottom: 8px;
  filter: hue-rotate(200deg);
}
.auth-logo h1 {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: #fff;
}
.auth-logo h1 span { color: var(--primary); }
.auth-logo p { color: var(--text2); font-size: 13px; margin-top: 4px; }

.screen { display: none; }
.screen.active { display: block; }

.screen h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  color: #fff;
}

.hint {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 20px;
  line-height: 1.6;
}
.hint.warning { color: var(--yellow); }

/* ── FIELDS ─────────────────────────────────────────────────── */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 6px;
}
.field input[type=text],
.field input[type=email],
.field input[type=password],
.field input[type=number],
.field select,
.field textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,142,247,.15);
}
.field textarea { resize: vertical; min-height: 120px; }

.input-eye {
  position: relative;
}
.input-eye input { padding-right: 42px; }
.btn-eye {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  background: none; border: none;
  cursor: pointer; font-size: 16px;
  color: var(--text2);
  padding: 4px;
}

/* ── PASSWORD STRENGTH ──────────────────────────────────────── */
.strength-bar {
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  margin-top: 8px;
  overflow: hidden;
}
.strength-bar div {
  height: 100%;
  width: 0%;
  border-radius: 4px;
  transition: width .3s, background .3s;
}
.pw-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text2);
}
.pw-checklist span { padding: 2px 8px; border-radius: 12px; background: var(--bg); }
.pw-checklist span.ok { color: var(--green); background: rgba(39,174,96,.12); }

/* ── BUTTONS ─────────────────────────────────────────────────── */
.btn-primary {
  display: block;
  width: 100%;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, opacity .2s;
  margin-top: 8px;
}
.btn-primary:hover { background: var(--primary2); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 18px;
  font-size: 13px;
  cursor: pointer;
  transition: background .2s;
}
.btn-secondary:hover { background: var(--border); }

.btn-link {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: var(--primary);
  font-size: 13px;
  cursor: pointer;
  padding: 10px;
  margin-top: 4px;
  text-align: center;
}
.btn-link:hover { text-decoration: underline; }

/* ── MESSAGES ───────────────────────────────────────────────── */
.msg-error {
  background: rgba(231,76,60,.12);
  border: 1px solid var(--red);
  color: #ff8a80;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 12px;
}
.msg-success {
  background: rgba(39,174,96,.12);
  border: 1px solid var(--green);
  color: #69f0ae;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 12px;
}
.hidden { display: none !important; }

/* ── RECOVERY CODES ─────────────────────────────────────────── */
.recovery-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 16px 0;
}
.recovery-grid span {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  font-family: monospace;
  font-size: 14px;
  letter-spacing: 1px;
  color: var(--primary);
}

/* ── APP LAYOUT ─────────────────────────────────────────────── */
.app-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: 240px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 0;
  flex-shrink: 0;
}
.sidebar-logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-logo span { font-size: 22px; }
.sidebar-logo strong { font-size: 16px; color: #fff; }
.sidebar-logo em { font-size: 11px; color: var(--text2); display: block; font-style: normal; }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text2);
  font-size: 13px;
  font-weight: 500;
  transition: background .15s, color .15s;
  text-decoration: none;
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: rgba(79,142,247,.15); color: var(--primary); }
.nav-item .nav-icon { font-size: 16px; width: 20px; text-align: center; }

.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text2);
  padding: 16px 14px 6px;
}

/* Top bar */
.topbar {
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  flex-shrink: 0;
}
.topbar-title {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  flex: 1;
}
.topbar-actions { display: flex; align-items: center; gap: 12px; }

/* Notification bell */
.notif-bell {
  position: relative;
  cursor: pointer;
  font-size: 20px;
  padding: 6px;
  border-radius: 8px;
  transition: background .15s;
}
.notif-bell:hover { background: var(--surface2); }
.notif-badge {
  position: absolute;
  top: 2px; right: 2px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
}

/* User avatar */
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

/* Main content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.page-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ── CARDS ───────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.card-title { font-size: 15px; font-weight: 600; color: #fff; }

/* ── KANBAN ──────────────────────────────────────────────────── */
.kanban-board {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
  min-height: 60vh;
}
.kanban-col {
  flex-shrink: 0;
  width: 280px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}
.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.kanban-col-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text2);
}
.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
}
.kanban-card:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(79,142,247,.2);
}
.kanban-card-title {
  font-size: 13px;
  font-weight: 500;
  color: #fff;
  margin-bottom: 8px;
  line-height: 1.4;
}
.task-priority {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: .4px;
}
.priority-urgente { background: rgba(231,76,60,.2); color: #ff8a80; }
.priority-alta    { background: rgba(243,156,18,.2); color: #ffd54f; }
.priority-media   { background: rgba(79,142,247,.2); color: #82b1ff; }
.priority-baixa   { background: rgba(39,174,96,.2);  color: #69f0ae; }

.checklist-progress {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text2);
}
.checklist-bar {
  flex: 1;
  height: 3px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.checklist-bar-fill {
  height: 100%;
  background: var(--green);
  border-radius: 4px;
  transition: width .3s;
}

/* ── MODAL ───────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.modal-title { font-size: 17px; font-weight: 700; color: #fff; }
.modal-close {
  background: none; border: none;
  color: var(--text2); font-size: 20px;
  cursor: pointer; padding: 4px 8px;
  border-radius: 6px;
  transition: background .15s;
}
.modal-close:hover { background: var(--surface2); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* ── NOTIFICATION DROPDOWN ──────────────────────────────────── */
.notif-dropdown {
  position: absolute;
  top: 56px; right: 16px;
  width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 500;
  overflow: hidden;
}
.notif-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.notif-header strong { font-size: 14px; color: #fff; }
.notif-list { max-height: 400px; overflow-y: auto; }
.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .15s;
}
.notif-item:hover { background: var(--surface2); }
.notif-item.unread { border-left: 3px solid var(--primary); }
.notif-item-title { font-size: 13px; font-weight: 500; color: #fff; margin-bottom: 2px; }
.notif-item-body  { font-size: 12px; color: var(--text2); }
.notif-item-time  { font-size: 11px; color: var(--text2); margin-top: 4px; }

/* ── PROFILE MODAL ───────────────────────────────────────────── */
.profile-avatar-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}
.profile-avatar-large {
  width: 80px; height: 80px;
  border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; color: #fff;
  overflow: hidden;
}
.profile-avatar-large img { width: 100%; height: 100%; object-fit: cover; }

/* ── INCOMPLETE PROFILE POPUP ───────────────────────────────── */
.popup-banner {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--surface);
  border: 1px solid var(--yellow);
  border-radius: var(--radius);
  padding: 16px 20px;
  max-width: 340px;
  box-shadow: var(--shadow);
  z-index: 400;
}
.popup-banner p { font-size: 13px; line-height: 1.5; color: var(--text); margin-bottom: 12px; }
.popup-banner .popup-actions { display: flex; gap: 8px; }

/* ── TABLES ──────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text2);
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
tr:last-child td { border-bottom: none; }

/* ── BADGES / CHIPS ──────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .4px;
}
.badge-blue   { background: rgba(79,142,247,.15); color: var(--primary); }
.badge-green  { background: rgba(39,174,96,.15);  color: var(--green); }
.badge-yellow { background: rgba(243,156,18,.15); color: var(--yellow); }
.badge-red    { background: rgba(231,76,60,.15);  color: var(--red); }
.badge-gray   { background: var(--surface2); color: var(--text2); }

/* ── STATS GRID ──────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  text-align: center;
}
.stat-card .stat-num { font-size: 32px; font-weight: 800; color: var(--primary); }
.stat-card .stat-label { font-size: 11px; color: var(--text2); margin-top: 4px; text-transform: uppercase; letter-spacing: .5px; }

/* ── TAP/PI FORM ─────────────────────────────────────────────── */
.doc-section {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.doc-section h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

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

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { position: fixed; left: -240px; z-index: 200; transition: left .3s; }
  .sidebar.open { left: 0; }
  .kanban-board { flex-direction: column; }
  .kanban-col { width: 100%; }
}
