:root{
  --ink:#0F2E36;
  --muted:#6B8A92;
  --bg:#F4F8F9;
  --card:#FFFFFF;
  --line:#E3ECEE;
  --brand:#0B5C78;
  --brand-2:#0E7FA6;
  --ok:#2EA44F;
  --warn:#D73A49;
  --soft:#F7FBFC;
  --radius:14px;
  --radius-sm:10px;
  --shadow:0 10px 30px rgba(15,46,54,.08);
  --shadow-sm:0 6px 16px rgba(15,46,54,.06);
  --mono:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial;
  background:linear-gradient(180deg,#F8FCFD,#EEF5F7);
  color:var(--ink);
}

main{
  display:grid;
  grid-template-columns:360px 1fr;
  min-height:calc(100vh - 64px);
}

#expenses div{
  transition:background-color .15s ease,border-color .15s ease;
}

/* LEFT RAIL */
.left{
  background:var(--card);
  border-right:1px solid var(--line);
  padding:18px;
  overflow:auto;
}
.left h3{
  font-weight:700;
  letter-spacing:.2px;
  margin-bottom:12px;
}
.left h4{
  margin-top:18px;
  font-size:13px;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.12em;
}
.left hr{
  border-top:1px solid var(--line);
  margin:14px 0;
}

/* INPUTS */
label{
  font-size:11px;
  color:var(--muted);
  margin-top:10px;
  display:block;
}
input,select,textarea,button{
  width:100%;
  padding:10px 12px;
  font-size:13px;
  border-radius:10px;
  border:1px solid var(--line);
  background:#fff;
}
textarea{resize:vertical}
input:focus,select:focus,textarea:focus{
  outline:none;
  border-color:var(--brand-2);
  box-shadow:0 0 0 3px rgba(14,127,166,.12);
}

/* BUTTONS */
button{
  background:linear-gradient(180deg,var(--brand-2),var(--brand));
  color:#fff;
  cursor:pointer;
  box-shadow:var(--shadow-sm);
}
button.secondary{
  background:#fff;
  color:var(--brand);
  border:1px solid var(--line);
}
button.ghost{
  background:transparent;
  color:var(--brand);
  box-shadow:none;
  border:1px dashed var(--line);
}
button:hover{filter:brightness(1.03)}
button:active{transform:translateY(1px)}

/* LISTS */
#expenses div,#docTypes div{
  padding:10px 12px;
  border-radius:10px;
  border:1px solid transparent;
  margin-bottom:6px;
  font-size:13px;
  display:flex;
  align-items:center;
  gap:8px;
}
#expenses div:hover,#docTypes div:hover{
  background:var(--soft);
}
#expenses div.active,#docTypes div.active{
  background:#E8F4F8;
  border-color:#CFE9F2;
}
#expenses div.complete{
  background:#EAF7EF;
  border-color:#CFEAD9;
}
#expenses div.flagged{
  background:#FDECEF;
  border-color:#F5C2CB;
  color:#7A0C17;
}

/* SORT */
.sortbox{
  border:1px solid var(--line);
  border-radius:12px;
  padding:10px;
  background:var(--soft);
  display:grid;
  gap:8px;
}
.sortlist{
  max-height:180px;
  overflow:auto;
  border:1px solid var(--line);
  border-radius:10px;
  background:#fff;
}
.sortitem{
  padding:8px 10px;
  border-bottom:1px solid var(--line);
  cursor:pointer;
  font-size:12px;
  word-break:break-word;
}
.sortitem:last-child{border-bottom:none}
.sortitem:hover{background:#f6fbfd}
.sortitem.active{
  background:#E8F4F8;
  border-left:3px solid var(--brand);
  padding-left:7px;
}
.sortmeta{
  font-size:11px;
  color:var(--muted);
}
.sortrow{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
}
.sortmodes{
  display:flex;
  gap:8px;
}
.sortmodes button{
  flex:1;
  padding:8px 10px;
}
.sortmodes button.active{
  background:var(--brand);
  color:#fff;
  border-color:var(--brand);
}
.sortpreview{
  border:1px solid var(--line);
  border-radius:10px;
  background:#fff;
  min-height:180px;
  height:260px;
  overflow:hidden;
}
.sortpreview iframe,.sortpreview img{
  width:100%;
  height:100%;
  border:0;
  object-fit:contain;
  background:#f6f8fa;
}
.smallbtn{
  padding:8px 10px;
  font-size:12px;
}
.hidden{display:none!important}

/* RIGHT */
.right-screen{background:transparent}
.top{
  padding:18px;
  height:68vh;
}
.right{
  background:var(--card);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  height:100%;
  padding:14px;
  position:relative;
}

/* PREVIEW */
.preview{
  border:2px dashed #D5E6EC;
  border-radius:var(--radius);
  padding:12px;
  display:grid;
  grid-template-columns:minmax(1 2);
  align-items:center;
  justify-content:center;
  color:var(--muted);
  height:100%;
  overflow:scroll;
}
.preview img{
  max-width:1080px;
  height:60vh;
  border-radius:12px;
  box-shadow:var(--shadow-sm);
}

/* MOD BUTTONS */
#mod-buttons{
  position:absolute;
  top:12px;
  right:12px;
  display:flex;
  gap:8px;
}
#mod-buttons button{
  width:auto;
  padding:8px 10px;
  border-radius:10px;
}

/* BOTTOM PANEL */
.bottom{
  background:var(--card);
  padding:0;
  height:28vh;
}
.bottom-header{
  height:44px;
  padding:0 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}
.bottom table{
  width:100%;
  border-collapse:collapse;
  font-size:12px;
}
.bottom th,.bottom td{
  padding:8px 10px;
}
.bottom th{
  color:var(--muted);
  font-weight:600;
  text-align:left;
}

/* EXCEL-TEMPLATE WRAPPERS ONLY */
.table-wrapper{
  border:solid black 1pt;
  padding:20px;
}
.expenses-excel{}
.ccExcelWrap{
  padding:12px;
  overflow:auto;
}
.ccExcelWrap table{
  margin:0 0 14px 0;
}
.ccExcelWrap table:last-child{
  margin-bottom:0;
}

/* SMALL TWEAKS */
.mono{font-family:var(--mono)}
.badge{
  padding:4px 8px;
  border-radius:999px;
  font-size:11px;
  background:#EEF6FA;
  color:var(--brand);
}