/* =====================================
   GlobalServices CRM — Stylesheet
   ===================================== */

:root {
  --blue: #3b82f6;
  --blue-dark: #1e40af;
  --blue-light: #dbeafe;
  --orange: #f59e0b;
  --green: #10b981;
  --red: #ef4444;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-400: #94a3b8;
  --gray-600: #475569;
  --gray-700: #374151;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --sidebar-w: 240px;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.10), 0 2px 4px rgba(0,0,0,.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { font-family: 'DM Sans', sans-serif; background: var(--gray-50); color: var(--gray-800); font-size: 14px; line-height: 1.5; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
input, select, textarea, button { font-family: inherit; font-size: 14px; }
textarea { resize: vertical; }

/* ---- Layout ---- */
.app-wrapper { display: flex; height: 100vh; overflow: hidden; }

/* ---- Sidebar ---- */
.sidebar { width: var(--sidebar-w); background: var(--gray-900); display: flex; flex-direction: column; flex-shrink: 0; transition: width .25s; overflow: hidden; }
.sidebar-header { display: flex; align-items: center; gap: 10px; padding: 20px 16px; border-bottom: 1px solid rgba(255,255,255,.07); }
.logo-mark { width: 36px; height: 36px; background: var(--blue); color: white; font-family: 'Syne', sans-serif; font-weight: 800; font-size: 14px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.logo-text { line-height: 1.2; }
.logo-main { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 15px; color: white; }
.logo-accent { font-family: 'Syne', sans-serif; font-weight: 700; font-size: 15px; color: var(--blue); }
.logo-sub { display: block; font-size: 10px; color: var(--gray-400); letter-spacing: 1px; text-transform: uppercase; }
.sidebar-nav { flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 8px; color: var(--gray-400); font-size: 13.5px; transition: all .15s; white-space: nowrap; }
.nav-item:hover { background: rgba(255,255,255,.07); color: white; text-decoration: none; }
.nav-item.active { background: var(--blue); color: white; }
.nav-item i { width: 18px; text-align: center; font-size: 13px; }
.nav-divider { height: 1px; background: rgba(255,255,255,.07); margin: 8px 0; }
.sidebar-footer { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.07); display: flex; align-items: center; gap: 8px; }
.user-avatar { width: 32px; height: 32px; background: var(--blue); border-radius: 50%; color: white; font-weight: 600; font-size: 13px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.user-info { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.user-details { min-width: 0; }
.user-name { display: block; font-size: 13px; color: white; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; }
.user-name:hover { color: var(--blue); }
.user-role { display: block; font-size: 11px; color: var(--gray-400); }
.logout-btn { background: none; border: none; cursor: pointer; color: var(--gray-400); padding: 6px; border-radius: 6px; transition: all .15s; display: flex; align-items: center; }
.logout-btn:hover { background: rgba(255,255,255,.07); color: white; text-decoration: none; }

/* ---- Main ---- */
.main-content { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.top-bar { background: white; border-bottom: 1px solid var(--gray-200); padding: 0 24px; height: 56px; display: flex; align-items: center; gap: 16px; position: sticky; top: 0; z-index: 10; }
.sidebar-toggle { background: none; border: none; cursor: pointer; color: var(--gray-600); padding: 6px; border-radius: 6px; }
.sidebar-toggle:hover { background: var(--gray-100); }
.page-breadcrumb { display: flex; align-items: center; gap: 8px; color: var(--gray-600); font-size: 13px; flex: 1; }
.page-breadcrumb a { color: var(--gray-600); }
.page-breadcrumb i { font-size: 10px; color: var(--gray-400); }
.top-bar-right { margin-left: auto; }
.date-display { font-size: 12px; color: var(--gray-400); }
.content-area { padding: 24px; flex: 1; }

/* ---- Alerts ---- */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-error { background: #fee2e2; color: #991b1b; }

/* ---- Page header ---- */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 12px; }
.page-title { font-family: 'Syne', sans-serif; font-size: 22px; font-weight: 700; color: var(--gray-900); }
.page-subtitle { color: var(--gray-600); font-size: 13.5px; margin-top: 2px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---- Stats ---- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stats-grid--small { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.stat-card { background: white; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--gray-200); display: flex; flex-direction: column; gap: 8px; }
.stat-card--alert { border-left: 3px solid var(--red); }
.stat-card--danger { border-left: 3px solid var(--red); }
.stat-card--warning { border-left: 3px solid var(--orange); }
.stat-card--action { background: var(--gray-50); }
.stat-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px; margin-bottom: 4px; }
.stat-icon--blue { background: var(--blue-light); color: var(--blue-dark); }
.stat-icon--green { background: #d1fae5; color: #065f46; }
.stat-icon--orange { background: #fef3c7; color: #92400e; }
.stat-icon--red { background: #fee2e2; color: #991b1b; }
.stat-value { font-family: 'Syne', sans-serif; font-size: 26px; font-weight: 700; color: var(--gray-900); }
.stat-label { font-size: 12.5px; color: var(--gray-600); }
.stat-detail { font-size: 12px; color: var(--gray-400); display: flex; flex-wrap: wrap; gap: 4px; }
.progress-bar-wrap { background: var(--gray-200); border-radius: 99px; height: 4px; overflow: hidden; }
.progress-bar { height: 4px; border-radius: 99px; }
.alert-client-link { display: block; color: var(--red); font-size: 12px; }

/* ---- Quick Actions ---- */
.quick-actions { display: flex; gap: 12px; margin-bottom: 28px; flex-wrap: wrap; }
.quick-action-card { background: white; border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 16px 20px; display: flex; align-items: center; gap: 10px; color: var(--gray-700); font-weight: 500; font-size: 13.5px; box-shadow: var(--shadow); transition: all .15s; }
.quick-action-card:hover { border-color: var(--blue); color: var(--blue); text-decoration: none; box-shadow: var(--shadow-md); }
.quick-action-card i { font-size: 18px; }

/* ---- Section ---- */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-title { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 600; color: var(--gray-800); }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 32px; }

/* ---- Table ---- */
.table-card { background: white; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--gray-200); overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; white-space: nowrap; }
.data-table thead th { background: var(--gray-800); color: white; padding: 10px 12px; font-size: 12px; font-weight: 600; text-align: left; }
.data-table tbody tr { border-bottom: 1px solid var(--gray-100); }
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--gray-50); }
.data-table td { padding: 10px 12px; font-size: 13px; }
.text-wrap { white-space: normal; min-width: 180px; }
.date-chip { background: var(--blue-light); color: var(--blue-dark); padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 500; }
.client-link { font-weight: 500; color: var(--gray-800); }
.client-link:hover { color: var(--blue); }
.text-muted { color: var(--gray-400); }
.text-danger { color: var(--red); }
.text-warning { color: var(--orange); }
.text-success { color: var(--green); }
.text-orange { color: var(--orange); }
.small { font-size: 12px; }
.row-actions { display: flex; gap: 4px; }

/* ---- Badges ---- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: 11.5px; font-weight: 500; }
.badge--avenca { background: #dbeafe; color: #1e40af; }
.badge--pacote { background: #fef3c7; color: #92400e; }
.badge--inactive { background: var(--gray-100); color: var(--gray-400); }
.badge--presencial { background: #d1fae5; color: #065f46; }
.badge--remota { background: #ede9fe; color: #5b21b6; }
.badge--laboratorio { background: #fff7ed; color: #c2410c; }
.badge--desl { background: #fef3c7; color: #92400e; }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 8px; font-size: 13.5px; font-weight: 500; cursor: pointer; border: 1.5px solid transparent; transition: all .15s; white-space: nowrap; }
.btn-primary { background: var(--blue); color: white; border-color: var(--blue); }
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); text-decoration: none; color: white; }
.btn-outline { background: white; color: var(--gray-700); border-color: var(--gray-200); }
.btn-outline:hover { border-color: var(--gray-400); text-decoration: none; color: var(--gray-800); }
.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 6px; color: var(--gray-600); background: none; border: none; cursor: pointer; transition: all .15s; text-decoration: none; }
.btn-icon:hover { background: var(--gray-100); color: var(--gray-800); text-decoration: none; }
.btn-icon--danger:hover { background: #fee2e2; color: var(--red); }
.text-red { color: var(--red); }

/* ---- Empty state ---- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--gray-400); }
.empty-state i { font-size: 40px; margin-bottom: 12px; display: block; }
.empty-state p { margin-bottom: 16px; font-size: 15px; }

/* ---- Clients Grid ---- */
.clients-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.client-card { background: white; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--gray-200); overflow: hidden; transition: box-shadow .15s; }
.client-card:hover { box-shadow: var(--shadow-md); }
.client-card--inactive { opacity: .6; }
.client-card-header { padding: 16px; background: var(--gray-50); border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; justify-content: space-between; }
.client-logo { max-height: 40px; max-width: 120px; object-fit: contain; }
.client-avatar { width: 44px; height: 44px; border-radius: 10px; background: var(--blue-dark); color: white; font-family: 'Syne', sans-serif; font-weight: 700; font-size: 15px; display: flex; align-items: center; justify-content: center; }
.client-avatar--lg { width: 52px; height: 52px; font-size: 18px; }
.client-card-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.client-card-body { padding: 16px; }
.client-name { font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.client-meta { font-size: 12.5px; color: var(--gray-600); display: flex; flex-direction: column; gap: 4px; }
.client-meta i { width: 14px; color: var(--gray-400); }
.client-contact { font-size: 12px; color: var(--gray-400); margin-top: 6px; }
.client-card-footer { padding: 12px 16px; border-top: 1px solid var(--gray-100); display: flex; gap: 8px; }

/* Client header */
.client-header-info { display: flex; align-items: center; gap: 14px; }
.client-header-logo { max-height: 50px; max-width: 150px; object-fit: contain; }
.client-header-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; flex-wrap: wrap; }
.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Report form */
.report-form { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.select-sm { padding: 4px 8px; border: 1px solid var(--gray-200); border-radius: 6px; font-size: 12px; background: white; }

/* ---- Form ---- */
.form-card { background: white; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--gray-200); padding: 28px; max-width: 860px; }
.form-section { margin-bottom: 28px; }
.form-section-title { font-family: 'Syne', sans-serif; font-size: 14px; font-weight: 600; color: var(--gray-700); margin-bottom: 16px; padding-bottom: 8px; border-bottom: 1px solid var(--gray-200); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid--3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group--full { grid-column: 1 / -1; }
.form-group label { font-size: 13px; font-weight: 500; color: var(--gray-700); }
.required { color: var(--red); }
.form-group input, .form-group select, .form-group textarea { padding: 9px 12px; border: 1.5px solid var(--gray-200); border-radius: 8px; font-size: 14px; color: var(--gray-800); transition: border-color .15s; background: white; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
.field-error { font-size: 12px; color: var(--red); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 20px; border-top: 1px solid var(--gray-200); }

/* Tipologia selector */
.tipologia-selector { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tipologia-option { border: 2px solid var(--gray-200); border-radius: var(--radius); padding: 14px; cursor: pointer; display: flex; align-items: center; gap: 12px; transition: all .15s; }
.tipologia-option:hover { border-color: var(--blue-light); }
.tipologia-option.selected { border-color: var(--blue); background: var(--blue-light); }
.tipologia-option input[type="radio"] { display: none; }
.tipologia-icon { font-size: 20px; color: var(--blue); }
.tipologia-info { display: flex; flex-direction: column; }
.tipologia-info strong { font-size: 13.5px; color: var(--gray-800); }
.tipologia-info span { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

/* Assistencia selector */
.assistencia-selector { display: flex; gap: 8px; flex-wrap: wrap; }
.assistencia-option { border: 1.5px solid var(--gray-200); border-radius: 8px; padding: 8px 12px; cursor: pointer; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--gray-700); transition: all .15s; }
.assistencia-option:hover { border-color: var(--blue); }
.assistencia-option.selected { border-color: var(--blue); background: var(--blue-light); color: var(--blue-dark); }
.assistencia-option input[type="radio"] { display: none; }

/* Duração */
.duracao-display { padding: 9px 12px; background: var(--gray-50); border: 1.5px solid var(--gray-200); border-radius: 8px; font-size: 18px; font-weight: 700; color: var(--blue-dark); font-family: 'Syne', sans-serif; }

/* Upload */
.upload-area { border: 2px dashed var(--gray-200); border-radius: var(--radius); padding: 24px; text-align: center; cursor: pointer; position: relative; transition: border-color .15s; }
.upload-area:hover { border-color: var(--blue); }
.upload-placeholder { color: var(--gray-400); }
.upload-placeholder i { font-size: 28px; margin-bottom: 8px; display: block; }
.upload-placeholder p { font-size: 13.5px; margin-bottom: 4px; }
.upload-placeholder span { font-size: 12px; }
.logo-preview { max-height: 80px; max-width: 200px; object-fit: contain; margin: 0 auto; display: block; }

/* Toggle */
.toggle-label { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; color: var(--gray-700); }
.toggle-label input { display: none; }
.toggle { width: 40px; height: 22px; background: var(--gray-200); border-radius: 99px; position: relative; transition: background .2s; flex-shrink: 0; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: white; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle-label input:checked + .toggle { background: var(--blue); }
.toggle-label input:checked + .toggle::after { transform: translateX(18px); }

/* Form check */
.form-check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--gray-600); }
.form-check input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--blue); }

/* ---- Modal ---- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal-box { background: white; border-radius: var(--radius); padding: 24px; width: 480px; max-width: 95vw; box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-header h3 { font-family: 'Syne', sans-serif; font-size: 17px; font-weight: 600; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--gray-400); font-size: 16px; padding: 4px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--gray-200); }
.modal-box .form-group { margin-bottom: 12px; }

/* ---- Login ---- */
.login-page { background: var(--gray-900); }
.login-wrapper { display: flex; height: 100vh; }
.login-visual { width: 45%; background: linear-gradient(135deg, #1e40af 0%, #3b82f6 50%, #60a5fa 100%); display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.login-visual::before { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 30% 70%, rgba(255,255,255,.08) 0%, transparent 60%); }
.login-visual-content { position: relative; text-align: center; color: white; padding: 40px; }
.visual-logo { width: 70px; height: 70px; background: rgba(255,255,255,.2); border-radius: 18px; font-family: 'Syne', sans-serif; font-weight: 800; font-size: 24px; display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; }
.visual-title { font-family: 'Syne', sans-serif; font-size: 36px; font-weight: 800; line-height: 1.1; margin-bottom: 12px; }
.visual-title span { opacity: .7; }
.visual-sub { opacity: .7; font-size: 14px; letter-spacing: 1px; }
.visual-dots { display: flex; gap: 8px; justify-content: center; margin-top: 40px; }
.visual-dots span { width: 8px; height: 8px; background: rgba(255,255,255,.4); border-radius: 50%; }
.visual-dots span:first-child { background: white; }
.login-form-panel { flex: 1; background: var(--gray-900); display: flex; align-items: center; justify-content: center; }
.login-form-inner { width: 380px; max-width: 90vw; }
.login-header { margin-bottom: 32px; }
.login-header h2 { font-family: 'Syne', sans-serif; font-size: 26px; font-weight: 700; color: white; margin-bottom: 6px; }
.login-header p { color: var(--gray-400); font-size: 14px; }
.login-form { display: flex; flex-direction: column; gap: 18px; }
.login-form .form-group label { color: var(--gray-400); }
.login-form .input-wrapper { position: relative; }
.login-form .input-wrapper i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--gray-400); font-size: 13px; }
.login-form input { width: 100%; padding: 11px 12px 11px 36px; background: rgba(255,255,255,.07); border: 1.5px solid rgba(255,255,255,.1); border-radius: 8px; color: white; font-size: 14px; }
.login-form input::placeholder { color: var(--gray-400); }
.login-form input:focus { outline: none; border-color: var(--blue); background: rgba(255,255,255,.1); }
.login-form .form-check label { color: var(--gray-400); }
.btn-login { width: 100%; padding: 12px; background: var(--blue); color: white; border: none; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; transition: background .15s; font-family: 'DM Sans', sans-serif; }
.btn-login:hover { background: var(--blue-dark); }
.login-footer-text { margin-top: 24px; text-align: center; font-size: 12px; color: rgba(255,255,255,.2); }

@media (max-width: 768px) {
  .login-visual { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid--3 { grid-template-columns: 1fr; }
  .tipologia-selector { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 50; height: 100%; transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: translateX(0); }
}
