:root {
  --blue: #E91E63;
  --blue-dark: #C2185B;
  --blue-light: #fce4ec;
  --blue-mid: #f8bbd0;
  --green: #10b981;
  --green-light: #d1fae5;
  --red: #ef4444;
  --red-light: #fee2e2;
  --orange: #f59e0b;
  --orange-light: #fef3c7;
  --g50:  #f8fafc;
  --g100: #f1f5f9;
  --g200: #e2e8f0;
  --g300: #cbd5e1;
  --g400: #94a3b8;
  --g500: #64748b;
  --g600: #475569;
  --g700: #334155;
  --g800: #1e293b;
  --g900: #0f172a;
  --white: #fff;
  --surface: #fff;
  --surface2: #f8fafc;
  --sw: 256px;
  --sw-collapsed: 64px;
  --r: 12px;
  --rlg: 16px;
}

[data-theme="dark"] {
  --blue-light: rgba(233,30,99,.15);
  --blue-mid: rgba(233,30,99,.2);
  --green-light: rgba(16,185,129,.15);
  --red-light: rgba(239,68,68,.15);
  --orange-light: rgba(245,158,11,.15);
  --g50:  #0f172a;
  --g100: #1e293b;
  --g200: #273548;
  --g300: #334155;
  --g400: #64748b;
  --g500: #94a3b8;
  --g600: #cbd5e1;
  --g700: #e2e8f0;
  --g800: #f1f5f9;
  --g900: #f8fafc;
  --white: #1e293b;
  --surface: #1e293b;
  --surface2: #273548;
}

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

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--g50);
  color: var(--g800);
  min-height: 100vh;
  width: 100%;
  transition: background .2s, color .2s;
}

/* ───────── LOGIN ───────── */
#loginScreen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f0f0f0;
}

.lcard {
  background: var(--white);
  border-radius: 16px;
  padding: 44px 40px;
  width: 420px;
  max-width: 92vw;
  box-shadow: 0 4px 24px rgba(0,0,0,.10);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.llogo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}

.llogo-icon {
  width: 44px;
  height: 44px;
  background: var(--blue);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 20px;
}

.llogo-text {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--g900);
}

.llogo-text span { color: var(--blue); }

.lcard h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--g900);
}

.lcard p {
  color: var(--g500);
  font-size: .875rem;
  margin-bottom: 28px;
}

.fl {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--g600);
  margin-bottom: 6px;
  text-align: left;
  width: 100%;
}

.fi {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--g200);
  border-radius: var(--r);
  font-family: inherit;
  font-size: .9rem;
  outline: none;
  transition: .2s;
  color: var(--g800);
  margin-bottom: 16px;
  background: var(--g50);
  text-align: left;
}

.fi:focus {
  border-color: var(--blue);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(233,30,99,.1);
}

.btn-login {
  width: 100%;
  padding: 13px;
  background: var(--blue);
  color: white;
  border: none;
  border-radius: var(--r);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: .2s;
  margin-top: 4px;
  letter-spacing: .3px;
}

.btn-login:hover {
  background: var(--blue-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(233,30,99,.3);
}

.lerr {
  color: var(--red);
  font-size: .82rem;
  margin-top: 10px;
  display: none;
  align-items: center;
  gap: 6px;
}

.lfooter {
  margin-top: 20px;
  font-size: .75rem;
  color: var(--g400);
}

/* ───────── APP / LAYOUT ───────── */
#appScreen { display: none; width: 100%; }

.app { display: flex; min-height: 100vh; width: 100vw; }

.sidebar {
  width: var(--sw);
  background: var(--white);
  border-right: 1px solid var(--g200);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 20;
  flex-shrink: 0;
  transition: width .2s ease;
  overflow: hidden;
}

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

.sidebar.collapsed .slogo-text,
.sidebar.collapsed .snav-sect,
.sidebar.collapsed .nitem span,
.sidebar.collapsed .uinfo {
  display: none;
}

.sidebar.collapsed .nitem { justify-content: center; padding: 9px; }
.sidebar.collapsed .ucard { padding: 6px; justify-content: center; }
.sidebar.collapsed .sbot { flex-direction: column; gap: 8px; }

.slogo {
  padding: 16px 20px;
  border-bottom: 1px solid var(--g100);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 72px;
  overflow: hidden;
}

.snav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.snav-sect {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--g400);
  padding: 12px 8px 6px;
  white-space: nowrap;
}

.nitem {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: .875rem;
  font-weight: 500;
  color: var(--g600);
  cursor: pointer;
  transition: .15s;
  white-space: nowrap;
}

.nitem i { width: 18px; text-align: center; font-size: 1rem; flex-shrink: 0; }
.nitem:hover { background: var(--g100); color: var(--g800); }
.nitem.active { background: var(--blue-light); color: var(--blue); font-weight: 600; }

.main {
  margin-left: var(--sw);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  width: calc(100% - var(--sw));
  overflow-x: hidden;
  transition: margin-left .2s ease, width .2s ease;
}

.main.expanded {
  margin-left: var(--sw-collapsed);
  width: calc(100% - var(--sw-collapsed));
}

.sidebar-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--g400);
  font-size: .95rem;
  padding: 5px 7px;
  border-radius: 8px;
  transition: .15s;
}
.sidebar-toggle:hover { background: var(--g100); color: var(--g600); }

.btn-dark {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  color: var(--g400);
  font-size: 1rem;
  transition: .15s;
}
.btn-dark:hover { background: var(--g100); color: var(--g600); }

.sbot {
  padding: 12px;
  border-top: 1px solid var(--g100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ucard {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--r);
  cursor: pointer;
  transition: .15s;
  flex: 1;
  overflow: hidden;
}
.ucard:hover { background: var(--g100); }

.uav {
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: 50%;
  background: var(--blue-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .8rem;
  color: var(--blue);
}

.uinfo { overflow: hidden; min-width: 0; }
.uname {
  font-size: .85rem;
  font-weight: 600;
  color: var(--g800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.urole {
  font-size: .72rem;
  color: var(--g500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ───────── TOPBAR ───────── */
.topbar {
  background: var(--white);
  border-bottom: 1px solid var(--g200);
  padding: 0 28px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
  width: 100%;
}

.topbar-l h1 { font-size: 1.15rem; font-weight: 700; color: var(--g900); }
.topbar-l p { font-size: .78rem; color: var(--g500); margin-top: 1px; }

.topbar-r { display: flex; align-items: center; gap: 10px; }

.btn-new {
  background: var(--blue);
  color: white;
  border: none;
  border-radius: var(--r);
  padding: 8px 16px;
  font-family: inherit;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: .2s;
}
.btn-new:hover { background: var(--blue-dark); transform: translateY(-1px); }

.content { padding: 24px 28px; flex: 1; width: 100%; min-width: 0; }

/* ───────── TABELA ───────── */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--g200);
  border-radius: var(--rlg);
  overflow: hidden;
}

.table-scroll { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: .845rem; }

thead th {
  padding: 13px 16px;
  background: var(--g50);
  border-bottom: 1px solid var(--g200);
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--g500);
  text-align: left;
  white-space: nowrap;
}

tbody tr { border-bottom: 1px solid var(--g100); transition: background .15s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--g50); }
tbody td { padding: 13px 16px; vertical-align: middle; }

.td-title { font-weight: 600; color: var(--g800); }
.td-sub { font-size: .75rem; color: var(--g500); margin-top: 2px; }

.col-actions { white-space: nowrap; }

.ibtn {
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  transition: .15s;
  background: transparent;
  color: var(--g400);
}
.ibtn:hover { background: var(--g100); color: var(--g700); }
.ibtn.danger:hover { background: var(--red-light); color: var(--red); }

.badge-equipe {
  background: var(--g100);
  padding: 2px 12px;
  border-radius: 12px;
  font-size: .72rem;
  color: var(--g600);
  font-weight: 600;
  display: inline-block;
}

.rbadge {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
}
.r-admin { background: #ede9fe; color: #5b21b6; }
.r-supervisor { background: #dbeafe; color: #1e40af; }
.r-vendedor { background: var(--g100); color: var(--g600); }

.empty {
  text-align: center;
  padding: 50px 20px;
  color: var(--g400);
}
.empty i { font-size: 2.2rem; margin-bottom: 10px; display: block; }

/* Senha com olhinho */
.senha-cell { display: flex; align-items: center; gap: 8px; }
.senha-mask { font-family: monospace; letter-spacing: 1px; color: var(--g600); }
.btn-eye {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--g400);
  font-size: .85rem;
  padding: 2px 4px;
  transition: .15s;
}
.btn-eye:hover { color: var(--blue); }

/* ───────── MODAIS ───────── */
.movl {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: .25s;
}
.movl.open { opacity: 1; visibility: visible; }

.mbox {
  background: var(--white);
  width: 720px;
  max-width: 95vw;
  max-height: 92vh;
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(.96) translateY(10px);
  transition: transform .25s;
}
.movl.open .mbox { transform: scale(1) translateY(0); }

.mbox.mbox-sm { width: 480px; }

.mhead {
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--g200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.mhead h3 { font-size: 1.1rem; font-weight: 700; display: flex; align-items: center; gap: 10px; }
.mhead h3 i { color: var(--blue); }

.mbox-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--g400);
  font-size: 1.1rem;
  padding: 4px;
}
.mbox-close:hover { color: var(--g700); }

.mbody { padding: 20px 24px; overflow-y: auto; flex: 1; }

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

.fgrp { margin-bottom: 16px; }
.fgrp label {
  display: block;
  font-size: .78rem;
  font-weight: 700;
  color: var(--g600);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.fgrp .hint { font-size: .72rem; color: var(--g400); margin-top: 4px; font-weight: 400; text-transform: none; }

.finput, .fselect {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--g200);
  border-radius: 10px;
  font-family: inherit;
  font-size: .9rem;
  outline: none;
  transition: .2s;
  color: var(--g800);
  background: var(--surface);
}
.finput:focus, .fselect:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(233,30,99,.08);
}

.frow { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.frow-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

.fsection-title {
  font-size: .82rem;
  font-weight: 700;
  color: var(--g700);
  margin: 20px 0 12px;
  padding-top: 16px;
  border-top: 1px solid var(--g100);
  display: flex;
  align-items: center;
  gap: 8px;
}
.fsection-title:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.fsection-title i { color: var(--blue); }

/* ───────── BOTÕES ───────── */
.btn-cy {
  padding: 9px 24px;
  background: var(--blue);
  color: white;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  transition: .2s;
}
.btn-cy:hover { background: var(--blue-dark); }
.btn-cy.danger { background: var(--red); }
.btn-cy.danger:hover { background: #dc2626; }

.btn-cn {
  padding: 9px 24px;
  background: var(--g100);
  color: var(--g700);
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
  transition: .2s;
}
.btn-cn:hover { background: var(--g200); }

/* ───────── CONFIRM ───────── */
.cfovl {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 400;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: .2s;
}
.cfovl.open { opacity: 1; visibility: visible; }

.cfbox {
  background: var(--surface);
  border-radius: 16px;
  padding: 28px;
  width: 380px;
  max-width: 90vw;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.25);
}
.cf-icon { font-size: 2.5rem; margin-bottom: 14px; color: var(--orange); }
.cfbox h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; }
.cfbox p { font-size: .875rem; color: var(--g500); margin-bottom: 22px; line-height: 1.5; }
.cf-btns { display: flex; gap: 10px; justify-content: center; }

/* ───────── TOAST ───────── */
.toastwrap {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--g900);
  color: white;
  padding: 12px 18px;
  border-radius: 12px;
  font-size: .85rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 25px -5px rgba(0,0,0,.12);
  animation: tin .3s ease;
  max-width: 320px;
}
.toast.s { background: #065f46; }
.toast.e { background: #991b1b; }
.toast.w { background: #92400e; }

@keyframes tin {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.hidden { display: none !important; }

/* ───────── RESPONSIVO ───────── */
@media (max-width: 900px) {
  .sidebar { width: var(--sw-collapsed) !important; }
  .slogo-text, .nitem span, .snav-sect, .uinfo { display: none !important; }
  .nitem { justify-content: center; padding: 9px; }
  .ucard { justify-content: center; padding: 6px; }
  .main { margin-left: var(--sw-collapsed) !important; width: calc(100% - var(--sw-collapsed)) !important; }
  .topbar { padding: 0 16px; }
  .frow, .frow-3 { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .content { padding: 14px; }
  table { font-size: .78rem; }
  thead th, tbody td { padding: 8px; }
}