:root{
  --bg:#f5f7fb;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --line:#e5e7eb;
  --accent:#1e3a8a;
  --accent2:#2563eb;
  --shadow: 0 10px 30px rgba(15, 23, 42, .08);
  --radius:14px;
  --mobile-sticky-offset: 0px;
}

*{box-sizing:border-box}
body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background: var(--bg);
  color: var(--text);
  overflow-x:hidden;
}

#bankFilter,
label[for="bankFilter"] {
  display: none !important;
}


/* ===== FORCE SUMMARY TABLE VERTICAL LINES ===== */

.summary-card {
  overflow-x: auto;
}

.summary-card table {
  width: 100%;
  min-width: 520px;
  border-collapse: separate;   /* IMPORTANT */
  border-spacing: 0;
}

/* header */
.summary-card th {
  padding: 8px 10px;
  font-size: 13px;
  background: #f9fafb;
  white-space: nowrap;

  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  border-right: 1px solid #e5e7eb;
}

.summary-card th:first-child {
  border-left: 1px solid #e5e7eb;
}

/* body */
.summary-card td {
  padding: 8px 10px;
  font-size: 13px;
  white-space: nowrap;

  border-bottom: 1px solid #e5e7eb;
  border-right: 1px solid #e5e7eb;
}

.summary-card td:first-child {
  border-left: 1px solid #e5e7eb;
}

/* ===== SUMMARY TABLE – VERTICAL + HORIZONTAL LINES ONLY ===== */

.summary-card {
  overflow-x: auto;
}

/* target ONLY tables inside summary-card */
.summary-card table {
  width: 100%;
  border-collapse: separate;   /* key for vertical lines */
  border-spacing: 0;
}

/* header cells */
.summary-card th {
  border-right: 1px solid #d1d5db;
  border-bottom: 1px solid #d1d5db;
  padding: 8px 10px;
  white-space: nowrap;
}

/* body cells */
.summary-card td {
  border-right: 1px solid #d1d5db;
  border-bottom: 1px solid #e5e7eb;
  padding: 8px 10px;
  white-space: nowrap;
}

/* left edge */
.summary-card th:first-child,
.summary-card td:first-child {
  border-left: 1px solid #d1d5db;
}

/* ================================
   FULL RIGHT PANEL SCROLL FIX
   (Summary + Records scroll together)
================================== */

/* make the right panel a fixed-height box */
.panel.wide{
  max-height: auto;   /* adjust: 75vh / 80vh / 85vh */
  overflow: hidden;   /* important */
  display: flex;
  flex-direction: column;
}

/* top filter section stays visible */
.panel.wide > .block{
  flex: 0 0 auto;
}

/* everything after first block becomes scrollable */
.panel.wide > .split{
  flex: 1 1 auto;
  overflow: auto;      /* THIS is the main vertical scroll */
  padding-right: 6px;  /* nice spacing for scrollbar */
}

/* keep tables scrollable horizontally only */
.tableWrap{
  overflow-x: auto;
  overflow-y: hidden;
}

a{color:inherit}
.sub{margin:4px 0 0; color:var(--muted)}
.small{font-size:12px}
.muted{color:var(--muted)}
.mono{font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace}
.tiny{font-size:12px}

.topbar{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:16px 22px;
  border-bottom:1px solid var(--line);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 2;
}
.topbar h2{margin:0; font-size:18px}

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

.page{
  padding:18px 22px;
  display:grid;
  grid-template-columns: 420px 1fr;
  gap:16px;
}
@media (max-width: 1100px){ .page{grid-template-columns:1fr} }

.panel{
  background: var(--card);
  border:1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding:16px;
}
.panel.wide{padding:14px}

.panelHead{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  margin-bottom:12px;
}

.form label{
  display:block;
  margin:10px 0 6px;
  color:var(--muted);
  font-size:13px;
}
.form input, .form textarea, .form select{
  width:100%;
  padding:10px 11px;
  border-radius:12px;
  border:1px solid var(--line);
  background:#fff;
  color: var(--text);
  outline:none;
}
.form input:focus, .form textarea:focus, .form select:focus{
  border-color: rgba(37,99,235,.45);
  box-shadow: 0 0 0 4px rgba(37,99,235,.12);
}

.grid2{display:grid; grid-template-columns:1fr 1fr; gap:10px;}
.miniTitle{
  margin:12px 0 8px;
  font-size:12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
}

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:10px 12px;
  border-radius: 12px;
  border:1px solid rgba(37,99,235,.35);
  background: rgba(37,99,235,.10);
  color: var(--accent);
  cursor:pointer;
  text-decoration:none;
  font-weight:700;
}
.btn:hover{background: rgba(37,99,235,.14)}
.btn.ghost{
  border-color: var(--line);
  background: #fff;
  color: var(--text);
}
.btn.ghost:hover{background:#f8fafc}
.btn.mini{padding:7px 10px; border-radius:10px; font-size:13px;}

.msg{margin:10px 0 0; font-size:13px; color: var(--muted)}
.msg.ok{color:#15803d}
.msg.bad{color:#b91c1c}

.hint{margin:10px 0 0; color: var(--muted); font-size:13px}

.alert{
  border:1px solid #fecaca;
  background: #fff1f2;
  padding:10px 12px;
  border-radius:12px;
  margin:10px 0 12px;
  color:#991b1b;
}

/* dashboard cards */
.cards{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:12px;
}
@media (max-width: 900px){ .cards{grid-template-columns:1fr} }

.card{
  display:block;
  text-decoration:none;
  padding:14px;
  border-radius: 14px;
  border:1px solid var(--line);
  background: #fff;
}
.card:hover{border-color: rgba(37,99,235,.35)}
.card h4{margin:0 0 6px}
.card p{margin:0; color:var(--muted); font-size:13px}
.card.disabled{opacity:.65}

/* summary + table layout */
.split{
  display:grid;
  grid-template-columns: 360px 1fr;
  gap:12px;
}
@media (max-width: 1100px){ .split{grid-template-columns:1fr} }
.miniPanel{padding:0; background:transparent; border:none; box-shadow:none;}

/* table scroll area */
.tableWrap{
  overflow:auto;
  border-radius: 14px;
  border:1px solid var(--line);
  background:#fff;
  max-height: 65vh;
}
.smallWrap{max-height: 280px}

/* PROFESSIONAL TABLE GRID LINES (vertical + horizontal) */
.table{
  width:100%;
  border-collapse: collapse; /* needed for clean grid */
  min-width: 1200px;        /* makes horizontal scroll if screen small */
}
.table thead th{
  position: sticky;
  top: var(--mobile-sticky-offset);
  z-index: 1;
  background:#f8fafc;
  border-bottom:1px solid var(--line);
  color: var(--muted);
  font-size:12px;
  text-transform: uppercase;
  letter-spacing:.06em;
  padding:10px;
  text-align:left;
  white-space: nowrap;
}
.table td{
  padding:10px;
  border-bottom:1px solid var(--line);
  border-right:1px solid var(--line); /* vertical lines */
  vertical-align: top;
  font-size:13px;
  white-space: nowrap;
}
.table th{border-right:1px solid var(--line)}
.table tr:hover td{background:#f8fafc}
.table td:last-child, .table th:last-child{border-right:none}

.badge{
  padding:4px 8px;
  border-radius: 999px;
  font-size:12px;
  border:1px solid var(--line);
  background:#fff;
}
.badge.good{border-color:#bbf7d0; background:#f0fdf4; color:#166534}
.badge.warn{border-color:#fde68a; background:#fffbeb; color:#92400e}

.pill{
  display:inline-flex;
  align-items:center;
  padding:4px 8px;
  border-radius: 999px;
  border:1px solid var(--line);
  background:#fff;
  font-size:12px;
}
.pill.link{
  border-color: rgba(37,99,235,.25);
  background: rgba(37,99,235,.08);
  text-decoration:none;
  color: var(--accent);
}
.pill.muted{opacity:.6}

.linkText{
  text-decoration:none;
  color: var(--accent2);
  font-weight:700;
}
.linkText:hover{text-decoration:underline}

/* finance controls */
.inlineLabel{font-size:12px; color: var(--muted); font-weight:700}
.smallSelect{
  padding:9px 10px;
  border-radius:12px;
  border:1px solid var(--line);
  background:#fff;
}

/* login */
.authWrap{
  min-height:100%;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:22px;
}
.authCard{
  width:min(480px, 100%);
  background:#fff;
  border:1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  padding:18px;
}
.brand{display:flex; gap:12px; align-items:center; margin-bottom:10px}
.logo{
  width:46px; height:46px;
  border-radius:14px;
  display:grid; place-items:center;
  background: rgba(37,99,235,.10);
  border:1px solid rgba(37,99,235,.20);
  font-weight:900;
  color: var(--accent);
}

/* section separator line */
.sectionLine{
  height:1px;
  background: var(--line);
  margin: 8px 0 12px;
}

/* better layout on laptop / smaller screens */
@media (max-width: 1200px){
  .page{grid-template-columns: 1fr;}
  .split{grid-template-columns: 1fr;}
  .table{min-width: 1000px;}
}

/* compact form for balance box */
.form.compact input, .form.compact select{
  padding:9px 10px;
}

/* block dividers for Finance right panel */
.block{
  padding: 10px 0;
}
.hr{
  height: 1px;
  background: var(--line);
  margin: 10px 0;
}

/* balance block polish */
.miniPanel .block{
  background: rgba(255,255,255,.015);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}

.btn.danger{
  border-color: rgba(185,28,28,.35);
  background: rgba(185,28,28,.08);
  color: #991b1b;
}
.btn.danger:hover{
  background: rgba(185,28,28,.12);
}

.btn.danger{
  border-color: rgba(185,28,28,.35);
  background: rgba(185,28,28,.08);
  color: #991b1b;
}
.btn.danger:hover{
  background: rgba(185,28,28,.12);
}

/* Deleted rows */
.rowDeleted{
  opacity: .55;
  background: #f8fafc;
}
.rowDeleted td{
  text-decoration: line-through;
}

/* Restore button */
.btn.ok{
  border-color: rgba(21,128,61,.25);
  background: rgba(21,128,61,.08);
  color: #166534;
}
.btn.ok:hover{
  background: rgba(21,128,61,.12);
}

/* Deleted rows */
.rowDeleted{
  opacity: .55;
  background: #f8fafc;
}
.rowDeleted td{
  text-decoration: line-through;
}

/* Restore button */
.btn.ok{
  border-color: rgba(21,128,61,.25);
  background: rgba(21,128,61,.08);
  color: #166534;
}
.btn.ok:hover{
  background: rgba(21,128,61,.12);
}


/* SUMMARY table: force vertical + horizontal lines */
.smallWrap .table{
  border-collapse: collapse !important;
}

.smallWrap .table th,
.smallWrap .table td{
  border: 2px solid var(--line) !important;
}


#bankFilter,
label[for="bankFilter"] {
  display: none;
}





.pill{
  display:inline-flex;
  align-items:center;
  padding:4px 8px;
  border-radius:999px;
  font-size:12px;
  border:1px solid var(--line);
  background:#fff;
}
.pill.link{
  border-color: rgba(37,99,235,.35);
  background: rgba(37,99,235,.08);
  color: var(--accent);
  text-decoration:none;
}

.topbar a.btn.ghost[href="/dashboard"]::before{
  content:"";
  width:7px;
  height:7px;
  border-left:2px solid currentColor;
  border-bottom:2px solid currentColor;
  transform:rotate(45deg);
  display:inline-block;
  margin-right:2px;
  flex:0 0 auto;
}

@media (max-width: 768px){
  :root{
    --mobile-sticky-offset: 108px;
  }

  html{
    scroll-padding-top: calc(var(--mobile-sticky-offset) + 12px);
  }

  body{
    overflow-x:hidden;
  }

  .topbar{
    padding:12px 14px;
    align-items:flex-start;
    gap:10px;
    flex-direction:column;
    z-index:60;
    box-shadow:0 10px 22px rgba(15, 23, 42, .08);
  }

  .topbar h2{
    font-size:17px;
    line-height:1.25;
  }

  .topbar .sub{
    line-height:1.45;
  }

  .topbar > .row,
  .topbar > div:last-child{
    width:100%;
  }

  .topbar .row{
    justify-content:flex-start;
    row-gap:8px;
  }

  .topbar .btn{
    min-height:40px;
    white-space:nowrap;
  }

  .page{
    padding:14px;
    gap:12px;
  }

  .panel,
  .panel.wide{
    min-width:0;
    padding:14px;
  }

  .panel.wide > .split{
    padding-right:0;
  }

  .grid2{
    grid-template-columns:1fr;
  }

  .row{
    row-gap:8px;
  }

  .tableWrap,
  .summary-card{
    max-width:100%;
    -webkit-overflow-scrolling:touch;
  }

  .table thead th,
  .me-table th,
  .att-table th,
  .ws-table th,
  .hs-table th{
    top: var(--mobile-sticky-offset) !important;
  }

  .pending-box{
    top: calc(var(--mobile-sticky-offset) + 8px) !important;
    left:12px !important;
    right:12px !important;
    max-width:none !important;
  }

  .topbar a.btn.ghost[href="/dashboard"]{
    gap:6px;
  }
}

@media (max-width: 560px){
  :root{
    --mobile-sticky-offset: 118px;
  }

  .topbar{
    padding:12px;
  }

  .page{
    padding:12px;
  }

  .panel,
  .panel.wide{
    padding:12px;
    border-radius:12px;
  }

  .topbar .btn{
    padding:9px 11px;
    font-size:13px;
  }
}
.pill.muted{ color: var(--muted); background:#f8fafc; }
.btn.danger{
  border-color: rgba(220,38,38,.35);
  background: rgba(220,38,38,.10);
  color:#991b1b;
}
.btn.danger:hover{ background: rgba(220,38,38,.14); }





.role-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  margin-left: 8px;
}

.role-admin {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.role-emp {
  background: #e0f2fe;
  color: #075985;
  border: 1px solid #bae6fd;
}


.cash-wrap {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 18px;
}

@media (max-width: 1100px) {
  .cash-wrap {
    grid-template-columns: 1fr;
  }
}

.cash-panel {
  background: #ffffff;
  border-radius: 16px;
  padding: 18px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 8px 25px rgba(0,0,0,.06);
}







.advance-open {
  color: #065f46;
  background: #dcfce7;
  border: 1px solid #86efac;
  padding: 4px 8px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 12px;
}

.advance-closed {
  color: #7f1d1d;
  background: #fee2e2;
  border: 1px solid #fecaca;
  padding: 4px 8px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 12px;
}


.expense-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 10px;
}

.expense-table th {
  background: #f9fafb;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: #475569;
  padding: 10px;
  border-bottom: 1px solid #e5e7eb;
}

.expense-table td {
  padding: 10px;
  border-bottom: 1px solid #e5e7eb;
  font-size: 14px;
}

.expense-table tr:last-child td {
  border-bottom: none;
}

.btn-danger {
  background: #fee2e2;
  border: 1px solid #fecaca;
  color: #991b1b;
  font-weight: 700;
}

.btn-danger:hover {
  background: #fecaca;
}


.readonly {
  opacity: .6;
  pointer-events: none;
}







/* ===============================
   CASH ADVANCES PAGE POLISH
   (NO HTML / JS CHANGES)
================================ */

/* Left panel spacing */
.panel .block {
  background: #f9fafb;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 14px;
}

/* Titles */
.panel h3 {
  margin-top: 0;
}

.miniTitle {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 10px;
}

/* Labels */
.panel label {
  display: block;
  margin: 10px 0 6px;
  font-size: 13px;
  color: var(--muted);
}

/* Inputs & selects */
.panel input,
.panel select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 14px;
}

.panel input:focus,
.panel select:focus {
  border-color: rgba(37,99,235,.45);
  box-shadow: 0 0 0 4px rgba(37,99,235,.12);
}

/* Grid spacing */
.grid2 {
  margin-top: 6px;
}

/* Buttons spacing */
.panel .btn {
  margin-top: 12px;
}

/* Danger button (Close Advance) */
.btn.danger {
  border-color: #fecaca;
  background: #fff1f2;
  color: #991b1b;
}

.btn.danger:hover {
  background: #ffe4e6;
}

/* Tables spacing */
.tableWrap {
  border-radius: 12px;
  border: 1px solid var(--line);
  overflow-x: auto;
}

/* Improve table readability */
.table th {
  background: #f9fafb;
  font-size: 13px;
}

.table td {
  font-size: 13px;
}

/* Right panel split scroll */
.panel.wide {
  display: flex;
  flex-direction: column;
}

.panel.wide .split {
  flex: 1;
  overflow: auto;
}

/* Message text */
.msg {
  margin-top: 8px;
  font-size: 13px;
}

.msg.ok {
  color: #15803d;
}

.msg.bad {
  color: #b91c1c;
}





/* Center buttons inside table cells (ACTION / PROOF columns) */
.table td {
  vertical-align: middle;
}

/* Center content ONLY for action-style buttons */
.table td button,
.table td .btn {
  display: inline-flex;
  margin: 0 auto;
}

/* If column uses links instead of buttons (OPEN link) */
.table td a.btn {
  display: inline-flex;
  margin: 0 auto;
}

/* Optional: force center text + buttons in last columns */
.table td:last-child,
.table th:last-child {
  text-align: center;
}


@media (max-width: 900px){
  #financeRightPanel .row{ flex-direction: column; }
}




/* =========================
   DOCUMENT STORAGE
========================= */
.doc-page{
  display:grid;
  grid-template-columns: 420px 1fr;
  gap:16px;
}
@media (max-width: 1200px){
  .doc-page{ grid-template-columns:1fr; }
}

.doc-left,
.doc-right{
  min-height: 78vh;
}

.doc-section{
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border:1px solid var(--line);
  border-radius:16px;
  padding:14px;
  margin-bottom:14px;
  box-shadow: 0 6px 18px rgba(15,23,42,.04);
}

.doc-header{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  flex-wrap:wrap;
}

.doc-search{
  min-width:260px;
}

.doc-share-box{
  max-height: 240px;
  overflow:auto;
  border:1px solid var(--line);
  border-radius:14px;
  background:#fff;
  padding:8px;
  margin-top:8px;
}

.doc-share-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  padding:10px 8px;
  border-bottom:1px solid var(--line);
}
.doc-share-row:last-child{
  border-bottom:none;
}

.doc-share-user{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  flex:1;
}

.doc-table-wrap{
  max-height: 68vh;
}

.doc-table{
  min-width: 1100px;
}

.doc-name-cell{
  display:flex;
  align-items:center;
  gap:10px;
  font-weight:700;
}

.doc-icon{
  width:32px;
  height:32px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border-radius:10px;
  background:rgba(37,99,235,.08);
  border:1px solid rgba(37,99,235,.18);
  font-size:16px;
}

.doc-lock-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:10px;
  margin-top:10px;
  padding:10px 12px;
  border:1px dashed var(--line);
  border-radius:12px;
  background:#f8fafc;
}

.doc-left .form input,
.doc-left .form textarea,
.doc-left .form select,
.doc-section input,
.doc-section textarea,
.doc-section select{
  width:100%;
}

.doc-right .table tr:hover td{
  background:#f7fbff;
}

.doc-right .table td,
.doc-right .table th{
  vertical-align:middle;
}






/* =========================
   MESSAGES PAGE SAFE EXTRA POLISH
   Added at bottom only
========================= */

/* Keep New Group button blue always on Messages page */
#newGroupBtn{
  background: rgba(37,99,235,.10);
  color: var(--accent);
  border:1px solid rgba(37,99,235,.35);
}

#newGroupBtn:hover,
#newGroupBtn:focus,
#newGroupBtn:active{
  background: rgba(37,99,235,.16);
  color: var(--accent);
  border:1px solid rgba(37,99,235,.40);
}

/* Optional small polish for message action buttons */
.msg-toolbar .btn.mini{
  min-height: 36px;
}

/* Keeps chat area looking clean when content grows */
.msg-right{
  min-width: 0;
}

.msg-left{
  min-width: 0;
}



