@font-face {
  font-family: "KionaIMT";
  src: local("Kiona Regular"), local("Kiona-Regular"), local("Kiona"),
       url("/fontes/Kiona-Regular.ttf") format("truetype"), url("/fontes/Kiona-Regular.otf") format("opentype");
  font-display: swap;
}
:root {
  --gold: #C9A84C;
  --gold-dark: #9C7B2E;
  --gold-light: #E6CD82;
  --gold-grad: linear-gradient(135deg, #E6CD82 0%, #C9A84C 48%, #9C7B2E 100%);
  --black: #0E0E0E;
  --side: #121212;
  --bg: #F6F4EF;
  --surface: #ffffff;
  --ink: #1C1C1C;
  --ink-2: #555555;
  --ink-3: #8A8782;
  --line: #E6E1D5;
  --brand: #9C7B2E;
  --brand-2: #F7F0DD;
  --ok: #1e7a46; --ok-bg: #e7f5ec;
  --warn: #8a5a00; --warn-bg: #fbf2dc;
  --bad: #b42318; --bad-bg: #fdecea;
  --info-bg: #efede8;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20,16,8,.05), 0 2px 6px rgba(20,16,8,.06);
  --marca: "KionaIMT", "Segoe UI", system-ui, sans-serif;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  font-size: 15px;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { min-height: 100vh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
.muted { color: var(--ink-3); }
.small { font-size: .85rem; }
.hidden { display: none !important; }
code, .mono { font-family: Consolas, "Cascadia Mono", monospace; font-size: .9em; }

/* ---------- layout */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--side); color: #d9d5cb; padding: 20px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
  border-right: 1px solid #000; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 10px 22px; }
.brand img { width: 40px; height: 40px; }
.brand b { display: block; font-family: var(--marca); font-weight: 400; font-size: 1.15rem; letter-spacing: .08em;
  background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand span { font-size: .75rem; color: #8f8a7f; letter-spacing: .04em; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 8px; color: #cfcabe; text-decoration: none; font-size: .95rem; }
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .8; }
.nav a:hover { background: rgba(255,255,255,.05); }
.nav a.on { background: rgba(201,168,76,.14); color: var(--gold-light); font-weight: 600; }
.nav a.on svg { opacity: 1; }
.nav .badge { margin-left: auto; background: var(--gold); color: var(--black); border-radius: 99px; font-size: .72rem; padding: 1px 7px; font-weight: 700; }
.side-foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid #262626; font-size: .8rem; color: #8f8a7f; }
.side-foot button { background: none; border: 1px solid #333; color: #cfcabe; border-radius: 7px; padding: 6px 10px; cursor: pointer; margin-top: 8px; }
.main { padding: 26px 32px 60px; min-width: 0; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.topbar p { margin: 4px 0 0; color: var(--ink-2); }
.mobilebar { display: none; }

/* ---------- componentes */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px; }
.card > h2 { margin-bottom: 12px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line); background: var(--surface);
  border-radius: 8px; padding: 8px 14px; cursor: pointer; font-weight: 500; text-decoration: none; color: var(--ink); white-space: nowrap; }
.btn:hover { border-color: #cfc6b0; background: #fdfcf8; }
.btn.prim { background: var(--black); color: var(--gold-light); border-color: var(--black); }
.btn.prim:hover { background: #222; }
.btn.ouro { background: var(--gold-grad); color: var(--black); border-color: var(--gold-dark); font-weight: 600; }
.btn.perigo { color: var(--bad); }
.btn.peq { padding: 5px 10px; font-size: .85rem; }
.btn.icone { padding: 6px 8px; }
.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: .45; cursor: default; }
label.campo { display: block; margin-bottom: 12px; }
label.campo > span { display: block; font-size: .85rem; color: var(--ink-2); margin-bottom: 5px; font-weight: 500; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; border: 1px solid #d9d3c4; border-radius: 8px; padding: 8px 10px; background: #fff; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(201,168,76,.45); border-color: var(--gold); }
.ajuda { font-size: .8rem; color: var(--ink-3); margin-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid #d9d3c4; background: #fff; border-radius: 99px; padding: 5px 12px; cursor: pointer; font-size: .88rem; user-select: none; }
.chip.on { background: var(--black); color: var(--gold-light); border-color: var(--black); }
.tag { display: inline-block; font-size: .74rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--info-bg); color: var(--ink-2); white-space: nowrap; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.bad { background: var(--bad-bg); color: var(--bad); }
.tag.ouro { background: var(--brand-2); color: var(--brand); }
.vazio { text-align: center; padding: 34px 16px; color: var(--ink-3); }
.vazio b { display: block; color: var(--ink); margin-bottom: 4px; font-size: 1.02rem; }
.aviso-box { border-radius: 8px; padding: 10px 14px; background: var(--warn-bg); color: var(--warn); font-size: .9rem; margin-bottom: 14px; }
.aviso-box.info { background: var(--info-bg); color: var(--ink-2); }
.aviso-box.ok { background: var(--ok-bg); color: var(--ok); }

/* interruptor */
.sw { position: relative; display: inline-block; width: 40px; height: 23px; flex: none; }
.sw input { opacity: 0; width: 0; height: 0; }
.sw i { position: absolute; inset: 0; background: #cfc9bb; border-radius: 99px; transition: .2s; cursor: pointer; }
.sw i::before { content: ""; position: absolute; width: 17px; height: 17px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.sw input:checked + i { background: var(--gold); }
.sw input:checked + i::before { transform: translateX(17px); }

/* ---------- resumo do topo */
.resumo { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 18px; }
.resumo .r { background: var(--black); color: #e9e5da; border-radius: var(--radius); padding: 14px 16px; position: relative; overflow: hidden; }
.resumo .r::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--gold-grad); }
.resumo .r b { display: block; font-size: 1.6rem; font-weight: 600; color: var(--gold-light); line-height: 1.1; }
.resumo .r span { font-size: .82rem; color: #a7a295; }
.ponto { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #777; margin-right: 6px; vertical-align: middle; }
.ponto.on { background: #3ccf7a; box-shadow: 0 0 0 3px rgba(60,207,122,.18); }

/* ---------- lista da programação */
.lista { display: flex; flex-direction: column; gap: 10px; }
.item { display: grid; grid-template-columns: 30px 132px 1fr auto; gap: 14px; align-items: center; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px 10px 8px; box-shadow: var(--shadow); }
.item.off { opacity: .62; }
.item .ord { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.item .ord button { border: none; background: none; cursor: pointer; padding: 2px; color: var(--ink-3); line-height: 0; }
.item .ord button:hover { color: var(--ink); }
.item .ord span { font-size: .78rem; color: var(--ink-3); font-weight: 600; }
.mini { width: 132px; aspect-ratio: 16/9; border-radius: 6px; overflow: hidden; background: var(--black); position: relative; display: block; }
.mini img, .mini video { width: 100%; height: 100%; object-fit: cover; display: block; }
.mini .tipo { position: absolute; left: 5px; bottom: 5px; background: rgba(14,14,14,.78); color: var(--gold-light); font-size: .68rem;
  padding: 1px 6px; border-radius: 4px; font-weight: 600; letter-spacing: .03em; }
.mini.cartao { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 6px 6px 20px; }
.mini.cartao b { font-family: var(--marca); font-weight: 400; font-size: .72rem; line-height: 1.15; background: var(--gold-grad);
  -webkit-background-clip: text; background-clip: text; color: transparent; max-height: 2.4em; overflow: hidden; }
.mini.cartao small { color: #cfcabe; font-size: .55rem; margin-top: 3px; max-height: 2.2em; overflow: hidden; }
.mini.cartao.claro { background: #F6F4EF; } .mini.cartao.claro small { color: #444; }
.mini.cartao.claro b { background: linear-gradient(135deg,#B8933A,#7A5F20); -webkit-background-clip: text; background-clip: text; }
.mini.cartao.dourado { background: var(--gold-grad); } .mini.cartao.dourado b { background: none; color: var(--black); } .mini.cartao.dourado small { color: #222; }
.item .corpo { min-width: 0; }
.item .corpo h3 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.item .regras { font-size: .84rem; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.item .acoes { display: flex; gap: 6px; align-items: center; }

/* ---------- mídias */
.soltar { border: 2px dashed #cfc6b0; border-radius: var(--radius); padding: 24px; text-align: center; background: #fdfcf8; cursor: pointer; transition: .15s; margin-bottom: 16px; }
.soltar.sobre { border-color: var(--gold); background: var(--brand-2); }
.soltar b { display: block; font-size: 1.02rem; margin-bottom: 4px; }
.envios .env { display: grid; grid-template-columns: 1fr 120px 54px; gap: 10px; align-items: center; font-size: .88rem; margin-bottom: 6px; }
.barra { height: 7px; background: #ebe6da; border-radius: 99px; overflow: hidden; }
.barra i { display: block; height: 100%; background: var(--gold-grad); width: 0; transition: width .2s; }
.galeria { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.midia { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.midia .mini { width: 100%; border-radius: 0; }
.midia .info { padding: 10px 12px; }
.midia .info b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; font-size: .93rem; }
.midia .info .row { margin-top: 8px; gap: 6px; }

/* ---------- tabelas simples */
.tab { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tab th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: .8rem; padding: 8px; border-bottom: 1px solid var(--line); }
.tab td { padding: 9px 8px; border-bottom: 1px solid #f0ece2; vertical-align: middle; }
.tab tr:last-child td { border-bottom: none; }

/* ---------- telas */
.tela-card .cab { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.endereco { font-family: Consolas, monospace; background: var(--black); color: var(--gold-light); border-radius: 8px; padding: 10px 14px;
  font-size: 1.05rem; word-break: break-all; display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.endereco button { background: none; border: 1px solid #444; color: #ddd; border-radius: 6px; padding: 4px 9px; cursor: pointer; font-family: inherit; font-size: .8rem; flex: none; }
.passos { margin: 0; padding-left: 22px; line-height: 1.65; }
.passos li { margin-bottom: 6px; }
.passos kbd { background: #f1ede3; border: 1px solid #d9d3c4; border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font-size: .85em; font-family: inherit; }

/* ---------- modal */
.fundo-modal { position: fixed; inset: 0; background: rgba(14,14,14,.55); display: flex; align-items: flex-start; justify-content: center;
  padding: 4vh 16px; overflow-y: auto; z-index: 50; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 860px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal.estreito { max-width: 520px; }
.modal header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal header button { border: none; background: none; font-size: 1.4rem; cursor: pointer; color: var(--ink-3); line-height: 1; }
.modal .conteudo { padding: 18px 20px; }
.modal footer { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--line); background: #fbfaf6; border-radius: 0 0 14px 14px; }
.editor { display: grid; grid-template-columns: 1fr 340px; gap: 20px; }
.previa { position: sticky; top: 0; }
.previa .quadro { width: 100%; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; background: var(--black); border: 1px solid #222; }
.previa .quadro iframe { width: 100%; height: 100%; border: 0; display: block; pointer-events: none; }
.previa .quadro img, .previa .quadro video { width: 100%; height: 100%; object-fit: contain; display: block; }
.tipos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.tipos button { border: 1px solid #d9d3c4; background: #fff; border-radius: 9px; padding: 10px 6px; cursor: pointer; font-weight: 500; }
.tipos button.on { border-color: var(--black); background: var(--black); color: var(--gold-light); }
.estilos { display: flex; gap: 8px; }
.estilos button { flex: 1; height: 38px; border-radius: 8px; border: 2px solid transparent; cursor: pointer; font-size: .8rem; font-weight: 600; }
.estilos button.on { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(201,168,76,.3); }
.escolher-midia { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; max-height: 260px; overflow-y: auto; padding: 2px; }
.escolher-midia button { border: 2px solid transparent; padding: 0; border-radius: 7px; overflow: hidden; background: none; cursor: pointer; text-align: left; }
.escolher-midia button.on { border-color: var(--gold); }
.escolher-midia button .mini { width: 100%; border-radius: 0; }
.escolher-midia button small { display: block; padding: 3px 5px; font-size: .72rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
details.mais { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }
details.mais summary { cursor: pointer; font-weight: 600; font-size: .92rem; margin-bottom: 10px; }

/* ---------- login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background: radial-gradient(circle at 80% 0%, rgba(201,168,76,.22), rgba(14,14,14,0) 55%), var(--black); }
.login .caixa { width: 100%; max-width: 380px; text-align: center; color: #ddd; }
.login img { width: min(320px, 80%); margin-bottom: 26px; }
.login form { background: #161616; border: 1px solid #2a2a2a; border-radius: 14px; padding: 22px; text-align: left; }
.login form h1 { color: #fff; font-size: 1.1rem; margin-bottom: 6px; }
.login form p { color: #9b968a; font-size: .88rem; margin: 0 0 14px; }
.login input { background: #0e0e0e; border-color: #333; color: #fff; }
.login .erro { color: #ff9b8f; font-size: .88rem; margin-top: 8px; min-height: 1.2em; }

/* ---------- toast */
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--black); color: var(--gold-light);
  padding: 11px 18px; border-radius: 10px; opacity: 0; transition: .25s; pointer-events: none; z-index: 99; max-width: calc(100vw - 32px); font-size: .92rem;
  box-shadow: 0 8px 24px rgba(0,0,0,.25); }
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.erro { background: var(--bad); color: #fff; }

/* ---------- celular */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 250px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .app.menu-aberto .side { transform: none; box-shadow: 0 0 0 100vw rgba(0,0,0,.45); }
  .mobilebar { display: flex; align-items: center; gap: 10px; background: var(--black); color: var(--gold-light); padding: 10px 16px; position: sticky; top: 0; z-index: 30; }
  .mobilebar button { background: none; border: none; color: #fff; padding: 4px; cursor: pointer; line-height: 0; }
  .mobilebar img { width: 28px; height: 28px; }
  .mobilebar b { font-family: var(--marca); font-weight: 400; letter-spacing: .08em; }
  .main { padding: 18px 16px 60px; }
  .grid2, .grid3, .editor { grid-template-columns: 1fr; }
  .previa { position: static; order: -1; }
  .item { grid-template-columns: 26px 92px 1fr; padding: 10px; gap: 10px; }
  .item .mini { width: 92px; }
  .item .acoes { grid-column: 1 / -1; justify-content: flex-end; flex-wrap: wrap; }
  .envios .env { grid-template-columns: 1fr 70px 44px; }
  .tab .some-cel { display: none; }
  .resumo { grid-template-columns: 1fr 1fr; gap: 8px; }
  .resumo .r { padding: 10px 12px; }
  .resumo .r b { font-size: 1.3rem; }
  .modal footer { flex-wrap: wrap; }
}

/* ---------- chamar paciente */
input.grande { font-size: 1.5rem; padding: 12px 14px; font-weight: 600; }
.btn.grande { padding: 14px 18px; font-size: 1.1rem; }
.chamar .chip { padding: 8px 14px; font-size: .95rem; }
details.card.mais summary { margin-bottom: 14px; }
