/* Osti — painel. Mobile first, modo noturno.
   Paleta: azul base #314a64, texto #ece8de, destaque #cbb06f. */

:root {
  color-scheme: dark;
  --bg: #0d1520;
  --bg-2: #121d2a;
  --navy: #314a64;
  --navy-deep: #1f3146;
  --text: #ece8de;
  --text-dim: rgba(236, 232, 222, 0.64);
  --text-faint: rgba(236, 232, 222, 0.42);
  --gold: #cbb06f;
  --gold-bright: #e0c98f;
  --gold-soft: rgba(203, 176, 111, 0.14);
  /* Azul claro derivado do azul base #314a64, usado nas ações */
  --sky: #6f9bc6;
  --sky-bright: #9ec0e2;
  --sky-deep: #4d79a6;
  --sky-soft: rgba(111, 155, 198, 0.16);
  --sky-glow: rgba(111, 165, 220, 0.55);
  --line: rgba(236, 232, 222, 0.1);
  --line-strong: rgba(236, 232, 222, 0.2);
  --ok: #9ad3a7;
  --bad: #ef9a86;
  --radius: 20px;
  --font-display: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --nav-h: 68px;
  font-family: var(--font-body);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; max-width: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; font-family: var(--font-display); font-weight: 400; letter-spacing: -0.005em; }
h2 { font-size: 34px; line-height: 1.05; }
.muted { color: var(--text-dim); font-size: 13px; margin: 4px 0 0; }

/* Fundo: duas luzes largas, fixas, sem custo de scroll */
.backdrop { position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(900px 520px at 85% -10%, rgba(49, 74, 100, 0.65), transparent 70%),
    radial-gradient(700px 420px at -10% 105%, rgba(203, 176, 111, 0.1), transparent 70%),
    linear-gradient(180deg, var(--bg), var(--bg-2)); }

/* Superfície de vidro usada em cartões, login e barras */
.glass {
  background: linear-gradient(155deg, rgba(49, 74, 100, 0.46), rgba(18, 29, 42, 0.82) 62%);
  border: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, 0 22px 44px -22px rgba(0, 0, 0, 0.7);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

/* Marca */
.brand { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.brand-logo { height: 34px; width: auto; display: block; align-self: center; }
.wordmark { font-family: var(--font-display); font-size: 30px; line-height: 1; color: var(--gold-bright); letter-spacing: 0.01em; }
.brand-lg { justify-content: center; }
.brand-lg .wordmark { font-size: 54px; }
.brand-lg .brand-logo { height: 84px; }
.handle { color: var(--text-faint); font-size: 12px; }

/* Login */
.login { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; border-radius: 26px; padding: 32px 26px; display: flex; flex-direction: column; gap: 14px; text-align: center; }
.login-card .field { text-align: left; }

/* Barra superior */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: rgba(13, 21, 32, 0.78); border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.hide-sm { display: none !important; }
.handle { display: none; }

/* Navegação: barra inferior no celular, abas no topo em telas maiores */
.tabs { position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 30; height: var(--nav-h);
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 6px; border-radius: 24px;
  background: rgba(18, 29, 42, 0.86); border: 1px solid var(--line-strong);
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.75);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; border-radius: 18px; background: none;
  font: inherit; font-size: 12px; font-weight: 600; color: var(--text-dim); cursor: pointer; transition: background 0.2s, color 0.2s; }
.tab svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tab.active { color: var(--sky-bright); background: linear-gradient(180deg, rgba(111, 155, 198, 0.28), rgba(111, 155, 198, 0.08)); box-shadow: 0 0 0 1px rgba(158, 192, 226, 0.32) inset, 0 0 24px -8px var(--sky-glow); }

.view { padding: 22px 16px 8px; max-width: 1200px; margin: 0 auto; min-width: 0; }
.toolbar { display: flex; flex-direction: column; gap: 16px; margin-bottom: 20px; }
.upload { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.notice { width: calc(100% - 32px); max-width: 1168px; margin: 14px auto 0; font-size: 12.5px; padding: 10px 14px; border-radius: 14px; background: var(--gold-soft); border: 1px solid rgba(203, 176, 111, 0.28); color: var(--gold-bright); font-size: 13px; }
.empty { padding: 36px 20px; text-align: center; border: 1px dashed var(--line-strong); border-radius: var(--radius); color: var(--text-dim); }

/* Botões e campos */
.btn { min-height: 48px; padding: 0 20px; border-radius: 14px; border: 1px solid var(--line-strong); background: rgba(236, 232, 222, 0.05);
  color: var(--text); font: inherit; font-weight: 700; cursor: pointer; transition: transform 0.15s, background 0.2s, border-color 0.2s, box-shadow 0.2s; }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn:hover:not(:disabled) { border-color: rgba(158, 192, 226, 0.55); }
.btn.primary { color: var(--text); border: 1px solid rgba(158, 192, 226, 0.45);
  background: linear-gradient(180deg, rgba(158, 192, 226, 0.34) 0%, rgba(111, 155, 198, 0.2) 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.28) inset, 0 -1px 0 rgba(0, 0, 0, 0.18) inset;
  -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%); }
.btn.primary:hover:not(:disabled) { border-color: rgba(190, 218, 245, 0.7); background: linear-gradient(180deg, rgba(158, 192, 226, 0.46) 0%, rgba(111, 155, 198, 0.3) 100%); }
.btn.danger { color: var(--bad); }
.btn.ghost { background: transparent; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 13px; border-radius: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--text-dim); }
input[type="text"], input[type="password"], input[type="date"], input[type="time"], select, textarea { width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 14px;
  background: rgba(7, 12, 19, 0.55); font: inherit; color: var(--text); transition: border-color 0.2s, box-shadow 0.2s; }
textarea { resize: vertical; min-height: 84px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--sky); box-shadow: 0 0 0 3px rgba(111, 155, 198, 0.3); }
:focus-visible { outline: 2px solid var(--sky-bright); outline-offset: 3px; border-radius: 10px; }

/* Chips de estado */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap;
  background: rgba(236, 232, 222, 0.08); color: var(--text-dim); border: 1px solid var(--line); }
.chip.ok { color: var(--ok); background: rgba(154, 211, 167, 0.1); border-color: rgba(154, 211, 167, 0.3); }
.chip.warn { color: var(--gold-bright); background: var(--gold-soft); border-color: rgba(203, 176, 111, 0.35); }
.chip.bad { color: var(--bad); background: rgba(239, 154, 134, 0.1); border-color: rgba(239, 154, 134, 0.3); }
.chip.new { color: var(--sky-bright); background: var(--sky-soft); border-color: rgba(158, 192, 226, 0.4); }
.chip.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: pulse 1.8s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(203, 176, 111, 0.6); } 80%, 100% { box-shadow: 0 0 0 8px rgba(203, 176, 111, 0); } }
.error { margin: 0; color: var(--bad); font-weight: 600; font-size: 13px; }

/* Cartões com brilho que segue o dedo ou o mouse (--mx/--my vêm do app.js) */
.card, .item { position: relative; border-radius: var(--radius); overflow: hidden; }
.card::before, .item::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px; pointer-events: none; z-index: 2;
  background: radial-gradient(260px circle at var(--mx, 50%) var(--my, 0%), rgba(158, 192, 226, 0.8), transparent 62%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); opacity: 0; transition: opacity 0.35s; }
.card::after, .item::after { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: radial-gradient(320px circle at var(--mx, 50%) var(--my, 0%), rgba(111, 155, 198, 0.12), transparent 65%); opacity: 0; transition: opacity 0.35s; }
.card:hover::before, .item:hover::before, .card:hover::after, .item:hover::after,
.card.lit::before, .item.lit::before, .card.lit::after, .item.lit::after { opacity: 1; }

/* Biblioteca: filtros por categoria e linhas compactas */
.filters { display: flex; gap: 8px; margin: 0 -16px 18px; padding: 2px 16px 6px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.filters::-webkit-scrollbar { display: none; }
.filter { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line-strong);
  background: rgba(236, 232, 222, 0.04); color: var(--text-dim); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; transition: background 0.2s, color 0.2s, border-color 0.2s; }
.filter-count { min-width: 20px; padding: 1px 6px; border-radius: 99px; background: rgba(236, 232, 222, 0.1); font-size: 11px; text-align: center; }
.filter.active { color: var(--text); border-color: rgba(158, 192, 226, 0.55); background: linear-gradient(180deg, rgba(158, 192, 226, 0.3), rgba(111, 155, 198, 0.14)); }
.filter.active .filter-count { background: rgba(236, 232, 222, 0.2); }

.grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-items: start; }
.card { display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 0 14px; padding: 10px 12px; min-width: 0; animation: rise 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.card:nth-child(2) { animation-delay: 0.05s; } .card:nth-child(3) { animation-delay: 0.1s; }
.card:nth-child(4) { animation-delay: 0.15s; } .card:nth-child(n+5) { animation-delay: 0.18s; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.card.paused .media img { filter: grayscale(0.85) brightness(0.7); }
.card.paused .card-title { color: var(--text-dim); }
.media { position: relative; width: 80px; height: 80px; border-radius: 16px; overflow: hidden; background: linear-gradient(135deg, var(--navy-deep), #162435); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; }
.media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1); }
.card:hover .media img { transform: scale(1.06); }
.media-empty { color: var(--text-faint); font-size: 11px; text-align: center; padding: 0 6px; }
.card-head { min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.card-title-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
.card-title { font-family: var(--font-display); font-size: 23px; line-height: 1.1; overflow-wrap: anywhere; }
.card-meta { color: var(--text-dim); font-size: 12.5px; overflow-wrap: anywhere; }
.card-meta.faint { color: var(--text-faint); font-size: 12px; }
.edit { grid-column: 1 / -1; margin-top: 0; }
.edit summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; min-height: 38px; font-weight: 700; font-size: 13px; color: var(--sky-bright); }
.edit summary::-webkit-details-marker { display: none; }
.edit summary::after { content: "+"; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid rgba(158, 192, 226, 0.5); line-height: 1; transition: transform 0.25s; }
.edit[open] summary::after { transform: rotate(45deg); }
.edit-body { display: flex; flex-direction: column; gap: 14px; padding-top: 8px; position: relative; z-index: 3; min-width: 0; }
.preview { width: 100%; max-height: 360px; object-fit: contain; border-radius: 14px; background: rgba(0, 0, 0, 0.25); border: 1px solid var(--line); }
.row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.days { display: flex; flex-wrap: wrap; gap: 8px; }
.day { position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 48px; min-height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 99px; font-size: 13px; font-weight: 600; color: var(--text-dim); cursor: pointer; transition: all 0.2s; }
.day input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.day:has(input:checked) { background: var(--sky-soft); border-color: var(--sky); color: var(--sky-bright); }
.day:has(input:focus-visible) { outline: 2px solid var(--sky-bright); outline-offset: 2px; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.actions .btn.primary { grid-column: 1 / -1; }

/* Fila */
.list { display: flex; flex-direction: column; gap: 14px; }
.item { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 14px; padding: 14px; animation: rise 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.thumb { width: 76px; height: 76px; border-radius: 16px; overflow: hidden; background: linear-gradient(135deg, var(--navy-deep), #162435); border: 1px solid var(--line); }
.thumb img, .thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.item-main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.item-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.item-title { font-family: var(--font-display); font-size: 24px; line-height: 1.1; }
.item-reason { color: var(--text-dim); font-size: 13px; }
.item-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto; gap: 10px; position: relative; z-index: 3; }

/* Aviso rápido */
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px); z-index: 50; transform: translateX(-50%) translateY(16px); max-width: calc(100% - 32px);
  padding: 13px 20px; border-radius: 16px; background: rgba(236, 232, 222, 0.96); color: #14202d; font-weight: 700; font-size: 14px; box-shadow: 0 16px 40px -10px rgba(0, 0, 0, 0.7);
  opacity: 0; pointer-events: none; transition: opacity 0.25s, transform 0.25s; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.bad { background: #f3b4a5; }

/* Telas maiores */
@media (min-width: 560px) {
  .hide-sm { display: inline-flex !important; }
  .handle { display: inline; }
  .toolbar { flex-direction: row; align-items: flex-end; justify-content: space-between; }
  .item { grid-template-columns: 76px minmax(0, 1fr) auto; align-items: center; }
  .item-actions { grid-column: auto; grid-template-columns: auto auto; }
}
@media (min-width: 900px) {
  :root { --nav-h: 0px; }
  body { padding-bottom: 40px; }
  .topbar { padding-left: 32px; padding-right: 32px; }
  .tabs { position: static; width: max-content; margin: 18px auto 0 32px; height: auto; display: flex; padding: 5px; gap: 4px; border-radius: 99px; box-shadow: none; }
  .tab { flex-direction: row; gap: 8px; padding: 10px 20px; border-radius: 99px; font-size: 14px; }
  .tab svg { width: 18px; height: 18px; }
  .view { padding: 30px 32px 8px; }
  h2 { font-size: 40px; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .filters { margin: 0 0 20px; padding: 2px 0 6px; flex-wrap: wrap; overflow: visible; }
  .toast { bottom: 28px; }
}
@media (min-width: 1280px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Eventos, alerta de estoque e campos extras */
.notice.alert { margin: 0 0 16px; width: auto; max-width: none; }
.filter-count.low { background: var(--gold-soft); color: var(--gold-bright); }
.form-card { display: flex; flex-direction: column; gap: 14px; padding: 18px; border-radius: var(--radius); margin-bottom: 18px; }
.hint { margin: 0; color: var(--text-dim); font-size: 12.5px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; font-size: 14px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--sky); }
.item-actions { align-self: center; }

/* v0.8: seletor de formato ao lado de "Sugerir agora" e linhas do alerta */
.suggest { display: flex; gap: 10px; align-items: stretch; }
.suggest select { flex: 1 1 auto; min-width: 0; width: auto; }
.suggest .btn { flex: 0 0 auto; }
.alert-line { display: block; }
.alert-line + .alert-line { margin-top: 8px; }
@media (min-width: 900px) { .suggest select { width: 220px; flex: 0 0 auto; } }
