/* Ziblic Dashboard — refreshed UI */
:root{
	--zib-side-width:320px;
	--zib-gap:10px;
	--zib-bg:#f6f7fb;
	--zib-panel:#ffffff;
	--zib-muted:#667085;
	--zib-accent:#2b6ef6;
	--zib-accent-2:#ffb86b;
	--zib-border:#e6e9ef;
	--zib-cell-bg:#ffffff;
	--zib-cell-alt:#fbfcfe;
	--zib-radius:8px;
	--zib-rail-size:22px;
	/* Modal max height for internal scrolling (easy to find and change) */
	--zib-modal-max-height:360px;
}
*{box-sizing:border-box}
body .zib-shell{font-family:Inter,Segoe UI,Roboto,Helvetica,Arial,sans-serif;color:#111;background:var(--zib-bg);border-radius:10px;padding:16px;margin:0}
.zib-shell{background:transparent;padding:0}
.zib-titlebar{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:14px 16px;border-radius:10px;background:linear-gradient(180deg,#fff, #fbfdff);border:1px solid var(--zib-border);box-shadow:0 1px 0 rgba(18,38,63,0.03);margin-bottom:12px}
.zib-logo{display:flex;align-items:center;gap:12px}
.zib-logo img{height:36px;width:36px;object-fit:contain;border-radius:6px}
.zib-logo strong{font-size:18px;color:#0b1320}
.zib-kpis{display:flex;gap:10px;margin-left:auto}
.zib-kpi{background:var(--zib-panel);padding:10px 12px;border-radius:8px;min-width:110px;border:1px solid var(--zib-border);box-shadow:0 1px 0 rgba(11,19,32,0.03)}
.zib-kpi label{display:block;font-size:11px;color:var(--zib-muted);margin-bottom:6px}
.zib-kpi .value{font-weight:700;font-size:15px;color:#0b1320}
.zib-ribbon{display:flex;gap:8px;align-items:center;padding:8px 0}
.zib-btn{background:transparent;border:1px solid var(--zib-border);padding:8px 10px;border-radius:8px;cursor:pointer;color:#0b1320}
.zib-btn:not(.zib-btn-gold){
	background-color: rgba(43,110,246,0.10); /* teinte légèrement renforcée pour meilleure lisibilité */
	border-color: rgba(43,110,246,0.12);
}
.zib-btn:hover{box-shadow:0 2px 10px rgba(43,110,246,0.12)}
.zib-btn-gold{background:linear-gradient(90deg,#ffefd9,#fff6ea);border-color:#f1d9b2}
.zib-card-btn{padding:8px}

/* Teinte transparente pour les boutons Conquête (Logo / Offre / Case) */
.zib-card-btn{
	background-color: rgba(43,110,246,0.08); /* teinte bleue un peu plus visible */
	border-color: rgba(43,110,246,0.14);
}
.zib-formula{margin-bottom:10px}

.zib-work{display:flex;gap:8px;position:relative;min-width:0;align-items:stretch}
.zib-sheet-wrap{flex:1 1 auto;min-width:0;overflow:hidden;position:relative;padding-bottom:calc(var(--zib-rail-size) + 4px)}

/* Reserve space for scrollbars to avoid layout shift when they appear/disappear */
.zib-sheet-wrap, .zib-rail-h, .zib-rail-v { scrollbar-gutter: stable both-edges; }

/* Ensure wrap uses full width and doesn't shrink on focus/click */
.zib-sheet-wrap{width:100%}

/* Avoid focus outline pushing layout */
.zib-sheet td:focus, .zib-sheet th:focus{outline: 2px solid rgba(43,110,246,0.12); outline-offset: -2px}

/* Rails */
.zib-rail-h{position:absolute;left:0;right:0;bottom:0;height:var(--zib-rail-size);overflow-x:auto;overflow-y:hidden;pointer-events:auto;z-index:60;background:transparent;padding:2px}
.zib-rail-h .zib-rail-inner{height:1px;width:1px}
.zib-rail-v{position:absolute;top:0;bottom:calc(var(--zib-rail-size) + 4px);right:calc(var(--zib-side-width) - 6px);width:var(--zib-rail-size);overflow-y:auto;overflow-x:hidden;pointer-events:auto;z-index:50;background:transparent;padding:2px}
.zib-rail-v .zib-rail-inner{width:1px;height:1px}
.zib-rail-h,.zib-rail-v{border-radius:8px}
.zib-rail-h::-webkit-scrollbar, .zib-rail-v::-webkit-scrollbar{width:8px;height:8px}
.zib-rail-h::-webkit-scrollbar-thumb, .zib-rail-v::-webkit-scrollbar-thumb{background:rgba(11,19,32,0.12);border-radius:8px}
.zib-rail-h:hover::-webkit-scrollbar-thumb, .zib-rail-v:hover::-webkit-scrollbar-thumb{background:rgba(11,19,32,0.18)}

.zib-sheet{position:relative;z-index:6;background:transparent;border-collapse:collapse;width:max-content;margin:0}
.zib-sheet td,.zib-sheet th{border:1px solid var(--zib-border);padding:8px;text-align:center;background:var(--zib-cell-bg)}
.zib-sheet tr:nth-child(even) td{background:var(--zib-cell-alt)}
.zib-sheet th{background:#f8fafc;color:var(--zib-muted);font-weight:600}
.zib-sheet td small{display:block;color:var(--zib-muted);font-size:11px;margin-top:6px}

/* Keep title on a single line inside cells to avoid layout shifts when grid moves */
.zib-sheet td > div{
	font-size:13px;
	line-height:1.1;
	white-space:nowrap;
	overflow:hidden;
	text-overflow:ellipsis;
}
.zib-sheet td small{
	font-size:11px; /* owner line */
	line-height:1.1;
}

.zib-side{flex:0 0 var(--zib-side-width);width:var(--zib-side-width);position:relative;z-index:3;padding-left:8px}
.zib-panel{background:var(--zib-panel);border:1px solid var(--zib-border);padding:12px;border-radius:8px;margin-bottom:12px;box-shadow:0 1px 0 rgba(11,19,32,0.03)}
.zib-panel:has(.zib-vault){
    padding-top:0;
    padding-bottom:10;
}

.zib-panel:has(.zib-vault) h3{
    margin-top:-45px;
    margin-bottom:30px;
    transform:translateY(65px);
}

.zib-vault{display:flex;gap:8px;align-items:center}
.zib-pips{display:flex;gap:6px}
.zib-pips span{width:12px;height:12px;border-radius:3px;background:#e6eefc}
.zib-pips span.on{background:var(--zib-accent)}

.zib-cards{display:flex;gap:8px}
.zib-pfc{width:60px;height:40px;border:1px solid var(--zib-border);border-radius:8px;background:#fff;position:relative;display:flex;align-items:center;justify-content:center;overflow:hidden}
.zib-pfc-svg{pointer-events:none;max-width:100%;max-height:100%}
.zib-pfc-badge{position:absolute;right:6px;top:6px;background:rgba(0,0,0,0.85);color:#fff;font-weight:700;font-size:12px;padding:2px 6px;border-radius:6px;line-height:1;opacity:0;transform:scale(.9);transition:opacity .18s ease, transform .18s ease}
.zib-pfc--result .zib-pfc-badge{opacity:1;transform:scale(1)}
.zib-pfc--play{animation:zib-pfc-pulse .6s ease}
@keyframes zib-pfc-pulse{0%{transform:scale(1)}50%{transform:scale(1.08)}100%{transform:scale(1)}}

/* Per-face richer animations triggered when the slot gains .zib-pfc--play */
.zib-pfc[data-face="pierre"] .p-rock-shape{transform-origin:30px 20px}
.zib-pfc[data-face="pierre"].zib-pfc--play .p-rock-shape{animation: zb-rock-jitter 700ms ease forwards}
@keyframes zb-rock-jitter{0%{transform:translateY(0) rotate(0)}30%{transform:translateY(-2px) rotate(-4deg)}60%{transform:translateY(1px) rotate(3deg)}100%{transform:translateY(0) rotate(0)} }
.zib-pfc[data-face="pierre"].zib-pfc--play .p-rock-core{animation: zb-rock-core-pulse 700ms ease forwards}
@keyframes zb-rock-core-pulse{0%{transform:scale(1);opacity:0.9}50%{transform:scale(1.18);opacity:1}100%{transform:scale(1);opacity:0.9}}

.zib-pfc[data-face="feuille"] .p-leaf{transform-origin:30px 20px}
.zib-pfc[data-face="feuille"].zib-pfc--play .p-leaf{animation: zb-leaf-flutter 900ms ease forwards}
@keyframes zb-leaf-flutter{0%{transform:translateY(0) rotate(0) scale(1)}25%{transform:translateY(-3px) rotate(-6deg) scale(1.02)}50%{transform:translateY(0) rotate(4deg) scale(1)}75%{transform:translateY(-1px) rotate(-2deg) scale(1.01)}100%{transform:translateY(0) rotate(0) scale(1)}}
.zib-pfc[data-face="feuille"].zib-pfc--play .p-leaf-shape{filter: drop-shadow(0 2px 2px rgba(0,0,0,0.06));}



.zib-pfc[data-face="ciseaux"] .blade{transform-origin:15px 0px}
.zib-pfc[data-face="ciseaux"].zib-pfc--play .blade-left{animation: zb-scissors-left 420ms ease forwards}
.zib-pfc[data-face="ciseaux"].zib-pfc--play .blade-right{animation: zb-scissors-right 420ms ease forwards}
@keyframes zb-scissors-left{0%{transform:rotate(-15deg)}50%{transform:rotate(-45deg)}100%{transform:rotate(-20deg)}}
@keyframes zb-scissors-right{0%{transform:rotate(15deg)}50%{transform:rotate(45deg)}100%{transform:rotate(18deg)}}

/* ensure badge remains readable on animated shapes */
.zib-pfc .zib-pfc-badge{z-index:5}
.zib-bottom{margin-top:10px}
.zib-tabs{display:flex;gap:6px;margin-bottom:6px}
.zib-tabs button{padding:8px 10px;border-radius:8px;border:1px solid var(--zib-border);background:transparent}
.zib-tab{background:var(--zib-panel);border:1px solid var(--zib-border);padding:12px;border-radius:8px;min-height:80px}
.zib-tab.is-on{display:block}
.zib-tab:not(.is-on){display:none}
.zib-flash{color:#c00;font-weight:600}
.zib-selected-item{font-size:14px}

/* Keep stable cell dimensions used by measurement logic (non-functional change) */
.zib-sheet{ table-layout: fixed; }
.zib-sheet th, .zib-sheet td{
		width:170px;
		min-width:170px;
		max-width:170px;
		box-sizing:border-box;
		overflow:hidden;
}
.zib-sheet tbody td, .zib-sheet tbody th{
		height:70px;
		min-height:70px;
		max-height:70px;
}

/* Selected cell highlight */
.zib-cell--selected{
  box-shadow: 0 0 0 3px rgba(43,110,246,0.12) inset, 0 0 0 2px rgba(43,110,246,0.08);
  border-color: rgba(43,110,246,0.18);
}

/* Reduce header height and narrow the left index column to avoid huge numeric boxes */
.zib-sheet thead th{
	height:36px;
	min-height:36px;
	max-height:36px;
	padding:6px 8px;
	font-size:12px;
	white-space:nowrap;
	vertical-align:middle;
}
.zib-sheet thead th:first-child{
	width:48px;
	min-width:48px;
	max-width:48px;
	padding:4px 6px;
	font-size:11px;
}
/* some implementations insert a TD in the top-left cell; ensure we target it too */
.zib-sheet thead td:first-child{
	width:48px;
	min-width:48px;
	max-width:48px;
	padding:4px 6px;
	font-size:11px;
}
.zib-sheet th:first-child,
.zib-sheet tbody th{
	width:48px;
	min-width:48px;
	max-width:48px;
	padding:4px 6px;
	text-align:center;
	font-size:11px;
	display:flex;
	align-items:center;
	justify-content:center;
	line-height:1;
}
/* make the index number visually compact within the tall row */
.zib-sheet tbody th{background:transparent}
.zib-sheet thead th, .zib-sheet tbody th{font-weight:600}
.zib-sheet thead th > div, .zib-sheet tbody th > div{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}

/* reduce gap between grid and side panel for tighter layout */
.zib-work{gap:6px}

/* Responsive tweaks */
@media (max-width: 900px){
	:root{--zib-side-width:260px}
	.zib-kpis{display:none}
}

@media (max-width: 700px){
	:root{--zib-side-width:220px}
	.zib-side{display:none}
}

/* Corner arrow buttons placed inside the top-left table cell */
.zib-corner-arrows{
	position:absolute;
	top:0; right:0; bottom:0; left:0; /* exactly cover the cell */
	padding:0; /* no inner offset */
	pointer-events:none; /* container passive; buttons receive events */
	z-index:40;
}
.zib-corner-btn{
	position:absolute;
	pointer-events:auto;
	background:transparent;
	border:1px solid rgba(11,19,32,0.06);
	border-radius:4px;
	line-height:1;
	font-size:12px;
	color:inherit;
	transition:background .12s ease;
	width:16px;
	height:16px;
	font-size:11px;
	box-sizing:border-box;
	margin:0; padding:0; transform:none;
}
.zib-corner-btn:hover{ background: rgba(11,19,32,0.06); }
/* Right arrow: strictly top-right */
.zib-corner-right{ top:0; right:0; }
/* Down arrow: strictly bottom-left */
.zib-corner-down{ bottom:0; left:0; }

/* Left arrow: strictly top-left */
.zib-corner-left{ top:0; left:0; }
/* Up arrow: strictly bottom-right */
.zib-corner-up{ bottom:0; right:0; }

/* Hide visual scrollbars for the rails while keeping scrolling functional
   This keeps the rails available for programmatic scrolling (buttons, sync)
   but removes their visible scrollbars to match desired UX. */
.zib-rail-h, .zib-rail-v{
	background: transparent !important;
	/* Firefox */
	scrollbar-width: none;
	/* IE 10+ */
	-ms-overflow-style: none;
}
.zib-rail-h::-webkit-scrollbar, .zib-rail-v::-webkit-scrollbar{
	display: none;
	width: 0;
	height: 0;
}

/* Journal: lignes alternées très discrètes pour meilleure lisibilité
   - cible les lignes créées avec la classe `zib-journal-line`
   - certaines lignes sont insérées directement dans #tab-journal, d'autres
	 dans .zib-journal-list; on couvre les deux cas pour une alternance uniforme
*/
#tab-journal .zib-journal-list .zib-journal-line:nth-child(odd),
#tab-journal .zib-journal-line:nth-child(odd){
	background-color: rgba(11,19,32,0.02);
}
#tab-journal .zib-journal-list .zib-journal-line:nth-child(even),
#tab-journal .zib-journal-line:nth-child(even){
	background-color: rgba(11,19,32,0.04);
}

/* Keep separators intact: do not remove borders or change padding */

/* Modals: limit height and allow internal vertical scrolling
   - Targets the inner 'box' element appended by JS into modal containers
   - Keeps width/positioning unchanged (JS sets minWidth and centering)
*/
#zib-siege-end-modal > div,
#zib-buy-confirm-modal > div,
#zib-conserve-modal > div{
	/* Use the easy-to-find variable above to control modal content height */
	max-height: var(--zib-modal-max-height);
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	box-sizing: border-box; /* ensure padding counted inside max-height */
}

/* Logo modal styles */
.zib-modal-overlay{position:fixed;left:0;right:0;top:0;bottom:0;background:rgba(0,0,0,0.45);display:flex;align-items:flex-start;justify-content:center;z-index:9999;padding-top:1vh}
.zib-modal-box{background:var(--zib-panel);border-radius:10px;border:1px solid var(--zib-border);width:360px;max-width:92%;box-shadow:0 8px 30px rgba(11,19,32,0.2);overflow:hidden;margin-top:0}
.zib-modal-header{display:flex;align-items:center;justify-content:space-between;padding:4px 14px;border-bottom:1px solid var(--zib-border)}
.zib-modal-body{padding:12px 14px;display:flex;flex-direction:column;gap:10px}
.zib-modal-footer{display:flex;gap:8px;justify-content:flex-end;padding:12px 14px;border-top:1px solid var(--zib-border)}
.zib-modal-close{background:transparent;border:0;font-size:16px;cursor:pointer}
.zib-field{display:block}
.zib-field input[type="number"]{padding:6px;border-radius:6px;border:1px solid var(--zib-border)}
.zib-field input[type="file"]{padding:6px}

/* native vertical scrollbar for the Journal list */
#tab-journal .zib-journal-list {
	height: 699px;
	overflow-y: auto;
}

/* Uniform scrolling behavior for various dashboard lists.
   Only adds overflow/scrolling behavior and touch momentum; does NOT
   modify existing heights or DOM structure. Journal remains the
   reference for scrollbar presentation. */
.zib-portfolio-list,
.zib-offers-wrap,
.zib-sieges-list {
	/* Responsive max-height to enable scrollbar like the Journal
	   without copying the Journal's fixed pixel height. */
	max-height: 60vh;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-gutter: stable both-edges;
}

/* Small image indicator shown next to portfolio entries when a property has an image */
.zib-portfolio-img{
	display:inline-flex;
	align-items:center;
	justify-content:center;
	width:18px;
	height:18px;
	font-size:14px;
	color:var(--zib-accent-2);
}

.zib-portfolio-logo{
    display:block;
    width:16px;
    height:16px;
    object-fit:contain;
    flex:0 0 16px;
    margin-left:8px;
}

/* Inline wrapper for modal fields to keep related inputs on a single line */
.zib-field-inline{
	display: inline-flex;
	gap: 8px;
	align-items: center;
	white-space: nowrap;
}

/* Very compact microcopy box placed above the zone-select button in the Coffre-fort */
.zib-zone-microcopy{
	display:block;
	font-size:12px;
	color:var(--zib-muted);
	background: rgba(255,255,255,0.6);
	border:1px solid var(--zib-border);
	padding:6px 8px;
	border-radius:6px;
	margin-bottom:6px;
	text-align:center;
}

/* Press feedback for dashboard buttons */
.zib-btn:active,
.zib-card-btn:active,
.zib-btn-gold:active,
.zib-stake-preset:active {
    filter: brightness(0.80);
    transform: translateY(1px) scale(0.98);
}

/* Zone selection overlay for commercial selection mode */
.zib-zone-overlay{
	position:absolute;
	border:2px dashed var(--zib-accent);
	background: rgba(43,110,246,0.06);
	pointer-events: none;
	z-index: 120;
	box-sizing: border-box;
}

/* Toggle button visual state */
#zib-toggle-zone-select.zone-active{
	box-shadow: 0 2px 10px rgba(43,110,246,0.12);
	background-color: rgba(43,110,246,0.12);
	border-color: rgba(43,110,246,0.16);
}

#tab-journal .zib-journal-list {
	/* Keep existing Journal height rule intact; ensure touch momentum */
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	scrollbar-gutter: stable both-edges;
}


