/* Portal Online Estoque Hospital - Valente */
:root{
  --bg:#eef5fb;
  --bg2:#f8fbff;
  --card:#ffffff;
  --text:#0f2742;
  --muted:#64748b;
  --line:#d9e5f0;
  --primary:#0f8fcf;
  --primary2:#0a6fa8;
  --green:#15945b;
  --yellow:#b7791f;
  --red:#d6333c;
  --shadow:0 18px 45px rgba(15,39,66,.10);
  --radius:18px;
}
*{box-sizing:border-box}
body{
  margin:0;
  font-family:Inter,Segoe UI,Arial,sans-serif;
  background:
    radial-gradient(circle at top left, rgba(15,143,207,.18), transparent 34rem),
    linear-gradient(135deg,var(--bg),var(--bg2));
  color:var(--text);
  min-height:100vh;
}
a{color:inherit;text-decoration:none}
button,input,select,textarea{font:inherit}
.hidden{display:none!important}

/* LOGIN */
.login-page{
  min-height:100vh;
  display:grid;
  grid-template-columns:minmax(320px,520px) 1fr;
}
.login-left{
  padding:44px;
  display:flex;
  align-items:center;
  justify-content:center;
}
.login-card{
  width:100%;
  max-width:460px;
  background:rgba(255,255,255,.94);
  border:1px solid rgba(217,229,240,.9);
  border-radius:28px;
  box-shadow:var(--shadow);
  padding:34px;
}
.brand{
  display:flex;
  align-items:center;
  gap:14px;
  margin-bottom:24px;
}
.logo{
  width:58px;height:58px;border-radius:18px;
  display:grid;place-items:center;
  background:linear-gradient(135deg,var(--primary),#18b3e8);
  color:white;
  box-shadow:0 12px 24px rgba(15,143,207,.24);
  font-size:28px;
  font-weight:800;
}
.brand h1{margin:0;font-size:24px;line-height:1.1}
.brand p{margin:5px 0 0;color:var(--muted);font-size:14px}
.login-card h2{font-size:28px;margin:0 0 8px}
.login-card .sub{margin:0 0 26px;color:var(--muted);line-height:1.45}
.field{margin-bottom:16px}
.field label{display:block;font-weight:700;font-size:13px;margin-bottom:8px;color:#28435f}
.field input,.field select,.field textarea{
  width:100%;
  border:1px solid var(--line);
  background:#f8fbff;
  color:var(--text);
  border-radius:14px;
  padding:13px 14px;
  outline:none;
}
.field input:focus,.field select:focus,.field textarea:focus{border-color:var(--primary);box-shadow:0 0 0 4px rgba(15,143,207,.12)}
.btn{
  border:0;
  border-radius:14px;
  padding:12px 16px;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  font-weight:800;
  transition:.18s ease;
}
.btn:hover{transform:translateY(-1px)}
.btn-primary{background:linear-gradient(135deg,var(--primary),var(--primary2));color:#fff;box-shadow:0 12px 24px rgba(15,143,207,.22)}
.btn-light{background:#fff;border:1px solid var(--line);color:var(--text)}
.btn-danger{background:#fee2e2;color:#991b1b}
.btn-full{width:100%}
.alert{
  border-radius:14px;
  padding:12px 14px;
  background:#fff4e5;
  color:#8a4b0f;
  margin:14px 0;
  font-weight:700;
}
.login-right{
  position:relative;
  padding:48px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  overflow:hidden;
  background:linear-gradient(135deg,#0a6fa8,#0f8fcf 55%,#25b4e7);
  color:#fff;
}
.login-right:before{
  content:"";
  position:absolute;inset:auto -10% -20% auto;
  width:540px;height:540px;border-radius:50%;
  background:rgba(255,255,255,.12);
}
.hero-content{position:relative;max-width:690px}
.hero-badge{
  display:inline-flex;gap:8px;align-items:center;
  background:rgba(255,255,255,.16);
  border:1px solid rgba(255,255,255,.22);
  padding:9px 13px;border-radius:999px;font-weight:800;
}
.hero-content h2{font-size:48px;line-height:1.05;margin:22px 0 16px}
.hero-content p{font-size:18px;line-height:1.55;opacity:.92}
.hero-grid{
  margin-top:32px;
  display:grid;
  grid-template-columns:repeat(2,minmax(180px,1fr));
  gap:14px;
}
.hero-mini{
  background:rgba(255,255,255,.14);
  border:1px solid rgba(255,255,255,.22);
  border-radius:18px;
  padding:18px;
}
.hero-mini strong{display:block;font-size:22px;margin-bottom:5px}

/* APP */
.app-shell{min-height:100vh;display:grid;grid-template-columns:286px 1fr}
.sidebar{
  background:rgba(255,255,255,.92);
  border-right:1px solid var(--line);
  padding:22px 18px;
  position:sticky;top:0;height:100vh;
}
.side-brand{display:flex;align-items:center;gap:12px;padding:8px 8px 20px;border-bottom:1px solid var(--line)}
.side-brand .logo{width:46px;height:46px;font-size:22px;border-radius:14px}
.side-brand h2{margin:0;font-size:17px}
.side-brand p{margin:3px 0 0;color:var(--muted);font-size:12px}
.menu{padding:18px 0;display:grid;gap:8px}
.menu button{
  border:0;background:transparent;color:#243b53;
  width:100%;text-align:left;border-radius:14px;
  padding:12px 12px;cursor:pointer;font-weight:800;
  display:flex;align-items:center;gap:10px;
}
.menu button:hover,.menu button.active{background:#e9f6fd;color:#075985}
.menu button .ico{width:25px;text-align:center}
.side-footer{
  position:absolute;left:18px;right:18px;bottom:18px;
  display:grid;gap:10px;
}
.user-box{
  border:1px solid var(--line);
  background:#f8fbff;
  border-radius:16px;
  padding:12px;
}
.user-box strong{display:block;font-size:14px}
.user-box span{font-size:12px;color:var(--muted)}
.main{padding:28px 34px 46px;min-width:0}
.topbar{
  display:flex;align-items:center;justify-content:space-between;gap:18px;margin-bottom:24px;
}
.title h1{font-size:30px;margin:0 0 6px}
.title p{margin:0;color:var(--muted)}
.top-actions{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.badge{
  display:inline-flex;align-items:center;gap:8px;
  background:#e8f7ee;color:#11613e;border:1px solid #c4ecd3;
  border-radius:999px;padding:8px 12px;font-size:13px;font-weight:800;
}
.grid{display:grid;gap:18px}
.cards{grid-template-columns:repeat(4,minmax(170px,1fr))}
.card{
  background:rgba(255,255,255,.95);
  border:1px solid rgba(217,229,240,.9);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:20px;
}
.metric{position:relative;overflow:hidden}
.metric:after{
  content:"";position:absolute;right:-22px;top:-22px;width:86px;height:86px;border-radius:50%;
  background:rgba(15,143,207,.10);
}
.metric .label{color:var(--muted);font-size:13px;font-weight:800;text-transform:uppercase;letter-spacing:.04em}
.metric .value{font-size:32px;font-weight:900;margin:10px 0 5px}
.metric .hint{font-size:13px;color:var(--muted)}
.section{margin-top:22px}
.section-head{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:12px}
.section-head h2{margin:0;font-size:21px}
.section-head p{margin:4px 0 0;color:var(--muted)}
.table-wrap{overflow:auto;border-radius:16px;border:1px solid var(--line);background:#fff}
table{width:100%;border-collapse:collapse;min-width:760px}
th,td{padding:12px 14px;border-bottom:1px solid #edf2f7;text-align:left;font-size:14px}
th{background:#f5f9fc;color:#40566d;font-size:12px;text-transform:uppercase;letter-spacing:.04em}
tr:last-child td{border-bottom:0}
.status{display:inline-flex;border-radius:999px;padding:6px 10px;font-size:12px;font-weight:900}
.status.ok{background:#e8f7ee;color:#11613e}
.status.warn{background:#fff4d6;color:#875400}
.status.zero{background:#fee2e2;color:#991b1b}
.toolbar{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin-bottom:14px}
.toolbar input,.toolbar select{
  border:1px solid var(--line);background:white;border-radius:13px;padding:11px 12px;outline:none;
}
.toolbar input{min-width:260px}
.two-col{grid-template-columns:1.25fr .75fr}
.chart-list{display:grid;gap:10px}
.bar-row{display:grid;grid-template-columns:160px 1fr 80px;gap:10px;align-items:center}
.bar-track{height:12px;border-radius:999px;background:#e9eef5;overflow:hidden}
.bar-fill{height:100%;border-radius:999px;background:linear-gradient(90deg,var(--primary),#35b8e6)}
.form-grid{display:grid;grid-template-columns:repeat(2,minmax(180px,1fr));gap:14px}
.form-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:8px}
.empty{
  padding:28px;text-align:center;color:var(--muted);
}
.kpi-note{background:#f6fbff;border:1px dashed #b8d9ee;border-radius:16px;padding:14px;color:#385a73}
.footer-note{color:var(--muted);font-size:12px;margin-top:24px}

@media(max-width:1000px){
  .login-page{grid-template-columns:1fr}
  .login-right{display:none}
  .app-shell{grid-template-columns:1fr}
  .sidebar{position:relative;height:auto}
  .side-footer{position:static}
  .cards{grid-template-columns:repeat(2,1fr)}
  .two-col,.form-grid{grid-template-columns:1fr}
}
@media(max-width:620px){
  .main{padding:20px 14px}
  .cards{grid-template-columns:1fr}
  .topbar{align-items:flex-start;flex-direction:column}
  .toolbar input{min-width:100%;width:100%}
}


/* V45 - filtros profissionais dos relatórios */
.filters-card{
  display:grid;
  grid-template-columns:repeat(6,minmax(150px,1fr));
  gap:12px;
  align-items:end;
}
.filters-card.compact{
  grid-template-columns:repeat(5,minmax(160px,1fr));
}
.filters-card .field{margin-bottom:0}
.action-field .btn{width:100%}
.sub{color:var(--muted);line-height:1.45}
@media(max-width:1200px){
  .filters-card,.filters-card.compact{grid-template-columns:repeat(3,1fr)}
}
@media(max-width:720px){
  .filters-card,.filters-card.compact{grid-template-columns:1fr}
}


/* V60 - Estoque online simplificado + responsividade ampla para celulares */
.estoque-online-table{
  min-width:0;
  table-layout:fixed;
}
.estoque-online-table th:first-child,
.estoque-online-table td:first-child{width:auto}
.estoque-online-table th:last-child,
.estoque-online-table td:last-child{
  width:150px;
  text-align:center;
}
.estoque-online-table td:first-child{
  overflow-wrap:anywhere;
  word-break:normal;
  line-height:1.35;
}
.estoque-online-table .qtd-cell{
  font-size:16px;
  white-space:nowrap;
}

@media(max-width:1000px){
  .app-shell{display:block}
  .sidebar{
    position:sticky;
    top:0;
    z-index:30;
    height:auto;
    padding:10px 12px;
    border-right:0;
    border-bottom:1px solid var(--line);
    box-shadow:0 5px 20px rgba(15,39,66,.08);
    background:rgba(255,255,255,.97);
  }
  .side-brand{
    padding:2px 4px 8px;
    border-bottom:0;
  }
  .side-brand .logo{width:38px;height:38px;font-size:19px;border-radius:12px}
  .side-brand h2{font-size:15px}
  .side-brand p{display:none}
  .menu{
    padding:4px 0 2px;
    display:flex;
    gap:7px;
    overflow-x:auto;
    -webkit-overflow-scrolling:touch;
    scrollbar-width:none;
  }
  .menu::-webkit-scrollbar{display:none}
  .menu button{
    width:auto;
    flex:0 0 auto;
    padding:9px 11px;
    border:1px solid #e3edf5;
    background:#f8fbff;
    font-size:13px;
    white-space:nowrap;
  }
  .menu button .ico{width:auto}
  .menu button.active{border-color:#c6e5f6;background:#e9f6fd}
  .side-footer{
    position:absolute;
    right:12px;
    top:10px;
    left:auto;
    bottom:auto;
    display:flex;
    align-items:center;
    gap:7px;
  }
  .user-box{display:none}
  .side-footer .btn{padding:8px 11px;font-size:12px;border-radius:11px}
  .main{padding:20px 18px 36px}
  .table-wrap{max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
}

@media(max-width:620px){
  body{background:#f4f8fb}
  .login-left{padding:18px 12px;align-items:flex-start}
  .login-card{padding:22px 18px;border-radius:20px;margin-top:18px}
  .brand{margin-bottom:18px}
  .brand .logo{width:48px;height:48px;border-radius:14px}
  .brand h1{font-size:20px}
  .login-card h2{font-size:24px}
  .field input,.field select,.field textarea{font-size:16px;padding:13px}
  .btn{min-height:44px}

  .sidebar{padding:8px 10px}
  .side-brand{padding-right:64px}
  .side-brand .logo{width:34px;height:34px;font-size:18px}
  .side-brand h2{font-size:14px}
  .side-footer{top:8px;right:10px}
  .side-footer .btn{min-height:34px;padding:6px 9px}
  .menu button{padding:8px 9px;font-size:12px;border-radius:11px}

  .main{padding:16px 10px 30px}
  .topbar{gap:12px;margin-bottom:16px}
  .title h1{font-size:25px;margin-bottom:4px}
  .title p{font-size:13px;line-height:1.4}
  .top-actions{width:100%;display:grid;grid-template-columns:1fr 1fr;gap:8px}
  .top-actions .badge,.top-actions .btn{width:100%;justify-content:center;min-height:42px}

  .card{padding:14px;border-radius:15px;box-shadow:0 8px 24px rgba(15,39,66,.07)}
  .section{margin-top:14px}
  .section-head{align-items:flex-start}
  .section-head h2{font-size:18px}
  .section-head p{font-size:13px;line-height:1.4}
  .metric .value{font-size:28px}

  .toolbar{display:grid;grid-template-columns:1fr;gap:8px;margin-bottom:12px}
  .toolbar input,.toolbar select{width:100%;min-width:0;font-size:16px;padding:12px}

  .estoque-mobile-wrap{overflow:visible;border-radius:13px}
  .estoque-online-table{width:100%;min-width:0;table-layout:fixed}
  .estoque-online-table th,
  .estoque-online-table td{padding:11px 9px}
  .estoque-online-table th{font-size:11px}
  .estoque-online-table th:last-child,
  .estoque-online-table td:last-child{width:96px;text-align:center}
  .estoque-online-table td:first-child{font-size:14px}
  .estoque-online-table .qtd-cell{font-size:16px}

  .cards{gap:10px}
  .bar-row{grid-template-columns:minmax(95px,1fr) minmax(80px,1.5fr) 58px;gap:7px;font-size:12px}
  .footer-note{text-align:center;font-size:11px;margin-top:18px}
}

@media(max-width:380px){
  .main{padding-left:8px;padding-right:8px}
  .card{padding:12px}
  .title h1{font-size:23px}
  .estoque-online-table th:last-child,
  .estoque-online-table td:last-child{width:84px}
  .estoque-online-table th,
  .estoque-online-table td{padding:10px 7px}
  .menu button{font-size:11px;padding:8px}
}
