/* ===================================================
   DS Logística - WMS Sistema
   Paleta: Laranja #F26522 | Cinza #4A4A4A | Branco #FFFFFF
   =================================================== */

:root {
  --orange:        #F26522;
  --orange-dark:   #D4541A;
  --orange-light:  #FFF0E8;
  --gray-dark:     #2E2E2E;
  --gray:          #4A4A4A;
  --gray-mid:      #7A7A7A;
  --gray-light:    #D0D0D0;
  --gray-bg:       #F4F5F7;
  --white:         #FFFFFF;
  --sidebar-width: 220px;
  --sidebar-collapsed-width: 78px;
  --header-height: 64px;
  --radius:        8px;
  --shadow:        0 2px 8px rgba(0,0,0,.10);
  --shadow-md:     0 4px 16px rgba(0,0,0,.13);
  --transition:    .22s ease;
}

/* ---- RESET ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; scroll-behavior: smooth; }
body { font-family: 'Segoe UI', Arial, sans-serif; background: var(--gray-bg); color: var(--gray); min-height: 100vh; }
a { text-decoration: none; color: inherit; }
ul, ol { list-style: none; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ===================================================
   LOGIN PAGE
   =================================================== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--gray-dark) 0%, #1a1a1a 60%, #3a1800 100%);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(242,101,34,.18) 0%, transparent 70%);
  top: -100px; right: -100px;
}
.login-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(242,101,34,.12) 0%, transparent 70%);
  bottom: -80px; left: -80px;
}

.login-card {
  background: var(--white);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  padding: 48px 44px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo .logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px; height: 72px;
  background: var(--orange);
  border-radius: 16px;
  margin-bottom: 14px;
  box-shadow: 0 6px 20px rgba(242,101,34,.40);
  overflow: hidden;
}

.login-logo .logo-icon svg {
  width: 40px; height: 40px;
  fill: white;
}

.login-logo .logo-icon.logo-icon-image {
  width: auto;
  height: auto;
  max-width: 260px;
  padding: 0;
  background: transparent;
  border-radius: 0;
  box-shadow: none;
}

.login-logo .logo-image {
  display: block;
  max-width: 100%;
  max-height: 84px;
  object-fit: contain;
}

.login-logo h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--gray-dark);
  letter-spacing: -.5px;
}

.login-logo h1 span {
  color: var(--orange);
}

.login-logo p {
  font-size: .82rem;
  color: var(--gray-mid);
  margin-top: 4px;
  letter-spacing: .5px;
  text-transform: uppercase;
}

.login-form h2 {
  font-size: 1.15rem;
  color: var(--gray-dark);
  margin-bottom: 24px;
  font-weight: 600;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--gray);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .4px;
}

.form-group .input-wrap {
  position: relative;
}

.form-group .input-wrap svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px; height: 17px;
  fill: var(--gray-mid);
  pointer-events: none;
  transition: fill var(--transition);
}

.form-group input {
  width: 100%;
  padding: 11px 14px 11px 40px;
  border: 1.5px solid var(--gray-light);
  border-radius: var(--radius);
  font-size: .95rem;
  color: var(--gray-dark);
  background: var(--gray-bg);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-group input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(242,101,34,.15);
  background: var(--white);
}

.form-group input:focus + svg,
.form-group .input-wrap:focus-within svg {
  fill: var(--orange);
}

/* fix icon order */
.form-group .input-wrap input { position: relative; z-index: 1; }

.btn-login {
  width: 100%;
  padding: 13px;
  background: var(--orange);
  color: var(--white);
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--radius);
  margin-top: 8px;
  letter-spacing: .3px;
  transition: background var(--transition), box-shadow var(--transition), transform .1s;
  box-shadow: 0 4px 14px rgba(242,101,34,.35);
}

.btn-login:hover {
  background: var(--orange-dark);
  box-shadow: 0 6px 20px rgba(242,101,34,.45);
  transform: translateY(-1px);
}
.btn-login:active { transform: translateY(0); }

.login-footer {
  text-align: center;
  margin-top: 28px;
  font-size: .78rem;
  color: var(--gray-light);
}

/* Error / Alert */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: .87rem;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-error { background: #FFF0F0; border: 1px solid #FFBABA; color: #C0392B; }
.alert svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ===================================================
   MAIN APP LAYOUT
   =================================================== */

/* --- Sidebar --- */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--gray-dark);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform var(--transition), width var(--transition);
  overflow: hidden;
}

.sidebar-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  padding: 20px 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.sidebar-desktop-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: calc(var(--sidebar-width) - 17px);
  z-index: 260;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--white);
  color: var(--gray);
  box-shadow: 0 6px 18px rgba(0,0,0,.16);
  border: 1px solid rgba(0,0,0,.08);
  transition: background var(--transition), color var(--transition), transform var(--transition), left var(--transition);
}

.sidebar-desktop-toggle:hover {
  background: var(--orange-light);
  color: var(--orange);
}

.sidebar-desktop-toggle svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.sidebar-desktop-toggle .icon-expand {
  display: none;
}

.sidebar-header .s-logo {
  width: 40px; height: 40px;
  background: var(--orange);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar-header .s-logo svg {
  width: 22px; height: 22px;
  fill: white;
}

.sidebar-header .s-logo-stack {
  display: flex;
  align-items: center;
  min-height: 42px;
}

.sidebar-header .s-logo.s-logo-open.s-logo-image {
  width: auto;
  height: 42px;
  background: transparent;
  border-radius: 0;
  justify-content: flex-start;
}

.sidebar-header .s-logo.s-logo-open.s-logo-image img {
  display: block;
  max-width: 148px;
  max-height: 42px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.sidebar-header .s-logo.s-logo-compact.s-logo-image {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,.08);
  border-radius: 12px;
  justify-content: center;
}

.sidebar-header .s-logo.s-logo-compact.s-logo-image img {
  display: block;
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.sidebar-header .s-logo-compact {
  display: none;
}

.sidebar-header .s-brand {
  overflow: hidden;
}
.sidebar-header .s-brand span {
  display: block;
  color: var(--gray-mid);
  font-size: .72rem;
  letter-spacing: .5px;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 14px 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}
.sidebar-nav::-webkit-scrollbar { display: none; }

.nav-section-label {
  padding: 12px 20px 4px;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray-mid);
  white-space: nowrap;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: #BDBDBD;
  font-size: .9rem;
  transition: background var(--transition), color var(--transition);
  position: relative;
  white-space: nowrap;
  border-left: 3px solid transparent;
}

.nav-item svg {
  width: 19px; height: 19px;
  fill: currentColor;
  flex-shrink: 0;
}

.nav-item .nav-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-item:hover {
  background: rgba(255,255,255,.06);
  color: white;
}

.nav-item.active {
  background: rgba(242,101,34,.15);
  color: var(--orange);
  border-left-color: var(--orange);
}

.nav-item .badge {
  margin-left: auto;
  background: var(--orange);
  color: white;
  font-size: .68rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
  min-width: 20px;
  text-align: center;
}

/* Sidebar footer */
.sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,.07);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}

.sidebar-user .avatar {
  width: 34px; height: 34px;
  background: var(--orange);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: .8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-user .user-info {
  overflow: hidden;
}
.sidebar-user .user-info strong {
  display: block;
  color: white;
  font-size: .85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user .user-info span {
  display: block;
  color: var(--gray-mid);
  font-size: .72rem;
  white-space: nowrap;
}

.btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: #BDBDBD;
  font-size: .85rem;
  margin-top: 8px;
  transition: background var(--transition), color var(--transition);
}
.btn-logout svg { width: 17px; height: 17px; fill: currentColor; flex-shrink: 0; }
.btn-logout:hover { background: rgba(255,255,255,.07); color: #FF6B6B; }

/* --- Header --- */
.header {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--header-height);
  background: var(--white);
  border-bottom: 1px solid var(--gray-light);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 16px;
  z-index: 100;
  box-shadow: var(--shadow);
  transition: left var(--transition);
}

.header-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: var(--radius);
  color: var(--gray);
  transition: background var(--transition);
}
.header-toggle:hover { background: var(--gray-bg); }
.header-toggle svg { width: 22px; height: 22px; fill: currentColor; }

.header-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--gray-dark);
}

.header-title span {
  color: var(--orange);
}

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: var(--radius);
  color: var(--gray);
  position: relative;
  transition: background var(--transition);
}
.header-btn:hover { background: var(--gray-bg); }
.header-btn svg { width: 20px; height: 20px; fill: currentColor; }

.header-btn .notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--orange);
  border-radius: 50%;
  border: 2px solid white;
}

.header-avatar {
  width: 36px; height: 36px;
  background: var(--orange);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  border: none;
  transition: box-shadow var(--transition);
}
.header-avatar:hover { box-shadow: 0 0 0 3px rgba(242,101,34,.30); }

/* --- Dropdown usuário --- */
.user-dropdown { position: relative; }

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background: white;
  border-radius: var(--radius);
  box-shadow: 0 8px 28px rgba(0,0,0,.15);
  min-width: 210px;
  z-index: 300;
  overflow: hidden;
  border: 1px solid var(--gray-light);
}
.dropdown-menu.show { display: block; }

.dropdown-header {
  padding: 14px 16px 12px;
  background: var(--gray-bg);
}
.dropdown-header strong {
  display: block;
  font-size: .9rem;
  font-weight: 700;
  color: var(--gray-dark);
}
.dropdown-header span {
  display: block;
  font-size: .75rem;
  color: var(--gray-mid);
  margin-top: 2px;
}

.dropdown-divider { height: 1px; background: var(--gray-light); }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  font-size: .88rem;
  color: var(--gray);
  width: 100%;
  text-align: left;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  text-decoration: none;
}
.dropdown-item svg { width: 17px; height: 17px; fill: currentColor; flex-shrink: 0; }
.dropdown-item:hover { background: var(--gray-bg); color: var(--orange); }
.dropdown-item-danger:hover { background: #FEF0F0; color: #E74C3C; }

/* --- Main Content --- */
.app-main {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  min-height: calc(100vh - var(--header-height));
  padding: 28px;
  transition: margin-left var(--transition);
}

@media (min-width: 901px) {
  .sidebar-desktop-toggle {
    display: inline-flex;
  }

  body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
  }

  body.sidebar-collapsed .header {
    left: var(--sidebar-collapsed-width);
  }

  body.sidebar-collapsed .app-main {
    margin-left: var(--sidebar-collapsed-width);
  }

  body.sidebar-collapsed .sidebar-header {
    align-items: center;
    padding-left: 12px;
    padding-right: 12px;
  }

  body.sidebar-collapsed .sidebar-desktop-toggle {
    left: calc(var(--sidebar-collapsed-width) - 17px);
  }

  body.sidebar-collapsed .sidebar-desktop-toggle .icon-collapse {
    display: none;
  }

  body.sidebar-collapsed .sidebar-desktop-toggle .icon-expand {
    display: block;
  }

  body.sidebar-collapsed .s-brand,
  body.sidebar-collapsed .nav-section-label,
  body.sidebar-collapsed .nav-item .nav-label,
  body.sidebar-collapsed .nav-item .badge {
    display: none;
  }

  body.sidebar-collapsed .sidebar-nav {
    padding-top: 10px;
  }

  body.sidebar-collapsed .sidebar-header .s-logo-open {
    display: none;
  }

  body.sidebar-collapsed .sidebar-header .s-logo-compact {
    display: flex;
  }

  body.sidebar-collapsed .nav-item {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
    margin: 0 10px;
    border-left-color: transparent;
    border-radius: 12px;
  }

  body.sidebar-collapsed .nav-item.active {
    border-left-color: transparent;
  }

  body.sidebar-collapsed .nav-item svg {
    width: 20px;
    height: 20px;
  }
}

/* ===================================================
   DASHBOARD COMPONENTS
   =================================================== */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--gray-dark);
}

.page-header p {
  font-size: .83rem;
  color: var(--gray-mid);
  margin-top: 2px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: .88rem;
  font-weight: 600;
  transition: background var(--transition), box-shadow var(--transition), transform .1s;
}
.btn svg { width: 16px; height: 16px; fill: currentColor; }

.btn-primary {
  background: var(--orange);
  color: white;
  box-shadow: 0 3px 10px rgba(242,101,34,.30);
}
.btn-primary:hover {
  background: var(--orange-dark);
  box-shadow: 0 5px 16px rgba(242,101,34,.40);
  transform: translateY(-1px);
}

.btn-outline {
  background: white;
  color: var(--gray);
  border: 1.5px solid var(--gray-light);
}
.btn-outline:hover { border-color: var(--orange); color: var(--orange); background: var(--orange-light); }

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 22px 22px 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 4px solid var(--gray-light);
  transition: transform var(--transition), box-shadow var(--transition);
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-card.orange { border-top-color: var(--orange); }
.kpi-card.green  { border-top-color: #27AE60; }
.kpi-card.blue   { border-top-color: #2980B9; }
.kpi-card.red    { border-top-color: #E74C3C; }

.kpi-card .kpi-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.kpi-card .kpi-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.kpi-card.orange .kpi-icon { background: rgba(242,101,34,.12); }
.kpi-card.green  .kpi-icon { background: rgba(39,174,96,.12); }
.kpi-card.blue   .kpi-icon { background: rgba(41,128,185,.12); }
.kpi-card.red    .kpi-icon { background: rgba(231,76,60,.12); }

.kpi-card .kpi-icon svg { width: 22px; height: 22px; }
.kpi-card.orange .kpi-icon svg { fill: var(--orange); }
.kpi-card.green  .kpi-icon svg { fill: #27AE60; }
.kpi-card.blue   .kpi-icon svg { fill: #2980B9; }
.kpi-card.red    .kpi-icon svg { fill: #E74C3C; }

.kpi-card .kpi-value {
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--gray-dark);
  line-height: 1;
  margin-top: 10px;
}

.kpi-card .kpi-label {
  font-size: .80rem;
  color: var(--gray-mid);
  font-weight: 500;
}

.kpi-card .kpi-trend {
  font-size: .75rem;
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 2px;
}
.kpi-trend.up   { color: #27AE60; }
.kpi-trend.down { color: #E74C3C; }
.kpi-trend svg  { width: 13px; height: 13px; fill: currentColor; }

/* Content grid */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 20px;
}

/* Cards */
.card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--gray-bg);
}

.card-header h3 {
  font-size: .98rem;
  font-weight: 700;
  color: var(--gray-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-header h3 svg { width: 18px; height: 18px; fill: var(--orange); }

.card-header .card-actions {
  display: flex;
  gap: 6px;
}

.btn-sm {
  padding: 5px 12px;
  font-size: .78rem;
}

/* Table */
.table-wrap {
  overflow-x: auto;
}

table.ds-table {
  width: 100%;
  border-collapse: collapse;
}

table.ds-table thead th {
  background: var(--gray-bg);
  padding: 10px 16px;
  text-align: left;
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--gray-mid);
  font-weight: 600;
  white-space: nowrap;
}

table.ds-table tbody tr {
  border-bottom: 1px solid var(--gray-bg);
  transition: background var(--transition);
}
table.ds-table tbody tr:hover { background: var(--orange-light); }
table.ds-table tbody tr:last-child { border-bottom: none; }

table.ds-table tbody td {
  padding: 11px 16px;
  font-size: .87rem;
  color: var(--gray);
  white-space: nowrap;
}

table.ds-table .font-bold { font-weight: 600; color: var(--gray-dark); }

/* Status badges */
.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .75rem;
  font-weight: 600;
}
.badge-status::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.s-recebido   { background: #E8F8F0; color: #27AE60; }
.s-armazenado { background: #EAF3FB; color: #2980B9; }
.s-transito   { background: #FFF4E5; color: #E67E22; }
.s-entregue   { background: #E9FBF0; color: #1ABC9C; }
.s-pendente   { background: #FEF9E7; color: #F39C12; }
.s-problema   { background: #FDEDEC; color: #E74C3C; }

/* Activity feed (right card) */
.activity-list {
  padding: 8px 0;
}

.activity-item {
  display: flex;
  gap: 12px;
  padding: 12px 22px;
  transition: background var(--transition);
}
.activity-item:hover { background: var(--gray-bg); }

.activity-dot {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}
.activity-dot svg { width: 16px; height: 16px; fill: currentColor; }
.dot-orange { background: rgba(242,101,34,.12); color: var(--orange); }
.dot-green  { background: rgba(39,174,96,.12);  color: #27AE60; }
.dot-blue   { background: rgba(41,128,185,.12);  color: #2980B9; }
.dot-red    { background: rgba(231,76,60,.12);   color: #E74C3C; }

.activity-body strong {
  display: block;
  font-size: .86rem;
  font-weight: 600;
  color: var(--gray-dark);
  line-height: 1.3;
}
.activity-body span {
  display: block;
  font-size: .77rem;
  color: var(--gray-mid);
  margin-top: 2px;
}

/* Botões ícone (ações de tabela) */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: background var(--transition), transform .1s;
  flex-shrink: 0;
}
.btn-icon svg { width: 17px; height: 17px; fill: currentColor; }
.btn-icon:hover { transform: scale(1.1); }

.btn-icon-danger  { background: #FEF0F0; color: #E74C3C; }
.btn-icon-danger:hover  { background: #FADBD8; }

.btn-icon-success { background: #E8F8F0; color: #27AE60; }
.btn-icon-success:hover { background: #A9DFBF; }

.btn-icon-edit    { background: var(--gray-bg); color: var(--gray); }
.btn-icon-edit:hover    { background: var(--orange-light); color: var(--orange); }

.btn-icon-pdf     { background: #FFF4E5; color: #D35400; }
.btn-icon-pdf:hover     { background: #FDEBD0; color: #AF601A; }

/* ===================================================
   MODAL (shared across all modules)
   =================================================== */
.modal-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 500;
  align-items: center;
  justify-content: center;
}
.modal-backdrop.show { display: flex; }

.modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  width: 100%;
  max-width: 500px;
  margin: 16px;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--gray-bg);
}
.modal-header h3 { font-size: 1.05rem; font-weight: 700; color: var(--gray-dark); }

.modal-close {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-mid);
  transition: background var(--transition);
}
.modal-close:hover { background: var(--gray-bg); color: var(--gray-dark); }
.modal-close svg { width: 18px; height: 18px; fill: currentColor; }

.modal-body { padding: 22px 24px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--gray-bg);
}

/* ===================================================
   SHARED UTILITY CLASSES
   =================================================== */
.alert-success { background: #E8F8F0; border: 1px solid #A9DFBF; color: #1E8449; }

.badge-perfil { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: .75rem; font-weight: 600; }
.p-adm { background: rgba(242,101,34,.12); color: #F26522; }
.p-usr { background: rgba(39,174,96,.12);  color: #27AE60; }
.p-mot { background: rgba(127,140,141,.15); color: #7F8C8D; }

.tag-ativo   { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: .72rem; font-weight: 600; background: #E8F8F0; color: #27AE60; }
.tag-inativo { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: .72rem; font-weight: 600; background: #FEF0F0; color: #E74C3C; }

.hint { font-size: .77rem; color: var(--gray-mid); margin-top: 4px; display: block; }

/* Sidebar overlay (mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 190;
}

/* ===================================================
   RESPONSIVE
   =================================================== */
@media (max-width: 1100px) {
  .content-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .sidebar-overlay.show {
    display: block;
  }
  .header {
    left: 0;
  }
  .header-toggle {
    display: flex;
  }
  .app-main {
    margin-left: 0;
    padding: 20px 16px;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 520px) {
  .login-card {
    margin: 16px;
    padding: 34px 24px;
  }
  .kpi-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .kpi-card .kpi-value {
    font-size: 1.5rem;
  }
  .app-main {
    padding: 16px 12px;
  }
  .header {
    padding: 0 14px;
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
