:root{
 --bg:#ffffff;
 --panel:#ffffff;
 --line:#111827;
 --soft:#e5e7eb;
 --muted:#6b7280;
 --shadow:none;

 --uiFont: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
 --graphFont: "KaTeX_Main", "Latin Modern Roman", "CMU Serif", "Times New Roman", serif;
}

*{ box-sizing:border-box; }

html, body{
 height:100%;
 margin:0;
 background:var(--bg);
 color:#0b0f17;
 font-family: var(--uiFont);
 overflow:hidden; /* no page scroll */
}

.btn{
 appearance:none;
 border:1px solid var(--soft);
 background:#fff;
 padding:10px 12px;
 border-radius:10px;
 cursor:pointer;
 font-size:13px;
 font-weight:500;
 line-height:1;
}

.btn:hover{ border-color:#cbd5e1; }
.btnPrimary{ background:#111827; color:#fff; border-color:#111827; }
.btnSmall{ padding:8px 10px; border-radius:10px; }

.app{
 height:100%;
 display:flex;
 flex-direction:column;
 opacity:0;
 pointer-events:none;
}

.topbar{
 height:56px;
 display:flex;
 align-items:center;
 justify-content:space-between;
 padding:0 14px;
 border-bottom:1px solid var(--soft);
 background:#fff;
}

.topbarRight{
 display:flex;
 gap:10px;
 align-items:center;
}

.layout{
 flex:1;
 display:grid;
 grid-template-columns: 340px 1fr;
 min-height:0;
}

.sidebar{
 border-right:1px solid var(--soft);
 background:#fff;
 padding:10px;
 min-height:0;
 display:flex;
 flex-direction:column;
 gap:10px;
}

.tabs{
 display:flex;
 gap:8px;
}

.tab{
 flex:1;
 padding:10px 10px;
 border:1px solid var(--soft);
 border-radius:12px;
 background:#fff;
 cursor:pointer;
 font-size:12px;
 font-weight:500;
}

.tab.active{
 border-color:#111827;
 box-shadow: 0 0 0 3px rgba(17,24,39,0.08);
}

.tabPanel{
 display:none;
 min-height:0;
 overflow:hidden;
}

.tabPanel.active{
 display:block;
}

.sectionTitle{
 font-size:11px;
 color:var(--muted);
 letter-spacing:0.12em;
 text-transform:uppercase;
 margin:10px 0 8px 2px;
 font-weight:600;
}

.field{
 display:flex;
 flex-direction:column;
 gap:6px;
 margin-bottom:10px;
}

label{
 font-size:12px;
 color:var(--muted);
 font-weight:500;
}

input[type="text"], select, input[type="color"]{
 width:100%;
 padding:10px 10px;
 border:1px solid var(--soft);
 border-radius:12px;
 outline:none;
 font-size:13px;
 background:#fff;
 font-weight:500;
}

input[type="range"]{ width:100%; }

.row{
 display:grid;
 grid-template-columns: 1fr 1fr;
 gap:10px;
 align-items:end;
}

.hint{
 font-size:12px;
 color:var(--muted);
 line-height:1.35;
 margin-top:6px;
}

/* FIX: more breathing room between Tax toggle and “Tax amount” label */
.toggleRow{
 margin: 6px 0 22px;
}

/* If your toggle is a button inside .toggleRow, also give it a little bottom margin */
.toggleRow .btn{
 margin-bottom: 10px;
}

.checks{
 display:flex;
 flex-direction:column;
 gap:10px;
}

.check{
 display:flex;
 align-items:center;
 gap:10px;
 font-size:13px;
 font-weight:500;
}

.check input{ transform:scale(1.05); }

.stage{
 background:#fff;
 min-height:0;
 display:flex;
 align-items:stretch;
 justify-content:stretch;
}

.stageInner{
 width:100%;
 height:100%;
 padding:12px 12px;
 display:flex;
 align-items:center;
 justify-content:center;
}

svg{
 max-width: 100%;
 max-height: 100%;
}

/* Brand (animated from splash to header) */
.brandHost{
 position:relative;
 height:56px;
 display:flex;
 align-items:center;
}

.brand{
 user-select:none;
 cursor:pointer;
 color:#0b0f17;
 font-family: var(--graphFont);
 position:fixed; /* animated element */
 left:50%;
 top:44%;
 transform:translate(-50%,-50%);
 transition: transform 650ms ease, left 650ms ease, top 650ms ease, opacity 300ms ease;
 text-align:center;
}

.brandTitle{
 font-size:54px;
 font-weight:400;
 letter-spacing:0.01em;
}

.brandSubtitle{
 margin-top:10px;
 font-size:18px;
 font-weight:400;
 opacity:0.85;
}

.brandLoadingGap{ height: 34px; }
.brandLoading{
 font-family: var(--uiFont);
 font-size:12px;
 color:var(--muted);
 font-weight:500;
 letter-spacing:0.02em;
}

/* After load, brand moves to top-left and shrinks */
body.ready .brand{
 left:16px;
 top:14px;
 transform:translate(0,0);
 text-align:left;
}

body.ready .brandTitle{
 font-size:18px;
}

body.ready .brandSubtitle{
 margin-top:2px;
 font-size:11px;
 opacity:0.75;
}

body.ready .brandLoadingGap,
body.ready .brandLoading{
 display:none;
}

/* Splash overlay */
.splash{
 position:fixed;
 inset:0;
 background:#fff;
 display:flex;
 align-items:center;
 justify-content:center;
 z-index:50;
}

.splashInner{
 width:100%;
 height:100%;
 display:flex;
 align-items:center;
 justify-content:center;
}

body.ready .splash{
 opacity:0;
 pointer-events:none;
 transition: opacity 350ms ease;
}

/* App becomes interactive after load */
body.ready .app{
 opacity:1;
 pointer-events:auto;
}

/* Home overlay */
.homeOverlay{
 position:fixed;
 inset:0;
 background:rgba(255,255,255,0.92);
 backdrop-filter: blur(6px);
 z-index:40;
 display:flex;
 align-items:center;
 justify-content:center;
}

.homeOverlay.hidden{
 display:none;
}

.homePanel{
 width:min(860px, 92vw);
 border:1px solid var(--soft);
 border-radius:16px;
 background:#fff;
 box-shadow: 0 18px 60px rgba(0,0,0,0.08);
 padding:18px;
 font-family: var(--uiFont);
}

.homeTitle{
 font-size:14px;
 font-weight:600;
 margin-bottom:12px;
 color:#111827;
}

.homeGrid{
 display:grid;
 grid-template-columns: repeat(3, minmax(0, 1fr));
 gap:12px;
}

.homeCard{
 text-align:left;
 padding:14px;
 border-radius:14px;
 border:1px solid var(--soft);
 background:#fff;
 cursor:pointer;
}

.homeCard:hover{ border-color:#cbd5e1; }

.homeCard:disabled{
 opacity:0.55;
 cursor:not-allowed;
}

.homeCardTitle{
 font-size:14px;
 font-weight:600;
 margin-bottom:6px;
}

.homeCardSub{
 font-size:12px;
 color:var(--muted);
 line-height:1.35;
}

.homeCard.active{
 border-color:#111827;
 box-shadow: 0 0 0 3px rgba(17,24,39,0.08);
}

@media (max-width: 920px){
 .layout{ grid-template-columns: 320px 1fr; }
 .homeGrid{ grid-template-columns: 1fr; }
}
