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

:root{
  --bg:#f8fafc;
  --card:#ffffff;
  --text:#020817;
  --muted:#64748b;
  --primary:#0f172a;
  --line:#e2e8f0;

  --green:#059669;
  --green-bg:#ecfdf5;
  --green-line:#86efac;

  --red:#dc2626;
  --red-bg:#fef2f2;
  --red-line:#fecaca;

  --blue:#2563eb;
  --blue-bg:#eff6ff;
  --blue-line:#bfdbfe;

  --orange:#b45309;
  --orange-bg:#fffbeb;
  --orange-line:#fde68a;
}

*{box-sizing:border-box}

html,body{
  margin:0;
  min-height:100%;
  font-family:'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background:var(--bg);
  color:var(--text);
  font-size:14px;
  font-weight:400;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  text-rendering:optimizeLegibility;
}

a{color:inherit;text-decoration:none}

.app{
  display:flex;
  min-height:100vh;
}

.sidebar{
  width:252px;
  background:#fff;
  border-right:1px solid var(--line);
  padding:16px 12px;
  position:sticky;
  top:0;
  height:100vh;
}

.brand{
  display:flex;
  gap:12px;
  align-items:center;
  padding:0 4px 20px;
  margin:0 0 8px;
}

.brand-link{
  text-decoration:none!important;
  color:inherit!important;
  cursor:pointer;
}

.logo{
  background:#020817;
  color:#fff;
  width:36px;
  height:36px;
  border-radius:9px;
  display:grid;
  place-items:center;
  font-weight:800;
  font-size:14px;
  letter-spacing:-.02em;
}

.brand strong{
  display:block;
  font-size:16px;
  line-height:1.08;
  font-weight:700;
  letter-spacing:-.02em;
}

.brand small{
  display:block;
  color:#475569;
  font-size:10px;
  margin-top:4px;
  text-transform:uppercase;
  line-height:1.15;
  font-weight:500;
  max-width:150px;
  letter-spacing:.01em;
}

nav{margin-top:4px}

nav a{
  display:flex;
  align-items:center;
  gap:12px;
  min-height:40px;
  padding:10px 12px;
  border-radius:7px;
  color:#405875;
  font-size:14px;
  font-weight:500;
  line-height:1;
  margin:3px 0;
  letter-spacing:-.01em;
  transition:background .12s ease,color .12s ease;
}

nav a .menu-icon,
nav a span.menu-icon{
  width:18px!important;
  min-width:18px!important;
  max-width:18px!important;
  height:18px!important;
  min-height:18px!important;
  max-height:18px!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  overflow:hidden!important;
  line-height:0!important;
  flex:0 0 18px!important;
  color:#64748b;
  border:0!important;
  background:none!important;
}

nav a span::before,
nav a span::after{
  content:none!important;
  display:none!important;
}

nav a .menu-icon svg,
nav a span.menu-icon svg,
.sidebar nav svg{
  width:16px!important;
  min-width:16px!important;
  max-width:16px!important;
  height:16px!important;
  min-height:16px!important;
  max-height:16px!important;
  display:block!important;
  fill:none!important;
  stroke:currentColor!important;
  stroke-width:1.85!important;
  stroke-linecap:round!important;
  stroke-linejoin:round!important;
}

nav a .menu-icon svg *{
  fill:none!important;
  stroke:currentColor!important;
  stroke-width:1.85!important;
  stroke-linecap:round!important;
  stroke-linejoin:round!important;
}

nav a:hover{
  background:#f1f5f9;
  color:#0f172a;
}

nav a:hover .menu-icon{color:#475569}

nav a.active{
  background:#0f172a;
  color:#fff;
  font-weight:700;
}

nav a.active .menu-icon{color:#fff}

.content{
  flex:1;
  padding:24px 28px;
}

.topbar{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  margin-bottom:24px;
}

.topbar h1{
  margin:0;
  font-size:25px;
  line-height:1.08;
  font-weight:700;
  letter-spacing:-.035em;
}

.topbar p{
  margin:6px 0 0;
  color:#64748b;
  font-size:16px;
  font-weight:400;
  letter-spacing:-.015em;
}

.userbox{
  color:#475569;
  font-size:14px;
}

.userbox a{
  color:#0f172a;
  font-weight:600;
}

.grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(180px,1fr));
  gap:16px;
}

.grid.grid-5{grid-template-columns:repeat(5,minmax(160px,1fr))}

.card{
  background:var(--card);
  border:1px solid var(--line);
  border-radius:8px;
  padding:22px 24px;
  box-shadow:0 1px 2px rgba(15,23,42,.03);
}

.metric{
  min-height:112px;
  position:relative;
}

.metric small{
  color:#334155;
  font-weight:500;
  font-size:13px;
  letter-spacing:-.01em;
}

.metric strong{
  display:block;
  font-size:28px;
  margin-top:14px;
  font-weight:700;
  letter-spacing:-.035em;
  line-height:1.05;
}

.metric .hint{
  display:block;
  font-size:12px;
  margin-top:4px;
  font-weight:400;
  letter-spacing:0;
  line-height:1.25;
}

.metric .ico{
  position:absolute;
  right:24px;
  top:26px;
  font-size:18px;
}

.metric.soft-green{background:var(--green-bg);border-color:var(--green-line);color:var(--green)}
.metric.soft-red{background:var(--red-bg);border-color:var(--red-line);color:var(--red)}
.metric.soft-blue{background:var(--blue-bg);border-color:var(--blue-line);color:var(--blue)}
.metric.soft-orange{background:var(--orange-bg);border-color:var(--orange-line);color:var(--orange)}
.metric.soft-green small,.metric.soft-red small,.metric.soft-blue small,.metric.soft-orange small{color:currentColor}

.green{color:var(--green)}
.red{color:var(--red)}
.blue{color:var(--blue)}
.orange{color:var(--orange)}

.panel{
  background:#fff;
  border:1px solid var(--line);
  border-radius:8px;
  padding:24px;
  box-shadow:0 1px 2px rgba(15,23,42,.03);
}

.actions{
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:space-between;
  margin-bottom:16px;
}

.actions-left{
  display:flex;
  gap:10px;
  align-items:center;
}

.btn{
  border:0;
  border-radius:7px;
  padding:10px 14px;
  font-weight:700;
  font-size:14px;
  cursor:pointer;
  background:#0f172a;
  color:#fff;
  display:inline-flex;
  align-items:center;
  gap:8px;
  line-height:1;
  font-family:inherit;
  letter-spacing:-.01em;
}

.btn.secondary{
  background:#eef3f9;
  color:#0f172a;
  border:1px solid var(--line);
}

.btn.danger{background:#ef4444}
.btn.icon{padding:9px 10px}

.table-wrap{
  background:#fff;
  border:1px solid var(--line);
  border-radius:8px;
  overflow:hidden;
}

.table{
  width:100%;
  border-collapse:collapse;
  background:#fff;
}

.table th,.table td{
  padding:18px 16px;
  border-bottom:1px solid var(--line);
  text-align:left;
  font-size:14px;
  font-weight:400;
  letter-spacing:-.01em;
  line-height:1.35;
}

.table th{
  color:#506985;
  font-weight:600;
  background:#fff;
}

.table tr:last-child td{border-bottom:0}
.table td strong{font-weight:700}

.form{
  background:#fff;
  border:1px solid var(--line);
  border-radius:10px;
  padding:24px;
  max-width:980px;
}

.row{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:14px;
}

.row.cols-4{grid-template-columns:repeat(4,1fr)}

.field{margin-bottom:14px}

.field label{
  display:block;
  font-weight:700;
  margin-bottom:7px;
  color:#111827;
  letter-spacing:-.01em;
}

.field input,.field select,.field textarea{
  width:100%;
  border:1px solid var(--line);
  border-radius:7px;
  padding:11px 12px;
  font-size:14px;
  background:#fff;
  font-family:inherit;
  font-weight:400;
  letter-spacing:-.005em;
}

.field input:focus,.field select:focus,.field textarea:focus{
  outline:2px solid #0f172a;
  outline-offset:0;
  border-color:#0f172a;
}

.field textarea{
  min-height:90px;
  resize:vertical;
}

.searchbox{
  display:flex;
  align-items:center;
  gap:10px;
  border:1px solid var(--line);
  border-radius:7px;
  background:#fff;
  padding:0 12px;
  min-width:385px;
}

.searchbox input{
  border:0;
  outline:0;
  padding:12px 0;
  width:100%;
  font-family:inherit;
  font-weight:400;
}

.login-page{
  min-height:100vh;
  display:grid;
  place-items:center;
  background:#0f172a;
}

.login-card{
  width:380px;
  background:#fff;
  border-radius:14px;
  padding:28px;
}

.login-card h1{
  margin:0 0 8px;
  letter-spacing:-.035em;
  font-weight:700;
}

.alert{
  padding:12px;
  border-radius:8px;
  margin-bottom:12px;
}

.alert.error{background:#fee2e2;color:#991b1b}
.alert.ok{background:#dcfce7;color:#166534}

.badge{
  padding:5px 10px;
  border-radius:99px;
  background:#0f172a;
  color:#fff;
  font-size:12px;
  font-weight:700;
}

.nowrap{white-space:nowrap}
.muted{color:var(--muted)}

.empty{
  min-height:180px;
  display:grid;
  place-items:center;
  color:#64748b;
  font-size:16px;
  font-weight:400;
}

.mt-16{margin-top:16px}
.mb-16{margin-bottom:16px}

/* Ajuste do formulário de Nova Venda - produto proporcional aos demais campos */
#modalVenda .box-section .item-row {
  display: grid !important;
  grid-template-columns: 1fr 80px 104px !important;
  gap: 10px !important;
  align-items: end !important;
}

#modalVenda .box-section .item-row select,
#modalVenda .box-section .item-row input {
  width: 100% !important;
  height: 40px !important;
  border: 1px solid var(--line) !important;
  border-radius: 7px !important;
  padding: 0 12px !important;
  font-family: inherit !important;
  font-size: 14px !important;
  background: #fff !important;
  color: var(--text) !important;
  outline: none !important;
}

#modalVenda .box-section .item-row select:focus,
#modalVenda .box-section .item-row input:focus {
  border-color: #0f172a !important;
  outline: 2px solid #0f172a !important;
  outline-offset: 0 !important;
}

#modalVenda .box-section .item-row .btn {
  height: 40px !important;
  justify-content: center !important;
  padding: 0 14px !important;
  white-space: nowrap !important;
}

#modalVenda .box-section h3 {margin-bottom: 14px !important}

@media(max-width:1100px){
  .grid,.grid.grid-5{grid-template-columns:repeat(2,1fr)}
}

@media(max-width:900px){
  .app{display:block}
  .sidebar{width:100%;height:auto;position:relative;border-right:0;border-bottom:1px solid var(--line)}
  nav{display:flex;overflow:auto;gap:6px}
  nav a{white-space:nowrap}
  .grid,.grid.grid-5{grid-template-columns:1fr}
  .row,.row.cols-4{grid-template-columns:1fr}
  .content{padding:16px}
  .topbar{display:block}
  .searchbox{min-width:0;width:100%}
}

@media(max-width:700px){
  #modalVenda .box-section .item-row {
    grid-template-columns: 1fr !important;
  }

  #modalVenda .box-section .item-row .btn {
    width: 100% !important;
  }
}
