/* Fichas: seções em cartões, campos compactos, rolagens, visão ampla e impressão. */
.char-create{flex-wrap:wrap}
.char-create input{flex:1 1 140px}
.char-create select{flex:1 1 150px;min-width:0;max-width:100%}
.char-create .template-hint{flex:1 0 100%;margin:2px 0 0;font:10px/1.6 var(--font-mono);color:#a6a6b0}

.system-tag{padding:3px 7px;font:600 9px var(--font-mono);letter-spacing:.5px;text-transform:uppercase;color:#ff8ca3;border:1px solid #6b1830;background:#240610}

.sheet-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin:0 0 14px;padding:8px;border:1px solid #303036;background:#08080b}
.sheet-toolbar button,.sheet-toolbar .sheet-import{min-height:30px;padding:4px 10px;font:600 10px var(--font-mono);cursor:pointer}
.sheet-toolbar button[aria-pressed=true]{background:#ed1742;border-color:#ff4568;color:#fff}
.sheet-toolbar select{max-width:170px;min-height:30px;font-size:11px}
.sheet-toolbar .sheet-import{display:inline-flex;align-items:center;border:1px solid #36363f;background:#141419}
.sheet-toolbar .sheet-import:hover{border-color:#74747e}
.sheet-toolbar [hidden]{display:none}
.sheet-toolbar #sheetClose{display:none}
.sheet-last-roll{flex:1 0 100%;margin:2px 0 0;font:11px/1.6 var(--font-mono);color:#d4d4e0;overflow-wrap:anywhere}

/* Seções como cartões */
.sheet-sections{display:grid;grid-template-columns:1fr;gap:12px;margin-top:14px}
.sheet-group{padding:10px 12px;border:1px solid #2b2b33;background:#0a0a0e;min-width:0}
.sheet-group>.sheet-section{margin:0 0 8px;padding-bottom:7px;border-bottom:1px solid #3a1420;color:#ff8ca3;font:600 10px var(--font-mono);letter-spacing:1.4px}
.sheet-group .sheet-block{padding:8px 0;margin:0;border-top:1px solid #1d1d24}
.sheet-group .sheet-block:first-of-type{border-top:0}
.sheet-group .block-heading{margin:0 0 4px}
.sheet-group .block-heading label{font:500 11px var(--font-mono);color:#d4d4e0}
.save-field{margin-left:auto;min-width:24px;min-height:22px;padding:0 6px;font-size:11px;border-color:transparent;background:transparent;color:#8a8a96}
.save-field:hover,.save-field:focus-visible{color:#fff;border-color:#ed1742}

/* Campo numérico + modificador + dado */
.number-row,.roll-row{display:flex;align-items:center;gap:6px}
.number-row input{flex:1 1 auto;min-width:0;max-width:110px;text-align:center;font:600 15px var(--font-mono)}
.stat-badge{min-width:46px;padding:5px 7px;text-align:center;font:700 12px var(--font-mono);color:#fff;background:#3a0c19;border:1px solid #7a1a33}
.roll-btn{min-width:34px;min-height:30px;padding:3px 8px;font:600 12px var(--font-mono);border:1px solid #7a1a33;background:#240610;color:#ffd1da}
.roll-btn:hover{background:#ed1742;border-color:#ff4568;color:#fff}
.roll-row input{flex:1 1 auto;min-width:0;font-size:11px}
.roll-main{white-space:nowrap}

/* Recurso com barra */
.field-type-resource .resource-row input{font:700 20px var(--font-mono);text-align:center;max-width:90px}
.resource-meter{height:6px;margin-top:6px;background:#1a1a20;border:1px solid #2b2b33}
.resource-meter>span{display:block;height:100%;background:linear-gradient(90deg,#8c1127,#ed1742)}

/* Número e recurso: rótulo à esquerda, controle à direita */
.sheet-group .field-type-number,.sheet-group .field-type-resource{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;column-gap:8px}
.sheet-group .field-type-number>.block-heading,.sheet-group .field-type-resource>.block-heading{grid-column:1;margin:0}
.sheet-group .field-type-number>.number-row,.sheet-group .field-type-resource>.resource-row{grid-column:2}
.sheet-group .field-type-number>.field-status,.sheet-group .field-type-number>.block-settings,.sheet-group .field-type-resource>.field-status,.sheet-group .field-type-resource>.block-settings,.sheet-group .field-type-resource>.resource-meter{grid-column:1 / -1}
.sheet-group .field-type-number{padding:5px 0}
.field-type-resource .resource-row{gap:6px}.field-type-resource .resource-row span{color:#8a8a96}

/* Estrutura da ficha (mestre): configurações de cada campo só aparecem no modo de edição */
#sheetsPanel:not(.sheet-editing) .block-settings{display:none}
.sheet-toolbar #sheetEdit{display:none}
.sheet-toolbar.is-host #sheetEdit{display:inline-block}
.sheet-toolbar #sheetEdit[aria-pressed=true]{background:#ed1742;border-color:#ff4568;color:#fff}

/* Configuração do mestre fica recolhida */
.sheet-group .block-settings{margin-top:6px;font-size:11px}
.sheet-group .block-settings summary{cursor:pointer;color:#8a8a96;font:10px var(--font-mono)}
.sheet-group .block-actions{justify-content:flex-start;flex-wrap:wrap}

/* ── Visão ampla ── */
.sheet-wide-open #layout::before{content:'';position:fixed;inset:0;background:#000b;z-index:55}
#layout[data-sheet-wide='1'] #tableSidebar{position:fixed;z-index:60;inset:max(66px,var(--header-height,60px)) 14px 14px 14px;width:auto;height:auto;max-width:none;border:1px solid #ed1742;box-shadow:0 0 0 4px #050507,0 20px 80px #000}
#layout[data-sheet-wide='1'] .table-tabs,#layout[data-sheet-wide='1'] #panelWidth,#layout[data-sheet-wide='1'] #sheetConnection{display:none}
#layout[data-sheet-wide='1'] #sheetsPanel{padding:16px 22px 26px}
#layout[data-sheet-wide='1'] .sheet-toolbar #sheetClose{display:inline-block}
#layout[data-sheet-wide='1'] .sheet-sections{grid-template-columns:repeat(auto-fill,minmax(270px,1fr));align-items:start}
#characters .char:not(.focused){display:none}
#layout[data-sheet-wide='1'] #sheetsPanel>h3{margin-bottom:12px}
#layout[data-sheet-wide='1'] .sheet-group:has(.field-wide){grid-column:span 2}
@media (max-width:700px){
  #layout[data-sheet-wide='1'] #tableSidebar{inset:0;border:0}
  #layout[data-sheet-wide='1'] #sheetsPanel{padding:12px}
  #layout[data-sheet-wide='1'] .sheet-group:has(.field-wide){grid-column:auto}
}

/* ── Impressão ── */
@media print{
  body.sheet-printing{background:#fff!important;color:#000!important}
  body.sheet-printing::after{display:none!important}
  body.sheet-printing #home,body.sheet-printing #game>header,body.sheet-printing #board,body.sheet-printing .table-tabs,body.sheet-printing #panelWidth,body.sheet-printing #saveStatus,
  body.sheet-printing .sheet-toolbar,body.sheet-printing .sheet-new,body.sheet-printing .sheet-list,body.sheet-printing #sheetUndo,body.sheet-printing #sheetEmpty,body.sheet-printing .owner-label,body.sheet-printing .char-create,body.sheet-printing #sheetConnection,body.sheet-printing #chatPanel,body.sheet-printing #masterTools,
  body.sheet-printing #sheetsPanel>h3,body.sheet-printing .char:not(.focused),body.sheet-printing .block-settings,body.sheet-printing .block-builder,body.sheet-printing .save-field,
  body.sheet-printing .roll-btn,body.sheet-printing .field-status,body.sheet-printing .sheet-title button,body.sheet-printing .sheet-items button,body.sheet-printing .char>button,body.sheet-printing .char>select{display:none!important}
  body.sheet-printing,body.sheet-printing #game,body.sheet-printing #layout,body.sheet-printing #tableSidebar,body.sheet-printing #sheetsPanel{display:block!important;position:static!important;height:auto!important;overflow:visible!important;width:auto!important;border:0!important;box-shadow:none!important;background:#fff!important;padding:0!important}
  body.sheet-printing .char{margin:0!important;padding:0!important;border:0!important}
  body.sheet-printing .sheet-title strong{color:#000!important;font-size:24px!important}
  body.sheet-printing .system-tag{color:#000!important;border-color:#000!important;background:#fff!important}
  body.sheet-printing .sheet-sections{display:grid!important;grid-template-columns:repeat(2,1fr)!important;gap:8px!important}
  body.sheet-printing .sheet-group{border:1px solid #000!important;background:#fff!important;break-inside:avoid}
  body.sheet-printing .sheet-group>.sheet-section{color:#000!important;border-color:#000!important}
  body.sheet-printing input,body.sheet-printing textarea,body.sheet-printing select{background:#fff!important;color:#000!important;border:0!important;border-bottom:1px solid #777!important;box-shadow:none!important}
  body.sheet-printing .stat-badge{background:#fff!important;color:#000!important;border-color:#000!important}
  body.sheet-printing label,body.sheet-printing .block-heading label{color:#000!important}
  body.sheet-printing .resource-meter{border-color:#000!important;background:#fff!important}
  body.sheet-printing .resource-meter>span{background:#555!important}
  body.sheet-printing textarea{height:auto!important;min-height:60px}
}

.sheet-toolbar .sheet-actions{display:inline-flex;flex-wrap:wrap;gap:6px;padding-left:8px;border-left:1px solid #303036}.sheet-toolbar .sheet-actions[hidden]{display:none}.sheet-toolbar button.danger{border-color:#7b1b2d;color:#ff8ca3}.sheet-toolbar button.danger:hover{background:#3a0c15;border-color:#ed1742;color:#fff}.sheet-toolbar .sheet-undo{flex-basis:100%;margin:2px 0 0;font:11px var(--font-mono);color:#ffd1da}.sheet-toolbar .sheet-undo[hidden]{display:none}
@media print{.sheet-toolbar{display:none!important}}

/* ── Organização da aba Fichas: lista → ferramentas → ficha ── */
.sheet-new{margin:0 0 12px;border:1px solid #303036;background:#08080b}
.sheet-new>summary{cursor:pointer;padding:9px 12px;font:600 11px var(--font-mono);color:#ffd1da}
.sheet-new[open]>summary{border-bottom:1px solid #303036}
.sheet-new .char-create{padding:10px 12px}
.sheet-new .sheet-import{display:inline-flex;margin:0 12px 12px;padding:6px 10px;border:1px solid #36363f;background:#141419;font:600 10px var(--font-mono);cursor:pointer}
.sheet-list{display:flex;flex-wrap:wrap;gap:6px;margin:0 0 10px}
.sheet-list[hidden],#sheetEmpty[hidden]{display:none}
.sheet-list button{display:inline-flex;align-items:center;gap:7px;min-height:34px;padding:5px 12px;font:600 12px var(--font-mono);border:1px solid #3a3a44;background:#101014;color:#d4d4e0;cursor:pointer}
.sheet-list button small{font:600 9px var(--font-mono);letter-spacing:.5px;text-transform:uppercase;color:#ff8ca3}
.sheet-list button[aria-pressed=true]{border-color:#ed1742;background:#2a0812;color:#fff;box-shadow:inset 0 -3px 0 #ed1742}
.sheet-toolbar[hidden]{display:none}
.sheet-toolbar{flex-direction:column;align-items:stretch;gap:8px}
.sheet-group-tools{display:flex;flex-wrap:wrap;align-items:center;gap:6px}
.sheet-tools-title{flex:0 0 62px;font:600 9px var(--font-mono);letter-spacing:1.2px;text-transform:uppercase;color:#8a8a96}
.sheet-toolbar .sheet-actions{padding-left:0;border-left:0}
.owner-label{display:block;margin:0 0 8px;font:600 10px var(--font-mono);color:#a6a6b2}
.owner-label select{display:block;width:100%;margin-top:4px}
.sheet-sections{margin-top:12px}
#sheetUndo{margin:0 0 10px;padding:8px 10px;border:1px solid #6b1830;background:#240610;font:11px var(--font-mono);color:#ffd1da}
#sheetUndo[hidden]{display:none}
