/* Tokens espelhados do institucional (src/app/globals.css): --brand #4a21bb, --radius 0.625rem.
   Geist é a fonte do institucional; a CSP local bloqueia hosts externos, então ela só é usada
   se estiver instalada. Autohospedar a fonte é decisão pendente — ver docs/DESIGN-SYSTEM.md. */
:root{--bg:#fafafa;--surface:#fff;--text:#171717;--muted:#737373;--line:#e9e9eb;--brand:#4a21bb;--brand-ink:#5660f1;--brand-soft:#f1edfa;--radius:10px;font-family:Geist,"Geist Sans",Inter,"Segoe UI",Arial,sans-serif;font-size:14px;color:var(--text);background:var(--bg);color-scheme:light}
*{box-sizing:border-box}body{margin:0}button,input,select{font:inherit}button{cursor:pointer;border:0;transition:background .15s,color .15s}button:disabled{opacity:.5;cursor:wait}
button:focus-visible,summary:focus-visible{outline:3px solid #ad98e7;outline-offset:3px}
/* Um único contorno: foco ocupa a borda existente, nunca cria um anel externo. */
input:hover,select:hover,textarea:hover{border-color:#bcb3cf}
input:focus,select:focus,textarea:focus{border-color:var(--brand);outline:2px solid var(--brand);outline-offset:-2px;box-shadow:none}
input,select{width:100%;min-width:0;min-height:44px;padding:11px 13px;border:1px solid #dcdce0;border-radius:7px;color:var(--text);background:var(--surface)}input::placeholder{color:#929298}
label{display:grid;gap:8px;font-size:13px;font-weight:500}h1,h2,h3,p{margin:0}h1{font-size:30px;font-weight:600;letter-spacing:-1.1px}h2{font-size:15px;font-weight:600}small{font-size:12px;color:var(--muted);line-height:1.6}
.primary{display:inline-flex;gap:12px;align-items:center;justify-content:center;min-height:42px;background:var(--brand);color:#fff;padding:11px 17px;border-radius:7px;font-weight:550}.primary:hover{background:#391a91}
.secondary{min-height:40px;border:1px solid #dddde2;background:#fff;color:#303036;padding:9px 14px;border-radius:7px}.secondary:hover{background:#f5f5f7}.quiet{background:transparent;color:var(--muted);padding:10px}
.brand{display:flex;align-items:center;gap:12px;font-size:13px;letter-spacing:2.5px;font-weight:650}.brand img{flex-shrink:0}.brand-product{display:block;font-size:10px;letter-spacing:3px;color:var(--muted);margin-top:5px;font-weight:500}
.login-screen{min-height:100svh;display:grid;place-items:center;background:#fff;padding:40px 24px}.login-box{width:100%;max-width:344px;margin-top:-52px}.login-brand{margin-bottom:52px;font-size:15px}.login-brand .brand-product{font-size:11px}.login-box h1{font-size:26px;letter-spacing:-.7px;margin-bottom:28px}.login-box form{display:grid;gap:10px}.password-field{position:relative}.password-field input{height:48px;padding-right:76px}.reveal{position:absolute;right:5px;top:5px;height:38px;padding:0 10px;background:transparent;color:var(--muted);font-size:12px}.login-submit{width:100%;height:46px;justify-content:space-between;margin-top:8px}.login-signature{position:fixed;bottom:26px;font-size:9px;letter-spacing:3px;color:#a3a3a3}.form-error{font-size:12px;color:#ad2541;line-height:1.6}.form-error:empty{display:none}
.app-shell{display:grid;grid-template-columns:232px minmax(0,1fr);min-height:100svh}.sidebar{position:sticky;top:0;height:100svh;padding:28px 18px 18px;background:var(--surface);border-right:1px solid var(--line);display:flex;flex-direction:column}.sidebar>.brand{padding:0 8px}.nav-label{font-size:9px;letter-spacing:1.5px;color:#94949b;margin:48px 12px 15px}.sidebar nav{display:grid;gap:5px}.nav-item{display:flex;gap:12px;align-items:center;text-align:left;background:transparent;color:#686870;padding:13px 12px;border-radius:7px;font-size:13px;min-height:44px}.nav-item:hover{background:#f7f7f8}.nav-item.active{background:var(--brand-soft);color:var(--brand);font-weight:600}.nav-icon{width:18px;text-align:center;font-size:20px;line-height:16px}.sidebar-bottom{margin-top:auto}.workspace-label{border-top:1px solid var(--line);padding:22px 8px 12px;display:flex;align-items:center;gap:10px;font-size:12px;font-weight:600}.workspace-label small{display:block;font-weight:400;font-size:11px;margin-top:3px}.avatar{display:grid;place-items:center;background:#f0f0f2;border:1px solid #e4e4e7;border-radius:8px;width:34px;height:34px;font-weight:600}.sign-out{width:100%;display:flex;justify-content:space-between;padding:12px 8px;background:transparent;color:var(--muted);font-size:12px}
.topbar{height:72px;border-bottom:1px solid var(--line);background:var(--surface);padding:0 36px;display:flex;align-items:center;justify-content:space-between;font-size:12px;color:#8a8a91}.topbar strong{color:#34343a;font-weight:500}.crumb-divider{margin:0 14px;color:#c4c4c9}.content{padding:36px;max-width:1480px;margin:auto}.page-heading{display:flex;justify-content:space-between;align-items:center;gap:16px;margin-bottom:30px}.eyebrow{font-size:9px;letter-spacing:1.6px;color:#92929a;margin-bottom:10px}.notice:not(:empty){background:var(--brand-soft);border:1px solid #ded4f4;border-radius:7px;padding:12px 16px;color:var(--brand);margin-bottom:20px;font-size:13px}
.metrics{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);margin-bottom:36px}.metrics:empty{display:none}.metrics article{padding:24px 28px}.metrics article+article{border-left:1px solid var(--line)}.metrics span{color:var(--muted);font-size:12px}.metrics strong{display:block;font-size:30px;font-weight:550;letter-spacing:-1px;margin-top:12px;font-variant-numeric:tabular-nums}.metrics small{display:block;margin-top:6px;font-size:11px}
.section-toolbar{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:16px}.search-label{width:230px}.search-label input{min-height:38px;font-size:12px;background:#fff}.table-container{border:1px solid var(--line);background:#fff;border-radius:var(--radius);overflow:auto}table{border-collapse:collapse;width:100%;text-align:left;white-space:nowrap}th{background:#fcfcfd;font-size:11px;font-weight:500;color:#85858d;padding:15px 22px;border-bottom:1px solid var(--line)}td{font-size:13px;padding:20px 22px;border-bottom:1px solid var(--line)}tr:last-child td{border-bottom:0}.client-name{font-weight:600;display:block}.client-slug{display:block;font-size:11px;color:var(--muted);margin-top:5px}.status{display:inline-flex;align-items:center;gap:6px;padding:5px 8px;border-radius:5px;font-size:11px;background:#f2f2f4;color:#686870}.status.active{background:#edf5ef;color:#39754b}.status.active::before{content:'';width:5px;height:5px;border-radius:50%;background:#58946a}.table-action{background:transparent;color:var(--muted);font-size:11px;padding:8px}.table-action:hover{color:var(--brand);background:var(--brand-soft);border-radius:5px}
.empty-state{padding:62px 24px;text-align:center}.empty-symbol{display:grid;place-items:center;margin:0 auto 18px;width:42px;height:42px;border:1px solid var(--line);border-radius:12px;font-size:24px;color:#97979f}.empty-state h3{font-size:16px;font-weight:550;margin-bottom:10px}.empty-state p{font-size:12px;color:var(--muted);line-height:1.7;margin-bottom:22px}.section-title{margin-bottom:18px}.contracts-title{margin-top:32px}.product-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.product-card{background:#fff;border:1px solid var(--line);border-radius:var(--radius);padding:22px;display:flex;align-items:center;gap:16px}.product-mark{width:38px;height:38px;border-radius:9px;background:var(--brand-soft);color:var(--brand);display:grid;place-items:center;font-size:16px}.product-card h3{font-size:13px;font-weight:600}.product-card p{margin-top:6px;color:var(--muted);font-size:11px}.list-panel{border:1px solid var(--line);border-radius:var(--radius);background:#fff}.record{display:flex;align-items:center;justify-content:space-between;padding:20px 24px;border-bottom:1px solid var(--line);gap:20px}.record:last-child{border-bottom:0}.record strong{font-size:13px;font-weight:600}.record span.detail{display:block;line-height:1.7;font-size:12px;color:var(--muted);margin-top:6px;overflow-wrap:anywhere}.empty-list{color:var(--muted);font-size:13px;padding:36px 24px;text-align:center;line-height:1.7}
dialog{border:1px solid var(--line);padding:28px;border-radius:14px;width:440px;max-width:calc(100vw - 32px);color:var(--text);box-shadow:0 24px 80px #0002}dialog::backdrop{background:#13131b65;backdrop-filter:blur(3px)}dialog form{display:grid;gap:18px}.dialog-heading{display:flex;align-items:center;justify-content:space-between;margin-bottom:6px}.dialog-heading h2{font-size:20px;letter-spacing:-.4px}.close{background:transparent;color:#888;font-size:24px;width:32px;height:32px}.dialog-actions{display:flex;justify-content:flex-end;gap:10px;padding-top:8px}dialog small{margin-top:-12px}details{font-size:12px;color:var(--muted)}summary{cursor:pointer;margin:6px 0}details label{margin-top:14px}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap}[hidden]{display:none!important}
@media(max-width:850px){.app-shell{grid-template-columns:190px minmax(0,1fr)}.sidebar{padding:24px 10px}.content{padding:24px}.topbar{padding:0 24px}.metrics article{padding:20px}.product-grid{grid-template-columns:1fr}}
@media(max-width:600px){.app-shell{display:block}.sidebar{height:auto;position:relative;padding:16px;border-right:0;border-bottom:1px solid var(--line)}.sidebar>.brand{padding:0}.sidebar>.brand img{width:30px;height:30px}.sidebar nav{display:flex;margin-top:18px;gap:4px}.nav-item{padding:10px 8px;font-size:11px;flex:1;gap:6px}.nav-icon{display:none}.nav-label,.workspace-label{display:none}.sidebar-bottom{position:absolute;right:16px;top:18px}.sign-out{font-size:11px;gap:10px}.topbar{height:52px;padding:0 20px}.content{padding:24px 16px}.page-heading{margin-bottom:24px}.page-heading h1{font-size:24px}.page-heading .primary{font-size:12px;padding:10px 12px}.metrics{margin-bottom:28px}.metrics article{padding:16px 12px}.metrics span{font-size:10px}.metrics strong{font-size:26px}.section-toolbar{align-items:start;flex-direction:column;gap:12px}.search-label{width:100%}.login-box{margin-top:-28px}.empty-state{padding:44px 20px}.login-brand{margin-bottom:40px}}
.ecosystem-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.ecosystem-card{padding:24px;background:var(--surface);border:1px solid var(--line);border-radius:10px;display:flex;flex-direction:column;gap:14px}.ecosystem-card header{display:flex;align-items:center;justify-content:space-between;gap:10px}.ecosystem-card h3{font-size:17px;letter-spacing:-.3px}.ecosystem-card p{font-size:13px;color:var(--muted);line-height:1.65}.ecosystem-category{font-size:10px;text-transform:uppercase;letter-spacing:1px;color:var(--brand)}.catalog-links{display:flex;flex-wrap:wrap;gap:18px;margin-top:auto;padding-top:10px}.catalog-links a,.resource-link{color:var(--brand);text-decoration:none;font-size:12px}.catalog-links a:hover,.resource-link:hover{text-decoration:underline}.catalog-caption{font-size:11px;color:var(--muted)}.catalog-footnote{margin-top:24px}.resource-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.resource-link{padding:18px;background:var(--surface);border:1px solid var(--line);border-radius:8px;display:flex;justify-content:space-between;gap:12px}.resource-link small{font-size:10px}a:focus-visible{outline:3px solid #ad98e7;outline-offset:3px}@media(max-width:700px){.ecosystem-grid,.resource-grid{grid-template-columns:1fr}.sidebar nav{flex-wrap:wrap}.nav-item{flex-basis:40%}.ecosystem-card{padding:20px}}

/* Troca de contexto: gestão geral da TZOLKIN ↔ gestão de um produto. */
.context-switch{margin:26px 8px 0;display:grid;gap:7px}.context-switch label{font-size:9px;letter-spacing:1.5px;color:#94949b;font-weight:500}.context-switch select{min-height:40px;font-size:12px;padding:9px 11px;background:var(--surface)}
body[data-context="product"] .context-switch select{border-color:#cfc2ee;background:var(--brand-soft);color:var(--brand);font-weight:600}
body[data-context="product"] .topbar #crumb-context{color:var(--brand)}
.context-panel{display:grid;gap:16px}.context-card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:26px;display:grid;gap:12px;justify-items:start}.context-card h2{font-size:19px;letter-spacing:-.4px}.context-card .detail{font-size:12px;color:var(--muted);font-variant-numeric:tabular-nums}.context-description{font-size:13px;color:#4b4b53;line-height:1.7;max-width:62ch}.context-card small{max-width:72ch}
.product-card{flex-wrap:wrap}.product-card-body{flex:1;min-width:150px}.product-card .table-action{margin-left:auto;white-space:nowrap}
#product-orgs td:nth-child(2) .client-slug{max-width:280px;white-space:normal;overflow-wrap:anywhere}
@media(max-width:850px){.metrics{grid-auto-flow:row;grid-template-columns:repeat(2,minmax(0,1fr))}.metrics article+article{border-left:0}.metrics article:nth-child(even){border-left:1px solid var(--line)}.metrics article:nth-child(n+3){border-top:1px solid var(--line)}}
@media(max-width:600px){.context-switch{margin:16px 0 0}}

/* Aviso persistente de transporte inseguro do banco. Some só quando o servidor parar de reportar texto claro. */
.security-banner{background:#fdf2f4;border:1px solid #f0c6cf;border-left:3px solid #ad2541;border-radius:7px;padding:13px 16px;color:#8d1e35;margin-bottom:20px;font-size:13px;line-height:1.6}

/* Deploys: leitura de provedores externos. Um cartão por projeto, mais recente em destaque. */
.deploy-grid{display:grid;gap:14px}.deploy-card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);overflow:hidden}
.deploy-card>header{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:18px 22px;border-bottom:1px solid var(--line)}.deploy-card h3{font-size:14px;font-weight:600}
.deploy-row{display:flex;align-items:flex-start;justify-content:space-between;gap:20px;padding:16px 22px;border-bottom:1px solid var(--line)}.deploy-row:last-child{border-bottom:0}.deploy-row.principal{background:#fcfcfd}
.deploy-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap}.deploy-target{font-size:10px;letter-spacing:.6px;text-transform:uppercase;color:var(--muted)}
.deploy-row .detail{display:block;font-size:12px;color:var(--muted);margin-top:7px;font-variant-numeric:tabular-nums}
.deploy-message{display:block;font-size:12px;color:#4b4b53;margin-top:5px;overflow-wrap:anywhere}
.deploy-error{display:block;font-size:12px;color:#ad2541;margin-top:5px;overflow-wrap:anywhere}
.deploy-links{display:flex;flex-direction:column;align-items:flex-end;gap:6px;flex-shrink:0;text-align:right}.deploy-links .detail{margin-top:0;white-space:nowrap}
.status.failed{background:#fdf2f4;color:#8d1e35}.status.failed::before{content:'';width:5px;height:5px;border-radius:50%;background:#c04159}
@media(max-width:600px){.deploy-row{flex-direction:column;gap:10px}.deploy-links{flex-direction:row;align-items:center;text-align:left}}
.notice-inline{background:var(--brand-soft);border:1px solid #ded4f4;border-radius:7px;padding:11px 15px;color:var(--brand);margin-bottom:14px;font-size:12px}
.deploy-card>header .deploy-head{gap:10px}

/* Layout responsivo compartilhado: conteúdo pode encolher sem esconder overflow. */
.app-main,.content,.view,.page-heading>div,.record>div,.context-card,.ecosystem-card,.resource-link{min-width:0}
.sidebar{overflow-y:auto}.sidebar .brand,.sidebar-bottom{flex-shrink:0}
.content :is(h1,h2,h3,p,small,.notice,.notice-inline,.record strong){overflow-wrap:anywhere}
.product-mark,.avatar{flex-shrink:0}.product-card-body{min-width:min(150px,100%)}
.table-container{max-width:100%;overscroll-behavior-x:contain}
.record{flex-wrap:wrap}.record>div{flex:1 1 180px}
.page-heading,.section-toolbar,.ecosystem-card header{flex-wrap:wrap}
.topbar{min-height:60px;height:auto;gap:12px;padding-block:12px}.topbar>span{min-width:0;overflow-wrap:anywhere}.topbar>button{flex-shrink:0}
dialog{max-height:calc(100dvh - 32px);overflow-y:auto;overscroll-behavior:contain}dialog form,dialog label{min-width:0}.dialog-actions{flex-wrap:wrap}.dialog-heading{gap:12px}.close{flex-shrink:0}
@media(max-width:1100px){.resource-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.ecosystem-grid{grid-template-columns:1fr}}
@media(max-width:900px){
 .app-shell{display:block}.sidebar{position:relative;height:auto;overflow:visible;padding:16px 20px;border-right:0;border-bottom:1px solid var(--line);display:grid;grid-template-columns:minmax(0,1fr) auto;gap:16px}
 .sidebar>.brand{padding:0}.sidebar>.brand img{width:30px;height:30px}.sidebar-bottom{position:static;margin:0;grid-column:2;grid-row:1;align-self:center}.workspace-label,.nav-label{display:none}.sign-out{min-height:44px;padding:8px;font-size:12px;gap:8px}
 .context-switch{grid-column:1/-1;margin:0;max-width:100%}.context-switch label{display:none}
 .sidebar nav{grid-column:1/-1;display:flex;flex-wrap:nowrap;overflow-x:auto;gap:6px;margin:0;padding:2px;overscroll-behavior-x:contain}.sidebar .nav-item{flex:0 0 auto;min-height:44px;padding:10px 12px;font-size:12px;gap:8px;white-space:nowrap}.sidebar .nav-icon{display:inline-block}
 .content{padding:28px 24px}.topbar{padding-inline:24px}.ecosystem-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:600px){
 .sidebar{padding:12px 16px;gap:12px}.content{padding:24px 16px}.topbar{padding:10px 16px}.crumb-divider{margin:0 7px}
 .page-heading{align-items:flex-start;gap:14px}.page-heading>div{flex:1 1 180px}.page-heading>.primary{min-height:44px}
 .ecosystem-grid,.resource-grid{grid-template-columns:1fr}.ecosystem-card,.context-card,.product-card{padding:18px}
 .record{padding:16px;gap:12px}.metrics article{padding:16px 12px}.metrics strong{overflow-wrap:anywhere}
 .search-label input,.context-switch select,input,select,textarea{font-size:16px}.table-action,.quiet,.secondary{min-height:44px}
 dialog{padding:20px;max-width:calc(100vw - 24px);max-height:calc(100dvh - 24px)}.dialog-actions>button{flex:1 1 100px}
 th,td{padding:14px 16px}.login-signature{position:static;align-self:end;margin-top:24px}.login-screen{grid-template-rows:1fr auto}.login-box{margin-top:0}
}
