/* ============================================================
   AGILIZA GUAMARÉ — Estilos Globais
   ============================================================ */

:root {
  --bg:           #F5F3FA;
  --surface:      #FFFFFF;
  --sidebar:      #5B3F86;
  --sidebar-dark: #4A3270;
  --primary:      #7C5CFC;
  --primary-soft: #EDE7FD;
  --accent-teal:  #0EA5A3;
  --accent-amber: #F59E0B;
  --accent-red:   #EF4444;
  --accent-green: #10B981;
  --accent-blue:  #3B82F6;
  --text:         #1F1B2E;
  --text-muted:   #6B6582;
  --text-subtle:  #9A94AE;
  --border:       #EAE5F4;
  --border-soft:  #F0EDF7;
  --shadow-sm:    0 1px 2px rgba(91,63,134,.04);
  --shadow-md:    0 4px 12px rgba(91,63,134,.08);
  --shadow-lg:    0 12px 32px rgba(91,63,134,.12);
}

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

html { font-size:14px; }

body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.serif { font-family: 'Instrument Serif', Georgia, serif; font-weight: 400; }

/* ============ LAYOUT ============ */
.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

.main {
  padding: 24px 32px 60px;
  min-width: 0;
  overflow-x: hidden;
}

/* ============ SIDEBAR ============ */
.sidebar {
  background: var(--sidebar);
  color: white;
  padding: 24px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 100;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 2px; }

.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px 24px; border-bottom: 1px solid rgba(255,255,255,.1);
  margin-bottom: 20px;
}
/* Logo SVG img tag */
.brand img {
  width: 100%;
  max-width: 186px;
  height: auto;
  display: block;
}
/* Mantidos por compatibilidade mas não mais usados no novo sidebar */
.brand-logo {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, #9B7FE8, #7C5CFC);
  border-radius: 10px; display: grid; place-items: center;
  font-weight: 800; font-size: 18px;
  box-shadow: 0 4px 12px rgba(123,92,252,.4); flex-shrink:0;
}
.brand-name { font-size: 18px; font-weight: 700; letter-spacing: -.3px; }
.brand-sub  { font-size: 11px; color: rgba(255,255,255,.6); font-weight: 500; letter-spacing: .5px; text-transform: uppercase; }

.nav-section-title {
  font-size: 11px; text-transform: uppercase; color: rgba(255,255,255,.45);
  letter-spacing: 1px; padding: 8px 12px; margin-top: 8px; font-weight: 600;
}

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  color: rgba(255,255,255,.8); font-weight: 500; font-size: 14px;
  text-decoration: none; margin-bottom: 2px;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: white; text-decoration:none; }
.nav-item.active { background: rgba(255,255,255,.14); color: white; font-weight: 600; }
.nav-icon { width: 20px; height: 20px; opacity: .9; flex-shrink: 0; }
.nav-badge { margin-left: auto; background: #FF6D61; color: white; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 10px; }

.nav-group { margin-bottom: 2px; }
.nav-group-header {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  color: rgba(255,255,255,.8); font-weight: 500; font-size: 14px;
  cursor: pointer; transition: background .15s;
  user-select: none;
}
.nav-group-header:hover { background: rgba(255,255,255,.08); }
.nav-group-header.open { color:white; }
.nav-group-children { padding-left: 12px; display:none; }
.nav-group-children.open { display:block; }
.nav-group-children .nav-item { font-size: 13px; padding: 8px 12px; }
.nav-caret { margin-left:auto; font-size:10px; transition: transform .2s; }
.nav-group-header.open .nav-caret { transform: rotate(180deg); }

.sidebar-footer {
  margin-top: auto; padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; gap: 10px;
}
.user-avatar {
  width: 36px; height: 36px; flex-shrink:0;
  background: linear-gradient(135deg, #A78BFA, #7C5CFC);
  border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 13px; color:white;
}
.user-info { flex:1; min-width:0; }
.user-name { font-size: 13px; font-weight: 600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.user-role { font-size: 11px; color: rgba(255,255,255,.55); }
.sidebar-logout { color:rgba(255,255,255,.5); font-size:18px; cursor:pointer; transition:color .15s; text-decoration:none; }
.sidebar-logout:hover { color:white; text-decoration:none; }

/* ============ PAGE HEADER ============ */
.page-header { display:flex; justify-content:space-between; align-items:flex-end; margin-bottom:24px; flex-wrap:wrap; gap:16px; }
.page-title { font-size: 32px; font-weight: 700; letter-spacing: -.8px; display:flex; align-items:baseline; gap:10px; }
.page-title .serif { font-size: 38px; font-style: italic; color: var(--primary); }
.page-sub { font-size: 14px; color: var(--text-muted); font-weight: 500; margin-top:4px; }
.page-actions { display:flex; gap:8px; flex-wrap:wrap; }

.breadcrumb { display:flex; align-items:center; gap:8px; font-size:13px; color:var(--text-muted); margin-bottom:20px; flex-wrap:wrap; }
.breadcrumb a { color:var(--text-muted); text-decoration:none; }
.breadcrumb a:hover { color:var(--primary); }
.breadcrumb .sep { color:var(--text-subtle); }
.breadcrumb .current { color:var(--text); font-weight:600; }

/* ============ BUTTONS ============ */
.btn { display:inline-flex; align-items:center; gap:8px; padding:10px 20px; border-radius:10px; font-family:inherit; font-size:13px; font-weight:600; cursor:pointer; border:none; transition:all .15s; text-decoration:none; white-space:nowrap; }
.btn:hover { text-decoration:none; }
.btn-primary { background:var(--sidebar); color:white; }
.btn-primary:hover { background:var(--sidebar-dark); color:white; }
.btn-outline { background:transparent; color:var(--text-muted); border:1.5px solid var(--border); }
.btn-outline:hover { border-color:var(--primary); color:var(--primary); }
.btn-danger { background:var(--accent-red); color:white; }
.btn-danger:hover { background:#dc2626; color:white; }
.btn-success { background:var(--accent-green); color:white; }
.btn-success:hover { background:#059669; color:white; }
.btn-ghost { background:transparent; color:var(--text-muted); border:none; padding:8px 12px; }
.btn-ghost:hover { background:var(--border-soft); color:var(--text); }
.btn-sm { padding:7px 14px; font-size:12px; border-radius:8px; }
.btn-icon { padding:8px; border-radius:8px; }
.btn-icon svg { width:16px; height:16px; }

/* ============ CARDS ============ */
.card { background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:24px; box-shadow:var(--shadow-sm); }
.card-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:20px; }
.card-title { font-size:16px; font-weight:700; display:flex; align-items:center; gap:8px; }
.card-sub { font-size:13px; color:var(--text-muted); margin-top:2px; }

/* ============ STATS ============ */
.stats-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(200px,1fr)); gap:16px; margin-bottom:24px; }
.stat-card { background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:20px; box-shadow:var(--shadow-sm); }
.stat-label { font-size:12px; font-weight:600; text-transform:uppercase; letter-spacing:.5px; color:var(--text-muted); margin-bottom:8px; }
.stat-value { font-size:32px; font-weight:800; letter-spacing:-1px; line-height:1; }
.stat-sub { font-size:12px; color:var(--text-muted); margin-top:4px; }
.stat-icon { width:40px; height:40px; border-radius:10px; display:grid; place-items:center; margin-bottom:12px; }

/* ============ TABLES ============ */
.table-wrap { overflow-x:auto; border-radius:12px; border:1px solid var(--border); }
table.data-table { width:100%; border-collapse:collapse; }
.data-table thead th { background:var(--bg); padding:12px 16px; font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:.5px; color:var(--text-muted); text-align:left; border-bottom:1px solid var(--border); white-space:nowrap; }
.data-table tbody td { padding:14px 16px; border-bottom:1px solid var(--border-soft); vertical-align:middle; }
.data-table tbody tr:last-child td { border-bottom:none; }
.data-table tbody tr { transition:background .1s; }
.data-table tbody tr:hover { background:#faf8fe; }
.data-table .col-actions { white-space:nowrap; text-align:right; }

/* ============ FORMS ============ */
.form-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(280px,1fr)); gap:20px; }
.form-grid-2 { grid-template-columns:1fr 1fr; }
.form-grid-3 { grid-template-columns:1fr 1fr 1fr; }
.form-row { display:grid; grid-template-columns:1fr 1fr; gap:20px; }
.form-full { grid-column: 1 / -1; }

.field { display:flex; flex-direction:column; gap:6px; }
.field label { font-size:13px; font-weight:600; color:var(--text); }
.field label .req { color:var(--accent-red); margin-left:2px; }
.field-hint { font-size:12px; color:var(--text-muted); }

input[type=text], input[type=email], input[type=tel], input[type=date],
input[type=time], input[type=number], input[type=password], input[type=url],
select, textarea {
  width:100%; padding:10px 14px; border:1.5px solid var(--border);
  border-radius:10px; font-family:inherit; font-size:14px; color:var(--text);
  background:white; transition:border-color .15s, box-shadow .15s;
  outline:none;
}
input:focus, select:focus, textarea:focus {
  border-color:var(--primary);
  box-shadow:0 0 0 3px rgba(124,92,252,.1);
}
input:disabled, select:disabled, textarea:disabled {
  background:var(--bg); color:var(--text-muted); cursor:not-allowed;
}
textarea { resize:vertical; min-height:80px; }
select { cursor:pointer; }

.input-group { display:flex; }
.input-group input { border-radius:10px 0 0 10px; border-right:none; }
.input-group .input-addon { padding:10px 14px; background:var(--bg); border:1.5px solid var(--border); border-radius:0 10px 10px 0; display:flex; align-items:center; color:var(--text-muted); font-size:13px; white-space:nowrap; }

.form-section { background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:24px; margin-bottom:20px; }
.form-section-title { font-size:15px; font-weight:700; margin-bottom:20px; display:flex; align-items:center; gap:8px; padding-bottom:14px; border-bottom:1px solid var(--border-soft); }
.form-section-title svg { width:18px; height:18px; color:var(--primary); }

/* ============ BADGES ============ */
.badge { display:inline-flex; align-items:center; padding:3px 10px; border-radius:20px; font-size:11px; font-weight:700; letter-spacing:.3px; white-space:nowrap; }
.badge-gray   { background:#F1F0F5; color:#6B6582; }
.badge-blue   { background:#EFF6FF; color:#1D4ED8; }
.badge-teal   { background:#ECFDF5; color:#065F46; }
.badge-green  { background:#DCFCE7; color:#166534; }
.badge-amber  { background:#FFFBEB; color:#92400E; }
.badge-red    { background:#FEF2F2; color:#991B1B; }
.badge-purple { background:var(--primary-soft); color:#4C1D95; }
.badge-dark   { background:#1F1B2E; color:white; }

/* ============ SEARCH BAR ============ */
.search-bar { display:flex; gap:10px; margin-bottom:20px; flex-wrap:wrap; align-items:center; }
.search-input-wrap { flex:1; min-width:220px; position:relative; }
.search-input-wrap svg { position:absolute; left:12px; top:50%; transform:translateY(-50%); width:16px; height:16px; color:var(--text-muted); pointer-events:none; }
.search-input-wrap input { padding-left:38px; }
.filter-select { min-width:160px; }

/* ============ FLASH ============ */
.flash { display:flex; align-items:center; gap:12px; padding:14px 20px; border-radius:12px; margin-bottom:20px; font-size:14px; font-weight:500; }
.flash-icon { width:24px; height:24px; border-radius:50%; display:grid; place-items:center; font-size:12px; font-weight:700; flex-shrink:0; }
.flash-success { background:#DCFCE7; color:#166534; border:1px solid #BBF7D0; }
.flash-success .flash-icon { background:#166534; color:white; }
.flash-error { background:#FEF2F2; color:#991B1B; border:1px solid #FECACA; }
.flash-error .flash-icon { background:#991B1B; color:white; }
.flash-warning { background:#FFFBEB; color:#92400E; border:1px solid #FDE68A; }
.flash-warning .flash-icon { background:#92400E; color:white; }
.flash-info { background:#EFF6FF; color:#1D4ED8; border:1px solid #BFDBFE; }
.flash-info .flash-icon { background:#1D4ED8; color:white; }

/* ============ PAGINATION ============ */
.pagination { display:flex; align-items:center; justify-content:space-between; padding:16px 0; flex-wrap:wrap; gap:12px; }
.pag-info { font-size:13px; color:var(--text-muted); }
.pag-btns { display:flex; gap:4px; }
.pag-btn { display:inline-flex; align-items:center; justify-content:center; width:36px; height:36px; border-radius:8px; border:1.5px solid var(--border); font-size:13px; font-weight:600; color:var(--text-muted); transition:all .15s; text-decoration:none; }
.pag-btn:hover { border-color:var(--primary); color:var(--primary); text-decoration:none; }
.pag-btn.active { background:var(--primary); border-color:var(--primary); color:white; }

/* ============ EMPTY STATE ============ */
.empty-state { text-align:center; padding:60px 24px; color:var(--text-muted); }
.empty-state svg { width:64px; height:64px; opacity:.3; margin:0 auto 16px; display:block; }
.empty-state p { font-size:15px; font-weight:600; margin-bottom:8px; color:var(--text); }
.empty-state small { font-size:13px; }

/* ============ MODAL ============ */
.modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,.45); display:grid; place-items:center; z-index:1000; padding:20px; opacity:0; transition:opacity .2s; pointer-events:none; }
.modal-overlay.open { opacity:1; pointer-events:all; }
.modal {
  background:white; border-radius:20px; padding:28px;
  max-width:600px; width:100%;
  max-height:calc(100vh - 48px);
  display:flex; flex-direction:column;
  box-shadow:0 24px 64px rgba(0,0,0,.2);
  transform:translateY(20px); transition:transform .2s;
}
.modal-overlay.open .modal { transform:translateY(0); }
.modal-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:20px; flex-shrink:0; }
.modal-title { font-size:18px; font-weight:700; }
.modal-close { background:none; border:none; font-size:22px; cursor:pointer; color:var(--text-muted); padding:4px; border-radius:6px; transition:color .15s; line-height:1; }
.modal-close:hover { color:var(--text); }
.modal-body { overflow-y:auto; flex:1; padding-right:2px; }
.modal-footer { display:flex; justify-content:flex-end; gap:10px; margin-top:24px; padding-top:20px; border-top:1px solid var(--border); flex-shrink:0; }

/* ============ APP FOOTER (dentro do grid) ============ */
.app-footer {
  grid-column: 1 / -1;
  padding:12px 32px;
  border-top:1px solid var(--border-soft);
  text-align:center;
  background:var(--bg);
}
.app-footer span {
  font-size:11px; color:var(--text-subtle);
  font-weight:500; letter-spacing:.2px;
}

/* ============ TABS ============ */
.tabs { display:flex; gap:4px; border-bottom:2px solid var(--border); margin-bottom:24px; overflow-x:auto; }
.tab { padding:10px 18px; font-size:14px; font-weight:600; color:var(--text-muted); cursor:pointer; border:none; background:none; border-bottom:2px solid transparent; margin-bottom:-2px; transition:all .15s; white-space:nowrap; font-family:inherit; }
.tab:hover { color:var(--primary); }
.tab.active { color:var(--primary); border-bottom-color:var(--primary); }

/* ============ KANBAN ============ */
.kanban-wrap { overflow-x:auto; padding-bottom:16px; }
.kanban-board { display:flex; gap:16px; align-items:flex-start; min-width:min-content; padding:4px; }
.kanban-col { width:300px; flex-shrink:0; }
.kanban-col-header { display:flex; align-items:center; gap:8px; padding:12px 16px; background:white; border:1px solid var(--border); border-radius:12px 12px 0 0; font-size:13px; font-weight:700; }
.kanban-col-count { margin-left:auto; background:var(--bg); border:1px solid var(--border); padding:2px 8px; border-radius:20px; font-size:11px; font-weight:700; color:var(--text-muted); }
.kanban-cards { min-height:200px; padding:8px; background:rgba(245,243,250,.6); border:1px solid var(--border); border-top:none; border-radius:0 0 12px 12px; display:flex; flex-direction:column; gap:8px; }
.kanban-card { background:white; border:1px solid var(--border); border-radius:10px; padding:14px; cursor:grab; transition:box-shadow .15s, transform .15s; position:relative; }
.kanban-card:hover { box-shadow:var(--shadow-md); transform:translateY(-1px); }
.kanban-card.dragging { opacity:.5; transform:rotate(2deg); }
.kanban-card .card-num { font-size:11px; font-weight:700; color:var(--text-muted); margin-bottom:6px; }
.kanban-card .card-name { font-size:13px; font-weight:700; margin-bottom:6px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.kanban-card .card-spec { font-size:12px; color:var(--text-muted); margin-bottom:8px; }
.kanban-card .card-meta { display:flex; gap:6px; align-items:center; flex-wrap:wrap; }
.kanban-col-drop { border:2px dashed var(--primary); background:var(--primary-soft); border-top:none; }

/* ============ ATTACHMENTS ============ */
.attachment-list { display:flex; flex-direction:column; gap:8px; margin-top:12px; }
.attachment-item { display:flex; align-items:center; gap:12px; padding:10px 14px; background:var(--bg); border:1px solid var(--border); border-radius:10px; }
.attachment-icon { width:32px; height:32px; border-radius:8px; background:var(--primary-soft); display:grid; place-items:center; flex-shrink:0; font-size:16px; }
.attachment-info { flex:1; min-width:0; }
.attachment-name { font-size:13px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.attachment-type { font-size:11px; color:var(--text-muted); }
.attachment-open { font-size:12px; font-weight:600; color:var(--primary); }

/* ============ DETAIL VIEW ============ */
.detail-grid { display:grid; grid-template-columns:1fr 1fr; gap:20px; }
.detail-field { }
.detail-label { font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.5px; color:var(--text-muted); margin-bottom:4px; }
.detail-value { font-size:14px; font-weight:500; }

/* ============ CALENDAR ============ */
.calendar-grid { display:grid; grid-template-columns:repeat(7,1fr); gap:2px; }
.cal-day-header { font-size:11px; font-weight:700; text-align:center; color:var(--text-muted); padding:8px 0; text-transform:uppercase; letter-spacing:.5px; }
.cal-day { min-height:80px; background:white; border:1px solid var(--border); border-radius:8px; padding:6px; }
.cal-day.other-month { background:var(--bg); opacity:.6; }
.cal-day.today { border-color:var(--primary); }
.cal-day-num { font-size:12px; font-weight:700; margin-bottom:4px; }
.cal-day.today .cal-day-num { background:var(--primary); color:white; width:22px; height:22px; border-radius:50%; display:grid; place-items:center; }
.cal-event { font-size:10px; font-weight:600; padding:2px 6px; border-radius:4px; margin-bottom:2px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

/* ============ LOADING ============ */
.loading-spinner { display:inline-block; width:20px; height:20px; border:2px solid var(--border); border-top-color:var(--primary); border-radius:50%; animation:spin .6s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }

/* ============ PRINT ============ */
@media print {
  .sidebar, .page-actions, .search-bar, .pagination, .btn, .flash { display:none!important; }
  .app { grid-template-columns:1fr; }
  .main { padding:0; }
  .card { box-shadow:none; border:1px solid #ccc; }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  .form-grid-2, .form-grid-3, .form-row { grid-template-columns:1fr; }
  .detail-grid { grid-template-columns:1fr; }
  .page-title { font-size:22px; }
  .page-title .serif { font-size:26px; }
}
