/* =============================================
   STETICAR R – ERP | style.css
   Cores: azul #1a4a7a, turquesa #2ac9c0, cinza #f0f4f8
   ============================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --blue: #1a4a7a;
  --blue-dark: #12355a;
  --blue-mid: #2563a8;
  --teal: #2ac9c0;
  --teal-dark: #1e9e96;
  --teal-light: #d0f5f3;
  --bg: #f0f4f8;
  --surface: #ffffff;
  --border: #dde4ed;
  --text: #1e2a3a;
  --text-sub: #6b798f;
  --green: #22c55e;
  --orange: #f59e0b;
  --red: #ef4444;
  --sidebar-w: 260px;
  --sidebar-c: #0f2d4a;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(26, 74, 122, .1);
  --transition: .22s cubic-bezier(.4, 0, .2, 1);
}

html,
body {
  height: 100%;
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--sidebar-c);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform var(--transition), width var(--transition);
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.sidebar-logo {
  width: 118px;
  height: auto;
  object-fit: contain;
  filter: brightness(1.05);
  border-radius: 8px;
}

.sidebar-toggle {
  background: rgba(255, 255, 255, .08);
  border: none;
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, .18);
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .7rem .9rem;
  border-radius: 10px;
  color: rgba(255, 255, 255, .65);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}

.nav-item i {
  width: 20px;
  text-align: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.nav-item:hover {
  background: rgba(255, 255, 255, .1);
  color: #fff;
}

.nav-item.active {
  background: var(--teal);
  color: #fff;
  box-shadow: 0 4px 14px rgba(42, 201, 192, .35);
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255, 255, 255, .08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

.user-info {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 0;
  flex: 1;
  overflow: hidden;
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .95rem;
  flex-shrink: 0;
}

.user-name {
  color: #fff;
  font-size: .875rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  color: rgba(255, 255, 255, .5);
  font-size: .75rem;
}

.btn-logout {
  background: rgba(239, 68, 68, .18);
  border: none;
  color: rgba(255, 255, 255, .7);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}

.btn-logout:hover {
  background: rgba(239, 68, 68, .4);
  color: #fff;
}

/* ===== MAIN WRAPPER ===== */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left var(--transition);
}

/* ===== TOPBAR ===== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .06);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: .85rem;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--blue);
}

.menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  font-size: 1.2rem;
  padding: .4rem;
  border-radius: 8px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.date-display {
  font-size: .82rem;
  color: var(--text-sub);
  white-space: nowrap;
}

/* ===== CONTENT ===== */
.content {
  flex: 1;
  padding: 1.5rem;
}

/* ===== PAGES ===== */
.page {
  display: none;
}

.page.active {
  display: block;
  animation: fadeIn .25s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* ===== STATS GRID ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(26, 74, 122, .13);
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.stat-icon.teal {
  background: rgba(42, 201, 192, .15);
  color: var(--teal-dark);
}

.stat-icon.blue {
  background: rgba(37, 99, 168, .13);
  color: var(--blue-mid);
}

.stat-icon.green {
  background: rgba(34, 197, 94, .13);
  color: #16a34a;
}

.stat-icon.orange {
  background: rgba(245, 158, 11, .13);
  color: #d97706;
}

.stat-info {}

.stat-value {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--blue);
  line-height: 1;
}

.stat-label {
  font-size: .8rem;
  color: var(--text-sub);
  margin-top: .25rem;
}

/* ===== DASHBOARD GRID ===== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== CARD ===== */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--border);
}

.card-header h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--blue);
}

/* ===== FILTERS ===== */
.filters {
  display: flex;
  gap: .75rem;
  padding: 1rem 1.4rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.filters .input {
  flex: 1;
  min-width: 160px;
}

/* ===== TABLE ===== */
.table {
  width: 100%;
  border-collapse: collapse;
}

.table thead th {
  background: var(--bg);
  color: var(--text-sub);
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  padding: .7rem 1rem;
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

.table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

.table tbody tr:last-child {
  border-bottom: none;
}

.table tbody tr:hover {
  background: var(--bg);
}

.table tbody td {
  padding: .75rem 1rem;
  font-size: .9rem;
  vertical-align: middle;
}

.table .empty {
  text-align: center;
  color: var(--text-sub);
  font-style: italic;
  padding: 2rem;
}

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .25rem .65rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
}

.badge-em-andamento {
  background: rgba(245, 158, 11, .15);
  color: #b45309;
}

.badge-concluido {
  background: rgba(34, 197, 94, .15);
  color: #15803d;
}

.badge-faturado {
  background: rgba(37, 99, 168, .13);
  color: var(--blue-mid);
}

.badge-ok {
  background: rgba(34, 197, 94, .15);
  color: #15803d;
}

.badge-baixo {
  background: rgba(239, 68, 68, .13);
  color: #dc2626;
}

.badge-particular {
  background: rgba(42, 201, 192, .15);
  color: var(--teal-dark);
}

.badge-locadora {
  background: rgba(26, 74, 122, .13);
  color: var(--blue);
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .55rem 1.1rem;
  border-radius: 8px;
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background: var(--teal);
  color: #fff;
}

.btn-primary:hover {
  background: var(--teal-dark);
  box-shadow: 0 4px 14px rgba(42, 201, 192, .4);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text);
}

.btn-outline:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
}

.btn-sm {
  padding: .38rem .75rem;
  font-size: .8rem;
}

.btn-danger {
  background: var(--red);
  color: #fff;
}

.btn-danger:hover {
  opacity: .88;
}

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  padding: .3rem;
  color: var(--text-sub);
  border-radius: 6px;
  transition: all var(--transition);
  font-size: .95rem;
}

.btn-icon:hover {
  color: var(--teal-dark);
  background: var(--teal-light);
}

.btn-icon.del:hover {
  color: var(--red);
  background: rgba(239, 68, 68, .1);
}

/* ===== INPUTS ===== */
.input {
  width: 100%;
  padding: .6rem .85rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: .9rem;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(42, 201, 192, .15);
}

select.input {
  appearance: auto;
  cursor: pointer;
}

textarea.input {
  resize: vertical;
}

/* ===== FORM ===== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .85rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.form-group.full {
  grid-column: 1/-1;
}

.form-group label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-sub);
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 40, .45);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 1rem;
}

.modal-overlay.open {
  display: flex;
  animation: fadeIn .2s ease;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 560px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .2);
  overflow: hidden;
  animation: slideUp .22s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(16px);
    opacity: 0;
  }

  to {
    transform: none;
    opacity: 1;
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-mid) 100%);
}

.modal-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
}

.modal-close {
  background: rgba(255, 255, 255, .15);
  border: none;
  color: #fff;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.modal-close:hover {
  background: rgba(255, 255, 255, .3);
}

.modal-body {
  padding: 1.4rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
  padding: 1rem 1.4rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

/* ===== AGENDA ===== */
.agenda-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1rem 1.4rem;
  border-bottom: 1px solid var(--border);
}

.agenda-date-label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--blue);
  min-width: 200px;
  text-align: center;
}

.agenda-slots {
  padding: 1rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.agenda-slot {
  display: flex;
  align-items: center;
  gap: .75rem;
  background: var(--teal-light);
  border-radius: 10px;
  padding: .75rem 1rem;
  font-size: .9rem;
  border-left: 4px solid var(--teal);
}

.agenda-slot .slot-time {
  font-weight: 700;
  color: var(--teal-dark);
  min-width: 50px;
}

.agenda-slot .slot-info {
  flex: 1;
}

.agenda-empty {
  text-align: center;
  color: var(--text-sub);
  padding: 2rem;
  font-style: italic;
}

.agenda-list {
  padding: .75rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.agenda-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .875rem;
  padding: .5rem .75rem;
  background: var(--teal-light);
  border-radius: 8px;
}

.agenda-item i {
  color: var(--teal-dark);
}

/* ===== RELATÓRIOS ===== */
.rel-list {
  padding: 1rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.rel-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .9rem;
}

.rel-bar-wrap {
  flex: 1;
  margin: 0 .75rem;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.rel-bar {
  height: 100%;
  background: var(--teal);
  border-radius: 4px;
  transition: width .5s ease;
}

.rel-val {
  font-weight: 700;
  color: var(--blue);
  min-width: 50px;
  text-align: right;
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 999;
  background: var(--blue);
  color: #fff;
  padding: .8rem 1.4rem;
  border-radius: 10px;
  font-size: .9rem;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
  opacity: 0;
  transform: translateY(12px);
  transition: opacity .3s ease, transform .3s ease;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: none;
}

.toast.success {
  background: #15803d;
}

.toast.error {
  background: var(--red);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: none;
  }

  .main-wrapper {
    margin-left: 0;
  }

  .menu-btn {
    display: flex;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-group.full {
    grid-column: 1;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .content {
    padding: 1rem;
  }

  .topbar {
    padding: .75rem 1rem;
  }

  .date-display {
    display: none;
  }
}

@media (max-width: 460px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .table thead {
    display: none;
  }

  .table tbody tr {
    display: flex;
    flex-direction: column;
    padding: .75rem 1rem;
    gap: .3rem;
    border-bottom: 2px solid var(--border);
  }

  .table tbody td {
    padding: 0;
    display: flex;
    gap: .5rem;
    font-size: .85rem;
  }

  .table tbody td::before {
    content: attr(data-label);
    font-weight: 600;
    color: var(--text-sub);
    min-width: 90px;
    font-size: .78rem;
  }
}