/* ── Marlin Inventário — casca no padrão do ServiceTicket ──────────────────
   Menu lateral, fontes e cores copiados do st.css do ServiceTicket.
   Tudo com prefixo st- (classes e variáveis) para NÃO colidir com o CSS
   próprio de cada tela, que segue funcionando por baixo até ser migrado.
   Usado por static/ui/shell.js (que monta o menu e liga a classe
   body.st-shell). ─────────────────────────────────────────────────────── */

@font-face { font-family: 'Inter'; src: url('/static/ui/fonts/Inter-latin.woff2') format('woff2');
  font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Syne'; src: url('/static/ui/fonts/Syne-latin-v2.woff2') format('woff2');
  font-weight: 400 700; font-style: normal; font-display: swap; }

:root {
  /* claro = padrão; escuro só com html[data-theme="dark"] (shell.js sempre
     grava o atributo explícito, então todas as telas concordam) */
  --st-side: #f8fafc; --st-glass-b: rgba(14,165,233,0.15);
  --st-primary: #0ea5e9; --st-primary-d: #0284c7; --st-hover: rgba(14,165,233,0.08); --st-ativo: rgba(14,165,233,0.12);
  --st-text: #0f172a; --st-text2: #334155; --st-text3: #64748b;
  --st-red: #dc2626; --st-purple: #a78bfa;
  --st-primary-tx: #0369a1; --st-av-a: #0369a1; --st-av-b: #6d28d9; /* texto azul e avatar com contraste AA */
  --st-sw: 242px; --st-rsm: 8px;
}
html[data-theme="dark"] {
  --st-side: #0a1628; --st-glass-b: rgba(56,189,248,0.14);
  --st-primary: #38bdf8; --st-primary-d: #0ea5e9; --st-hover: rgba(56,189,248,0.08); --st-ativo: rgba(56,189,248,0.13);
  --st-text: #f1f5f9; --st-text2: #c4cdd6; --st-text3: #7c8fa3; --st-red: #f87171;
  --st-primary-tx: #38bdf8; --st-av-a: #0369a1; --st-av-b: #6d28d9;
}

/* ── Layout ─────────────────────────────────────────────────────────────── */
body.st-shell { padding-left: var(--st-sw); font-family: 'Inter', system-ui, sans-serif; }
body.st-shell .topbar-brand,
body.st-shell .topbar .title,
body.st-shell .topbar h1 { font-family: 'Inter', system-ui, sans-serif; letter-spacing: -.01em; }

/* Navegação entre telas agora vive no menu lateral: some das barras do topo */
body.st-shell .topbar a.btn[href="/"],
body.st-shell .topbar a.back-btn,
body.st-shell .topbar a.btn[href="/pat"],
body.st-shell .topbar a.btn[href="/alm"],
body.st-shell .topbar a.btn[href="/estoque"],
body.st-shell .topbar a.btn[href="/servidores"],
body.st-shell .topbar a.btn[href="/devolucoes"],
body.st-shell .topbar a.btn[href="/noc"],
body.st-shell .topbar a.btn[href="/usuarios"],
body.st-shell .topbar .dropdown-item[href="/pat"],
body.st-shell .topbar .dropdown-item[href="/alm"],
body.st-shell .topbar #theme-btn,
body.st-shell .topbar .theme-btn,
body.st-shell .topbar .user-badge,
body.st-shell .topbar .btn-logout,
body.st-shell .topbar button[onclick="confirmLogout()"],
body.st-shell .topbar .divider { display: none !important; }

/* ── Menu lateral (cópia do .sidebar do ServiceTicket) ──────────────────── */
.st-sidebar {
  position: fixed; left: 0; top: 0; height: 100vh; width: var(--st-sw);
  background: var(--st-side); color: var(--st-text);
  border-right: 1px solid var(--st-glass-b);
  display: flex; flex-direction: column; z-index: 150; overflow-y: auto;
  font-family: 'Inter', system-ui, sans-serif; font-size: 14px; line-height: 1.5;
}
.st-sidebar { box-shadow: 2px 0 12px rgba(0,0,0,0.06); }
/* Rolagem do menu (só se não couber): fina, na cor do tema e só ao passar o mouse */
.st-sidebar { scrollbar-width: thin; scrollbar-color: transparent transparent; }
.st-sidebar:hover, .st-sidebar:focus-within { scrollbar-color: var(--st-text3) transparent; }
.st-sidebar::-webkit-scrollbar { width: 6px; }
.st-sidebar::-webkit-scrollbar-track { background: transparent; }
.st-sidebar::-webkit-scrollbar-thumb { background: transparent; border-radius: 6px; }
.st-sidebar:hover::-webkit-scrollbar-thumb, .st-sidebar:focus-within::-webkit-scrollbar-thumb { background: var(--st-text3); }
html[data-theme="dark"] .st-sidebar { box-shadow: none; }
.st-logo { padding: 18px 16px 14px; border-bottom: 1px solid var(--st-glass-b); text-align: center; }
.st-brand {
  font-family: 'Syne', sans-serif; font-size: 14px; font-weight: 700; color: var(--st-primary-tx);
  display: flex; align-items: center; justify-content: center; gap: 9px; text-decoration: none;
}
.st-brand i { font-size: 20px; }
.st-marlin { width: 26px; height: 22px; flex-shrink: 0; background: currentColor;
  -webkit-mask: url(/static/ui/marlin.svg) no-repeat center / contain; mask: url(/static/ui/marlin.svg) no-repeat center / contain; }
.st-brand-sub { font-size: 11px; color: var(--st-text3); margin-top: 2px; }
.st-nav { flex: 1; padding: 10px 8px; }
.st-sect { font-size: 11px; color: var(--st-text3); padding: 12px 10px 4px; font-weight: 600; }
.st-item {
  display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: var(--st-rsm);
  color: var(--st-text2); font-size: 13px; font-weight: 500; text-decoration: none;
  transition: background .15s, color .15s;
}
.st-item:hover { background: var(--st-hover); color: var(--st-text); text-decoration: none; }
.st-item.active { background: var(--st-ativo); color: var(--st-primary-tx); }
.st-item i { font-size: 17px; width: 19px; flex-shrink: 0; }
.st-item .st-ext { margin-left: auto; font-size: 13px; width: auto; color: var(--st-text3); }
.st-item:focus-visible, .st-theme:focus-visible, .st-out:focus-visible, .st-burger:focus-visible {
  outline: 2px solid var(--st-primary); outline-offset: 2px;
}

.st-user { padding: 12px 16px; border-top: 1px solid var(--st-glass-b); }
.st-user-row { display: flex; align-items: center; gap: 10px; }
.st-av {
  width: 38px; height: 38px; flex-shrink: 0; border-radius: 50%;
  background: linear-gradient(135deg, var(--st-av-a), var(--st-av-b));
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif; font-size: 13px; font-weight: 700; color: #fff;
}
.st-nm { font-size: 12px; font-weight: 600; line-height: 1.2; color: var(--st-text); }
.st-rl { font-size: 11px; color: var(--st-text2); }
.st-theme, .st-out {
  background: none; border: none; cursor: pointer; font: inherit; font-size: 12px;
  display: flex; align-items: center; gap: 6px; width: 100%; padding: 5px 0;
  color: var(--st-text3); border-radius: 6px; transition: color .15s;
}
.st-theme { margin-top: 8px; }
.st-theme:hover { color: var(--st-primary); }
.st-out:hover { color: var(--st-red); }

/* ── Celular: menu vira gaveta ──────────────────────────────────────────── */
.st-burger {
  display: none; position: fixed; left: 10px; top: 9px; z-index: 160;
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer;
  background: var(--st-side); color: var(--st-text); border: 1px solid var(--st-glass-b);
  align-items: center; justify-content: center; font-size: 20px;
}
.st-scrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 140; }
.st-topo { display: none; }
@media (max-width: 900px) {
  body.st-shell { padding-left: 0; }
  body.st-shell .topbar { padding-left: 58px !important; }
  .st-burger { display: flex; }
  .st-sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  body.st-open .st-sidebar { transform: none; }
  body.st-open .st-scrim { display: block; }
  body.st-open .st-burger { left: calc(var(--st-sw) + 10px); }
  /* barra superior fixa com o fundo do tema; o conteúdo começa abaixo dela */
  .st-topo { display: flex; align-items: center; position: fixed; top: 0; left: 0; right: 0; z-index: 130; height: 56px;
    padding: 0 16px 0 60px; background: var(--st-side); border-bottom: 1px solid var(--st-glass-b); box-shadow: 0 1px 8px rgba(15,23,42,.06); }
  html[data-theme="dark"] .st-topo { box-shadow: none; }
  .st-topo-tit { font-size: 15px; font-weight: 600; color: var(--st-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body.st-shell.st-com-topo { padding-top: 56px; }
}
@media (prefers-reduced-motion: reduce) { .st-sidebar, .st-item { transition: none; } }

@media print {
  .st-sidebar, .st-burger, .st-scrim, .st-topo { display: none !important; }
  body.st-shell.st-com-topo { padding-top: 0; }
  body.st-shell { padding-left: 0; }
}

/* ── Largura do conteúdo (todas as telas com o menu) ───────────────────────
   Antes cada tela centralizava o próprio container com max-width, deixando um
   vão de ~120px+ entre o menu e o conteúdo em 1920px. Agora o conteúdo começa
   colado ao menu, com padding fixo, e só para de crescer em 1680px (ultra-wide).
   Tela estreita de propósito (ex.: Bolso) usa main.st-estreito: mantém a
   largura dela, mas alinhada à esquerda. */
/* Menu compacto no desktop: os 17 itens do admin cabem em 768px de altura (no celular fica o espaçamento maior) */
@media (min-width: 901px) {
  .st-logo { padding: 12px 16px 10px; }
  .st-nav { padding: 6px 8px; }
  .st-sect { padding: 8px 10px 2px; line-height: 1.35; }
  .st-item { padding: 5px 12px; line-height: 1.35; }
  .st-user { padding: 10px 16px; }
  .st-theme { margin-top: 4px; }
  .st-theme, .st-out { padding: 3px 0; }
}
@media (min-width: 901px) {
  body.st-shell > main, body.st-shell > .page, body.st-shell > .wrapper {
    margin-left: 0; margin-right: auto; padding-left: 24px; padding-right: 24px;
  }
  body.st-shell > main:not(.st-estreito), body.st-shell > .page, body.st-shell > .wrapper { max-width: 1680px; }
  body.st-shell > .topbar { padding-left: 24px; padding-right: 24px; }
}
@media (min-width: 1441px) {
  body.st-shell > main, body.st-shell > .page, body.st-shell > .wrapper,
  body.st-shell > .topbar { padding-left: 32px; padding-right: 32px; }
}

/* Contador ao lado do item do menu (ex.: Lista de compras) */
.st-cont{margin-left:auto;min-width:22px;height:20px;padding:0 7px;border-radius:100px;background:var(--st-av-a);color:#fff;
  font-size:11.5px;font-weight:700;line-height:20px;text-align:center;font-variant-numeric:tabular-nums}

/* Notificações de pedido (static/ui/notificacoes.js) */
.st-cont.notif{background:#b91c1c}
.ntf-painel{position:fixed;left:calc(var(--st-sw,242px) + 12px);bottom:12px;z-index:210;width:min(340px,calc(100vw - 24px));padding:14px 16px;border-radius:12px;
  background:var(--st-side,#fff);color:var(--st-text,#0f172a);border:1px solid var(--st-glass-b,rgba(14,165,233,.15));box-shadow:0 10px 32px rgba(2,6,23,.25);font-size:13px}
.ntf-topo{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-bottom:6px;font-size:14px}
.ntf-x{width:36px;height:36px;border:0;border-radius:8px;background:transparent;color:inherit;font-size:22px;cursor:pointer}
.ntf-sit{margin:0 0 10px;color:var(--st-text2,#334155)}
.ntf-bts{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:10px}
.ntf-bt{min-height:36px;padding:0 12px;border:1px solid var(--st-glass-b,rgba(14,165,233,.3));border-radius:8px;background:transparent;color:inherit;font:inherit;font-size:13px;cursor:pointer}
.ntf-bt.pri{background:var(--st-av-a,#0369a1);border-color:var(--st-av-a,#0369a1);color:#fff}
.ntf-bt:disabled{opacity:.6;cursor:progress}
.ntf-bt:focus-visible,.ntf-x:focus-visible,.ntf-op input:focus-visible{outline:2px solid var(--st-primary,#0ea5e9);outline-offset:2px}
.ntf-op{display:flex;align-items:center;gap:8px;min-height:32px;cursor:pointer}
.ntf-op input{width:16px;height:16px}
.ntf-msg:empty{display:none}
.ntf-msg{margin:8px 0 0;padding:8px 10px;border-radius:8px;background:rgba(21,128,61,.12);color:var(--st-text,#0f172a)}
.ntf-msg.ruim{background:rgba(220,38,38,.12)}
.ntf-dica{margin:8px 0 0;font-size:12px;color:var(--st-text3,#64748b);line-height:1.45}
@media (pointer:coarse){.ntf-bt,.ntf-op{min-height:44px}}
@media (max-width:900px){.ntf-painel{left:12px}}
.st-notif{margin-left:auto;flex:none;width:34px;height:34px;display:inline-flex;align-items:center;justify-content:center;border:1px solid var(--st-glass-b);
  border-radius:8px;background:transparent;color:var(--st-text2);font-size:17px;cursor:pointer}
.st-notif:hover,.st-notif[aria-expanded="true"]{color:var(--st-primary);border-color:var(--st-primary)}
.st-notif:focus-visible{outline:2px solid var(--st-primary);outline-offset:2px}
@media (pointer:coarse){.st-notif{width:44px;height:44px}}
