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

:root {
  --sidebar-bg: #0A1828;
  --sidebar-hover: #112035;
  --sidebar-active: #00E5D1;
  --sidebar-text: #7a9bb5;
  --sidebar-text-active: #0A1828;
  --sidebar-width: 240px;
  --topbar-h: 60px;
  --main-bg: #f1f5f9;
  --card-bg: #ffffff;
  --primary: #00A89C;
  --primary-dark: #008C82;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
}

body { font-family: 'Inter', system-ui, sans-serif; font-size: 14px; color: var(--text); background: var(--main-bg); }

/* ── LOGIN ── */
.login-body { background: linear-gradient(135deg, #0A1828 0%, #0D2340 60%, #0f2e50 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { background: white; border-radius: 16px; padding: 40px; width: 100%; max-width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo h1 { font-size: 28px; font-weight: 800; color: #0A1828; letter-spacing: -.5px; }
.login-logo h1 span { color: #00A89C; }
.login-logo p { color: var(--text-muted); margin-top: 4px; font-size: 13px; }

/* ── LAYOUT ── */
.layout { display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.sidebar { width: var(--sidebar-width); background: var(--sidebar-bg); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; z-index: 100; transition: width .2s; }
.sidebar-logo { padding: 20px 16px; border-bottom: 1px solid rgba(255,255,255,.06); }
.sidebar-logo h2 { font-size: 18px; font-weight: 800; color: #fff; letter-spacing: -.3px; }
.sidebar-logo h2 span { color: #00E5D1; }
.sidebar-logo small { color: var(--sidebar-text); font-size: 11px; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0; }
.nav-section { padding: 16px 16px 6px; font-size: 10px; font-weight: 600; letter-spacing: .08em; color: #475569; text-transform: uppercase; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 16px; color: var(--sidebar-text); text-decoration: none; cursor: pointer; transition: all .15s; border-left: 3px solid transparent; font-size: 13.5px; }
.nav-item:hover { background: var(--sidebar-hover); color: #e2e8f0; }
.nav-item.active { background: rgba(59,130,246,.12); color: var(--sidebar-text-active); border-left-color: var(--sidebar-active); }
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-footer { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.06); }
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); display: flex; align-items: center; justify-content: center; color: white; font-weight: 600; font-size: 13px; }
.user-name { color: #e2e8f0; font-size: 13px; font-weight: 500; }
.user-role { color: var(--sidebar-text); font-size: 11px; }
.btn-logout { margin-top: 8px; width: 100%; padding: 7px; background: rgba(239,68,68,.1); color: #fca5a5; border: 1px solid rgba(239,68,68,.2); border-radius: 6px; cursor: pointer; font-size: 12px; transition: all .15s; }
.btn-logout:hover { background: rgba(239,68,68,.2); }

/* ── MAIN ── */
.main { margin-left: var(--sidebar-width); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { height: var(--topbar-h); background: white; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 50; }
.topbar-title { font-size: 16px; font-weight: 600; color: var(--text); }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.content { padding: 24px; flex: 1; }

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

/* ── KPI CARDS ── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.kpi-card { background: white; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 8px; }
.kpi-label { font-size: 12px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.kpi-value { font-size: 28px; font-weight: 700; color: var(--text); }
.kpi-sub { font-size: 12px; color: var(--text-muted); }
.kpi-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.kpi-icon.blue { background: rgba(59,130,246,.1); color: var(--primary); }
.kpi-icon.green { background: rgba(16,185,129,.1); color: var(--success); }
.kpi-icon.yellow { background: rgba(245,158,11,.1); color: var(--warning); }
.kpi-icon.red { background: rgba(239,68,68,.1); color: var(--danger); }

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 14px; color: var(--text); background: white; transition: border-color .15s;
  font-family: inherit;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; border: none; transition: all .15s; font-family: inherit; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }
.btn-warning { background: var(--warning); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-outline { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: white; }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--main-bg); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; padding: 11px; }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn-icon { padding: 6px; border-radius: 6px; background: transparent; border: 1px solid var(--border); cursor: pointer; color: var(--text-muted); display: inline-flex; align-items: center; justify-content: center; transition: all .15s; }
.btn-icon:hover { background: var(--main-bg); color: var(--text); }
.btn-icon.danger:hover { background: rgba(239,68,68,.1); color: var(--danger); border-color: var(--danger); }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th { padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; border-bottom: 2px solid var(--border); white-space: nowrap; }
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--border); color: var(--text); font-size: 13.5px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f8fafc; }

/* ── BADGES ── */
.badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.badge-blue { background: rgba(59,130,246,.1); color: var(--primary); }
.badge-green { background: rgba(16,185,129,.1); color: var(--success); }
.badge-yellow { background: rgba(245,158,11,.1); color: var(--warning); }
.badge-red { background: rgba(239,68,68,.1); color: var(--danger); }
.badge-gray { background: var(--border); color: var(--text-muted); }

/* ── MODAL ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 20px; opacity: 0; pointer-events: none; transition: opacity .2s; }
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal { background: white; border-radius: 12px; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.2); transform: translateY(-20px); transition: transform .2s; }
.modal-overlay.open .modal { transform: translateY(0); }
.modal-lg { max-width: 760px; }
.modal-header { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); line-height: 1; padding: 4px; }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ── SEARCH & FILTERS ── */
.filters-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.search-input { position: relative; }
.search-input input { padding-left: 34px; min-width: 220px; }
.search-input svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); width: 16px; height: 16px; }

/* ── DROPZONE ── */
.dropzone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 48px 24px; text-align: center; cursor: pointer; transition: all .2s; }
.dropzone:hover, .dropzone.drag-over { border-color: var(--primary); background: rgba(59,130,246,.04); }
.dropzone svg { width: 48px; height: 48px; color: var(--text-muted); margin-bottom: 12px; }
.dropzone p { color: var(--text-muted); }
.dropzone span { color: var(--primary); font-weight: 500; }

/* ── SCHEDULE GRID ── */
.slots-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.slot-card { background: white; border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.slot-card.disponivel { border-left: 3px solid var(--success); }
.slot-card.reservado { border-left: 3px solid var(--warning); }
.slot-card.cancelado { border-left: 3px solid var(--danger); opacity: .6; }
.slot-date { font-weight: 600; font-size: 13px; }
.slot-time { color: var(--primary); font-weight: 600; font-size: 15px; }
.slot-info { color: var(--text-muted); font-size: 12px; }

/* ── IMPORT PREVIEW ── */
.import-preview { overflow-x: auto; max-height: 340px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.import-preview table { font-size: 12px; }
.import-preview thead th { background: var(--main-bg); position: sticky; top: 0; }

/* ── UTILS ── */
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-primary { color: var(--primary); }
.fw-600 { font-weight: 600; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.gap-12 { gap: 12px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }

.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: .4; }
.empty-state p { font-size: 15px; }
.empty-state small { font-size: 13px; }

.error-msg { background: rgba(239,68,68,.08); color: var(--danger); border: 1px solid rgba(239,68,68,.2); border-radius: 6px; padding: 10px 14px; font-size: 13px; margin-top: 12px; }
.success-msg { background: rgba(16,185,129,.08); color: var(--success); border: 1px solid rgba(16,185,129,.2); border-radius: 6px; padding: 10px 14px; font-size: 13px; }

.separator { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ── FAIXAS DINÂMICAS ── */
.faixas-list { display: flex; flex-direction: column; gap: 8px; }
.faixa-row { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: 8px; align-items: end; }
.faixa-row input { margin-bottom: 0; }

/* ── LOTE ── */
.lote-summary { background: var(--main-bg); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.lote-total { font-size: 22px; font-weight: 700; color: var(--success); }

/* ── TOAST ── */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 18px; border-radius: 8px; font-size: 14px; font-weight: 500; color: white; box-shadow: var(--shadow-md); animation: slideIn .25s ease; max-width: 300px; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--primary); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar { width: 0; overflow: hidden; }
  .main { margin-left: 0; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
}
