/* Painel da equipa: denso o suficiente para trabalhar, calmo o suficiente para mostrar numa reunião. */

body.pn { background: #f4f0e8; }
.pn [hidden] { display: none !important; }
.pn-muted { color: var(--ink-2); }
.pn-small { font-size: 0.8rem; }
.pn-eyebrow { margin: 0 0 6px; font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--wine); font-weight: 600; }

/* Entrar */
.pn-login { min-height: calc(100dvh - 40px); display: grid; place-items: center; padding: 24px; }
.pn-login-card {
  width: min(420px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 32px 28px; box-shadow: 0 20px 50px rgba(31, 26, 23, 0.08); display: flex; flex-direction: column; gap: 10px;
}
.pn-login-card h1 { font-size: 2rem; margin: 0; }
.pn-login-card label { font-size: 0.85rem; font-weight: 600; margin-top: 10px; }
.pn-login-card input, .pn-modal-card input {
  font: inherit; font-size: 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
.pn-login-card input:focus, .pn-modal-card input:focus { outline: 2px solid var(--wine); outline-offset: 1px; border-color: transparent; }
.pn-login-card .btn { margin-top: 6px; }
.pn-login-error { margin: 0; color: #8a1f1f; font-size: 0.88rem; }

/* Cabeçalho */
.pn-head { background: var(--ink); color: #f1eadf; position: sticky; top: 0; z-index: 20; }
.pn-head-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px clamp(16px, 4vw, 32px); flex-wrap: wrap; }
.pn-brand { display: flex; flex-direction: column; line-height: 1.15; }
.pn-brand-name { font-family: var(--serif); font-size: 1.4rem; font-weight: 600; }
.pn-brand-sub { font-size: 0.74rem; opacity: 0.7; letter-spacing: 0.03em; }
.pn-head-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pn-btn-ghost {
  border: 1px solid rgba(241, 234, 223, 0.25); background: transparent; color: inherit; border-radius: 999px;
  padding: 7px 14px; font-size: 0.82rem; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.pn-btn-ghost:hover { background: rgba(241, 234, 223, 0.1); }
.pn-main .pn-btn-ghost, .pn-modal .pn-btn-ghost { border-color: var(--line); color: var(--ink); }
.pn-main .pn-btn-ghost:hover, .pn-modal .pn-btn-ghost:hover { background: var(--paper-2); }
.pn-btn-small { padding: 5px 12px; font-size: 0.78rem; }
.pn-live { display: inline-flex; align-items: center; gap: 6px; font-size: 0.76rem; opacity: 0.8; margin-right: 6px; }
.pn-live-dot { width: 7px; height: 7px; border-radius: 50%; background: #7fbf8e; box-shadow: 0 0 0 0 rgba(127, 191, 142, .6); animation: pn-pulse 2s infinite; }
.pn-live-off .pn-live-dot { background: #c9a227; animation: none; }
@keyframes pn-pulse { 0% { box-shadow: 0 0 0 0 rgba(127,191,142,.55); } 70% { box-shadow: 0 0 0 7px rgba(127,191,142,0); } 100% { box-shadow: 0 0 0 0 rgba(127,191,142,0); } }

.pn-tabs { display: flex; gap: 2px; padding: 0 clamp(8px, 3vw, 24px); overflow-x: auto; scrollbar-width: none; }
.pn-tabs::-webkit-scrollbar { display: none; }
.pn-tabs button {
  border: 0; background: transparent; color: rgba(241, 234, 223, 0.65); cursor: pointer; white-space: nowrap;
  padding: 12px 14px 13px; font-size: 0.9rem; font-weight: 600; border-bottom: 2px solid transparent;
}
.pn-tabs button[aria-selected="true"] { color: #fff; border-bottom-color: #c9a46a; }
.pn-count:not(:empty) {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 4px;
  border-radius: 999px; background: #c9a46a; color: var(--ink); font-size: 0.72rem;
}
.pn-count-quiet:not(:empty) { background: rgba(241, 234, 223, 0.18); color: #f1eadf; }

/* Conteúdo */
.pn-main { max-width: 1180px; margin: 0 auto; padding: 28px clamp(16px, 4vw, 32px) 64px; }
.pn-section-head { margin-bottom: 18px; }
.pn-section-head h2 { font-family: var(--serif); font-weight: 500; font-size: 1.9rem; margin: 0 0 4px; }
.pn-section-head p { margin: 0; max-width: 760px; }
.pn-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.pn-filters button {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 6px 13px; font-size: 0.82rem; cursor: pointer; color: var(--ink-2);
}
.pn-filters button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }

.pn-list { display: flex; flex-direction: column; gap: 12px; }
.pn-empty { color: var(--ink-3); padding: 28px; text-align: center; border: 1px dashed var(--line); border-radius: 14px; background: rgba(255,255,255,.4); margin: 0; }

.pn-item { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; }
.pn-item.pn-new { animation: pn-flash 2.4s ease-out; }
@keyframes pn-flash { 0% { box-shadow: 0 0 0 3px rgba(201, 164, 106, .7); } 100% { box-shadow: 0 0 0 3px rgba(201, 164, 106, 0); } }
.pn-resolved { opacity: 0.62; }
.pn-item-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.pn-item-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pn-item-meta { display: flex; align-items: center; gap: 10px; color: var(--ink-3); font-size: 0.8rem; }
.pn-ref { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-weight: 600; letter-spacing: 0.04em; font-size: 0.86rem; }
.pn-kind { font-weight: 650; }
.pn-kind-restaurant { color: #7a4a14; }
.pn-kind-change, .pn-kind-cancel, .pn-kind-handover { color: var(--wine); }
.pn-tag { font-size: 0.72rem; padding: 2px 9px; border-radius: 999px; background: var(--paper-2); color: var(--ink-2); white-space: nowrap; }
.pn-tag-open { background: #f3e1df; color: var(--wine); }
.pn-tag-group { background: #f1e7d5; color: #6b4e1d; }

.pn-status { font: inherit; font-size: 0.8rem; font-weight: 600; padding: 6px 28px 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; }
.pn-status-pending { background: #fbf3e2; border-color: #e7d3a8; color: #7a5a22; }
.pn-status-confirmed { background: #e8f1ea; border-color: #b9d3bf; color: #2f5a3b; }
.pn-status-declined { background: #f1eeea; color: var(--ink-3); }
.pn-status-done { background: #eef0f3; color: #4a5160; }

.pn-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 18px; margin: 14px 0 0; }
.pn-facts dt { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); }
.pn-facts dd { margin: 2px 0 0; font-weight: 500; overflow-wrap: anywhere; }
.pn-notes { margin: 12px 0 0; padding: 10px 12px; background: var(--paper); border-radius: 10px; font-size: 0.9rem; white-space: pre-wrap; }
.pn-summary-label { margin: 12px 0 2px; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); }
.pn-summary { margin: 0; white-space: pre-wrap; }
.pn-item-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--paper-2); flex-wrap: wrap; }
.pn-contact { display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: 0.88rem; }
.pn-contact-name { font-weight: 600; }
.pn-contact a { color: var(--wine); text-decoration: none; overflow-wrap: anywhere; }
.pn-link { border: 0; background: none; color: var(--wine); font-weight: 600; cursor: pointer; padding: 4px 0; font-size: 0.88rem; }

/* Conversas */
.pn-split { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 16px; align-items: start; }
.pn-conv-list { gap: 8px; max-height: calc(100dvh - 260px); overflow-y: auto; position: sticky; top: 120px; }
.pn-conv {
  display: flex; flex-direction: column; gap: 6px; text-align: left; width: 100%; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font: inherit; color: inherit;
}
.pn-conv:hover { border-color: #cbbda8; }
.pn-conv-active { border-color: var(--wine); box-shadow: 0 0 0 1px var(--wine); }
.pn-conv.pn-new { animation: pn-flash 2.4s ease-out; }
.pn-conv-top { display: flex; justify-content: space-between; font-size: 0.76rem; color: var(--ink-3); }
.pn-flag { font-weight: 700; letter-spacing: 0.06em; color: var(--ink); }
.pn-conv-first { font-size: 0.9rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pn-conv-tags { display: flex; gap: 6px; flex-wrap: wrap; font-size: 0.74rem; color: var(--ink-3); align-items: center; }

.pn-transcript { background: var(--card); border: 1px solid var(--line); border-radius: 14px; min-height: 320px; overflow: hidden; }
.pn-transcript > .pn-empty { border: 0; }
.pn-transcript-head { padding: 14px 18px; border-bottom: 1px solid var(--paper-2); }
.pn-transcript-title { margin: 0; font-weight: 650; }
.pn-transcript-head .pn-muted { margin: 2px 0 0; }
.pn-transcript-body { padding: 16px 18px 22px; display: flex; flex-direction: column; gap: 10px; }
.pn-msg { max-width: 82%; padding: 9px 13px; border-radius: 14px; font-size: 0.92rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.pn-msg p { margin: 0; }
.pn-msg-user { align-self: flex-end; background: var(--ink); color: #fff; border-bottom-right-radius: 5px; }
.pn-msg-assistant { align-self: flex-start; background: var(--paper); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.pn-msg-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.pn-msg-meta:empty { display: none; }
.pn-fb { font-size: 0.7rem; border-radius: 999px; padding: 1px 8px; border: 1px solid var(--line); }
.pn-fb-up { background: #e8f1ea; border-color: #b9d3bf; color: #2f5a3b; }
.pn-fb-down { background: #f7e9e6; border-color: #e5c4bd; color: #7a2a22; }
.pn-tag-up { background: #e8f1ea; color: #2f5a3b; }
.pn-tag-down { background: #f7e9e6; color: #7a2a22; }
.pn-msg-form { background: #3b352e; }
.pn-form-tag { display: block; font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.7; margin-bottom: 3px; }
.pn-msg-ui { color: var(--ink-2); background: var(--paper-2); }
.pn-model { display: inline-block; font-size: 0.68rem; letter-spacing: 0.04em; color: var(--ink-3); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; }
.pn-model-prime { color: #6b4e1d; border-color: #e7d3a8; background: #fbf3e2; }
.pn-msg-tool { align-self: center; font-size: 0.78rem; color: #6b4e1d; background: #f6eedf; border-radius: 999px; padding: 4px 12px; }
.pn-msg-tool-retry { color: var(--ink-3); background: var(--paper-2); }

/* Conhecimento */
[data-knowledge] h3 { font-size: 1rem; margin: 28px 0 10px; }
.pn-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.pn-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; min-width: 860px; }
.pn-table th, .pn-table td { text-align: left; vertical-align: top; padding: 12px 14px; border-bottom: 1px solid var(--paper-2); }
.pn-table thead th { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); background: var(--paper); }
.pn-table tbody th { font-weight: 400; width: 26%; }
.pn-exp-name { display: block; font-weight: 650; margin-bottom: 4px; }
.pn-table td:nth-child(2) { width: 26%; }
.pn-missing { color: #8a5a1f; font-style: normal; background: #fbf3e2; padding: 1px 6px; border-radius: 6px; font-size: 0.8rem; }
.pn-facts-list, .pn-missing-list { margin: 0; padding: 0; list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.pn-facts-list li { display: grid; grid-template-columns: 110px 1fr auto; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--paper-2); font-size: 0.88rem; align-items: baseline; }
.pn-facts-list li:last-child, .pn-missing-list li:last-child { border-bottom: 0; }
.pn-topic { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); }
.pn-facts-list li > * { min-width: 0; }
.pn-facts-list a, .pn-table a { color: var(--wine); overflow-wrap: anywhere; }
.pn-block { display: block; margin-top: 4px; }
.pn-md p { margin: 0; }
.pn-md p + p, .pn-md p + ul, .pn-md ul + p, .pn-md p + ol, .pn-md ol + p { margin-top: 6px; }
.pn-md ul, .pn-md ol { margin: 4px 0 0; padding-left: 18px; }
.pn-msg-assistant { white-space: normal; }
.pn-missing-list li { padding: 10px 14px 10px 36px; border-bottom: 1px solid var(--paper-2); font-size: 0.9rem; position: relative; }
.pn-missing-list li::before { content: "?"; position: absolute; left: 12px; top: 10px; width: 16px; height: 16px; border-radius: 50%; background: #fbf3e2; color: #8a5a1f; font-size: 0.7rem; font-weight: 700; display: grid; place-items: center; }

/* Modal e aviso */
.pn-modal { position: fixed; inset: 0; z-index: 50; background: rgba(31, 26, 23, 0.45); display: grid; place-items: center; padding: 20px; }
.pn-modal-card { width: min(440px, 100%); background: var(--card); border-radius: 16px; padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.pn-modal-card h2 { font-family: var(--serif); font-weight: 500; margin: 0; font-size: 1.6rem; }
.pn-modal-card p { margin: 0; }
.pn-modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.pn-modal-actions .btn { min-height: 40px; padding: 0 18px; }
.pn-toast {
  position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60;
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 0.86rem; max-width: calc(100vw - 32px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

@media (max-width: 820px) {
  /* A tabela do conhecimento vira cartões: cada célula com o seu rótulo. */
  .pn-table-wrap { overflow: visible; border: 0; background: transparent; }
  .pn-table { min-width: 0; }
  .pn-table thead { display: none; }
  .pn-table, .pn-table tbody, .pn-table tr, .pn-table th, .pn-table td { display: block; width: auto !important; }
  .pn-table tr { background: var(--card); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 10px; overflow: hidden; }
  .pn-table td { border-bottom: 0; padding-top: 4px; }
  .pn-table td::before { content: attr(data-label); display: block; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); margin-bottom: 2px; }
  .pn-split { grid-template-columns: 1fr; }
  .pn-conv-list { position: static; max-height: none; }
  .pn-msg { max-width: 92%; }
  .pn-facts-list li { grid-template-columns: 1fr; gap: 2px; }
  .pn-live { display: none; }
}
@media (max-width: 560px) {
  .pn-head-inner { padding-top: 10px; padding-bottom: 8px; }
  .pn-brand-name { font-size: 1.2rem; }
  .pn-head-actions { width: 100%; }
  .pn-section-head h2 { font-size: 1.55rem; }
  .pn-item { padding: 14px; }
}
