:root{
  font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  color:#111827;
  background:#f4f5f7;
  font-synthesis:none;
}
*{box-sizing:border-box}
html{min-height:100%}
body{margin:0;background:#f4f5f7}
a{color:inherit}
.shell{max-width:1180px;margin:0 auto;padding:24px 24px 96px}
.card{
  background:#fff;
  border:1px solid #e2e5e9;
  border-radius:15px;
  padding:22px;
  box-shadow:0 1px 3px rgba(17,24,39,.045);
}
.card.subtle{background:#fafbfc}
.auth{max-width:430px;margin:8vh auto}
h1{font-size:26px;line-height:1.15;margin:0}
h2{font-size:25px;line-height:1.2;margin:0}
h3{font-size:18px;line-height:1.25;margin:0 0 15px}
p{line-height:1.5}
.muted{color:#6b7280}
p.muted{margin:5px 0 0}
label{display:block;font-size:13px;font-weight:700;margin:14px 0 6px;color:#374151}
input,select{
  width:100%;
  min-height:43px;
  padding:10px 12px;
  border:1px solid #cfd4dc;
  border-radius:9px;
  font:inherit;
  color:#111827;
  background:#fff;
  outline:none;
}
input:focus,select:focus{border-color:#7c8491;box-shadow:0 0 0 3px rgba(17,24,39,.06)}
input[type="checkbox"]{width:auto;min-height:auto;margin:0 7px 0 0}
button,.button-link{
  border:0;
  border-radius:9px;
  padding:10px 14px;
  min-height:40px;
  background:#111827;
  color:#fff;
  font:inherit;
  font-weight:750;
  cursor:pointer;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  white-space:nowrap;
}
button:hover,.button-link:hover{opacity:.91}
button:disabled{opacity:.45;cursor:not-allowed}
button.secondary,.secondary{background:#e9ebee;color:#111827}
button.small,.small{padding:8px 11px;min-height:36px;font-size:13px}
.actions{display:flex;gap:9px;flex-wrap:wrap;margin-top:18px}
.actions.compact{margin:0}
.link{color:#1d4ed8;text-decoration:none}
.notice{padding:11px 13px;border-radius:9px;margin:13px 0;background:#eef2ff;color:#293056;font-size:14px}
.notice.error,.error{background:#fef2f2;color:#991b1b}
.hidden{display:none!important}

.app-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
  min-height:62px;
}
.brand{display:flex;align-items:center;gap:12px;min-width:0}
.brand-mark{
  width:39px;height:39px;border-radius:11px;background:#111827;color:#fff;
  display:grid;place-items:center;font-size:20px;font-weight:800;flex:0 0 auto;
}
.userline{margin-top:3px;color:#6b7280;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.header-actions{display:flex;align-items:center;gap:9px}
.company-switch{width:260px;min-height:38px;padding:7px 10px;font-size:14px;font-weight:650}

.desktop-nav{
  display:flex;gap:3px;margin:20px 0 24px;padding:5px;background:#e9ebee;border-radius:11px;
}
.nav-link{
  text-decoration:none;
  color:#4b5563;
  padding:9px 15px;
  border-radius:8px;
  font-size:14px;
  font-weight:700;
  transition:.15s ease;
}
.nav-link:hover{background:rgba(255,255,255,.65);color:#111827}
.nav-link.active{background:#fff;color:#111827;box-shadow:0 1px 2px rgba(0,0,0,.08)}
.mobile-nav{display:none}

.content{display:flex;flex-direction:column;gap:16px}
.page-head{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;margin:1px 1px 2px}
.page-head .muted{font-size:14px}
.grid{display:grid;gap:16px}
.grid.two{grid-template-columns:1fr 1fr}
.stats{display:grid;grid-template-columns:repeat(4,1fr);gap:14px}
.stat{text-decoration:none;display:flex;flex-direction:column;gap:6px;min-height:132px}
.stat:hover{border-color:#c8cdd4}
.stat-label{font-size:13px;font-weight:750;color:#6b7280}
.stat strong{font-size:25px;letter-spacing:-.02em}
.stat small{color:#6b7280;font-size:12px}
.quick-actions{display:flex;flex-direction:column}
.quick-actions a{
  text-decoration:none;
  font-weight:700;
  padding:11px 0;
  border-top:1px solid #edf0f2;
}
.quick-actions a:first-child{border-top:0;padding-top:0}
.quick-actions a:after{content:"›";float:right;color:#9ca3af}
.compact-list{display:flex;flex-direction:column}
.compact-row{display:flex;justify-content:space-between;gap:14px;padding:10px 0;border-top:1px solid #edf0f2}
.compact-row:first-child{border-top:0;padding-top:0}
.compact-row>div{display:flex;flex-direction:column;gap:2px;min-width:0}
.compact-row span{font-size:12px;color:#6b7280;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.compact-row .right{text-align:right}
.empty-state{text-align:center;padding:52px 24px}
.empty-state p{max-width:560px;margin:10px auto 20px}
.hero-empty{text-align:center;padding:50px 24px}
.hero-empty p{max-width:590px;margin:10px auto 20px}
.camera-symbol{
  width:56px;height:56px;margin:0 auto 15px;border-radius:16px;background:#eef0f3;
  display:grid;place-items:center;font-size:25px;color:#4b5563
}

.section-title{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}
.section-title h3{margin:0}
.pill{font-size:12px;font-weight:800;background:#eef0f3;border-radius:999px;padding:5px 9px;color:#4b5563}
.table-wrap{overflow:auto}
table{width:100%;border-collapse:collapse}
th,td{text-align:left;padding:11px 9px;border-bottom:1px solid #eceff2;font-size:13px;vertical-align:middle}
th{color:#5b6472;font-weight:750;white-space:nowrap}
tbody tr:last-child td{border-bottom:0}
.num{text-align:right}
.empty-inline{padding:22px 4px;color:#6b7280}

.form-grid{display:grid;gap:0 14px}
.form-grid.two{grid-template-columns:repeat(2,1fr)}
.form-grid.three{grid-template-columns:repeat(3,1fr)}
.span-two{grid-column:span 2}
.check-field{display:flex;align-items:flex-end;padding-bottom:10px}
.check-field label{display:flex;align-items:center;margin:0;min-height:43px}

.invoice-item{
  display:grid;
  grid-template-columns:minmax(220px,1fr) 110px 150px 100px 36px;
  gap:10px;
  align-items:end;
  border-top:1px solid #edf0f2;
  margin-top:15px;
  padding-top:4px;
}
.invoice-item:first-child{border-top:0;margin-top:0}
.icon-button{
  width:36px;height:43px;min-height:43px;padding:0;background:#eef0f3;color:#4b5563;font-size:22px;
}
.inline-form{display:grid;grid-template-columns:180px 120px 1fr auto;gap:10px;align-items:end}
.inline-form input,.inline-form select{margin:0}

.preview-box{
  margin-top:15px;padding:13px;border-radius:10px;background:#f5f6f8;
  display:grid;grid-template-columns:1fr auto;gap:7px 12px;font-size:13px
}
.preview-box span{color:#6b7280}
.settings-details{margin-top:15px;border-top:1px solid #edf0f2;padding-top:13px}
.settings-details summary{cursor:pointer;font-weight:750;color:#374151}
.nested-form{padding-top:4px}
.settings-grid{align-items:start}

@media(max-width:920px){
  .stats{grid-template-columns:repeat(2,1fr)}
  .form-grid.three{grid-template-columns:repeat(2,1fr)}
  .invoice-item{grid-template-columns:1fr 100px 130px 90px 36px}
  .inline-form{grid-template-columns:1fr 120px}
  .inline-form input[type="file"]{grid-column:1/-1}
}

@media(max-width:700px){
  .shell{padding:14px 14px 90px}
  .app-header{align-items:flex-start}
  .brand h1{font-size:21px}
  .brand-mark{width:35px;height:35px;border-radius:10px}
  .userline{max-width:180px}
  .header-actions{align-items:flex-end;flex-direction:column;gap:6px}
  .company-switch{width:180px;max-width:45vw}
  .desktop-nav{display:none}
  .mobile-nav{
    position:fixed;left:0;right:0;bottom:0;z-index:40;
    display:grid;grid-template-columns:repeat(5,1fr);
    background:rgba(255,255,255,.96);border-top:1px solid #dfe3e8;
    padding:6px max(6px,env(safe-area-inset-left)) calc(6px + env(safe-area-inset-bottom));
    backdrop-filter:blur(14px);
  }
  .mobile-nav .nav-link{
    padding:9px 2px;text-align:center;font-size:11px;border-radius:8px;color:#6b7280
  }
  .mobile-nav .nav-link.active{background:#eef0f3;box-shadow:none;color:#111827}
  .content{margin-top:18px}
  .page-head{align-items:flex-start}
  .page-head h2{font-size:22px}
  .grid.two,.stats{grid-template-columns:1fr}
  .stats{gap:9px}
  .stat{min-height:auto;padding:16px;display:grid;grid-template-columns:1fr auto;align-items:center}
  .stat-label{grid-column:1}
  .stat strong{grid-column:2;grid-row:1/3;font-size:21px}
  .stat small{grid-column:1}
  .form-grid.two,.form-grid.three{grid-template-columns:1fr}
  .span-two{grid-column:auto}
  .invoice-item{
    grid-template-columns:1fr 1fr 36px;
    padding:12px 0 2px;
  }
  .invoice-item .grow{grid-column:1/-1}
  .invoice-item .mini.wide{grid-column:1}
  .invoice-item .remove-item{grid-column:3;grid-row:2;align-self:end}
  .inline-form{grid-template-columns:1fr}
  .inline-form input[type="file"]{grid-column:auto}
  .card{padding:17px;border-radius:13px}
  th,td{padding:10px 7px;white-space:nowrap}
}

@media(max-width:430px){
  .header-actions .secondary{display:none}
  .company-switch{width:155px}
  .brand h1{font-size:19px}
  .userline{max-width:150px}
}
