:root {
  /* Paleta AssetGrid (Descubra Tech): Void + Electric Iris (#8052ff) + Saffron Spark (#ffb829) */
  --ink: #131b33;
  --ink-2: #39435c;
  --muted: #65708a;
  --line: #e1e6f2;
  --line-2: #c9d2e4;
  --bg: #f5f7fc;
  --surface: #ffffff;
  --brand: #8052ff;
  --brand-deep: #000000;
  --brand-soft: #f3efff;
  --accent: #8052ff;
  --accent-soft: #ede7ff;
  --gold: #ffcd06;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --ok: #0e9f4e;
  --ok-soft: #dcfce7;
  --info: #1d4ed8;
  --info-soft: #e3effc;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(13, 22, 48, .05), 0 8px 24px -16px rgba(13, 22, 48, .25);
  --sidebar: 250px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Quicksand, "Segoe UI", sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }
:focus-visible { outline: 3px solid rgba(0, 196, 52, .28); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------------------------------------------------------------- login */
.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  background:
    radial-gradient(900px 520px at 12% 6%, rgba(128, 82, 255, .28), transparent 62%),
    radial-gradient(1200px 700px at 15% 10%, #120d24 0%, #080512 48%, #000000 100%);
  color: #fff;
}
.login-aside { padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.login-brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 20px; letter-spacing: .02em; }
.mark {
  width: 44px; height: 44px; border-radius: 11px;
  display: grid; place-items: center; overflow: hidden; flex: 0 0 auto;
}
.mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.login-copy h1 { font-size: clamp(26px, 3vw, 40px); line-height: 1.15; max-width: 15em; }
.login-copy p { margin-top: 16px; max-width: 34em; color: #b9c7e7; line-height: 1.65; }
.login-points { display: grid; gap: 14px; margin-top: 32px; padding: 0; list-style: none; }
.login-points li { display: flex; gap: 12px; align-items: flex-start; color: #d3dcf1; }
.login-points svg { flex: 0 0 auto; margin-top: 2px; color: #ffb829; }
.login-foot { color: #8093c0; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }

.login-main { display: grid; place-items: center; padding: 32px; }
.login-card {
  width: min(420px, 100%);
  background: rgba(255, 255, 255, .97);
  color: var(--ink);
  border-radius: 22px;
  padding: 38px 36px 32px;
  box-shadow: 0 40px 80px -40px rgba(0,0,0,.6);
  position: relative;
}
.login-avatar {
  position: absolute; top: -26px; left: 50%; transform: translateX(-50%);
  width: 64px; height: 64px; border-radius: 50%; background: #fff;
  display: grid; place-items: center; box-shadow: 0 10px 24px -14px rgba(0,0,0,.5);
}
.login-avatar .mark { width: 52px; height: 52px; border-radius: 15px; padding: 4px; background: #071a42; }
.login-card h2 { font-size: 21px; margin-bottom: 6px; }
.login-card .lead { color: var(--muted); margin-bottom: 24px; line-height: 1.5; }
.login-step { display: flex; gap: 6px; margin-bottom: 24px; }
.login-step span { height: 4px; border-radius: 99px; flex: 1; background: var(--line); }
.login-step span.on { background: var(--accent); }
.login-hint { margin-top: 18px; font-size: 12px; color: var(--muted); line-height: 1.5; }
.login-back { margin-top: 14px; display: flex; justify-content: space-between; gap: 12px; }

/* ---------------------------------------------------------------- forms */
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-2); letter-spacing: .01em; }
.field input, .field select, .field textarea, .input {
  width: 100%; min-height: 42px; padding: 10px 12px;
  border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus, .input:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(20, 32, 67, .12); outline: none;
}
.field .help { font-size: 12px; color: var(--muted); }
.field .err, .err { font-size: 13px; color: var(--danger); font-weight: 600; }
#login-error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--danger-soft);
  border: 1px solid #fecaca;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}
#login-error[hidden] { display: none; }
.row { display: grid; gap: 14px; }
.row.two { grid-template-columns: 1fr 1fr; }
.row.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 720px) { .row.two, .row.three { grid-template-columns: 1fr; } }

/* Seletor com criação inline (ex.: categoria no cadastro de ativo). */
.picker { display: flex; gap: 8px; align-items: stretch; }
.picker select { flex: 1; min-width: 0; }
.picker .btn { flex: 0 0 auto; min-height: 42px; }
.inline-create {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-top: 8px; padding: 10px;
  border: 1px dashed var(--line-2); border-radius: var(--radius-sm); background: var(--bg);
}
.inline-create[hidden] { display: none; }
.inline-create input:not([type="color"]) { flex: 1 1 140px; min-width: 0; }
.inline-create input[type="color"] {
  flex: 0 0 auto; width: 44px; height: 42px; padding: 3px;
  border: 1px solid var(--line-2); border-radius: 8px; background: #fff; cursor: pointer;
}
.inline-create .btn { flex: 0 0 auto; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: var(--accent); color: #071a42;
  font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: filter .15s, background .15s, border-color .15s;
}
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.block { width: 100%; min-height: 48px; font-size: 15px; border-radius: 11px; }
.btn.accent { background: var(--accent); color: #071a42; }
.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn.primary:hover { background: #1c2d5e; border-color: #1c2d5e; color: #fff; }
.btn.primary:active { background: var(--brand-deep); }
.btn.ghost { background: #fff; color: var(--ink-2); border-color: var(--line-2); }
.btn.ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.link { background: none; color: var(--brand); padding: 0 6px; min-height: 32px; }
.btn.sm { min-height: 32px; padding: 0 10px; font-size: 12px; }
.btn.icon { padding: 0; width: 34px; min-height: 34px; }
.btn[hidden] { display: none; }

/* ---------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, #142043 0%, #0a1430 100%);
  color: #cfd8ee; padding: 18px 14px; display: flex; flex-direction: column; gap: 18px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar .inner-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; font-weight: 700; letter-spacing: .02em; }
.sidebar nav { display: grid; gap: 3px; }
.nav-label { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: #7f92c4; padding: 12px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px;
  color: #b9c6e2; text-decoration: none; font-size: 13px; border-left: 2px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item[aria-current="page"] { background: rgba(255,255,255,.09); color: #fff; border-left-color: var(--accent); }
.nav-item svg { width: 17px; height: 17px; opacity: .85; }
.sidebar-foot { margin-top: auto; padding: 12px 10px 4px; border-top: 1px solid rgba(255,255,255,.1); font-size: 11px; color: #7f92c4; line-height: 1.6; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 10px; background: rgba(255,255,255,.06); }
.sidebar-user .avatar { width: 32px; height: 32px; border-radius: 50%; background: #24396f; display: grid; place-items: center; font-weight: 700; color: #fff; }
.sidebar-user small { display: block; color: #8fa2cd; font-size: 11px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 28px; background: rgba(245,247,252,.85); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 20px; }
.topbar .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.content { padding: 24px 28px 48px; max-width: 1500px; width: 100%; }

/* ---------------------------------------------------------------- cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 15px; }
.card-head .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .kpis { grid-template-columns: minmax(0, 1fr); } }
.kpi { padding: 18px 20px; display: grid; gap: 8px; position: relative; overflow: hidden; }
.kpi.clickable { text-align: left; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.kpi.clickable:hover { border-color: var(--line-2); box-shadow: 0 12px 30px -22px rgba(7, 20, 66, .55); transform: translateY(-1px); }
.kpi .peek { position: absolute; top: 12px; right: 12px; color: var(--muted); opacity: .4; }
.kpi.clickable:hover .peek { color: var(--brand); opacity: 1; }
.kpi .label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 600; }
.kpi .value { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.kpi .foot { font-size: 12px; color: var(--muted); }
.kpi .spark { position: absolute; right: -6px; bottom: -6px; opacity: .7; }
.kpi.danger .value { color: var(--danger); }
.kpi.ok .value { color: var(--ok); }
.charts { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
@media (max-width: 1000px) { .charts { grid-template-columns: minmax(0, 1fr); } }
.split { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
@media (max-width: 1000px) { .split { grid-template-columns: minmax(0, 1fr); } }

/* ---------------------------------------------------------------- table */
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; padding: 10px 14px; background: #f6f8fd; color: var(--muted);
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1; white-space: nowrap;
}
thead th.sortable { padding: 0; }
.th-sort {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 8px;
  width: 100%; min-height: 38px; padding: 10px 14px; background: transparent;
  border: 0; font: inherit; font-size: 11px; text-transform: uppercase;
  letter-spacing: .06em; font-weight: 700; color: var(--muted); cursor: pointer;
  text-align: left; transition: color .15s, background .15s;
}
.th-sort:hover { color: var(--brand); background: rgba(14, 116, 229, 0.06); }
.th-sort:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.th-sort.active { color: var(--brand); }
.sort-badge {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800; letter-spacing: 0;
  padding: 2px 5px; border-radius: 4px; color: var(--muted);
  background: #eef2fa; opacity: .7; line-height: 1; transition: opacity .15s, background .15s, color .15s;
}
.th-sort:hover .sort-badge { opacity: 1; }
.sort-badge.active {
  background: var(--brand); color: #fff; opacity: 1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}
tbody td { padding: 11px 14px; border-bottom: 1px solid #eef1f9; vertical-align: middle; }
tbody tr:hover { background: #f6f8fd; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.actions { text-align: right; white-space: nowrap; }
.count { font-weight: 700; font-variant-numeric: tabular-nums; }
.count.zero { font-weight: 400; color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }

/* Coluna padronizada de problema e leitura por extenso */
th.col-maint-problem { width: 340px; max-width: 360px; min-width: 240px; }
td.cell-maint-problem { max-width: 360px; min-width: 240px; vertical-align: top; }
.maint-problem-text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  line-height: 1.45;
  cursor: pointer;
  transition: color .15s ease;
}
.maint-problem-text:hover { color: var(--brand); }
.maint-res-preview {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
  cursor: pointer;
}
.maint-res-preview:hover { color: var(--brand); }
.btn-view-maint-full {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  margin-top: 4px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--brand);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
}
.btn-view-maint-full:hover { text-decoration: underline; }
.ticket-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}
@media (max-width: 640px) {
  .ticket-meta-grid {
    grid-template-columns: 1fr;
  }
}
.ticket-meta-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  min-height: 88px;
  min-width: 0;
  box-sizing: border-box;
}
.ticket-meta-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: 6px;
  line-height: 1.2;
}
.ticket-meta-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.ticket-meta-val.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  letter-spacing: -.01em;
}
.ticket-meta-sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
  line-height: 1.3;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.ticket-full-box {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  font-size: 13.5px;
  line-height: 1.6;
  text-align: left;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  color: var(--ink);
  max-height: 320px;
  overflow-y: auto;
  overflow-x: hidden;
}
.ticket-full-box.resolution {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #14532d;
}

/* ---------------------------------------------------------------- badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px;
  font-size: 11px; font-weight: 700; letter-spacing: .01em; white-space: nowrap;
  background: #eef2fa; color: var(--ink-2);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-soft); color: #14532d; }
.badge.warn { background: var(--warn-soft); color: #78350f; }
.badge.danger { background: var(--danger-soft); color: #7f1d1d; }
.badge.info { background: var(--info-soft); color: #1e3a8a; }
.badge.brand { background: var(--brand-soft); color: var(--brand); }
.badge.plain::before { display: none; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; background: #eef2fa; font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ---------------------------------------------------------------- toolbar */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.toolbar .grow { flex: 1; }
.toolbar input, .toolbar select { min-height: 37px; padding: 7px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; }
.toolbar input[type="search"] { min-width: 220px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab { border: 1px solid transparent; background: none; padding: 7px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; cursor: pointer; }
.tab[aria-selected="true"] { background: var(--brand-soft); color: var(--brand); }

/* ---------------------------------------------------------------- charts */
.chart { width: 100%; height: 230px; display: block; }
.legend { display: grid; gap: 9px; }
.legend-row { display: grid; grid-template-columns: 10px 1fr auto; gap: 9px; align-items: center; font-size: 12px; }
.legend-row.clickable { border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.legend-row.clickable:hover { background: #f6f8fd; box-shadow: 0 0 0 6px #f6f8fd; border-radius: 8px; }
.legend-row.clickable:hover .legend-bar > span { filter: brightness(1.08); }
.legend-bar { height: 6px; border-radius: 99px; background: #e9eef9; overflow: hidden; grid-column: 1 / -1; }
.legend-bar > span { display: block; height: 100%; border-radius: 99px; }

/* ---------------------------------------------------------------- dialog */
dialog {
  border: 0; border-radius: 16px; padding: 0; width: min(760px, calc(100vw - 32px)); max-width: calc(100vw - 32px);
  box-shadow: 0 40px 80px -30px rgba(2, 8, 20, .5); color: var(--ink);
}
dialog::backdrop { background: rgba(7, 14, 34, .58); backdrop-filter: blur(2px); }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { font-size: 17px; }
.dialog-head .sub { color: var(--muted); font-size: 12px; margin-top: 3px; }
.dialog-body { padding: 20px 22px; max-height: 68vh; overflow: auto; }
.dialog-foot { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--line); background: #fbfcff; border-radius: 0 0 16px 16px; }
.dl { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; font-size: 13px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.timeline li { padding-left: 18px; border-left: 2px solid var(--line); position: relative; font-size: 12px; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.timeline strong { display: block; font-size: 13px; }

/* ---------------------------------------------------------------- misc */
.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: 10px; font-size: 13px; line-height: 1.5; }
.alert.warn { background: var(--warn-soft); color: #713f12; }
.alert.info { background: var(--info-soft); color: #1e3a8a; }
.alert.danger { background: var(--danger-soft); color: #7f1d1d; }
.toasts { position: fixed; right: 18px; bottom: 18px; display: grid; gap: 10px; z-index: 100; width: min(360px, calc(100vw - 36px)); }
.toast { padding: 12px 14px; border-radius: 10px; background: #142043; color: #fff; font-size: 13px; box-shadow: var(--shadow); animation: in .2s ease-out; }
.toast.err { background: #7f1d1d; }
.toast.ok { background: #14532d; }
@keyframes in { from { opacity: 0; transform: translateY(6px); } }
.loading { display: grid; place-items: center; padding: 60px; color: var(--muted); }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress { height: 8px; background: #e9eef9; border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--brand); }
.hr { height: 1px; background: var(--line); margin: 18px 0; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.flex { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.right { margin-left: auto; }
.nowrap { white-space: nowrap; }
.stat-line { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.stat-line.clickable { width: 100%; border: 0; border-bottom: 1px dashed var(--line); background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; }
.stat-line.clickable:hover { background: #f6f8fd; box-shadow: 0 0 0 7px #f6f8fd; border-radius: 6px; }
.stat-line.clickable:last-child { border-bottom: 0; }
.stat-line:last-child { border-bottom: 0; }
.stat-line strong { font-variant-numeric: tabular-nums; }
.dep-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.dep-grid .box { background: #f7f9fd; border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.dep-grid .box span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.dep-grid .box strong { display: block; margin-top: 4px; font-size: 16px; }
.sector-block { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; background: #f7f9fd; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.sector-block .flex { align-items: center; }

@media (max-width: 900px) {
  .login { grid-template-columns: 1fr; }
  .login-aside { display: none; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .sidebar nav { grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; }
  .nav-label, .sidebar-foot { display: none; }
  .content { padding: 18px 16px 40px; }
  .topbar { padding: 14px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ---------------------------------------------------------------- inventory */
.mini-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.mini { padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; position: relative; }
.mini.clickable { text-align: left; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.mini.clickable:hover { border-color: var(--line-2); box-shadow: 0 10px 24px -20px rgba(7, 20, 66, .5); transform: translateY(-1px); }
.mini .peek { position: absolute; top: 12px; right: 12px; opacity: .35; }
.mini.clickable:hover .peek { color: var(--brand); opacity: 1; }
.mini span { font-size: 12px; color: var(--muted); font-weight: 600; }
.mini strong { font-size: 21px; font-variant-numeric: tabular-nums; }

.two-cols { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); gap: 24px; }
.mini-title { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 10px; font-weight: 700; }

.custody {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  border: 1px solid var(--line); border-radius: 12px; background: #f7f9fd;
}
.avatar.lg { width: 42px; height: 42px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 16px; }

.seat-meter { height: 8px; background: #e9eef9; border-radius: 99px; overflow: hidden; margin-bottom: 6px; }
.seat-meter > span { display: block; height: 100%; border-radius: 99px; }

.site-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }

@media (max-width: 1100px) { .mini-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px) { .two-cols { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .mini-grid { grid-template-columns: minmax(0, 1fr); } }

/* ------------------------------------------------------ termo de responsabilidade */
.term-doc {
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 30px 34px; color: var(--ink); font-size: 13px; line-height: 1.55;
  box-shadow: 0 18px 40px -36px rgba(7, 20, 66, .55);
}
.term-head { text-align: center; border-bottom: 1.5px solid var(--ink); padding-bottom: 12px; margin-bottom: 20px; }
.term-header-img { max-width: 240px; max-height: 76px; object-fit: contain; display: block; margin: 0 auto 8px; }
.term-head h3 { font-size: 17px; letter-spacing: .01em; }
.term-head p { margin-top: 3px; font-size: 10px; letter-spacing: .14em; color: var(--muted); font-weight: 600; }
.term-doc h4 {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--brand); margin: 20px 0 8px;
}
.term-ident { display: grid; gap: 7px; margin: 0; }
.term-ident div { display: grid; grid-template-columns: 78px 1fr; gap: 10px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.term-ident dt { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.term-ident dd { margin: 0; font-size: 13px; }
.term-intro { margin: 16px 0 0; text-align: justify; font-size: 12.5px; white-space: pre-line; }
.term-table { margin-bottom: 4px; }
.term-table table { font-size: 11.5px; }
.term-table th { font-size: 10px; text-transform: uppercase; letter-spacing: .04em; }
.term-conditions { margin: 0; padding-left: 20px; display: grid; gap: 7px; font-size: 12px; text-align: justify; }
.term-custom-block { margin-top: 14px; }
.term-custom-text { margin: 6px 0 0; font-size: 12px; text-align: justify; white-space: pre-line; }
.term-custom-fig { margin: 8px 0 0; text-align: center; }
.term-custom-fig img { max-width: 100%; max-height: 220px; object-fit: contain; border-radius: 8px; border: 1px solid var(--line); }
.term-custom-fig figcaption { margin-top: 4px; font-size: 11px; color: var(--muted); }
.term-date { margin-top: 18px; font-size: 12px; }
.term-footer-note { margin-top: 8px; font-size: 11.5px; color: var(--muted); white-space: pre-line; }
.tpl-layout { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 20px; align-items: start; }
.tpl-preview-col { position: sticky; top: 82px; }
.tpl-cond-row { display: grid; grid-template-columns: 22px 1fr auto; gap: 8px; align-items: start; }
.tpl-block-card { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fbfcff; display: grid; gap: 10px; }
.tpl-img-preview { border: 1px dashed var(--line-2); border-radius: 10px; padding: 10px; background: #fff; display: grid; place-items: center; }
.tpl-img-preview img { max-width: 100%; max-height: 120px; object-fit: contain; display: block; }
.term-sign-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; align-items: start; }
.term-sign-label { font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }
.sign-pad-wrap {
  position: relative; border: 1.5px dashed var(--line-2); border-radius: 12px;
  background: #fbfcff; overflow: hidden; cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.sign-pad-wrap:not(.signed):hover {
  border-color: var(--brand-accent, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}
.sign-pad-expand-btn {
  position: absolute; top: 8px; right: 8px; z-index: 5;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--line-2, #cbd5e1);
  color: var(--ink-2, #1e293b);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  pointer-events: auto;
  transition: all .15s ease;
}
.sign-pad-expand-btn:hover {
  background: #fff;
  border-color: var(--brand-accent, #2563eb);
  color: var(--brand-accent, #2563eb);
}
.sign-pad { display: block; width: 100%; height: 140px; touch-action: none; cursor: crosshair; }
.sign-hint {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: var(--muted); font-size: 12px; pointer-events: none; transition: opacity .15s;
}
.sign-pad-wrap.signed { border-style: solid; border-color: var(--brand-soft); background: #fff; }
.sign-pad-wrap.signed .sign-hint { opacity: 0; }
.sign-view-box { min-height: 140px; display: grid; place-items: center; padding: 10px; cursor: default; }
.sign-view-img { max-width: 100%; max-height: 120px; object-fit: contain; display: block; }
.term-sign-grid .btn.ghost.sm { margin-top: 8px; }

/* ---------------------------------------------------- fullscreen signature modal */
.sign-fullscreen-modal {
  position: fixed; inset: 0; z-index: 999999;
  background: #ffffff;
  display: flex; flex-direction: column;
  width: 100vw; height: 100vh; height: 100dvh;
  margin: 0; padding: 0; border: none; max-width: 100vw; max-height: 100dvh;
  box-sizing: border-box;
  animation: fadeInSignModal .2s ease-out;
}
@keyframes fadeInSignModal {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}
.sign-fullscreen-head {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 18px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
}
.sign-fullscreen-title { font-size: 15px; font-weight: 700; color: #0f172a; margin: 0; }
.sign-fullscreen-sub { font-size: 12px; color: #64748b; margin: 2px 0 0; }
.sign-fullscreen-body {
  flex: 1 1 auto;
  position: relative;
  background: #fdfdfd;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.sign-fullscreen-canvas {
  width: 100%; height: 100%; flex: 1 1 auto;
  touch-action: none; display: block; cursor: crosshair;
}
.sign-fullscreen-hint {
  position: absolute; inset: 0; display: grid; place-items: center;
  pointer-events: none; color: #94a3b8; font-size: 15px; font-weight: 500;
  transition: opacity .15s;
}
.sign-fullscreen-body.has-strokes .sign-fullscreen-hint {
  opacity: 0;
}
.sign-fullscreen-baseline {
  position: absolute; bottom: 25%; left: 8%; right: 8%;
  border-bottom: 1px dashed #cbd5e1;
  pointer-events: none;
}
.sign-fullscreen-baseline-label {
  position: absolute; right: 0; bottom: 4px;
  font-size: 11px; color: #94a3b8; font-weight: 500; text-transform: uppercase; letter-spacing: 0.05em;
}
.sign-fullscreen-foot {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 18px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}
.sign-fullscreen-actions-right {
  display: flex; align-items: center; gap: 10px;
}
@media (max-width: 1080px) {
  .tpl-layout { grid-template-columns: 1fr; }
  .tpl-preview-col { position: static; }
}
@media (max-width: 760px) {
  .term-doc { padding: 20px 18px; }
  .term-sign-grid { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------- cookie banner & reval */
.cookie-banner {
  position: fixed; bottom: 18px; left: 18px; right: 18px; max-width: 960px;
  margin: 0 auto; z-index: 9999; background: #0b1a3d; color: #fff;
  border-radius: 14px; box-shadow: 0 12px 36px rgba(7, 26, 66, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12); animation: slideUp .25s ease-out;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.cookie-banner-content {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 16px 20px; flex-wrap: wrap;
}
.cookie-banner-text { font-size: 13px; line-height: 1.5; color: #d6e1fa; max-width: 680px; }
.cookie-banner-text strong { color: #fff; }
.cookie-banner-actions { display: flex; align-items: center; gap: 10px; }
.cookie-banner-actions .btn.ghost { color: #fff; border-color: rgba(255, 255, 255, 0.25); }
.cookie-banner-actions .btn.ghost:hover { background: rgba(255, 255, 255, 0.1); }

.reval-dialog {
  border: 0; border-radius: 16px; padding: 0; width: min(440px, calc(100vw - 32px));
  box-shadow: 0 20px 48px rgba(7, 26, 66, 0.4);
}
.reval-dialog::backdrop { background: rgba(7, 26, 66, 0.7); backdrop-filter: blur(4px); }

/* ---------------------------------------------------------------- update notification */
.update-notification-card {
  position: fixed;
  top: 22px;
  right: 22px;
  max-width: 440px;
  width: calc(100vw - 44px);
  z-index: 100000;
  background: #0b1a3d;
  color: #fff;
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(7, 26, 66, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  animation: slideInDown .3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity .25s ease, transform .25s ease;
}
.update-notification-card.hide {
  opacity: 0;
  transform: translateY(-16px);
}
@keyframes slideInDown {
  from { opacity: 0; transform: translateY(-24px); }
  to { opacity: 1; transform: translateY(0); }
}
.update-card-icon {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #a8f5c8;
  display: grid;
  place-items: center;
}
.update-card-content {
  flex: 1 1 auto;
  display: grid;
  gap: 6px;
}
.update-card-title {
  font-weight: 700;
  font-size: 14px;
  color: #ffffff;
}
.update-card-desc {
  font-size: 12px;
  line-height: 1.45;
  color: #d6e1fa;
}
.update-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.update-card-actions .btn.sm {
  background: #2563eb;
  color: #fff;
  font-size: 12px;
  padding: 6px 14px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
}
.update-card-actions .btn.sm:hover {
  filter: brightness(1.1);
}
.update-card-actions .btn.ghost.sm {
  background: transparent;
  color: #d6e1fa;
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 12px;
  padding: 6px 12px;
  cursor: pointer;
  border-radius: 8px;
}
.update-card-actions .btn.ghost.sm:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.update-card-close {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  margin-top: -2px;
  margin-right: -4px;
}
.update-card-close:hover {
  color: #fff;
}

/* --------------------------------------------------------------- notifications */
.btn-bell-wrapper {
  position: relative;
  display: inline-flex;
}
.bell-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 17px;
  height: 17px;
  line-height: 17px;
  border-radius: 9px;
  text-align: center;
  padding: 0 4px;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  pointer-events: none;
}
.bell-badge.pulse {
  animation: bellPulse 1.8s infinite;
}
@keyframes bellPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); box-shadow: 0 0 8px rgba(239, 68, 68, 0.6); }
  100% { transform: scale(1); }
}

.notifications-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 380px;
  max-width: calc(100vw - 32px);
  background: #ffffff;
  color: #1e293b;
  border-radius: 12px;
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.18), 0 2px 6px rgba(15, 23, 42, 0.08);
  border: 1px solid #e2e8f0;
  z-index: 99990;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: popoverFadeIn .2s ease-out;
}
@keyframes popoverFadeIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.notif-popover-head {
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.notif-popover-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
}
.notif-popover-head .notif-unread-pill {
  background: #eff6ff;
  color: #2563eb;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 6px;
}
.notif-toggle-row {
  padding: 8px 16px;
  background: #f1f5f9;
  border-bottom: 1px solid #e2e8f0;
  font-size: 11.5px;
  color: #475569;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.notif-toggle-row label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}
.notif-list {
  max-height: 360px;
  overflow-y: auto;
  list-style: none;
  margin: 0;
  padding: 0;
}
.notif-item {
  padding: 12px 16px;
  display: flex;
  gap: 12px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background .15s ease;
  position: relative;
}
.notif-item:hover {
  background: #f8fafc;
}
.notif-item.unread {
  background: #f0f7ff;
}
.notif-item.unread::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 18px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2563eb;
}
.notif-item-icon {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  margin-top: 2px;
}
.notif-item-icon.opened {
  background: #fef3c7;
  color: #d97706;
}
.notif-item-icon.status {
  background: #e0f2fe;
  color: #0284c7;
}
.notif-item-icon.resolved {
  background: #dcfce7;
  color: #16a34a;
}
.notif-item-content {
  flex: 1 1 auto;
  display: grid;
  gap: 2px;
}
.notif-item-title {
  font-size: 13px;
  font-weight: 600;
  color: #0f172a;
}
.notif-item-desc {
  font-size: 12px;
  color: #475569;
  line-height: 1.35;
}
.notif-item-time {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}
.notif-empty {
  padding: 32px 16px;
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
}
.notif-popover-foot {
  padding: 10px 16px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  text-align: center;
}
.notif-popover-foot a {
  font-size: 12px;
  font-weight: 600;
  color: #2563eb;
  text-decoration: none;
}
.notif-popover-foot a:hover {
  text-decoration: underline;
}

/* Card flutuante na tela (parecido com o aviso de atualização) */
.ticket-notification-card {
  position: fixed;
  top: 22px;
  right: 22px;
  max-width: 440px;
  width: calc(100vw - 44px);
  z-index: 99995;
  background: #0f172a;
  color: #fff;
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  animation: slideInDown .3s cubic-bezier(0.16, 1, 0.3, 1);
  transition: opacity .25s ease, transform .25s ease;
}
.ticket-notification-card.hide {
  opacity: 0;
  transform: translateY(-16px);
}
.ticket-card-icon {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
}
.ticket-card-icon.opened {
  background: rgba(245, 158, 11, 0.2);
  color: #fbbf24;
}
.ticket-card-icon.status {
  background: rgba(56, 189, 248, 0.2);
  color: #38bdf8;
}
.ticket-card-icon.resolved {
  background: rgba(74, 222, 128, 0.2);
  color: #4ade80;
}
.ticket-card-content {
  flex: 1 1 auto;
  display: grid;
  gap: 6px;
}
.ticket-card-title {
  font-weight: 700;
  font-size: 14px;
  color: #ffffff;
}
.ticket-card-desc {
  font-size: 12px;
  line-height: 1.45;
  color: #e2e8f0;
}
.ticket-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}
.ticket-card-actions .btn.sm {
  background: #2563eb;
  color: #fff;
  font-size: 12px;
  padding: 6px 14px;
  border: none;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
}
.ticket-card-actions .btn.sm:hover {
  filter: brightness(1.1);
}
.ticket-card-actions .btn.ghost.sm {
  background: transparent;
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 12px;
  padding: 6px 12px;
  cursor: pointer;
  border-radius: 8px;
}
.ticket-card-actions .btn.ghost.sm:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.ticket-card-close {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.6);
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  margin-top: -2px;
  margin-right: -4px;
}
.ticket-card-close:hover {
  color: #fff;
}
