:root {
  --navy: #0f3258;
  --navy-2: #0c2c4e;
  --navy-deep: #0a2544;
  --navy-text: #163a66;
  --blue: #1e74f5;
  --blue-hover: #1665dc;
  --blue-soft: #e8f1fd;
  --orange: #f47b20;
  --text: #1c3d66;
  --muted: #6b82a3;
  --line: #d7e3f0;
  --bg: #f3f7fb;
  --white: #ffffff;
  --shadow: 0 12px 40px rgba(15, 50, 88, 0.12);
  --radius: 18px;
  --minuta-1: #3a92f0;
  --minuta-2: #1f73e8;
  --rota-1: #27c08a;
  --rota-2: #16a36f;
  --inventario-1: #f0b134;
  --inventario-2: #e39214;
  --estoque-1: #8b7cf0;
  --estoque-2: #6d5ce3;
  --devolucao-1: #f06a6a;
  --devolucao-2: #e14b4b;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Inter, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; }
button, input, select { font-family: inherit; }

.brand {
  display: flex;
  align-items: center;
  line-height: 1;
}
.brand img {
  display: block;
  height: 40px;
  width: auto;
}
.brand-sm img { height: 36px; }
.brand-hero img { height: 88px; }

/* ========== LOGIN ========== */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 1fr;
}
.login-hero {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(8, 28, 56, 0.28) 0%, rgba(8, 32, 64, 0.50) 38%, rgba(8, 32, 64, 0.40) 100%),
    url("../img/login-bg.jpg?v=6") center 70% / cover no-repeat;
  color: #fff;
  padding: 72px 56px 52px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.login-hero h1 {
  margin: 26px 0 0;
  font-size: 42px;
  font-weight: 500;
  line-height: 1.22;
  max-width: 540px;
  text-shadow: 0 2px 16px rgba(0, 0, 0, 0.25);
}
.hero-foot {
  font-size: 15px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.86);
}
.login-panel {
  background: #eaf3fb;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px 24px;
  position: relative;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--white);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 42px 40px 32px;
}
.login-card h2 {
  margin: 0;
  text-align: center;
  color: var(--navy-text);
  font-size: 28px;
  font-weight: 700;
}
.login-card .sub {
  margin: 10px 0 28px;
  text-align: center;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.45;
}
.field {
  position: relative;
  margin-bottom: 14px;
}
.field input {
  width: 100%;
  height: 50px;
  border: 1px solid #dbe6f2;
  background: #f7fafc;
  border-radius: 12px;
  padding: 0 44px 0 44px;
  font-size: 15px;
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(30, 116, 245, 0.12);
  background: #fff;
}
.field .ico {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #8aa0b8;
  display: flex;
}
.field .eye {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: none;
  color: #8aa0b8;
  cursor: pointer;
  padding: 4px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  cursor: pointer;
  font-weight: 700;
  border-radius: 12px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 8px 18px rgba(30, 116, 245, 0.28);
}
.btn-primary:hover { background: var(--blue-hover); }
.btn-block {
  width: 100%;
  height: 50px;
  font-size: 16px;
  margin-top: 8px;
}
.forgot {
  display: block;
  text-align: center;
  margin-top: 16px;
  font-weight: 600;
  font-size: 14px;
}
.login-copy {
  position: absolute;
  bottom: 18px;
  color: #8aa0b8;
  font-size: 13px;
}
.alert {
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 16px;
  font-size: 14px;
}
.alert-erro { background: #fde8e8; color: #b42318; }
.alert-ok { background: #e7f8ef; color: #067647; }
.alert-info { background: var(--blue-soft); color: #175cd3; }

/* ========== PORTAL ========== */
.topbar {
  height: 68px;
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}
.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar-sep {
  width: 1px;
  height: 28px;
  background: rgba(255,255,255,0.28);
}
.topbar-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.95;
}
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.35);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  background: rgba(255,255,255,0.12);
}
.user-chip strong { display: block; font-size: 14px; }
.user-chip small { display: block; font-size: 12px; opacity: 0.8; }
.btn-sair, .btn-admin {
  color: #fff;
  background: transparent;
  border: 0;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}
.btn-admin {
  opacity: 0.9;
  padding: 6px 10px;
  border-radius: 8px;
}
.btn-admin:hover { background: rgba(255,255,255,0.08); }

.portal-wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 36px 28px 48px;
}
.portal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 28px;
}
.portal-head h1 {
  margin: 0;
  font-size: 40px;
  color: #1d4f9a;
  font-weight: 800;
}
.portal-head p {
  margin: 8px 0 0;
  color: #4b6ea3;
  font-size: 16px;
}
.when { text-align: right; color: #7b8eaa; }
.when .date { font-size: 14px; }
.when .hour { font-size: 22px; font-weight: 700; color: #5b7190; margin-top: 2px; }

.cards {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
}
.sys-card {
  min-height: 252px;
  border-radius: 18px;
  color: #fff;
  padding: 26px 20px 20px;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(20, 40, 80, 0.12);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  cursor: pointer;
}
.sys-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 30px rgba(20, 40, 80, 0.18);
  color: #fff;
}
.sys-card .icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  margin-bottom: 22px;
}
.sys-card h3 {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.sys-card .desc {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.35;
  color: rgba(255,255,255,0.92);
  max-width: 140px;
}
.sys-card .go {
  margin-top: auto;
  padding-top: 18px;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0.95;
}
.card-minuta { background: linear-gradient(180deg, var(--minuta-1), var(--minuta-2)); }
.card-rota { background: linear-gradient(180deg, var(--rota-1), var(--rota-2)); }
.card-inventario { background: linear-gradient(180deg, var(--inventario-1), var(--inventario-2)); }
.card-estoque { background: linear-gradient(180deg, var(--estoque-1), var(--estoque-2)); }
.card-devolucao { background: linear-gradient(180deg, var(--devolucao-1), var(--devolucao-2)); }

.info-bar {
  margin-top: 22px;
  background: #eef5ff;
  border-radius: 16px;
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  color: #3d5f8f;
  font-size: 13.5px;
}
.info-bar .left {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.info-bar .dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #d6e8ff;
  color: var(--blue);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-weight: 800;
}
.info-meta { display: flex; gap: 18px; color: #7b93b3; font-weight: 600; }

.empty-cards {
  background: #fff;
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  color: var(--muted);
}

/* ========== ADMIN ========== */
.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 232px 1fr;
}
.sidebar {
  background: linear-gradient(180deg, #123a66 0%, #0d2f54 100%);
  color: #fff;
  padding: 22px 16px 18px;
  display: flex;
  flex-direction: column;
}
.side-brand { padding: 6px 10px 18px; }
.side-kicker {
  margin: 10px 0 18px;
  font-size: 11px;
  letter-spacing: 0.14em;
  font-weight: 800;
  opacity: 0.85;
}
.side-nav { display: flex; flex-direction: column; gap: 4px; }
.side-nav a {
  color: rgba(255,255,255,0.88);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 14px;
}
.side-nav a:hover { background: rgba(255,255,255,0.08); color: #fff; }
.side-nav a.active {
  background: #2f6cb8;
  color: #fff;
}
.side-foot {
  margin-top: auto;
  padding: 16px 10px 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  line-height: 1.45;
  color: #7fb7ff;
}

.admin-main { padding: 28px 32px 40px; }
.page-card {
  background: #fff;
  border-radius: 22px;
  box-shadow: 0 8px 30px rgba(16, 50, 88, 0.06);
  padding: 28px;
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
}
.page-head h1, .back-title {
  margin: 0;
  color: #1d4f9a;
  font-size: 32px;
  font-weight: 800;
}
.page-head p, .page-sub {
  margin: 6px 0 0;
  color: var(--muted);
}
.back-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.back-title a { color: #1d4f9a; display: grid; }

.btn-new {
  height: 42px;
  padding: 0 16px;
  border-radius: 12px;
  font-size: 14px;
}
.table-wrap { overflow-x: auto; }
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.data th {
  text-align: left;
  color: #7b8eaa;
  font-weight: 700;
  font-size: 12px;
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
}
table.data td {
  padding: 12px 8px;
  border-bottom: 1px solid #eef3f8;
  color: var(--text);
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.badge-on { background: #e6f8ee; color: #12b76a; }
.badge-off { background: #fde8e8; color: #f04438; }
.actions { display: flex; gap: 8px; }
.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 0;
  display: grid;
  place-items: center;
  cursor: pointer;
  background: #eef5ff;
  color: var(--blue);
}
.icon-btn.danger { background: #fde8e8; color: #f04438; }
.icon-btn.ghost { background: #eef5ff; color: #2f6cb8; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 28px;
}
label.lbl {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--navy-text);
}
input.ctl, select.ctl {
  width: 100%;
  height: 46px;
  border: 1px solid #dbe6f2;
  border-radius: 12px;
  padding: 0 14px;
  background: #fff;
  color: var(--text);
  outline: none;
}
input.ctl:focus, select.ctl:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(30, 116, 245, 0.12);
}
.checks { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.checks label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--text);
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 28px;
}
.btn-ghost {
  height: 44px;
  padding: 0 18px;
  background: #fff;
  color: var(--navy-text);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-weight: 700;
}
.notice {
  background: #eef6ff;
  color: #2f6cb8;
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 18px;
  font-size: 14px;
}
.prog-ico {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  color: #fff;
  margin-right: 8px;
  vertical-align: middle;
}
.prog-ico.minuta { background: var(--minuta-2); }
.prog-ico.rota { background: var(--rota-2); }
.prog-ico.inventario { background: var(--inventario-2); }
.prog-ico.estoque { background: var(--estoque-2); }
.prog-ico.devolucao { background: var(--devolucao-2); }
.prog-ico svg { width: 16px; height: 16px; }
.url-input {
  width: 100%;
  min-width: 240px;
  height: 38px;
  border: 0;
  background: #f3f7fb;
  border-radius: 8px;
  padding: 0 10px;
  color: #3d5f8f;
  font-size: 13px;
}
.check-cell { text-align: center; }
.cfg-list { display: grid; gap: 12px; max-width: 560px; }
.cfg-item {
  background: #f6f9fc;
  border-radius: 12px;
  padding: 14px 16px;
}
.cfg-item small { color: var(--muted); display: block; margin-bottom: 4px; }
.flash-stack { margin-bottom: 16px; }

.perm-table input { width: 16px; height: 16px; }

@media (max-width: 1100px) {
  .cards { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .login-page { grid-template-columns: 1fr; }
  .login-hero { min-height: 320px; padding: 36px 28px; }
  .login-hero h1 { font-size: 34px; }
  .brand-hero img { height: 70px; }
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; gap: 8px; }
  .side-nav { flex-direction: row; flex-wrap: wrap; }
  .side-foot { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .portal-head { flex-direction: column; }
  .when { text-align: left; }
}
@media (max-width: 640px) {
  .cards { grid-template-columns: 1fr; }
  .login-card { padding: 28px 20px; }
  .topbar { padding: 0 14px; }
  .topbar-title { display: none; }
}
