@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root{
  --hb-bg: #f6f7fb;
  --hb-surface: #ffffff;
  --hb-text: #0f172a;
  --hb-muted: #64748b;
  --hb-border: rgba(15, 23, 42, 0.10);
  --hb-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
  --hb-radius: 14px;
  --hb-radius-sm: 10px;
  --hb-primary: #2563eb;
  --hb-primary-weak: rgba(37, 99, 235, 0.12);
  --hb-danger: #dc2626;
}

*{ box-sizing:border-box; }
html, body{ height:100%; }
body{
  margin:0;
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--hb-text);
  background: var(--hb-bg);
}

/* Bootstrap refinements */
.form-control, .form-select{
  border-radius: 12px !important;
  border-color: var(--hb-border) !important;
  min-height: 42px;
}
.form-control:focus, .form-select:focus{
  box-shadow: 0 0 0 4px var(--hb-primary-weak) !important;
  border-color: rgba(37, 99, 235, 0.45) !important;
}
.btn{
  border-radius: 12px !important;
  font-weight: 600;
}
.btn-primary{
  background: var(--hb-primary) !important;
  border-color: var(--hb-primary) !important;
}

/* Layout shell */
.hb-shell{
  display:flex;
  min-height:100vh;
}

/* Backdrop (mobile) */
.hb-backdrop{
  position:fixed;
  inset:0;
  background: rgba(15,23,42,0.45);
  z-index: 40;
}
body.hb-backdrop-on{ overflow:hidden; }

/* ASIDE */
.hb-aside{
  width: 280px;
  background: var(--hb-surface);
  border-right: 1px solid var(--hb-border);
  padding: 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow:auto;
  z-index: 50;
}
.hb-aside__brand{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding: 6px 6px 12px;
}
.hb-brand{
  display:flex;
  align-items:center;
  gap:10px;
  text-decoration:none;
  color: var(--hb-text);
  font-weight: 800;
  letter-spacing: .3px;
}
.hb-brand__logo{
  width: 34px;
  height: 34px;
  object-fit: contain;
  border-radius: 10px;
}
.hb-brand__text{ font-size: 0.95rem; }

.hb-aside__close{
  display:none;
}

.hb-nav{
  display:flex;
  flex-direction:column;
  gap:6px;
  padding: 6px;
}
.hb-nav__link{
  display:flex;
  align-items:center;
  gap:10px;
  padding: 10px 10px;
  border-radius: 12px;
  text-decoration:none;
  color: var(--hb-text);
  border: 1px solid transparent;
}
.hb-nav__link i{
  width: 20px;
  text-align:center;
  color: var(--hb-muted);
}
.hb-nav__link:hover{
  background: rgba(15,23,42,0.03);
  border-color: var(--hb-border);
}
.hb-nav__link.is-active{
  background: var(--hb-primary-weak);
  border-color: rgba(37,99,235,0.25);
}
.hb-nav__link.is-active i{
  color: var(--hb-primary);
}
.hb-nav__link--danger{
  color: var(--hb-danger);
}
.hb-nav__link--danger i{
  color: var(--hb-danger);
}
.hb-aside__footer{
  margin-top: 14px;
  padding: 10px 6px;
  border-top: 1px solid var(--hb-border);
}
.hb-aside__hint{
  margin-top: 10px;
  font-size: .82rem;
  color: var(--hb-muted);
}
kbd{
  border: 1px solid var(--hb-border);
  border-bottom-width: 2px;
  padding: 2px 6px;
  border-radius: 8px;
  background: rgba(255,255,255,0.7);
  font-size: .8rem;
}

/* Content */
.hb-content{
  flex:1;
  min-width:0;
  display:flex;
  flex-direction:column;
}
.hb-topbar{
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(246,247,251,0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--hb-border);
  padding: 12px 18px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}
.hb-topbar__title{
  display:flex;
  flex-direction:column;
  gap:2px;
  min-width:0;
}
.hb-eyebrow{
  font-size: .78rem;
  color: var(--hb-muted);
}
.hb-title{
  font-weight: 800;
  letter-spacing: -0.2px;
  font-size: 1.05rem;
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}
.hb-topbar__right{
  display:flex;
  align-items:center;
  gap:10px;
}
.hb-userchip{
  display:flex;
  align-items:center;
  gap:8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--hb-border);
  background: var(--hb-surface);
  color: var(--hb-text);
  font-weight: 600;
  font-size: .9rem;
}
.hb-icon-btn{
  border: 1px solid var(--hb-border);
  background: var(--hb-surface);
  color: var(--hb-text);
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display:grid;
  place-items:center;
}
.hb-icon-btn:hover{
  background: rgba(15,23,42,0.03);
}

/* Main */
.hb-main{
  padding: 18px;
  flex:1;
}
.hb-container{
  max-width: 1180px;
}
.hb-footer{
  border-top: 1px solid var(--hb-border);
  padding: 14px 18px;
  color: var(--hb-muted);
}
.hb-footer__inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

/* Stepper */
.hb-stepper{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin: 6px 0 16px;
}
.hb-step{
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--hb-border);
  background: var(--hb-surface);
  color: var(--hb-muted);
  font-weight: 700;
  font-size: .84rem;
}
.hb-step.is-active{
  color: var(--hb-text);
  background: var(--hb-primary-weak);
  border-color: rgba(37,99,235,0.25);
}
.hb-step.is-complete{
  color: #0b3b2d;
  background: rgba(16,185,129,0.14);
  border-color: rgba(16,185,129,0.25);
}

/* Cards */
.hb-card{
  background: var(--hb-surface);
  border: 1px solid var(--hb-border);
  border-radius: var(--hb-radius);
  box-shadow: var(--hb-shadow);
  padding: 16px;
}
.hb-card__head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin-bottom: 12px;
}
.hb-h1{
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.3px;
}
.hb-h2{
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.2px;
}
.hb-muted{
  color: var(--hb-muted);
}
.hb-divider{
  height:1px;
  background: var(--hb-border);
  margin: 14px 0;
}

/* Company grid */
.hb-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}
.hb-company{
  border: 1px solid var(--hb-border);
  background: var(--hb-surface);
  border-radius: var(--hb-radius);
  padding: 14px;
  text-align:left;
  cursor:pointer;
  transition: transform .08s ease, box-shadow .08s ease;
}
.hb-company:hover{
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(15,23,42,0.08);
}
.hb-company__logo{
  width: 100%;
  height: 64px;
  object-fit: contain;
  margin-bottom: 10px;
}
.hb-company__name{
  font-weight: 800;
  margin-bottom: 8px;
}
.hb-company__meta{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.hb-pill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(15,23,42,0.04);
  border: 1px solid var(--hb-border);
  font-weight: 700;
  font-size: .82rem;
}
.hb-pill--ghost{
  background: transparent;
  color: var(--hb-muted);
}

/* Entity logo */
.hb-entitylogo{
  width: 64px;
  height: 64px;
  object-fit: contain;
  background: var(--hb-surface);
  border: 1px solid var(--hb-border);
  border-radius: 14px;
  padding: 8px;
}

/* Form grid */
.hb-formgrid{
  display:grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 12px;
}
.hb-formgrid > div{
  grid-column: span 6;
}
.hb-formgrid__wide{
  grid-column: span 12 !important;
}
@media (max-width: 992px){
  .hb-formgrid > div{ grid-column: span 12; }
}

/* Callouts */
.hb-callout{
  border: 1px solid var(--hb-border);
  border-radius: var(--hb-radius);
  padding: 12px;
  background: rgba(255,255,255,0.7);
}
.hb-callout--info{
  background: rgba(37,99,235,0.06);
  border-color: rgba(37,99,235,0.18);
}
.hb-callout--warn{
  background: rgba(245,158,11,0.12);
  border-color: rgba(245,158,11,0.25);
}
.hb-callout__title{
  font-weight: 800;
  margin-bottom: 6px;
}
.hb-callout__body{ margin-top: 6px; }

/* Lines */
.hb-lines{
  display:flex;
  flex-direction:column;
  gap: 10px;
}
.hb-line{
  border: 1px solid var(--hb-border);
  background: rgba(255,255,255,0.75);
  border-radius: var(--hb-radius);
  padding: 12px;
}
.hb-line__row{
  display:grid;
  grid-template-columns: 1.6fr 0.6fr 0.8fr auto;
  gap: 10px;
  align-items:end;
}
.hb-line__label{
  font-size: .82rem;
  font-weight: 800;
  color: var(--hb-muted);
  margin-bottom: 4px;
}
.hb-line__actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
}
.hb-line__meta{
  margin-top: 10px;
  display:flex;
  gap: 14px;
  flex-wrap:wrap;
  color: var(--hb-muted);
  font-size: .9rem;
}
@media (max-width: 992px){
  .hb-line__row{
    grid-template-columns: 1fr;
  }
  .hb-line__actions{ justify-content:flex-start; }
}

/* Summary */
.hb-summary{
  border: 1px solid var(--hb-border);
  background: var(--hb-surface);
  border-radius: var(--hb-radius);
  padding: 14px;
}
.hb-summary__top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.hb-summary__title{
  font-weight: 800;
}
.hb-summary__total{
  font-weight: 900;
  font-size: 1.25rem;
  letter-spacing: -0.3px;
}
.hb-summary__grid{
  margin-top: 10px;
  display:grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.hb-summary__grid > div{
  border: 1px solid var(--hb-border);
  border-radius: 12px;
  padding: 10px;
  background: rgba(15,23,42,0.02);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
@media (max-width: 992px){
  .hb-summary__grid{ grid-template-columns: 1fr; }
}

/* Flash hash */
.hb-alert{
  border-radius: var(--hb-radius) !important;
}
.hb-hash{
  display:flex;
  flex-wrap:wrap;
  gap: 8px;
  align-items:center;
}
.hb-hash code{
  border: 1px solid var(--hb-border);
  background: rgba(15,23,42,0.04);
  padding: 4px 8px;
  border-radius: 10px;
  font-size: .88rem;
}
.hb-note{
  color: var(--hb-muted);
  font-size: .86rem;
}

/* Sidebar hidden (desktop) */
body.hb-sidebar-hidden .hb-aside{
  display:none;
}
body.hb-sidebar-hidden .hb-content{
  width: 100%;
}

/* Mobile overlay */
@media (max-width: 992px){
  .hb-aside{
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-102%);
    transition: transform .18s ease;
    box-shadow: 0 30px 80px rgba(15,23,42,0.25);
  }
  body.hb-aside-open .hb-aside{
    transform: translateX(0);
  }
  .hb-aside__close{ display:grid; }
}

/* Print */
@media print{
  .hb-aside, .hb-topbar, .hb-footer, .hb-backdrop{ display:none !important; }
  body{ background:#fff !important; }
  .hb-main{ padding:0 !important; }
  .hb-invoice-meta .box {width: 32%!important;display:inline-block!important;float: left!important;}
}