*{box-sizing:border-box}
html,body{margin:0;padding:0;font-family:Arial,Helvetica,sans-serif;background:#f4f4f4;color:#111}
body{min-height:100vh}
a{color:inherit;text-decoration:none}
button,input{font:inherit}

.boot{
  min-height:100vh;
  display:grid;
  place-items:center;
  font-size:22px;
  font-weight:700;
}

.login-wrap{
  min-height:100vh;
  display:grid;
  place-items:center;
  padding:24px;
}

.login-card{
  width:min(440px,100%);
  background:#fff;
  border:1px solid #ddd;
  border-radius:18px;
  padding:28px;
  box-shadow:0 18px 60px rgba(0,0,0,.08);
}

.login-card h1{margin:0 0 6px;font-size:32px}
.login-card p{margin:0 0 22px;color:#666}
.field{display:flex;flex-direction:column;gap:6px;margin-bottom:14px}
.field label{font-size:13px;font-weight:700}
.field input{
  padding:13px 14px;
  border:1px solid #ccc;
  border-radius:10px;
  background:#fff;
}

.btn{
  border:0;
  border-radius:10px;
  padding:11px 15px;
  background:#111;
  color:#fff;
  font-weight:700;
  cursor:pointer;
}
.btn.secondary{
  background:#fff;
  color:#111;
  border:1px solid #ccc;
}

.login-msg{margin-top:12px;color:#a00;font-size:14px;min-height:20px}

.app-shell{
  min-height:100vh;
  display:grid;
  grid-template-columns:250px 1fr;
}

.sidebar{
  background:#111;
  color:#fff;
  min-height:100vh;
  padding:20px 14px;
  position:sticky;
  top:0;
  height:100vh;
}

.brand{
  display:flex;
  gap:12px;
  align-items:center;
  padding:6px 8px 22px;
}
.brand-mark{
  width:42px;
  height:42px;
  display:grid;
  place-items:center;
  border:1px solid #555;
  border-radius:10px;
  font-weight:900;
}
.brand small{display:block;color:#aaa;margin-top:2px}

.nav{display:flex;flex-direction:column;gap:5px}
.nav a{
  padding:11px 12px;
  border-radius:9px;
  color:#ddd;
}
.nav a:hover,.nav a.active{
  background:#252525;
  color:#fff;
}

.side-bottom{
  position:absolute;
  left:14px;
  right:14px;
  bottom:18px;
}
.side-bottom button{width:100%}

.main{padding:28px}
.topbar{
  display:flex;
  justify-content:space-between;
  gap:20px;
  align-items:flex-start;
  margin-bottom:24px;
}
.topbar h1{margin:4px 0 0;font-size:30px}
.kicker{font-size:12px;font-weight:800;letter-spacing:.08em;color:#666;text-transform:uppercase}

.metrics{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:14px;
  margin-bottom:20px;
}
.metric{
  background:#fff;
  border:1px solid #ddd;
  border-radius:14px;
  padding:18px;
}
.metric span{display:block;color:#666;font-size:13px}
.metric strong{display:block;font-size:28px;margin-top:4px}

.grid{
  display:grid;
  grid-template-columns:1.3fr 1fr;
  gap:16px;
}
.panel{
  background:#fff;
  border:1px solid #ddd;
  border-radius:14px;
  overflow:hidden;
}
.panel-head{
  padding:16px 18px;
  border-bottom:1px solid #eee;
  display:flex;
  justify-content:space-between;
  align-items:center;
}
.panel-body{padding:16px 18px}

.row{
  display:flex;
  justify-content:space-between;
  gap:16px;
  padding:12px 0;
  border-bottom:1px solid #eee;
}
.row:last-child{border-bottom:0}
.muted{color:#777}
.chip{
  display:inline-block;
  padding:4px 8px;
  border-radius:999px;
  background:#eee;
  font-size:12px;
  font-weight:700;
}

.quick-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:10px;
}
.quick{
  border:1px solid #ddd;
  border-radius:12px;
  padding:14px;
  background:#fafafa;
}
.quick b{display:block;margin-bottom:4px}
.quick span{font-size:13px;color:#666}

.error{
  padding:14px;
  border:1px solid #e3b5b5;
  background:#fff1f1;
  border-radius:10px;
  color:#8a1f1f;
}

@media(max-width:900px){
  .app-shell{grid-template-columns:1fr}
  .sidebar{
    position:relative;
    height:auto;
    min-height:auto;
  }
  .side-bottom{position:relative;left:auto;right:auto;bottom:auto;margin-top:20px}
  .metrics{grid-template-columns:1fr 1fr}
  .grid{grid-template-columns:1fr}
}

/* =========================================================
   EVENTS & PROGRAMMING
========================================================= */

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

.event-row{
  display:grid;
  grid-template-columns:150px minmax(0,1fr) auto;
  gap:18px;
  align-items:center;
  padding:14px 0;
  border-bottom:1px solid rgba(255,255,255,.08);
}

.event-row:last-child{
  border-bottom:0;
}

.event-date{
  font-size:13px;
  font-weight:700;
}

.event-main{
  min-width:0;
}

.event-main strong{
  display:block;
  font-size:15px;
}

.event-meta{
  margin-top:4px;
  font-size:11px;
  opacity:.55;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.event-actions{
  display:flex;
  justify-content:flex-end;
}

.event-count{
  min-width:34px;
  height:34px;
  display:flex;
  align-items:center;
  justify-content:center;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.14);
  font-size:13px;
  font-weight:700;
}

.event-empty{
  padding:18px 0;
  opacity:.6;
}

@media(max-width:720px){
  .event-row{
    grid-template-columns:1fr;
    gap:8px;
  }

  .event-actions{
    justify-content:flex-start;
  }
}


/* =========================================================
   THEBANK CRM / RELATIONSHIP WORKSPACE
========================================================= */

.bank-metrics{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:12px;
  margin:0 0 18px;
}

.bank-metrics .metric{
  min-width:0;
}

.crm-tabs{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin-bottom:14px;
}

.crm-tabs .btn{
  width:auto;
}

.crm-tabs .btn.active{
  background:#111;
  color:#fff;
  border-color:#111;
}

.crm-toolbar{
  display:grid;
  grid-template-columns:minmax(240px,1fr) 190px;
  gap:10px;
  margin-bottom:16px;
}

.crm-toolbar input,
.crm-toolbar select{
  width:100%;
  box-sizing:border-box;
  padding:10px 12px;
  border:1px solid #d8d8d8;
  border-radius:8px;
  background:#fff;
  color:#111;
  font:inherit;
}

.crm-row{
  align-items:center;
}

.crm-row .event-main{
  min-width:0;
}

.crm-row strong{
  display:block;
  margin-top:8px;
  font-size:17px;
}

.crm-row .pill{
  display:inline-flex;
  margin-right:5px;
  margin-bottom:3px;
}


/* Modal */

.bank-modal{
  display:none;
  position:fixed;
  inset:0;
  z-index:10000;
  overflow:auto;
  padding:28px;
  background:rgba(0,0,0,.66);
  backdrop-filter:blur(3px);
}

.bank-modal.open{
  display:flex;
  align-items:flex-start;
  justify-content:center;
}

.bank-modal-card{
  position:relative;
  width:min(1180px,100%);
  margin:auto;
  background:#fff;
  color:#111;
  border-radius:14px;
  box-shadow:0 24px 80px rgba(0,0,0,.28);
  overflow:hidden;
}

.bank-modal-close{
  position:absolute;
  top:14px;
  right:16px;
  z-index:3;
  width:38px;
  height:38px;
  border:1px solid #ddd;
  border-radius:999px;
  background:#fff;
  color:#111;
  font-size:24px;
  line-height:1;
  cursor:pointer;
}

.bank-modal-close:hover{
  background:#f3f3f3;
}


/* CRM workspace */

.crm-workspace{
  padding:22px;
}

.crm-workspace-head{
  padding:4px 50px 18px 0;
  border-bottom:1px solid #e7e7e7;
  margin-bottom:18px;
}

.crm-workspace-head h2{
  margin:4px 0 5px;
}

.crm-workspace-head p{
  margin:0;
}

.crm-workspace-grid{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr);
  gap:18px;
  align-items:start;
}

.crm-workspace-col{
  display:flex;
  flex-direction:column;
  gap:16px;
  min-width:0;
}

.crm-section{
  border:1px solid #e4e4e4;
  border-radius:12px;
  background:#fafafa;
  padding:16px;
}

.crm-section h3{
  margin:0 0 12px;
  font-size:16px;
}

.crm-section form{
  margin:0;
}

.crm-section label,
.crm-create label{
  display:block;
  margin:10px 0 5px;
  font-size:12px;
  font-weight:700;
}

.crm-section input,
.crm-section select,
.crm-section textarea,
.crm-create input,
.crm-create select,
.crm-create textarea{
  width:100%;
  box-sizing:border-box;
  border:1px solid #d5d5d5;
  border-radius:8px;
  background:#fff;
  color:#111;
  padding:9px 10px;
  font:inherit;
}

.crm-section textarea,
.crm-create textarea{
  resize:vertical;
  min-height:86px;
}

.crm-section button[type="submit"],
.crm-create button[type="submit"],
.crm-create .btn{
  margin-top:12px;
}


/* Activity / notes / communications */

.crm-log{
  display:flex;
  flex-direction:column;
  gap:8px;
  max-height:330px;
  overflow:auto;
}

.crm-log-item{
  padding:10px 11px;
  border:1px solid #e7e7e7;
  border-radius:8px;
  background:#fff;
}

.crm-log-item strong{
  display:block;
  margin-bottom:3px;
}

.crm-log-item small{
  color:#707070;
}

.crm-task{
  padding:10px;
  border:1px solid #e4e4e4;
  border-radius:8px;
  background:#fff;
  margin-bottom:8px;
}

.crm-task:last-child{
  margin-bottom:0;
}


/* Payment / relationship value */

.crm-payment-totals{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:8px;
  margin:12px 0;
}

.crm-payment-totals > *{
  padding:10px;
  border:1px solid #e1e1e1;
  border-radius:8px;
  background:#fff;
}

.crm-payment-totals strong{
  display:block;
  font-size:18px;
}


/* Create relationship */

.crm-create{
  width:min(620px,100%);
  padding:22px;
}

.crm-create h2{
  margin-top:4px;
  padding-right:45px;
}

.crm-create form{
  margin-top:16px;
}


/* Responsive */

@media (max-width:900px){

  .bank-metrics{
    grid-template-columns:1fr 1fr;
  }

  .crm-workspace-grid{
    grid-template-columns:1fr;
  }

  .crm-payment-totals{
    grid-template-columns:1fr;
  }
}

@media (max-width:640px){

  .bank-modal{
    padding:0;
  }

  .bank-modal-card{
    min-height:100%;
    border-radius:0;
  }

  .crm-workspace,
  .crm-create{
    padding:18px;
  }

  .bank-metrics{
    grid-template-columns:1fr 1fr;
  }

  .crm-toolbar{
    grid-template-columns:1fr;
  }

  .crm-tabs{
    gap:6px;
  }
}



/* =========================================================
   CRM V4.1 WORKSPACE POLISH
========================================================= */

.crm-workspace-grid{
  grid-template-columns:
    minmax(360px,.92fr)
    minmax(420px,1.08fr);
}

.crm-workspace-col{
  align-self:start;
}

.crm-section p{
  line-height:1.45;
  overflow-wrap:anywhere;
}

.crm-workspace-col > .btn[data-crm-archive]{
  width:100%;
  margin-top:0;
}

@media (max-width:960px){
  .crm-workspace-grid{
    grid-template-columns:1fr;
  }
}



/* =========================================================
   THEBANK COMMERCE
========================================================= */

.commerce-shell{
  display:flex;
  flex-direction:column;
  gap:16px;
}

.commerce-body{
  min-width:0;
}

.commerce-totals{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:12px;
  margin-bottom:18px;
}

.stat-card{
  border:1px solid #ddd;
  border-radius:12px;
  background:#fff;
  padding:16px;
}

.stat-card span{
  display:block;
  color:#666;
  font-size:13px;
  margin-bottom:4px;
}

.stat-card strong{
  display:block;
  font-size:26px;
}

.bank-section-head{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:18px;
  margin:8px 0 14px;
}

.bank-section-head h3{
  margin:0 0 3px;
}

.bank-section-head p{
  margin:0;
  color:#666;
}

.bank-table-wrap{
  width:100%;
  overflow:auto;
  border:1px solid #ddd;
  border-radius:12px;
  background:#fff;
}

.bank-table{
  width:100%;
  min-width:760px;
  border-collapse:collapse;
}

.bank-table th,
.bank-table td{
  padding:12px 14px;
  border-bottom:1px solid #e8e8e8;
  text-align:left;
  vertical-align:top;
}

.bank-table th{
  background:#f6f6f6;
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.04em;
  color:#555;
}

.bank-table tbody tr:last-child td{
  border-bottom:0;
}

.commerce-shell .crm-tabs button{
  appearance:none;
  border:1px solid #ccc;
  border-radius:8px;
  background:#fff;
  padding:9px 14px;
  cursor:pointer;
  font:inherit;
  font-weight:700;
}

.commerce-shell .crm-tabs button.active{
  background:#111;
  border-color:#111;
  color:#fff;
}

.bank-modal-card > h2{
  margin:0 0 18px;
  padding-right:45px;
}

.bank-modal-card > form{
  padding:0;
}

.bank-modal-card label{
  display:block;
  font-size:12px;
  font-weight:700;
}

.bank-modal-card input,
.bank-modal-card select,
.bank-modal-card textarea{
  width:100%;
  box-sizing:border-box;
  margin-top:5px;
  border:1px solid #d5d5d5;
  border-radius:8px;
  background:#fff;
  padding:10px;
  font:inherit;
}

.bank-modal-card textarea{
  min-height:90px;
  resize:vertical;
}

.bank-modal-card > form > .btn,
.bank-modal-card form > .btn{
  margin-top:16px;
}

.commerce-shell + *{
  min-width:0;
}

@media(max-width:800px){
  .commerce-totals{
    grid-template-columns:1fr;
  }

  .bank-section-head{
    align-items:flex-start;
    flex-direction:column;
  }
}

