/* =========================================================
   Área de Cliente (demonstração) — Newcogest
   Usa os tokens de style.css
   ========================================================= */

.portal { background: var(--paper); min-height: 100vh; }
.portal [hidden] { display: none !important; }
.demo-ribbon {
  position: sticky; top: 0; z-index: 30; display: flex; justify-content: center; gap: 18px; align-items: center;
  background: var(--gold); color: var(--navy); font-size: 13px; padding: 8px var(--gutter); text-align: center;
}
.demo-ribbon a { font-weight: 800; text-decoration: underline; }

/* ---------- Entrada ---------- */
.p-login { display: grid; grid-template-columns: 1.15fr 1fr; min-height: calc(100vh - 37px); }
.p-login-media { position: relative; overflow: hidden; background: var(--navy); }
.p-login-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .55; }
.p-login-media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(10,22,51,.1), rgba(10,22,51,.92)); }
.p-login-quote { position: absolute; z-index: 1; left: clamp(28px, 5vw, 72px); right: clamp(28px, 5vw, 72px); bottom: clamp(36px, 7vh, 80px); color: var(--white); }
.p-login-quote h2 { font-size: clamp(34px, 4vw, 60px); font-weight: 500; letter-spacing: -.03em; margin: 16px 0 14px; max-width: 14ch; }
.p-login-quote h2 .serif { font-style: italic; color: var(--gold); }
.p-login-quote p { color: rgba(255,255,255,.8); max-width: 44ch; }
.p-login-panel { display: flex; flex-direction: column; justify-content: center; padding: clamp(32px, 6vw, 96px); gap: 18px; max-width: 620px; }
.p-login-logo { width: 168px; height: auto; margin-bottom: 18px; }
.p-login-panel h1 { font-size: clamp(30px, 3vw, 42px); }
.p-muted { color: var(--muted); }
.p-roles { display: grid; gap: 12px; margin-top: 10px; }
.p-role {
  display: grid; grid-template-columns: 52px 1fr 40px; gap: 16px; align-items: center; text-align: left;
  background: var(--white); border: 1px solid var(--line); border-radius: 18px; padding: 18px; transition: border-color .3s, transform .4s var(--ease), box-shadow .3s;
}
.p-role:hover { border-color: var(--blue); transform: translateY(-2px); box-shadow: 0 20px 40px -24px rgba(29,63,214,.5); }
.p-role b { display: block; font-size: 17px; }
.p-role small { display: block; color: var(--muted); font-size: 14px; margin-top: 2px; }
.p-role-ic { width: 52px; height: 52px; border-radius: 14px; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; }
.p-role-ic .icon { width: 24px; height: 24px; }
.p-role-go { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; transition: .3s; }
.p-role:hover .p-role-go { background: var(--blue); color: var(--white); border-color: var(--blue); }
.p-secure { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; margin-top: 8px; }

/* ---------- Aplicação ---------- */
.p-app { display: grid; grid-template-columns: 268px 1fr; min-height: calc(100vh - 37px); }
.p-side { background: var(--navy); color: rgba(255,255,255,.8); padding: 26px 18px; display: flex; flex-direction: column; gap: 26px; position: sticky; top: 37px; height: calc(100vh - 37px); }
.p-side-logo img { width: 150px; height: auto; margin: 4px 8px 0; }
.p-profile { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 14px; background: rgba(255,255,255,.06); }
.p-profile b { display: block; color: var(--white); font-size: 14px; }
.p-profile small { display: block; font-size: 12px; color: rgba(255,255,255,.6); }
.p-avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--gold); color: var(--navy); display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; }
.p-nav { display: grid; gap: 4px; }
.p-nav button { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; color: rgba(255,255,255,.72); font-weight: 600; font-size: 15px; text-align: left; transition: background .3s, color .3s; }
.p-nav button:hover { background: rgba(255,255,255,.06); color: var(--white); }
.p-nav button[aria-current="page"] { background: var(--white); color: var(--navy); }
.p-nav .count { margin-left: auto; background: var(--gold); color: var(--navy); border-radius: 999px; font-size: 11px; font-weight: 800; padding: 2px 8px; }
.p-side-foot { margin-top: auto; display: grid; gap: 10px; }
.p-manager { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 14px; background: rgba(37,211,102,.12); color: var(--white); }
.p-manager .icon { color: var(--wa); width: 22px; height: 22px; }
.p-manager b { display: block; font-size: 14px; }
.p-manager small { display: block; font-size: 12px; color: rgba(255,255,255,.6); }
.p-logout { display: flex; gap: 10px; align-items: center; color: rgba(255,255,255,.6); padding: 10px 14px; font-size: 14px; }
.p-logout:hover { color: var(--white); }

.p-main { padding: clamp(20px, 3vw, 40px); min-width: 0; }
.p-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.p-date { color: var(--muted); font-size: 14px; font-weight: 600; }
.p-date::first-letter { text-transform: uppercase; }
.p-top h1 { font-size: clamp(28px, 2.6vw, 38px); margin-top: 4px; }
.p-top h1 .serif { font-style: italic; color: var(--blue); }
.p-top-actions { display: flex; gap: 10px; align-items: center; }
.p-bell { position: relative; width: 44px; height: 44px; border-radius: 50%; background: var(--white); border: 1px solid var(--line); display: grid; place-items: center; }
.p-bell i { position: absolute; top: -2px; right: -2px; min-width: 18px; height: 18px; border-radius: 999px; background: #d93025; color: #fff; font-size: 11px; font-style: normal; font-weight: 800; display: grid; place-items: center; padding: 0 4px; }

.p-content { display: grid; gap: 20px; }
.p-grid { display: grid; gap: 20px; }
.p-grid.k4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.p-grid.c2 { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.p-card { background: var(--white); border-radius: 20px; padding: 22px; border: 1px solid var(--line); min-width: 0; }
.p-card h2 { font-size: 18px; display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.p-card h2 small { font-size: 13px; color: var(--muted); font-weight: 600; }
.p-kpi { display: grid; gap: 6px; }
.p-kpi .label { color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: .04em; }
.p-kpi .value { font-family: var(--serif); font-size: clamp(34px, 3vw, 46px); line-height: 1; letter-spacing: -.01em; }
.p-kpi .value small { font-family: var(--sans); font-size: 14px; color: var(--muted); font-weight: 700; margin-left: 4px; }
.p-kpi .delta { font-size: 13px; font-weight: 700; color: #15803d; }
.p-kpi .delta.warn { color: #b7791f; }

/* Tabela */
.p-table-wrap { overflow-x: auto; margin: 0 -22px -22px; }
.p-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.p-table th { text-align: left; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 10px 22px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.p-table td { padding: 14px 22px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.p-table tr:last-child td { border-bottom: 0; }
.p-table .who b { display: block; }
.p-table .who small { color: var(--muted); }

/* Gráfico de barras (SVG) */
.p-chart svg { width: 100%; height: auto; display: block; }
.p-chart .bar { fill: var(--blue); }
.p-chart .bar.low { fill: var(--gold); }
.p-chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--sans); }
.p-chart .grid { stroke: var(--line); }
.p-legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin-top: 10px; flex-wrap: wrap; }
.p-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* Anel de ocupação */
.p-ring { display: flex; gap: 18px; align-items: center; }
.p-ring svg { width: 96px; height: 96px; flex: none; }
.p-ring .track { stroke: var(--paper-2); }
.p-ring .fill { stroke: var(--blue); stroke-linecap: round; }

/* Manutenção */
.p-tickets { display: grid; gap: 14px; }
.p-ticket { border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: grid; gap: 12px; }
.p-ticket-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.p-ticket-head b { display: block; }
.p-ticket-head small { color: var(--muted); }
.p-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.p-steps span { height: 6px; border-radius: 999px; background: var(--paper-2); }
.p-steps span.done { background: var(--blue); }
.p-steps-labels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; font-size: 11px; color: var(--muted); font-weight: 700; }
.p-ticket-foot { display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); }
.p-ticket-foot .icon { color: var(--blue); }

/* Lista (documentos, avisos) */
.p-list { display: grid; }
.p-list-item { display: flex; gap: 14px; align-items: center; padding: 13px 0; border-bottom: 1px solid var(--line); }
.p-list-item:last-child { border-bottom: 0; }
.p-list-ic { width: 40px; height: 40px; border-radius: 12px; background: var(--paper); display: grid; place-items: center; color: var(--blue); flex: none; }
.p-list-item b { display: block; font-size: 14px; }
.p-list-item small { color: var(--muted); font-size: 13px; }
.p-list-item .end { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.p-icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink); }
.p-icon-btn:hover { border-color: var(--blue); color: var(--blue); }

/* Imóveis */
.p-props { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.p-prop { background: var(--white); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; }
.p-prop img { width: 100%; aspect-ratio: 16/10; object-fit: cover; }
.p-prop-body { padding: 16px; display: grid; gap: 8px; }
.p-prop-body b { font-size: 16px; }
.p-prop-row { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); }
.p-prop-row strong { color: var(--ink); }

/* Relatório financeiro */
.p-ledger { display: grid; gap: 0; font-size: 15px; }
.p-ledger div { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px dashed var(--line); }
.p-ledger div.total { border-bottom: 0; border-top: 2px solid var(--ink); font-weight: 800; font-size: 17px; margin-top: 4px; }
.p-ledger .neg { color: #b42318; }
.p-hint { font-size: 12px; color: var(--muted); margin-top: 10px; }

/* Modal */
.p-modal { border: 0; border-radius: 22px; padding: 0; width: min(520px, calc(100vw - 32px)); box-shadow: 0 40px 100px -30px rgba(10,22,51,.6); }
.p-modal::backdrop { background: rgba(10,22,51,.55); }
.p-form { padding: 26px; display: grid; gap: 14px; }
.p-form > label { display: grid; gap: 6px; font-size: 13px; font-weight: 700; color: #3a3f52; }
.p-form select, .p-form textarea { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--paper); width: 100%; }
.p-form textarea { min-height: 96px; resize: vertical; }
.p-modal-head { display: flex; justify-content: space-between; align-items: center; }
.p-modal-head h2 { font-size: 22px; }
.p-x { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; }
.p-seg { display: inline-flex; gap: 8px; }
.p-seg label { position: relative; }
.p-seg input { position: absolute; inset: 0; opacity: 0; width: 1px; height: 1px; }
.p-seg span { display: inline-flex; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line); font-weight: 700; cursor: pointer; }
.p-seg input:checked + span { background: var(--navy); color: var(--white); border-color: var(--navy); }
.p-seg input:focus-visible + span { outline: 2px solid var(--blue-2); outline-offset: 2px; }
.p-note { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.p-modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 6px; }

.p-toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 90; transform: translate(-50%, 140%); opacity: 0;
  background: var(--ink); color: var(--white); padding: 14px 20px; border-radius: 14px; font-weight: 600; font-size: 14px;
  transition: transform .5s var(--ease), opacity .5s; max-width: calc(100vw - 32px); box-shadow: 0 20px 50px -20px rgba(0,0,0,.5);
}
.p-toast.show { transform: translate(-50%, 0); opacity: 1; }

.p-fade { animation: pfade .5s var(--ease) both; }
@keyframes pfade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- Responsivo ---------- */
@media (max-width: 1100px) {
  .p-grid.k4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .p-grid.c2 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .p-login { grid-template-columns: 1fr; }
  .p-login-media { min-height: 300px; }
  .p-app { grid-template-columns: 1fr; padding-bottom: 76px; }
  .p-side { position: static; height: auto; flex-direction: row; align-items: center; padding: 14px 16px; gap: 12px; }
  .p-side-logo img { width: 120px; margin: 0; }
  .p-profile { margin-left: auto; padding: 0; background: none; }
  .p-profile > span:last-child { display: none; }
  .p-side-foot { display: none; }
  .p-nav { position: fixed; z-index: 40; left: 0; right: 0; bottom: 0; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0; background: var(--navy); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .p-nav button { flex-direction: column; gap: 4px; font-size: 11px; padding: 8px 2px; text-align: center; justify-content: center; }
  .p-nav .count { display: none; }
  .p-nav button[aria-current="page"] { background: rgba(255,255,255,.12); color: var(--white); }
}
@media (max-width: 560px) {
  .p-grid.k4 { grid-template-columns: 1fr 1fr; gap: 12px; }
  .p-card { padding: 16px; }
  .p-table-wrap { margin: 0 -16px -16px; }
  .p-kpi .value { font-size: 30px; }
  .demo-ribbon { font-size: 12px; gap: 10px; }
  .p-top-actions .btn span[data-primary-label] { display: none; }
}
