/* ============================================================
   Porto Painel Logístico
   ============================================================ */

:root {
  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Sora', 'Inter', ui-sans-serif, system-ui, sans-serif;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --ease: cubic-bezier(.22, .8, .28, 1);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #060c16;
  --bg-soft: #0a1322;
  --panel: #0d1728;
  --panel-2: #101e33;
  --panel-3: #16273f;
  --border: rgba(148, 163, 184, .14);
  --border-strong: rgba(148, 163, 184, .3);
  --text: #e9eff9;
  --text-strong: #ffffff;
  --muted: #8ba0bb;
  --muted-2: #63788f;
  --track: rgba(148, 163, 184, .12);
  --hover: rgba(148, 163, 184, .07);
  --hover-strong: rgba(148, 163, 184, .13);
  --grid: rgba(148, 163, 184, .1);
  --chart-panel: #0d1728;
  --shadow: 0 24px 60px -30px rgba(2, 8, 20, .9);
  --shadow-sm: 0 10px 30px -18px rgba(2, 8, 20, .9);
  --primary: #2dd4bf;
  --primary-strong: #5eead4;
  --primary-soft: rgba(45, 212, 191, .12);
  --info: #38bdf8;
  --warn: #fbbf24;
  --danger: #fb7185;
  --pos: #34d399;
  --neg: #fb7185;
  --scroll: #24344d;
  --logo-color: #ffffff;
  --heat-strong-text: #ffffff;
  --grad-head: linear-gradient(100deg, #5eead4 0%, #38bdf8 55%, #a78bfa 100%);
  --login-glow-a: rgba(45, 212, 191, .16);
  --login-glow-b: rgba(59, 130, 246, .14);
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #eef3f9;
  --bg-soft: #f6f9fd;
  --panel: #ffffff;
  --panel-2: #f7fafd;
  --panel-3: #eef4fb;
  --border: rgba(16, 38, 66, .09);
  --border-strong: rgba(16, 38, 66, .2);
  --text: #0f1e31;
  --text-strong: #07121f;
  --muted: #5d7290;
  --muted-2: #8194ac;
  --track: rgba(16, 38, 66, .08);
  --hover: rgba(16, 38, 66, .04);
  --hover-strong: rgba(16, 38, 66, .08);
  --grid: rgba(16, 38, 66, .08);
  --chart-panel: #ffffff;
  --shadow: 0 22px 50px -32px rgba(15, 38, 66, .35);
  --shadow-sm: 0 10px 24px -18px rgba(15, 38, 66, .35);
  --primary: #0d9488;
  --primary-strong: #0f766e;
  --primary-soft: rgba(13, 148, 136, .1);
  --info: #0284c7;
  --warn: #d97706;
  --danger: #e11d48;
  --pos: #0f9d75;
  --neg: #e11d48;
  --scroll: #c3d2e4;
  --logo-color: #0b1220;
  --heat-strong-text: #04211d;
  --grad-head: linear-gradient(100deg, #0d9488 0%, #0284c7 55%, #7c3aed 100%);
  --login-glow-a: rgba(13, 148, 136, .14);
  --login-glow-b: rgba(59, 130, 246, .1);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background:
    radial-gradient(1100px 560px at 10% -10%, var(--login-glow-a), transparent 60%),
    radial-gradient(900px 500px at 92% -5%, var(--login-glow-b), transparent 55%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  transition: background-color .45s var(--ease), color .45s var(--ease);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 72px 72px;
  -webkit-mask-image: radial-gradient(ellipse 85% 55% at 50% 0%, #000 5%, transparent 72%);
  mask-image: radial-gradient(ellipse 85% 55% at 50% 0%, #000 5%, transparent 72%);
  opacity: .45;
  pointer-events: none;
  z-index: 0;
}

::selection { background: rgba(45, 212, 191, .28); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll); border-radius: 99px; border: 2px solid transparent; background-clip: content-box; }

.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.logo { display: block; color: var(--logo-color); width: 156px; height: auto; }
.logo-compact { display: none; width: 38px; }
.is-hidden { display: none !important; }

h1, h2, h3, h4, p { margin-top: 0; }
button { font-family: inherit; }
a { color: inherit; }

/* ============================================================
   LOGIN
   ============================================================ */

.login-screen {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 24px 40px 20px;
  overflow: hidden;
}

.login-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  z-index: 0;
}

.login-glow-a { width: 520px; height: 520px; left: -160px; top: -180px; background: var(--login-glow-a); }
.login-glow-b { width: 620px; height: 620px; right: -220px; bottom: -260px; background: var(--login-glow-b); }

.login-top {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.login-brand { display: inline-flex; align-items: center; text-decoration: none; }
.login-brand .logo { width: 208px; }

.login-top-actions { display: flex; align-items: center; gap: 10px; }

.env-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--panel);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.env-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 10px var(--warn); }
.env-pill.supabase .dot { background: var(--pos); box-shadow: 0 0 10px var(--pos); }

.login-main {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr);
  align-items: center;
  gap: 64px;
  width: 100%;
  max-width: 1380px;
  margin: auto;
  padding: 48px 0;
}

.login-hero { max-width: 640px; animation: rise .7s var(--ease) both; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
}

.pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 0 rgba(45, 212, 191, .6);
  animation: ping 2.4s infinite;
  flex: none;
}

.login-hero h1 {
  margin: 0 0 18px;
  font-family: var(--font-display);
  font-size: clamp(38px, 4.4vw, 62px);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -.045em;
  color: var(--text-strong);
}

.grad-text {
  background: var(--grad-head);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.login-lead {
  max-width: 520px;
  margin: 0 0 28px;
  font-size: 14.5px;
  line-height: 1.7;
  color: var(--muted);
}

.login-features { list-style: none; display: flex; flex-direction: column; gap: 14px; margin: 0 0 34px; padding: 0; }
.login-features li { display: flex; gap: 12px; align-items: flex-start; }
.feature-icon {
  flex: none;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  margin-top: 1px;
  border-radius: 7px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}
.login-features strong { display: block; font-size: 12.5px; font-weight: 600; color: var(--text); }
.login-features small { display: block; margin-top: 3px; font-size: 11px; color: var(--muted-2); line-height: 1.5; }

.login-preview { position: relative; width: min(430px, 100%); height: 190px; }
.preview-card {
  position: absolute;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: linear-gradient(160deg, var(--panel), var(--panel-2));
  box-shadow: var(--shadow);
}
.preview-main { left: 0; bottom: 0; width: 330px; padding: 16px 18px; }
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.preview-head span:first-child { font-size: 9px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.preview-badge { padding: 3px 7px; border-radius: 99px; background: var(--primary-soft); color: var(--primary); font-size: 8.5px; font-weight: 700; }
.preview-main strong { display: block; font-family: var(--font-display); font-size: 31px; font-weight: 700; letter-spacing: -.04em; color: var(--text-strong); }
.preview-bars { display: flex; align-items: flex-end; gap: 5px; height: 54px; margin-top: 10px; }
.preview-bars i { flex: 1; border-radius: 3px 3px 0 0; background: linear-gradient(180deg, #2dd4bf, rgba(45, 212, 191, .18)); animation: growY .8s var(--ease) both; }
.preview-bars i:nth-child(2n) { background: linear-gradient(180deg, #38bdf8, rgba(56, 189, 248, .16)); }
.preview-float { right: 0; top: 0; width: 150px; padding: 13px 15px; transform: rotate(3deg); }
.preview-label { display: block; font-size: 8.5px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.preview-float strong { display: block; margin: 5px 0 2px; font-family: var(--font-display); font-size: 26px; font-weight: 700; color: var(--text-strong); }
.preview-float small { font-size: 9px; color: var(--pos); }

.login-card {
  width: 100%;
  max-width: 430px;
  justify-self: end;
  padding: 32px;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: linear-gradient(165deg, var(--panel) 0%, var(--panel-2) 100%);
  box-shadow: var(--shadow);
  animation: rise .7s .08s var(--ease) both;
}

.login-card-head { margin-bottom: 24px; }
.badge-soft {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  margin-bottom: 14px;
  border-radius: 99px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.login-card h2 { margin: 0 0 7px; font-family: var(--font-display); font-size: 25px; font-weight: 700; letter-spacing: -.03em; color: var(--text-strong); }
.login-card-head p { margin: 0; font-size: 12px; color: var(--muted); }

.input-group { display: flex; flex-direction: column; gap: 7px; margin-bottom: 15px; }
.input-group > span { font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

.input-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--panel-2);
  color: var(--muted-2);
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.input-wrap:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); background: var(--panel); }
.input-wrap svg { flex: none; }
.input-wrap input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
}
.input-wrap input::placeholder { color: var(--muted-2); }
.input-action { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 7px; background: transparent; color: var(--muted-2); cursor: pointer; transition: color .2s, background .2s; }
.input-action:hover { color: var(--primary); background: var(--hover); }

.login-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 2px 0 14px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--muted); cursor: pointer; }
.check input { width: 14px; height: 14px; accent-color: var(--primary); }
.link { padding: 0; border: 0; background: none; color: var(--primary); font-size: 11.5px; font-weight: 600; cursor: pointer; }
.link:hover { text-decoration: underline; }

.form-error {
  min-height: 18px;
  margin: 0 0 10px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--danger);
  line-height: 1.4;
}
.form-error:empty { min-height: 0; margin-bottom: 4px; }

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .18s, border-color .2s, background .2s, color .2s, box-shadow .2s;
}
.btn:hover { border-color: var(--border-strong); background: var(--panel-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary {
  border-color: transparent;
  background: linear-gradient(135deg, #2dd4bf, #0ea5e9);
  color: #04121b;
  box-shadow: 0 12px 26px -14px rgba(45, 212, 191, .8);
}
.btn-primary:hover { background: linear-gradient(135deg, #5eead4, #38bdf8); box-shadow: 0 16px 30px -14px rgba(45, 212, 191, .9); }
.btn-danger { border-color: rgba(251, 113, 133, .35); background: rgba(251, 113, 133, .1); color: var(--danger); }
.btn-danger:hover { background: rgba(251, 113, 133, .18); }
.btn-ghost { background: transparent; }
.btn-sm { height: 34px; padding: 0 11px; font-size: 11px; border-radius: 8px; }
.btn-block { width: 100%; height: 46px; font-size: 13px; }

.btn .spinner { display: none; }
.btn.is-loading .spinner { display: block; }
.btn.is-loading .btn-label { opacity: .7; }
.btn.is-loading { pointer-events: none; }

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(4, 18, 27, .25);
  border-top-color: #04121b;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex: none;
}
.btn:not(.btn-primary) .spinner { border-color: var(--border-strong); border-top-color: var(--primary); }

.demo-box {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.demo-box-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; font-size: 9px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; color: var(--muted-2); }
.tag { padding: 2px 6px; border-radius: 5px; background: rgba(251, 191, 36, .12); color: var(--warn); font-size: 8px; letter-spacing: .08em; }
.demo-account {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .18s;
}
.demo-account:hover { background: var(--hover); }
.demo-avatar { flex: none; width: 27px; height: 27px; display: grid; place-items: center; border-radius: 8px; background: var(--panel-3); color: var(--primary); font-size: 9px; font-weight: 800; }
.demo-account strong { display: block; font-size: 10.5px; font-weight: 600; color: var(--text); }
.demo-account small { display: block; margin-top: 1px; font-size: 9.5px; color: var(--muted-2); }
.demo-enter { margin-left: auto; font-size: 9px; font-weight: 700; color: var(--primary); opacity: 0; transition: opacity .18s; }
.demo-account:hover .demo-enter { opacity: 1; }
.login-foot { margin: 18px 0 0; text-align: center; font-size: 9.5px; color: var(--muted-2); }

/* ============================================================
   APP SHELL
   ============================================================ */

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px 12px 16px;
  border-right: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel) 0%, rgba(13, 23, 40, .55) 100%);
  backdrop-filter: blur(18px);
  overflow-y: auto;
  z-index: 40;
}
html[data-theme="light"] .sidebar { background: linear-gradient(180deg, #ffffff 0%, rgba(247, 250, 253, .75) 100%); }

.sidebar-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 6px; }
.brand { display: inline-flex; align-items: center; text-decoration: none; color: inherit; }
.sidebar-close { display: none; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-title { margin: 15px 12px 5px; font-size: 9px; font-weight: 700; letter-spacing: .2em; text-transform: uppercase; color: var(--muted-2); }
.nav-title:first-child { margin-top: 0; }

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background .2s, color .2s, transform .2s;
}
.nav-item svg { flex: none; opacity: .9; }
.nav-item:hover { background: var(--hover); color: var(--text); transform: translateX(2px); }
.nav-item.active { color: var(--text-strong); background: linear-gradient(90deg, var(--primary-soft), transparent 92%); box-shadow: inset 0 0 0 1px rgba(45, 212, 191, .18); }
.nav-item.active::before { content: ''; position: absolute; left: -12px; top: 50%; transform: translateY(-50%); width: 3px; height: 20px; border-radius: 0 3px 3px 0; background: var(--primary); box-shadow: 0 0 14px var(--primary); }
.nav-item.active svg { color: var(--primary); opacity: 1; }
.nav-badge { margin-left: auto; padding: 1px 5px; border-radius: 4px; background: var(--primary-soft); color: var(--primary); font-size: 7.5px; font-weight: 800; letter-spacing: .05em; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.connection-card {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: linear-gradient(160deg, var(--panel-2), transparent);
}
.connection-card .live-dot { flex: none; }
.connection-card strong { display: block; font-size: 9.5px; font-weight: 700; color: var(--text); }
.connection-card small { display: block; margin-top: 2px; font-size: 8.5px; color: var(--muted-2); }

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 0 rgba(52, 211, 153, .6);
  animation: ping 2.2s infinite;
}
.live-dot.warn { background: var(--warn); box-shadow: 0 0 0 0 rgba(251, 191, 36, .6); }

.sidebar-user { display: flex; align-items: center; gap: 9px; padding: 11px 8px 0; border-top: 1px solid var(--border); }
.user-meta { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.user-meta strong { font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta small { font-size: 9.5px; color: var(--muted-2); }

.avatar {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: .02em;
  color: #06202b;
  background: linear-gradient(140deg, #99f6e4, #38bdf8);
  box-shadow: 0 0 0 2px var(--panel), 0 0 0 3px var(--border);
}

.main { min-width: 0; display: flex; flex-direction: column; padding: 22px 28px 24px; }

.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 20px; flex-wrap: wrap; }
.title-block { min-width: 0; }
.title-block .eyebrow { margin-bottom: 7px; }
.title-block h1 { margin: 0; font-family: var(--font-display); font-size: clamp(23px, 2.2vw, 31px); font-weight: 700; letter-spacing: -.035em; color: var(--text-strong); }
.page-sub { margin: 4px 0 0; font-size: 11.5px; color: var(--muted-2); }
.top-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  transition: color .2s, border-color .2s, transform .2s, background .2s;
}
.icon-btn:hover { color: var(--primary); border-color: rgba(45, 212, 191, .4); background: var(--panel-2); }
.icon-btn:active { transform: scale(.94); }
.icon-btn-sm { width: 30px; height: 30px; border-radius: 8px; }
.menu-btn { display: none; }

.theme-toggle { color: var(--primary); border-color: rgba(45, 212, 191, .28); background: var(--primary-soft); }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
html[data-theme="light"] .theme-toggle .icon-sun { display: block; }
html[data-theme="light"] .theme-toggle .icon-moon { display: none; }

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--panel);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.live-pill .live-dot { width: 6px; height: 6px; }

.profile-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 42px;
  padding: 0 9px 0 5px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  color: inherit;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.profile-btn:hover { border-color: var(--border-strong); background: var(--panel-2); }
.profile-btn .avatar { width: 30px; height: 30px; font-size: 9.5px; box-shadow: none; }
.profile-meta { display: flex; flex-direction: column; line-height: 1.2; text-align: left; }
.profile-meta strong { font-size: 10.5px; font-weight: 600; }
.profile-meta small { font-size: 9px; color: var(--muted-2); }
.profile-btn > svg { color: var(--muted-2); }

.sidebar-overlay { display: none; }

/* ============================================================
   CONTEÚDO · PÁGINAS
   ============================================================ */

.content { flex: 1; min-width: 0; }
.page { display: flex; flex-direction: column; gap: 16px; animation: fadeUp .45s var(--ease) both; }
.page.is-hidden { display: none !important; }

.page-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 10px;
  color: var(--muted-2);
  flex-wrap: wrap;
}
.page-foot b { color: var(--muted); font-weight: 600; }

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.toolbar-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar-spacer { flex: 1; }

.seg {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
}
.seg button {
  height: 28px;
  padding: 0 11px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background .18s, color .18s;
}
.seg button:hover { color: var(--text); background: var(--hover); }
.seg button.active { background: var(--primary-soft); color: var(--primary); box-shadow: inset 0 0 0 1px rgba(45, 212, 191, .24); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--panel);
  color: var(--muted);
  font: inherit;
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .2s, color .2s, background .2s;
}
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip.active { border-color: rgba(45, 212, 191, .45); background: var(--primary-soft); color: var(--primary); }
.chip-count {
  display: grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 99px;
  background: var(--primary);
  color: #04121b;
  font-size: 8.5px;
  font-weight: 800;
}

/* Filtros */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: linear-gradient(150deg, var(--panel), var(--panel-2));
  box-shadow: var(--shadow-sm);
}
.filter-bar.is-hidden { display: none !important; }
.filter-field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.filter-field > span { font-size: 8.5px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); }

.select-wrap { position: relative; display: flex; align-items: center; }
.select-wrap select {
  appearance: none;
  height: 34px;
  min-width: 128px;
  max-width: 200px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.select-wrap select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.select-wrap::after {
  content: '';
  position: absolute;
  right: 10px;
  width: 7px;
  height: 7px;
  border-right: 1.6px solid var(--muted-2);
  border-bottom: 1.6px solid var(--muted-2);
  transform: translateY(-2px) rotate(45deg);
  pointer-events: none;
}

.date-field input {
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 11px;
  outline: none;
  color-scheme: inherit;
  transition: border-color .2s, box-shadow .2s;
}
.date-field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* Multiselect dos filtros */
.ms-wrap { position: relative; }
.ms-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 34px;
  min-width: 128px;
  max-width: 200px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.ms-toggle:hover { border-color: var(--border-strong); }
.ms-toggle:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.ms-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-toggle svg { flex: none; color: var(--muted-2); transition: transform .2s; }
.ms.open .ms-toggle { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.ms.open .ms-toggle svg { transform: rotate(180deg); }
.ms-menu {
  display: none;
  position: absolute;
  z-index: 45;
  top: calc(100% + 6px);
  left: 0;
  min-width: 100%;
  max-width: 280px;
  max-height: 270px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
}
.ms.open .ms-menu { display: block; }
.ms-all {
  width: 100%;
  margin-bottom: 2px;
  padding: 7px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted-2);
  font: inherit;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
}
.ms-all:hover { background: var(--hover); color: var(--text); }
.ms-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 7px;
  color: var(--text);
  font-size: 11px;
  cursor: pointer;
  white-space: nowrap;
}
.ms-option:hover { background: var(--hover); }
.ms-option input { width: 13px; height: 13px; margin: 0; flex: none; accent-color: var(--primary); cursor: pointer; }

/* Visões salvas */
.preset-ms .ms-menu { min-width: 260px; max-width: 300px; }
.preset-menu { padding: 6px; }
.preset-row { display: flex; align-items: stretch; gap: 2px; }
.preset-apply {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.preset-apply:hover { background: var(--hover); }
.preset-apply strong { font-size: 11px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preset-apply small { font-size: 9px; color: var(--muted-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preset-del {
  width: 24px;
  flex: none;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted-2);
  font: inherit;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.preset-del:hover { background: var(--hover); color: var(--danger); }
.preset-empty { margin: 4px 8px 8px; font-size: 10px; color: var(--muted-2); }
.preset-save-open {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  margin-top: 4px;
  padding: 8px;
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0 0 7px 7px;
  background: transparent;
  color: var(--primary);
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}
.preset-save-open:hover { background: var(--hover); }
.preset-form { display: flex; gap: 6px; padding: 6px 4px 2px; }
.preset-form input {
  flex: 1;
  min-width: 0;
  height: 30px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 11px;
  outline: none;
}
.preset-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.kpi-icon[data-tip-title] { cursor: help; }

@media (max-width: 560px) {
  .preset-ms .ms-menu { left: auto; right: 0; min-width: 230px; }
}
.ms-option span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--muted-2);
  width: 100%;
  min-width: 0;
  flex: 0 0 auto;
  transition: border-color .2s, box-shadow .2s;
}
.search-field:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.search-field input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 11px; }
.search-field input::placeholder { color: var(--muted-2); }

.active-filters { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.filter-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 8px;
  border: 1px solid rgba(45, 212, 191, .28);
  border-radius: 99px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 9.5px;
  font-weight: 600;
}
.filter-tag button { display: grid; place-items: center; width: 14px; height: 14px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; font-size: 12px; line-height: 1; cursor: pointer; }
.filter-tag button:hover { background: rgba(45, 212, 191, .22); }
.clear-filters { padding: 0; border: 0; background: none; color: var(--muted-2); font: inherit; font-size: 9.5px; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.clear-filters:hover { color: var(--danger); }

/* KPIs */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.kpi {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  padding: 11px 13px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(160deg, var(--panel) 0%, var(--panel-2) 100%);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform .22s var(--ease), border-color .22s, box-shadow .22s;
}
.kpi::before {
  content: '';
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, var(--kpi-tone, var(--primary)), transparent 70%);
  opacity: .9;
}
.kpi:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.kpi[data-tone="info"] { --kpi-tone: var(--info); }
.kpi[data-tone="warn"] { --kpi-tone: var(--warn); }
.kpi[data-tone="danger"] { --kpi-tone: var(--danger); }
.kpi[data-tone="violet"] { --kpi-tone: #a78bfa; }
.kpi[data-tone="pos"] { --kpi-tone: var(--pos); }

.kpi-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { font-size: 8.5px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-icon { display: grid; place-items: center; width: 23px; height: 23px; flex: none; border-radius: 7px; background: var(--hover-strong); color: var(--kpi-tone, var(--primary)); }
.kpi-icon svg { width: 13px; height: 13px; }
.kpi-value { font-family: var(--font-display); font-size: clamp(19px, 1.6vw, 23px); font-weight: 700; letter-spacing: -.04em; line-height: 1.05; color: var(--text-strong); white-space: nowrap; }
.kpi-value small { font-family: var(--font-sans); font-size: 9px; font-weight: 600; letter-spacing: 0; color: var(--muted-2); margin-left: 2px; }
.kpi-foot { display: flex; align-items: center; gap: 5px; min-height: 14px; font-size: 8.5px; color: var(--muted-2); white-space: nowrap; overflow: hidden; }
.kpi-foot .delta { display: inline-flex; align-items: center; gap: 3px; font-size: 8.5px; font-weight: 700; }
.delta.up { color: var(--pos); }
.delta.down { color: var(--danger); }
.delta.flat { color: var(--muted-2); }
.kpi-bar { height: 4px; margin-top: 2px; border-radius: 99px; background: var(--track); overflow: hidden; }
.kpi-bar i { display: block; height: 100%; border-radius: 99px; background: var(--kpi-tone, var(--primary)); transition: width .6s var(--ease); }
/* Barra composta (Performance): no prazo | fora do prazo | sem avaliação */
.kpi-bar-stack { display: flex; }
.kpi-bar-stack i { flex: none; }
.kpi-bar-stack[data-tip-title] { cursor: help; }
.kpi-bar[data-tip-title] { cursor: help; }
/* Nota fixa abaixo dos KPIs: explica a base da performance sem
   esconder a informação atrás de um tooltip. */
.kpi-note-bar {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 8px;
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--hover);
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.5;
}
.kpi-note-bar strong { color: var(--text); font-weight: 700; }
.kpi-note-ico { flex: none; display: grid; place-items: center; color: var(--info); margin-top: 1px; }

/* Cards e gráficos */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.grid-wide { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 14px; }

.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(160deg, var(--panel) 0%, var(--panel-2) 100%);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px 10px;
}
.card-head h2 { margin: 0; font-family: var(--font-display); font-size: 13px; font-weight: 700; letter-spacing: -.01em; color: var(--text-strong); }
.card-head p { margin: 3px 0 0; font-size: 9.5px; color: var(--muted-2); }
.card-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.card-body { flex: 1; min-width: 0; padding: 4px 16px 14px; }
.card-body.tight { padding: 0 8px 8px; }
.card-body.flush { padding: 0; }

.chart { display: block; width: 100%; overflow: visible; }
.chart text { font-family: var(--font-sans); }
.chart-grid { stroke: var(--grid); stroke-width: 1; }
.chart-axis { fill: var(--muted-2); font-size: 8.5px; font-weight: 500; }
.chart-axis-strong { fill: var(--muted); font-size: 9px; font-weight: 700; }
.chart-value { fill: var(--text); font-size: 9px; font-weight: 700; paint-order: stroke; stroke: var(--panel); stroke-width: 3px; stroke-linejoin: round; }
.chart-bar { transition: opacity .18s, filter .18s; cursor: pointer; }
.chart-bar:hover { filter: brightness(1.15); }
.chart-bar.is-dim { opacity: .28; }
.chart-line { fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.chart-area { opacity: .16; }
.chart-point { stroke: var(--panel); stroke-width: 2; cursor: pointer; transition: r .18s; }
.chart-point:hover { r: 5; }
.chart-hit { fill: transparent; cursor: pointer; }
.chart-legend { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; font-size: 9px; color: var(--muted); }
.chart-legend i { width: 7px; height: 7px; border-radius: 2px; flex: none; }
.chart-tip-label { fill: var(--text-strong); font-size: 9.5px; font-weight: 700; }

/* O card da rosca ocupa a mesma altura do gráfico de linha,
   então o conteúdo é centralizado para não sobrar espaço embaixo. */
.donut-body { display: flex; align-items: center; justify-content: center; }
.donut-wrap { display: flex; align-items: center; gap: 22px; width: 100%; }
.donut { flex: none; }
.donut-center { fill: var(--text-strong); font-family: var(--font-display); font-size: 22px; font-weight: 700; }
.donut-center-sub { fill: var(--muted-2); font-size: 8.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.donut-legend { display: flex; flex-direction: column; gap: 11px; min-width: 0; flex: 1; }
.donut-legend button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 7px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background .18s;
}
.donut-legend button:hover { background: var(--hover); }
.donut-legend i { width: 8px; height: 8px; border-radius: 3px; flex: none; }
.donut-legend strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 10px; font-weight: 600; line-height: 1.2; color: var(--text); }
.donut-legend small { margin-left: auto; font-size: 9px; font-weight: 700; color: var(--muted); }
.donut-legend .pct { font-size: 8.5px; color: var(--muted-2); min-width: 34px; text-align: right; }

.bar-list { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(92px, 152px) minmax(0, 1fr) 62px; align-items: center; gap: 9px; cursor: pointer; border-radius: 7px; padding: 2px 4px; margin: 0 -4px; transition: background .18s; }
.bar-row:hover { background: var(--hover); }
.bar-row:not([data-action]) { cursor: default; }
.bar-row.is-dim { opacity: .4; }
/* Rótulo em até 2 linhas: nomes longos de cliente/remetente deixam de
   ser cortados no meio da palavra. */
.bar-label {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.22;
  color: var(--text);
}
.bar-track { height: 7px; border-radius: 99px; background: var(--track); overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--primary), var(--info)); transition: width .6s var(--ease); }
.bar-row[data-tone="warn"] .bar-fill { background: linear-gradient(90deg, var(--warn), #f97316); }
.bar-row[data-tone="danger"] .bar-fill { background: linear-gradient(90deg, var(--danger), #f43f5e); }
.bar-row[data-tone="violet"] .bar-fill { background: linear-gradient(90deg, #a78bfa, #6366f1); }
.bar-value { font-size: 9.5px; font-weight: 700; color: var(--muted); text-align: right; white-space: nowrap; }

.stack-bar { display: flex; gap: 2px; height: 10px; border-radius: 99px; background: var(--track); overflow: hidden; }
.stack-bar i { display: block; height: 100%; min-width: 2px; transition: width .6s var(--ease); }
.stack-bar i:first-child { border-radius: 99px 0 0 99px; }
.stack-bar i:last-child { border-radius: 0 99px 99px 0; }
.chart-legend b { color: var(--text); font-weight: 700; }
.muted { color: var(--muted-2); }

/* Alternância de métrica nos gráficos */
.metric-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--hover);
}
.metric-toggle button {
  padding: 3px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 9px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background .18s, color .18s;
}
.metric-toggle button:hover { color: var(--text); }
.metric-toggle button.active { background: var(--primary-soft); color: var(--primary); box-shadow: inset 0 0 0 1px rgba(45, 212, 191, .22); }

/* Gráfico de colunas (destinos críticos) */
.column-chart { display: flex; align-items: flex-end; gap: 8px; height: 196px; padding: 6px 2px 0; }
.column-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
  height: 100%;
  min-width: 0;
  padding: 4px 2px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .18s;
}
.column-item:hover { background: var(--hover); }
/* A barra é um % da altura do trilho, então o trilho precisa ocupar
   o espaço restante do item (sem ele a barra fica com 0 px). */
.column-track {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  flex: 1;
  min-height: 0;
}
.column-bar {
  width: 100%;
  max-width: 34px;
  min-height: 3px;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, var(--danger), rgba(251, 113, 133, .35));
  transition: height .55s var(--ease);
}
.column-value { font-size: 8.5px; font-weight: 700; color: var(--text); white-space: nowrap; }
.column-label { height: 22px; overflow: hidden; font-size: 8.5px; line-height: 1.15; color: var(--muted-2); text-align: center; }
.column-sub { font-size: 8px; color: var(--muted-2); white-space: nowrap; }

/* Tabelas largas: cada linha fica em uma única altura, sem quebra de
   texto. A leitura horizontal é feita pela rolagem da tabela. */
.table-wide { min-width: 2350px; }
.table-entregas { min-width: 1120px; }
.table-wide td,
.table-entregas td { white-space: nowrap; }

/* Tabelas */
.table-wrap { width: 100%; overflow-x: auto; border-top: 1px solid var(--border); }
.table { width: 100%; border-collapse: collapse; font-size: 10.5px; }
.table th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--muted-2);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  text-align: left;
  white-space: nowrap;
}
.table th.sortable { cursor: pointer; user-select: none; transition: color .18s; }
.table th.sortable:hover { color: var(--text); }
.table th .sort-ind { display: inline-block; margin-left: 4px; font-size: 8px; opacity: .5; }
.table th.sorted { color: var(--primary); }
.table th.sorted .sort-ind { opacity: 1; }
.table td { padding: 9px 12px; border-bottom: 1px solid var(--border); color: var(--text); vertical-align: middle; }
.table tbody tr { transition: background .15s; }
.table tbody tr:hover { background: var(--hover); }
.table tbody tr.row-click { cursor: pointer; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .mono { font-variant-numeric: tabular-nums; }
.table .strong { font-weight: 600; color: var(--text-strong); }
.table .muted { color: var(--muted-2); }
.table .nowrap { white-space: nowrap; }
.table-empty { padding: 34px 16px; text-align: center; color: var(--muted-2); font-size: 11px; }
.table-empty strong { display: block; margin-bottom: 4px; color: var(--text); font-size: 12px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 20px;
  padding: 0 7px;
  border-radius: 5px;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge::before { content: ''; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.badge-ok { background: rgba(52, 211, 153, .12); color: var(--pos); }
.badge-warn { background: rgba(251, 191, 36, .12); color: var(--warn); }
.badge-danger { background: rgba(251, 113, 133, .12); color: var(--danger); }
.badge-info { background: rgba(56, 189, 248, .12); color: var(--info); }
.badge-neutral { background: var(--hover-strong); color: var(--muted); }
.badge-violet { background: rgba(167, 139, 250, .14); color: #a78bfa; }

.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  font-size: 10px;
  color: var(--muted-2);
  flex-wrap: wrap;
}
.pager-btns { display: flex; align-items: center; gap: 5px; }
.pager-btn {
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--muted);
  font: inherit;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .18s, color .18s, background .18s;
}
.pager-btn:hover:not(:disabled) { border-color: var(--border-strong); color: var(--text); }
.pager-btn.active { border-color: rgba(45, 212, 191, .45); background: var(--primary-soft); color: var(--primary); }
.pager-btn:disabled { opacity: .4; cursor: not-allowed; }

/* Estado vazio / carregamento */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 46px 20px;
  text-align: center;
  color: var(--muted-2);
}
.empty-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 14px; background: var(--hover-strong); color: var(--muted); }
.empty-icon svg { width: 22px; height: 22px; }
.empty strong { font-size: 12px; color: var(--text); }
.empty p { margin: 0; font-size: 10.5px; max-width: 320px; line-height: 1.5; }

.skeleton { position: relative; overflow: hidden; border-radius: 6px; background: var(--hover-strong); }
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, var(--hover), transparent);
  animation: shimmer 1.4s infinite;
}

/* ============================================================
   PERFIL
   ============================================================ */

.profile-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 14px; align-items: start; }

.profile-hero {
  position: relative;
  padding: 0 0 18px;
  overflow: hidden;
}
.profile-cover {
  height: 86px;
  background:
    radial-gradient(420px 140px at 18% 0%, rgba(45, 212, 191, .32), transparent 70%),
    radial-gradient(420px 160px at 88% 10%, rgba(56, 189, 248, .24), transparent 72%),
    linear-gradient(120deg, var(--panel-3), var(--panel-2));
  border-bottom: 1px solid var(--border);
}
.profile-hero-body { display: flex; align-items: flex-end; gap: 14px; padding: 0 18px; margin-top: -30px; }
.profile-avatar {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 20px;
  background: linear-gradient(140deg, #99f6e4, #38bdf8);
  color: #06202b;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.02em;
  box-shadow: 0 0 0 4px var(--panel), var(--shadow-sm);
}
.profile-identity { min-width: 0; padding-bottom: 2px; }
.profile-identity h2 { margin: 0; font-family: var(--font-display); font-size: 20px; font-weight: 700; letter-spacing: -.03em; color: var(--text-strong); }
.profile-identity p { margin: 3px 0 0; font-size: 10.5px; color: var(--muted-2); }
.profile-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

.profile-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; padding: 18px; }
.info-item { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); min-width: 0; }
.info-item span { display: block; font-size: 8px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 4px; }
.info-item strong { display: block; font-size: 11px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.info-item.wide { grid-column: 1 / -1; }

.screens-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 18px 4px; }
.screen-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 600;
}
.screen-chip.allowed { border-color: rgba(45, 212, 191, .32); background: var(--primary-soft); color: var(--primary); }
.screen-chip.denied { opacity: .55; text-decoration: line-through; }

.form-card .card-body { padding: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 13px; }
.field > span { font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%;
  height: 40px;
  padding: 0 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
.field textarea { height: auto; min-height: 80px; padding: 10px 11px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); background: var(--panel); }
.field input::placeholder { color: var(--muted-2); }
.field input:disabled, .field select:disabled { opacity: .6; cursor: not-allowed; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.field-hint { font-size: 9.5px; color: var(--muted-2); line-height: 1.45; }
.field-error { font-size: 9.5px; font-weight: 600; color: var(--danger); min-height: 0; }

.password-wrap { position: relative; }
.password-wrap input { padding-right: 40px; }
.password-wrap .input-action { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }

.password-meter { display: flex; gap: 4px; margin-top: 2px; }
.password-meter i { height: 3px; flex: 1; border-radius: 99px; background: var(--track); transition: background .25s; }
.password-meter[data-score="1"] i:nth-child(1) { background: var(--danger); }
.password-meter[data-score="2"] i:nth-child(-n+2) { background: var(--warn); }
.password-meter[data-score="3"] i:nth-child(-n+3) { background: var(--info); }
.password-meter[data-score="4"] i { background: var(--pos); }

/* ============================================================
   ADMINISTRAÇÃO
   ============================================================ */

.admin-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat-mini {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: linear-gradient(150deg, var(--panel), var(--panel-2));
  box-shadow: var(--shadow-sm);
}
.stat-mini-icon { display: grid; place-items: center; width: 34px; height: 34px; flex: none; border-radius: 10px; background: var(--primary-soft); color: var(--primary); }
.stat-mini-icon svg { width: 16px; height: 16px; }
.stat-mini[data-tone="info"] .stat-mini-icon { background: rgba(56, 189, 248, .12); color: var(--info); }
.stat-mini[data-tone="warn"] .stat-mini-icon { background: rgba(251, 191, 36, .12); color: var(--warn); }
.stat-mini[data-tone="violet"] .stat-mini-icon { background: rgba(167, 139, 250, .14); color: #a78bfa; }
.stat-mini strong { display: block; font-family: var(--font-display); font-size: 19px; font-weight: 700; line-height: 1.1; color: var(--text-strong); }
.stat-mini small { display: block; margin-top: 1px; font-size: 9px; color: var(--muted-2); }

.admin-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid rgba(56, 189, 248, .22);
  border-radius: 11px;
  background: rgba(56, 189, 248, .07);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}
.admin-note svg { flex: none; margin-top: 1px; color: var(--info); }
.admin-note b { color: var(--text); font-weight: 600; }
.admin-note code { padding: 1px 4px; border-radius: 4px; background: var(--hover-strong); color: var(--info); font-size: 9px; }

.user-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }
.user-cell .avatar { width: 30px; height: 30px; font-size: 9px; box-shadow: none; }
.user-cell-meta { min-width: 0; }
.user-cell-meta strong { display: block; font-size: 10.5px; font-weight: 600; color: var(--text-strong); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-cell-meta small { display: block; font-size: 9px; color: var(--muted-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-you { display: inline-block; margin-left: 4px; padding: 1px 4px; border-radius: 4px; background: var(--primary-soft); color: var(--primary); font-size: 7.5px; font-weight: 800; vertical-align: 1px; }

.role-pill {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 5px;
  background: var(--hover-strong);
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.role-pill.admin { background: rgba(167, 139, 250, .14); color: #a78bfa; }

.perm-chips { display: flex; flex-wrap: wrap; gap: 4px; max-width: 250px; }
.perm-chip {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--hover-strong);
  color: var(--muted-2);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.perm-chip.on { background: var(--primary-soft); color: var(--primary); }

.user-actions { display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.icon-action {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel-2);
  color: var(--muted);
  cursor: pointer;
  transition: color .18s, border-color .18s, background .18s;
}
.icon-action svg { width: 13px; height: 13px; }
.icon-action:hover { color: var(--primary); border-color: rgba(45, 212, 191, .4); background: var(--primary-soft); }
.icon-action.danger:hover { color: var(--danger); border-color: rgba(251, 113, 133, .4); background: rgba(251, 113, 133, .1); }
.icon-action:disabled { opacity: .35; cursor: not-allowed; }

.switch { position: relative; display: inline-flex; align-items: center; width: 34px; height: 20px; flex: none; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--track); transition: background .22s; }
.switch i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .3); transition: transform .22s var(--ease); }
.switch input:checked + i { background: var(--primary); }
.switch input:checked + i::after { transform: translateX(14px); }
.switch input:focus-visible + i { box-shadow: 0 0 0 3px var(--primary-soft); }

.perm-options { display: flex; flex-direction: column; gap: 8px; }
.perm-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.perm-option:hover { border-color: var(--border-strong); }
.perm-option.checked { border-color: rgba(45, 212, 191, .4); background: var(--primary-soft); }
.perm-option input { width: 15px; height: 15px; accent-color: var(--primary); flex: none; }
.perm-option div { min-width: 0; }
.perm-option strong { display: block; font-size: 10.5px; font-weight: 600; color: var(--text); }
.perm-option small { display: block; margin-top: 1px; font-size: 9px; color: var(--muted-2); }
.perm-option .perm-lock { margin-left: auto; font-size: 8px; font-weight: 700; color: var(--muted-2); text-transform: uppercase; letter-spacing: .06em; }

/* ============================================================
   MODAL / DRAWER / TOAST / TOOLTIP
   ============================================================ */

.modal-backdrop, .drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(2, 8, 20, .62);
  backdrop-filter: blur(6px);
  animation: fadeIn .22s var(--ease) both;
}
.modal-backdrop { display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal {
  width: min(480px, 100%);
  max-height: min(88vh, 760px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  background: linear-gradient(165deg, var(--panel), var(--panel-2));
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .8);
  animation: popIn .28s var(--ease) both;
  overflow: hidden;
}
.modal.modal-lg { width: min(620px, 100%); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 18px 12px; }
.modal-head h2 { margin: 0; font-family: var(--font-display); font-size: 17px; font-weight: 700; letter-spacing: -.02em; color: var(--text-strong); }
.modal-head p { margin: 4px 0 0; font-size: 10.5px; color: var(--muted-2); line-height: 1.45; }
.modal-close { flex: none; }
.modal-body { flex: 1; overflow-y: auto; padding: 4px 18px 16px; }
.modal-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 13px 18px; border-top: 1px solid var(--border); background: var(--panel-2); }
.modal-foot .left { margin-right: auto; }
.confirm-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 12px;
  border-radius: 13px;
  background: rgba(251, 113, 133, .12);
  color: var(--danger);
}
.confirm-icon svg { width: 20px; height: 20px; }
.confirm-text { margin: 0; font-size: 11px; line-height: 1.6; color: var(--muted); }
.confirm-text b { color: var(--text); }

.drawer-backdrop { display: flex; justify-content: flex-end; }
.drawer {
  width: min(460px, 100%);
  height: 100%;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border-strong);
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  box-shadow: -30px 0 80px -30px rgba(0, 0, 0, .7);
  animation: slideIn .3s var(--ease) both;
}
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 18px 14px; border-bottom: 1px solid var(--border); }
.drawer-head h2 { margin: 0; font-family: var(--font-display); font-size: 16px; font-weight: 700; letter-spacing: -.02em; color: var(--text-strong); }
.drawer-head p { margin: 4px 0 0; font-size: 10px; color: var(--muted-2); }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px 18px 24px; }
.detail-section { margin-bottom: 20px; }
.detail-section:last-child { margin-bottom: 0; }
.detail-section h3 { margin: 0 0 9px; font-size: 8.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--muted-2); }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.detail-item { padding: 9px 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--panel-2); min-width: 0; }
.detail-item span { display: block; font-size: 8px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 3px; }
.detail-item strong { display: block; font-size: 10.5px; font-weight: 600; color: var(--text); word-break: break-word; }
.detail-item.wide { grid-column: 1 / -1; }
.detail-timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { position: relative; display: flex; gap: 11px; padding-bottom: 15px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before { content: ''; position: absolute; left: 6px; top: 15px; bottom: 0; width: 1px; background: var(--border); }
.timeline-item:last-child::before { display: none; }
.timeline-dot { flex: none; width: 13px; height: 13px; margin-top: 1px; border-radius: 50%; border: 3px solid var(--panel); background: var(--primary); box-shadow: 0 0 0 1px var(--border-strong); }
.timeline-item.done .timeline-dot { background: var(--pos); }
.timeline-item.late .timeline-dot { background: var(--danger); }
.timeline-item.pending .timeline-dot { background: var(--muted-2); }
.timeline-content strong { display: block; font-size: 10.5px; font-weight: 600; color: var(--text); }
.timeline-content small { display: block; margin-top: 2px; font-size: 9px; color: var(--muted-2); }

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 300;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: 360px;
  padding: 11px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 11px;
  background: var(--panel);
  color: var(--text);
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .6);
  font-size: 11px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast::before { content: ''; width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--primary); }
.toast[data-tone="success"]::before { background: var(--pos); }
.toast[data-tone="error"]::before { background: var(--danger); }
.toast[data-tone="warn"]::before { background: var(--warn); }

.tooltip {
  position: fixed;
  z-index: 400;
  max-width: 230px;
  padding: 7px 9px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
  font-size: 9.5px;
  line-height: 1.45;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .14s, transform .14s;
}
.tooltip.show { opacity: 1; transform: translateY(0); }
.tooltip strong { display: block; font-size: 10px; color: var(--text-strong); }
.tooltip small { display: block; color: var(--muted-2); }

.global-loader {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(2, 8, 20, .6);
  backdrop-filter: blur(4px);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
}
.global-loader .spinner { width: 26px; height: 26px; border-width: 2.5px; border-color: var(--border-strong); border-top-color: var(--primary); }

/* ============================================================
   ANIMAÇÕES
   ============================================================ */

@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(28px); } to { opacity: 1; transform: translateX(0); } }
@keyframes growY { from { transform: scaleY(.1); transform-origin: bottom; } to { transform: scaleY(1); transform-origin: bottom; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .55); } 70% { box-shadow: 0 0 0 6px rgba(52, 211, 153, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); } }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ============================================================
   RESPONSIVO
   ============================================================ */

@media (max-width: 1440px) {
  .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 1200px) {
  .app-shell { grid-template-columns: 212px minmax(0, 1fr); }
  .main { padding: 20px 20px 22px; }
  .grid-wide { grid-template-columns: minmax(0, 1fr); }
  .admin-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1080px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .profile-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 980px) {
  .app-shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(280px, 86vw);
    transform: translateX(-102%);
    transition: transform .3s var(--ease);
    box-shadow: 30px 0 80px -30px rgba(0, 0, 0, .7);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: grid; }
  .sidebar-overlay { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(2, 8, 20, .55); backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity .3s; }
  .sidebar-overlay.show { opacity: 1; pointer-events: auto; }
  .menu-btn { display: grid; }
  .topbar { align-items: flex-start; }
  .top-actions { margin-left: auto; }
  .login-main { grid-template-columns: minmax(0, 1fr); gap: 40px; max-width: 560px; }
  .login-card { justify-self: stretch; max-width: none; }
  .login-hero { max-width: none; }
  .login-preview { display: none; }
}

@media (max-width: 760px) {
  .login-screen { padding: 18px 18px 22px; }
  .login-brand .logo { width: 168px; }
  .env-pill { display: none; }
  .main { padding: 16px 14px 20px; }
  .topbar { margin-bottom: 16px; gap: 12px; }
  .page-sub { display: none; }
  .live-pill { display: none; }
  .profile-meta { display: none; }
  .profile-btn { padding: 0 5px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 10px; }
  .kpi-value { font-size: 18px; }
  .toolbar { gap: 8px; }
  .toolbar-group { gap: 6px; }
  .search-field { max-width: none; flex-basis: 100%; }
  .filter-bar { padding: 10px; }
  .filter-field { flex: 1 1 130px; }
  .select-wrap select { width: 100%; max-width: none; }
  .admin-stats { grid-template-columns: minmax(0, 1fr); }
  .profile-meta { grid-template-columns: minmax(0, 1fr); }
  .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .modal { max-height: 92vh; }
  .drawer { width: 100%; }
  .page-foot { font-size: 9px; }

  /* Tabelas no mobile: primeira coluna fixa para não perder a
     referência da linha ao rolar para o lado. */
  .table-wrap { overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch; }
  .table th,
  .table td { padding: 8px 10px; }
  .table th:first-child,
  .table td:first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--panel);
    box-shadow: 1px 0 0 var(--border);
  }
  .table th:first-child { z-index: 3; background: var(--panel-2); }
  .table tbody tr:hover td:first-child { background: var(--hover); }
}

@media (max-width: 520px) {
  .login-card { padding: 22px 18px; border-radius: 18px; }
  .login-hero h1 { font-size: 32px; }
  .login-features { display: none; }
  .login-main { padding: 24px 0; }
  .login-top-actions .icon-btn { width: 34px; height: 34px; }
  .kpi-grid { grid-template-columns: minmax(0, 1fr); }
  .seg { width: 100%; overflow-x: auto; }
  .seg button { flex: 1; }
  .field-row { grid-template-columns: minmax(0, 1fr); }
  .card-head { flex-direction: column; }
  .card-actions { width: 100%; }
  .donut-wrap { flex-direction: column; align-items: stretch; }
  .donut { align-self: center; }
}

@media print {
  body { background: #fff !important; color: #000 !important; }
  body::before, .sidebar, .topbar, .page-foot, .toolbar, .filter-bar, .card-actions,
  .sidebar-overlay, .theme-toggle, .profile-btn, .icon-action, .btn, .pager-btns,
  .toast, .tooltip, .modal-backdrop, .drawer-backdrop { display: none !important; }
  .app-shell { display: block; }
  .main { padding: 0; }
  .page { gap: 10px; }
  .card, .kpi { border: 1px solid #ddd; box-shadow: none; background: #fff; break-inside: avoid; }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .table-wrap { overflow: visible; }
  .table th { position: static; background: #f4f4f4; color: #000; }
  .table td { color: #111; }
  .badge { border: 1px solid #ccc; }
  .is-hidden { display: none !important; }
}
