:root{
  --bg:#f6f7fb;
  --panel:#ffffff;
  --panel2:#fbfcff;
  --line:#e7eaf2;
  --text:#0f172a;
  --muted:#64748b;
  --brand:#2f7cff;     /* azul */
  --brand2:#1e5eff;
  --danger:#ef4444;
  --radius:14px;
  --shadow: 0 10px 30px rgba(15,23,42,.06);
  --shadow2: 0 6px 18px rgba(15,23,42,.08);
  --sidebarW: 84px;
  --topbarH: 64px;
}

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

a{ color:inherit; text-decoration:none }
.hidden{ display:none !important; }

.app{
  display:grid;
  grid-template-columns: var(--sidebarW) 1fr;
  grid-template-rows: var(--topbarH) 1fr;
  height:100vh;
}

.sidebar{
  grid-row: 1 / span 2;
  background: var(--panel);
  border-right: 1px solid var(--line);
  display:flex;
  flex-direction:column;
  align-items:center;
  padding:12px 8px;
  gap:12px;
}

.sb-logo{
  width:48px; height:48px;
  border-radius:16px;
  display:grid; place-items:center;
  background: linear-gradient(135deg, var(--brand), var(--brand2));
  box-shadow: var(--shadow2);
}
.logo-mark{
  color:#fff;
  font-weight:800;
  font-size:20px;
  text-transform:lowercase;
}

.sb-nav{ width:100%; display:flex; flex-direction:column; gap:8px; align-items:center; margin-top:8px; }
.sb-item{
  width:48px; height:48px;
  border-radius:16px;
  display:grid; place-items:center;
  color: var(--muted);
  transition: .15s ease;
}
.sb-item:hover{
  background: var(--panel2);
  color: var(--text);
}
.sb-item.active{
  background: rgba(47,124,255,.12);
  color: var(--brand2);
}
.sb-sep{ width:40px; height:1px; background: var(--line); margin:10px 0; }

.topbar{
  grid-column:2;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding: 0 18px;
  gap: 14px;
}

.top-left, .top-right{ display:flex; align-items:center; gap:12px; }

.search{ position:relative; width:min(520px, 58vw); }
.search input{
  width:100%;
  height:40px;
  border:1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  outline:none;
  background: #fff;
}
.search input:focus{
  border-color: rgba(47,124,255,.45);
  box-shadow: 0 0 0 4px rgba(47,124,255,.12);
}
.search-results{
  position:absolute;
  top: 46px;
  left:0;
  right:0;
  background:#fff;
  border:1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 20;
  max-height: 360px;
  overflow:auto;
}
.sr-group{ padding:6px; }
.sr-title{ font-size:12px; color:var(--muted); padding:6px 8px; text-transform:uppercase; letter-spacing:.04em; }
.sr-item{
  padding:10px 10px;
  border-radius: 12px;
  cursor:pointer;
  display:flex;
  justify-content:space-between;
  gap:10px;
}
.sr-item:hover{ background: var(--panel2); }
.sr-left{ display:flex; flex-direction:column; gap:2px; }
.sr-main{ font-weight:650; }
.sr-sub{ font-size:12px; color:var(--muted); }
.sr-type{ font-size:12px; color: var(--muted); }

.workspace{
  grid-column:2;
  overflow:auto;
  padding: 18px;
}

.view{ max-width: 1180px; margin: 0 auto; display:flex; flex-direction:column; gap: 14px; }

.pagehead{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  gap: 14px;
  padding: 4px 2px;
}
.pagehead h1{ margin:0; font-size: 22px; }
.pagehead p{ margin:6px 0 0 0; }
.actions{ display:flex; gap:10px; }

.muted{ color:var(--muted); }

.card{
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}
.card-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.card h2{ margin:0; font-size: 16px; }

.grid{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.grid2{
  display:grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 12px;
}
@media (max-width: 980px){
  .grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid2{ grid-template-columns: 1fr; }
  .search{ width: min(420px, 56vw); }
}
@media (max-width: 640px){
  :root{ --sidebarW: 72px; }
  .grid{ grid-template-columns: 1fr; }
  .search{ width: 58vw; }
}

.kpi-title{ color:var(--muted); font-size:13px; }
.kpi-value{ font-size:28px; font-weight:800; margin-top:6px; }
.kpi-foot{ margin-top:6px; font-size:12px; }

.btn{
  height:40px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  cursor:pointer;
  font-weight:650;
}
.btn:hover{ background: var(--panel2); }
.btn-primary{
  border-color: rgba(47,124,255,.25);
  background: linear-gradient(135deg, rgba(47,124,255,.98), rgba(30,94,255,.98));
  color:#fff;
}
.btn-primary:hover{ filter: brightness(1.03); }

.iconbtn{
  width:40px; height:40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background:#fff;
  cursor:pointer;
}
.iconbtn:hover{ background: var(--panel2); }

.userbox{
  display:flex;
  align-items:center;
  gap: 10px;
  padding-left: 6px;
  position:relative;
}
.avatar{
  width:38px; height:38px;
  border-radius: 14px;
  display:grid; place-items:center;
  background: rgba(47,124,255,.12);
  color: var(--brand2);
  font-weight: 900;
}
.usermeta{ display:flex; flex-direction:column; line-height:1.05; }
.uname{ font-weight: 750; font-size: 13px; }
.urole{ font-size: 12px; color: var(--muted); }

.menu{
  position:absolute;
  top: 48px;
  left: 0;
  background:#fff;
  border:1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding:6px;
  z-index: 30;
  min-width: 220px;
}
.menu.right{ left:auto; right:0; }
.menu-item{
  width:100%;
  text-align:left;
  padding:10px 10px;
  border-radius: 12px;
  border: 0;
  background: transparent;
  cursor:pointer;
  font-weight:650;
}
.menu-item:hover{ background: var(--panel2); }
.menu-item.danger{ color: var(--danger); }

.pom{ display:flex; flex-direction:column; gap:10px; align-items:flex-start; }
.pom-time{ font-size: 46px; font-weight: 900; letter-spacing: .02em; }
.pom-buttons{ display:flex; gap:10px; flex-wrap:wrap; }
.pom-actions{ display:flex; gap:8px; flex-wrap:wrap; }

.timeline{ display:flex; flex-direction:column; gap:10px; }
.tl-item{ padding:10px 12px; border:1px dashed var(--line); border-radius: 14px; }

.auth-shell{
  min-height:100vh;
  display:grid;
  place-items:center;
  padding: 18px;
}
.login-card{
  width: min(420px, 92vw);
  background:#fff;
  border:1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 18px;
}
.login-title{ font-size: 22px; font-weight: 900; }
.login-sub{ margin-top:6px; color: var(--muted); }
.form{ margin-top: 14px; display:flex; flex-direction:column; gap: 12px; }
.field{ display:flex; flex-direction:column; gap: 6px; }
.field span{ font-size: 13px; color: var(--muted); }
.field input{
  height:42px;
  border:1px solid var(--line);
  border-radius: 12px;
  padding: 0 12px;
  outline:none;
}
.field input:focus{
  border-color: rgba(47,124,255,.45);
  box-shadow: 0 0 0 4px rgba(47,124,255,.12);
}
.form-error{
  margin-top: 6px;
  background: rgba(239,68,68,.10);
  border: 1px solid rgba(239,68,68,.25);
  color: #991b1b;
  padding: 10px 12px;
  border-radius: 12px;
  font-weight:650;
}