:root{
  --bg:#f7f5f3;
  --surface:#ffffff;
  --surface-2:#fbf9f8;
  --text:#282321;
  --muted:#817873;
  --line:#ebe4e0;
  --accent:#bd7c76;
  --accent-dark:#9c625d;
  --accent-soft:#f4e5e3;
  --green:#43815f;
  --green-soft:#ebf5ef;
  --orange:#b57c34;
  --orange-soft:#fff3e4;
  --red:#b55757;
  --red-soft:#fbecec;
  --shadow:0 12px 34px rgba(66,44,37,.07);
  --radius:18px;
}
*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{
  margin:0;
  min-height:100vh;
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  background:var(--bg);
  color:var(--text);
}
button,input,select,textarea{font:inherit}
button{cursor:pointer}
a{color:inherit}
.site-header{
  position:sticky;
  top:0;
  z-index:20;
  background:rgba(255,255,255,.94);
  backdrop-filter:blur(14px);
  border-bottom:1px solid var(--line);
}
.header-inner{
  max-width:1240px;
  margin:auto;
  min-height:80px;
  padding:0 22px;
  display:flex;
  align-items:center;
  gap:28px;
}
.brand{
  display:flex;
  align-items:center;
  gap:12px;
  text-decoration:none;
  font-weight:800;
  white-space:nowrap;
}
.brand-mark{
  width:40px;height:40px;border-radius:12px;
  display:grid;place-items:center;
  background:var(--accent);
  color:white;
  font-family:Georgia,serif;
  font-size:22px;
}
.brand-name{font-size:16px}
.nav{
  display:flex;
  align-items:center;
  gap:7px;
  overflow-x:auto;
  scrollbar-width:none;
}
.nav::-webkit-scrollbar{display:none}
.nav a{
  display:flex;
  align-items:center;
  gap:7px;
  padding:11px 13px;
  border-radius:12px;
  text-decoration:none;
  color:#665d58;
  font-size:14px;
  white-space:nowrap;
}
.nav a:hover,.nav a.active{
  color:var(--accent-dark);
  background:var(--accent-soft);
}
.header-spacer{margin-left:auto}
.user-chip{
  display:flex;align-items:center;gap:9px;
  padding:8px 10px;
  border:1px solid var(--line);
  border-radius:13px;
  background:var(--surface);
}
.user-avatar{
  width:32px;height:32px;border-radius:50%;
  display:grid;place-items:center;
  background:#e7d5d1;color:#78534f;font-weight:800;font-size:12px;
}
.user-chip strong{font-size:12px;display:block}
.user-chip small{font-size:11px;color:var(--muted);display:block}
.container{
  max-width:1240px;
  margin:auto;
  padding:30px 22px 60px;
}
.page-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:20px;
  margin-bottom:24px;
}
.page-head h1{
  margin:0 0 7px;
  font-size:29px;
  letter-spacing:-.6px;
}
.page-head p{margin:0;color:var(--muted);font-size:14px}
.btn{
  border:0;
  border-radius:12px;
  padding:11px 16px;
  font-weight:700;
  font-size:13px;
  transition:.18s ease;
}
.btn:hover{transform:translateY(-1px)}
.btn-primary{background:var(--accent);color:#fff}
.btn-primary:hover{background:var(--accent-dark)}
.btn-secondary{background:#fff;border:1px solid var(--line);color:var(--text)}
.btn-danger{background:var(--red-soft);color:var(--red)}
.btn-sm{padding:8px 10px;font-size:12px}
.stats{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:15px;
  margin-bottom:18px;
}
.card{
  background:var(--surface);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
}
.stat{padding:19px}
.stat-label{font-size:12px;color:var(--muted);margin-bottom:8px}
.stat-value{font-size:25px;font-weight:800;letter-spacing:-.5px}
.stat-note{font-size:11px;color:var(--green);margin-top:8px}
.grid-2{
  display:grid;
  grid-template-columns:1.4fr .9fr;
  gap:18px;
}
.section{padding:20px}
.section-head{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  margin-bottom:15px;
}
.section-head h2{margin:0;font-size:17px}
.muted-link{font-size:12px;color:var(--accent-dark);text-decoration:none}
.list{display:grid;gap:10px}
.list-item{
  border:1px solid var(--line);
  border-radius:14px;
  padding:13px 14px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  background:#fff;
}
.item-main{min-width:0}
.item-title{font-size:13px;font-weight:750;margin-bottom:4px}
.item-subtitle{font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.item-right{text-align:right;white-space:nowrap}
.amount{font-weight:800;font-size:13px}
.badge{
  display:inline-flex;align-items:center;
  padding:6px 9px;border-radius:999px;
  font-size:10px;font-weight:750;
}
.badge-green{color:var(--green);background:var(--green-soft)}
.badge-orange{color:var(--orange);background:var(--orange-soft)}
.badge-red{color:var(--red);background:var(--red-soft)}
.badge-gray{color:#746b67;background:#f0ecea}
.table-wrap{overflow:auto}
table{width:100%;border-collapse:collapse;min-width:700px}
th,td{padding:13px 12px;text-align:left;border-bottom:1px solid var(--line);font-size:12px}
th{font-size:11px;color:var(--muted);text-transform:uppercase;letter-spacing:.5px}
tbody tr:hover{background:#fcfaf9}
.actions{display:flex;gap:7px;align-items:center;flex-wrap:wrap}
.toolbar{
  display:flex;
  align-items:center;
  gap:10px;
  margin-bottom:15px;
  flex-wrap:wrap;
}
.search{
  flex:1;
  min-width:220px;
  position:relative;
}
.search input{padding-left:37px}
.search::before{
  content:"⌕";
  position:absolute;left:13px;top:50%;transform:translateY(-50%);
  color:var(--muted);
}
input,select,textarea{
  width:100%;
  border:1px solid var(--line);
  border-radius:11px;
  background:#fff;
  padding:11px 12px;
  outline:none;
  color:var(--text);
}
textarea{resize:vertical;min-height:110px}
input:focus,select:focus,textarea:focus{
  border-color:var(--accent);
  box-shadow:0 0 0 3px var(--accent-soft);
}
.form-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}
.form-group{display:grid;gap:6px}
.form-group.full{grid-column:1/-1}
label{font-size:12px;font-weight:700;color:#5f5652}
.empty{
  padding:30px 20px;
  border:1px dashed #d9ceca;
  border-radius:14px;
  color:var(--muted);
  text-align:center;
  font-size:13px;
  background:#fcfaf9;
}
.modal{
  position:fixed;
  inset:0;
  z-index:50;
  display:none;
  place-items:center;
  padding:20px;
  background:rgba(25,20,18,.42);
}
.modal.show{display:grid}
.modal-card{
  width:min(560px,100%);
  max-height:90vh;
  overflow:auto;
  background:#fff;
  border-radius:20px;
  box-shadow:0 30px 90px rgba(0,0,0,.2);
  padding:22px;
}
.modal-head{
  display:flex;align-items:center;justify-content:space-between;
  gap:15px;margin-bottom:18px;
}
.modal-head h3{margin:0;font-size:18px}
.icon-btn{
  width:34px;height:34px;border:0;border-radius:10px;
  background:#f6f1ef;color:#6d625d;
}
.modal-actions{
  display:flex;justify-content:flex-end;gap:9px;margin-top:18px;
}
.notice{
  padding:12px 14px;
  border-radius:12px;
  background:var(--accent-soft);
  color:#77504c;
  font-size:12px;
  margin-bottom:16px;
}
.whatsapp-layout{
  display:grid;
  grid-template-columns:.8fr 1.2fr;
  gap:18px;
}
.phone-preview{
  max-width:360px;
  margin:auto;
  border:8px solid #292929;
  border-radius:30px;
  overflow:hidden;
  background:#efeae2;
  box-shadow:var(--shadow);
}
.phone-top{
  padding:14px;
  background:#075e54;
  color:white;
  display:flex;align-items:center;gap:10px;
}
.phone-avatar{
  width:35px;height:35px;border-radius:50%;background:#d7cbc5;
  display:grid;place-items:center;color:#6b514d;font-weight:800;
}
.phone-top strong{font-size:12px;display:block}
.phone-top small{font-size:10px;opacity:.8}
.phone-body{
  min-height:420px;
  padding:18px 12px;
  background-color:#efeae2;
}
.chat-bubble{
  margin-left:auto;
  width:88%;
  padding:10px 11px;
  border-radius:9px 2px 9px 9px;
  background:#d9fdd3;
  font-size:12px;
  line-height:1.55;
  white-space:pre-wrap;
}
.toast{
  position:fixed;
  right:20px;
  bottom:20px;
  z-index:100;
  padding:12px 15px;
  border-radius:12px;
  background:#282321;
  color:#fff;
  font-size:12px;
  opacity:0;
  transform:translateY(15px);
  pointer-events:none;
  transition:.25s ease;
}
.toast.show{opacity:1;transform:translateY(0)}
.quick-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
}
.quick-link{
  padding:14px;
  border:1px solid var(--line);
  border-radius:13px;
  text-decoration:none;
  background:#fff;
}
.quick-link:hover{border-color:#d7c4bf;background:#fdfafa}
.quick-link strong{display:block;font-size:13px;margin-bottom:4px}
.quick-link small{color:var(--muted);font-size:11px}
@media(max-width:960px){
  .header-inner{gap:14px}
  .brand-name,.user-chip{display:none}
  .grid-2,.whatsapp-layout{grid-template-columns:1fr}
  .stats{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:640px){
  .header-inner{padding:0 13px;min-height:72px;align-items:flex-start;padding-top:13px;padding-bottom:10px}
  .brand-mark{width:36px;height:36px}
  .nav a{padding:9px 10px}
  .container{padding:22px 14px 45px}
  .page-head{align-items:flex-start}
  .page-head h1{font-size:24px}
  .stats{grid-template-columns:1fr}
  .form-grid{grid-template-columns:1fr}
  .form-group.full{grid-column:auto}
  .page-head .btn{white-space:nowrap}
  .quick-grid{grid-template-columns:1fr}
}

/* Invoice share page */
.invoice-document-wrap{
  max-width:900px;
  margin:0 auto;
}
.invoice-toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:16px;
  flex-wrap:wrap;
}
.invoice-paper{
  background:#fff;
  border:1px solid var(--line);
  border-radius:20px;
  box-shadow:var(--shadow);
  padding:34px;
}
.invoice-paper-head{
  display:flex;
  justify-content:space-between;
  gap:24px;
  padding-bottom:24px;
  border-bottom:1px solid var(--line);
}
.invoice-business{
  display:flex;
  gap:14px;
  align-items:flex-start;
}
.invoice-logo{
  width:52px;
  height:52px;
  border-radius:15px;
  display:grid;
  place-items:center;
  background:var(--accent);
  color:#fff;
  font-family:Georgia,serif;
  font-size:28px;
  font-weight:700;
}
.invoice-business h1{
  margin:0 0 4px;
  font-size:20px;
}
.invoice-business p,
.invoice-meta p,
.invoice-party p,
.invoice-notes p{
  margin:3px 0;
  color:var(--muted);
  font-size:12px;
  line-height:1.55;
}
.invoice-meta{
  text-align:right;
}
.invoice-meta strong{
  display:block;
  margin-bottom:7px;
  font-size:22px;
}
.invoice-parties{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:18px;
  padding:24px 0;
}
.invoice-party{
  padding:16px;
  border:1px solid var(--line);
  border-radius:14px;
  background:#fcfaf9;
}
.invoice-party span{
  display:block;
  color:var(--muted);
  font-size:10px;
  text-transform:uppercase;
  letter-spacing:.6px;
  margin-bottom:7px;
}
.invoice-party strong{
  display:block;
  font-size:14px;
  margin-bottom:4px;
}
.invoice-items{
  width:100%;
  min-width:0;
  border-collapse:collapse;
}
.invoice-items th,
.invoice-items td{
  padding:14px 12px;
  border-bottom:1px solid var(--line);
}
.invoice-items th:last-child,
.invoice-items td:last-child{
  text-align:right;
}
.invoice-total{
  margin-left:auto;
  width:min(360px,100%);
  padding-top:18px;
}
.invoice-total-row{
  display:flex;
  justify-content:space-between;
  gap:20px;
  padding:8px 0;
  font-size:13px;
}
.invoice-total-row.grand{
  margin-top:7px;
  padding-top:14px;
  border-top:1px solid var(--line);
  font-size:18px;
  font-weight:800;
}
.invoice-payment,
.invoice-notes{
  margin-top:24px;
  padding:16px;
  border-radius:14px;
  background:#fcfaf9;
  border:1px solid var(--line);
}
.invoice-payment h3,
.invoice-notes h3{
  font-size:13px;
  margin:0 0 8px;
}
.invoice-footer{
  margin-top:26px;
  padding-top:18px;
  border-top:1px solid var(--line);
  text-align:center;
  color:var(--muted);
  font-size:11px;
  line-height:1.6;
}
.status-pill{
  display:inline-flex;
  margin-top:8px;
  padding:7px 10px;
  border-radius:999px;
  font-size:10px;
  font-weight:800;
}
@media(max-width:640px){
  .invoice-paper{padding:22px 16px;border-radius:14px}
  .invoice-paper-head{display:grid}
  .invoice-meta{text-align:left}
  .invoice-parties{grid-template-columns:1fr}
}
@media print{
  body{background:#fff}
  .site-header,.invoice-toolbar,.toast{display:none!important}
  .container{max-width:none;padding:0}
  .invoice-paper{border:0;box-shadow:none;border-radius:0;padding:0}
  .invoice-document-wrap{max-width:none}
}
